use strict;
my $str = '1906823505|BPA|CORENC-BPAUR0133|LR35788G|LEONETTI CATHERINE|04.76.88.14.14||INT|MG_ENS_010002|Ensemble Chauffage-Climatisation||MNT|MG116|05/06/2019 17:36:00|06/06/2019 10:36:00|4|FR|05/06/2019 16:36:00|BPA|CORENC-BPAUR0133|LR35788G|BPAURA-ENGIE LOIR|ENGIE COFELY LOIRE|0|||313|002|A1 - ESPACE 4|0|BP AUVERGNE RHONE ALPES (CORENC-BPAUR0133)|2 AVENUE DU GRESIVAUDAN||38700|CORENC|0438884619||||1906823505|merci d\'intervenir pour rétablir la clim à l\'agence';
my $regex = qr/^(?:.*?\x7C){14}(?'champs1'.*?)\x7C(?:.*?\x7C){6}(?'champs2'.*?)\x7C(?'champs3'.*?)\x7C/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