my @Strings = ( '$3,023,123.34', '9,876,453', '123456.78', "4,33,234.34", '$1.234', "abc", "1,0000.00" ); my $Payment; foreach $Payment (@Strings) { if ($Payment =~ /^\$?(\d{1,3}(,\d{3})*|\d+)(\.\d\d)?$/) {print "Match: $Payment\n";} else {print "Fail: $Payment\n";} } Output: Match: $3,023,123.34 Match: 9,876,453 Match: 123456.78 Fail: 4,33,234.34 Fail: $1.234 Fail: abc Fail: 1,0000.00 Match: 199999.99
In reply to Re: Regular Expression Currency Check
by GrandFather
in thread Regular Expression Currency Check
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |