in reply to Need help with perl regexp
There is more than one possible solution depending on the "real" data structure.
Something has been said on your regex by others, so I'll add another version (only)...
... my $address = ... ; my ($street, $n, $number) = $address =~ /(.+?) # first g +roup (nr\.\s+ | \s+) # number +prefix? [A-z]+ # letters + preceeding number (\d+)- # number /ix; print "STREET: $street, N: $n, NUMBER: $number\n" ...
BTW, is this "$n" really needed?
Regards
mwa
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Need help with perl regexp
by flaviusm (Acolyte) on Oct 22, 2007 at 18:51 UTC | |
by mwah (Hermit) on Oct 22, 2007 at 19:36 UTC |