Use the regex engine just to locate the number. To see if the number is between a thousand and a hundred thousand, use the built-in Perl implementation of arithmetic.
while (<>) { chomp; print "$_: "; if (my ($number) = /^\$?(\d[,\d]*)/) { $number =~ s/,//g; print $number < 1000 ? 'too small' : $number > 100_000 ? 'too big' : 'just right'; } else {print 'not a number'} print "!\n"; }
In reply to Re: matching USD amounts
by Narveson
in thread matching USD amounts
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |