use strict;
my $str = 'Geldersekade 5
Prins Hendrikkade 94-95
Zeedijk 39 a
Prins Hendrikkade 85
Kromme Waal 24 t/o
Oude Waal 26 sous
Recht Boomssloot 50-b
Oudeschans 5a
Blaak 5a
çstraét 12
Æbçøüdéstrāßè 12
binnenbantammer straat n.2
Oudezijds Voorburgwal 36-HS
De Ruijterkade 105 1S
De Ruijterkade 110H
Prins Hendrikkade 133 3A
Plein 1818 2a
Scheveningseveer 21
De Stelling 15 11
Plein ’40-’45 nr. 9
Burg.de Vlugtlaan 139
Plein ‘40-’45 6
Plein 18 1
Plein 1953 2
Plein 1953 28
Plein 1337 4-c
Plein 1337 4 1d
Regulieersdwarsstraat 5-1
Regulieersdwarsstraat 5-1c
Regulieersdwarsstraat 5 1x
Rechte boom straat 5001 33
Plein 2001 22-44
Plein1234 4
Hesseplaats 53
1e middellandstraat 12
Prins Hendrikkade 4/A
Langerakplein 22/44
Roer 266
3 Spinel
Roer
';
my $regex = qr/^(?<streetName>.*?)(\s((nr|n|no)\.?\s*)?(?<houseNumber>[1-9][0-9]*)(\s*[-\/]\s*(?<houseNumberTo>[1-9][0-9]*))?([\s-\/]*(?<houseLetter>[a-z]))?([\s\-]+(?<houseNumberAddition>[a-z1-9][a-z0-9\/]*[a-z]+))?)?$/imup;
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