Hello keesturam, Im sure it could be simplified more, but this is what I came up with! hope it helps :)
if($input =~ /^(-?)((0|\d+).)?\d+$/) { print ("Yes, it is a number\n"); }
UPDATE: don't need that 0 in there,
if($input =~ /^(-?)(\d+.)?\d+$/)
In reply to Re: Reg Ex exercise
by Rudolf
in thread Reg Ex exercise
by keesturam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |