use strict;
my $str = 'record18,$65535,sisoog,do,5463213,33436,12,18,-17,+16,78,trUe,End
record15,#15,25,45,sisoog,s,is,oog,5463213,6,-7,78,33-43,True,End
record16,55,-35,sisoog,End,use,wait,546365213,#88,15,5485,False,End
record17,15,-45,351,sisoog,do,wait,smit,5463213,33-436,faLse,End
record17,15,-45,351,sisoog,do,smit,5463213,3436,End';
my $regex = qr/^record(?<id>\d+),[0-9\#\$\%\-\+\,]+,(?<name>\w+),[\D\,]+,(?<PostalCode>\d+),[0-9\#\$\%\-\+\,]+,(?<Status>(true|false)),End$/mip;
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