in reply to Re: Regex Substitution
in thread Regex Substitution
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. :-)
|
|---|