use strict;
my $str = '2422072021115242 GU32120300002689543200710020 489346250700918BE0D011 0022072021114833700918BE0D1 04D10790201AEA005 543200710020 1 5 543200310050 100 0 5 5491127654295 1 0 22072021114834 65535 655356553565535655356553565535 3 0 X700
';
my $regex = qr/^(.{2})(.{14}).{14}(.{8})(.{8})(.{20})(.{8})(.{1})(.{10}).{2}.{2}(.{2})(.{14}).{10}.{5}(.{16})(.{3})(.{18}).{15}.{15}.{6}.{6}.{2}.{3}.{18}.{10}(.{2}).{3}.{32}.{2}(.{10})(.{15}).{38}.{5}.{5}.{5}.{5}.{5}.{5}(.{16})(.{16})(.{20})(.{3})(.{3})(.{2})(.{20})(.{5})(.{15})(.{10}).{3}.{3}(.{2})(.{24})(.{3})(.{20})(.{2}).{24}(.{6}).{6}.{10}(.{3}).{3}.{3}(.{3})(.{3})(.{5})(.{3})(.{2}).{2}(.{5}).{2}.{20}.{5}.{20}.{2}.{3}.{2}.{5}.{325}(.{14}).{3}.{24}.{25}.{20}.{1}.{1}.{2}.{5}.{3}.{3}.{3}.{6}.{4}.{3}(.{5})(.{5})(.{3})(.{1})(.{3})/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