Hi,
Just in case you need to support decimal numbers, here is an extended version of Eimi's answer:
s/(-?\d+(\.\d+)?)/$1>0 ? "L" : ($1 == 0 ? "Q" : "S")/e; or s/(-?\d+(\.\d+)?)/qw(Q L S)[$1 <=> 0]/e;
and add support of scientific notation:
s/(-?\d+(\.\d+)?([Ee][+-]?\d+)?)/ ...
Ted Young
($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)In reply to Re^2: Regex Substitution
by TedYoung
in thread Regex Substitution
by SamCG
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |