use strict;
my $str = 'Apt. 120, 9 Quai de Caumartin, 21305 Tourcoing
8 étage, 229 Boulevard de Caumartin, 41224 Clichy
8116 Boulevard Pierre Charron, 51703 Bordeaux
9 Quai de Caumartin, 21305 Tourcoing
Apt. 901, 8431 Boulevard Vaneau, 85330 Mérignac
314 Passage de la Férronnerie, 76818 Villejuif
1 étage, 6645 Avenue des Grands Augustins, 47851 Lyon
Apt. 889, 301 Place Adolphe Mille, 04320 Issy-les-Moulineaux
Apt. 470, 147 Allée, Voie des Grands Augustins, 37097 Asnières-sur-Seine
Apt. 356, 1 Allée, Voie de l\'Abbaye, 83865 Champigny-sur-Marne
';
my $regex = qr/(([a-zA-Z-éÉèÈàÀùÙâÂêÊîÎôÔûÛïÏëËüÜçÇæœ'.]*\s)\d*(\s[a-zA-Z-éÉèÈàÀùÙâÂêÊîÎôÔûÛïÏëËüÜçÇæœ']*)*,)*\d*(\s[a-zA-Z-éÉèÈàÀùÙâÂêÊîÎôÔûÛïÏëËüÜçÇæœ']*)+,\s([\d]{5})\s[a-zA-Z-éÉèÈàÀùÙâÂêÊîÎôÔûÛïÏëËüÜçÇæœ']+/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