use strict;
my $str = ' 6001908/ SAR - 125 KG 1 PC 96.00 12,000.00
32021000 BALSYN
73101090 INV. REF TAX INVOICE INV DT. QTY BILL RATE
ACTUAL RATE RATE DIFF
BASIC AMT DIFF C.GST 9% UT GST 9% TOTAL DIFF.
AMOUNT
1710125231 DH191012604017 29.10.2019 200 1,350.00
1,290.00 60.00 12
,000.00 1,080.00 1,080.00 14,160.00
1710125233 DH191012604018 29.10.2019 203 1,350.00
1,290.00 60.00 12
,180.00 1,096.20 1,096.20 14,372.40
TOTAL 403 24,180.00 2,176.20 2,176.20 28,532.40
73101090 200/210 LITRE NOMINAL CAPACITY NEW EMPTY
DRUMS MADE
FROM STEEL SHEET OF 1.25 MM NOMINAL
THICKNESS
COMPLETE WITH 50MM AND 20MM CLOSURE,
INTERNALLY
EPOXY COATED AS PER YOUR SPECIFICATION
';
my $regex = qr/^(?<Data_0>[ ]{13,16})(?<Data_1>[0-9]{6,9})\s{5,6}(?<Data_2>[0-9a-zA-Z\/.\-_,\n%: ]{6,720})(?: [0-9]{8} )/mp;
if ( $str =~ /$regex/g ) {
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