while (<>) { / ( ^ -? \d+ ) \s+ # optional minus at start of line, some digits, some space ( -? \d+ ) # same thing, but NOT at start of line /x # eXplanation mode (m is useless when you read line by line) and print; # I didn't get the purpose of your print statements - # this one will simply print the line if matched. }
In reply to Re: regex negative numbers
by Django
in thread regex negative numbers
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |