use strict;
my $str = 'PAS_BEGIN_0009999
T71_MANUFACTURER_4=98
T71_COLOR_ID_7=000
T71_OS_7=08
PAS_END_0009999
PAS_BEGIN_0009996
T72_VAS_SERVICE_IDENTIFIER_6=
T72_ORDER_NB_7=0003
T72_TECHNOLOGY_7=01
PAS_END_0009996
TPV_BEGIN
PAS_20819001=3600000
TPV_END';
my $regex = qr/PAS_BEGIN_0009999(.*?)PAS_END_0009999/sp;
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