use strict;
my $str = 'problem satatement is to get all the amount despite of inconsistencies in comma or dollar sign also I need to exclude year from that (if no pattern can be made asssume to get all the amount greater than 3000)
$ 1,000,000.6522
$ 3,500,000
90,00,00,000
5000000
200
200,000
20,00,000
1,000
$ 4,000,000 for the 2023
800,000
90.65
5,555
5000
2021 --------this should be excluded from the pattern
89jfe90ABI900 ----this also should be excluded from the pattern';
my $regex = qr/\b\d{1,3}(?:,\d{2,3})*(?:,\d{3})*(?:\.\d+)?\b/p;
if ( $str =~ /$regex/ ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html