flaviusm has asked for the wisdom of the Perl Monks concerning the following question:
I have a string following the pattern: "aaa. bbb ccc nr. ddd23-56" where a, b, c, d are alphanum having "(aaa. bbb ccc) nr. ddd(23)-56" : I want to extract whatever is between paranteses () The word between [] can be present or not. This is what I have done and I need help with:($street, $n, $number) = ($address =~ /(.*?)(nr\.)*\b\D*(\d+)[\d\w-]+\b$/i);
The above regexp extracts $number="23" but it doesn't extract the $street. The correct results should be: $street == "aaa. bb cc" $number == "23" Thank you very much.P.S. The requirement is to do it in only one regexp
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need help with perl regexp
by ikegami (Patriarch) on Oct 22, 2007 at 18:32 UTC | |
|
Re: Need help with perl regexp
by mwah (Hermit) on Oct 22, 2007 at 18:43 UTC | |
by flaviusm (Acolyte) on Oct 22, 2007 at 18:51 UTC | |
by mwah (Hermit) on Oct 22, 2007 at 19:36 UTC | |
|
Re: Need help with perl regexp
by Krambambuli (Curate) on Oct 22, 2007 at 18:53 UTC | |
by flaviusm (Acolyte) on Oct 22, 2007 at 19:03 UTC | |
|
Re: Need help with perl regexp
by gamache (Friar) on Oct 22, 2007 at 18:34 UTC | |
by ikegami (Patriarch) on Oct 22, 2007 at 18:37 UTC | |
by gamache (Friar) on Oct 22, 2007 at 18:50 UTC |