use strict;
my $str = '02.04.2024 02.04.2024 280 "ADDEBITO SEPA DD PER FATTURA A VOSTRO CARICO Incasso 2023-03-24
17 53 26.259 SDD da IT38ZZZ0000001168010070 KNOT SRL mandato nr.
BJWRS001212620072" -871,18
02.04.2024 29.03.2024 43 "PAGAMENTO VISA Contactless del 29/03/2024 CARTA *8642 DI EUR 15,12 2L
AOSTA" -15,12
03.04.2024 03.04.2024 48 "BONIFICO A VOSTRO FAVORE BONIFICO SEPA DA LA KIUVA SOCIETA
COOPERATIVA PER fattura COMM 0,00 SPESE 0,00 TRN 1001240942034482" 1.098,00';
my $regex = qr/(.*?)\n(.*?)/p;
if ( $str =~ /$regex/ ) {
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