use strict;
my $str = '_zz&69050398_5d147597dd4aca00014351d9_zz sf 76064603RPL_Import_Create
_zm&69396284_5d165ed60198d60001fbef9a_75946292_Import
_aa&69385775_5d15782bdd4aca0001435432_supplier_info_import_template
_aa&68936210_5d16581add4aca00014355e9_76005473 RPL_Import_Create_Stand_to_Package
_ac&68728692_5d18fa52dd4aca00014356dd_SF 76113839 Copy of Generic_Export_AdvancePR_result - 2019-06-30T200450.090';
my $regex = qr/[^&]_*\s*(SF)*\d{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