beanryu has asked for the wisdom of the Perl Monks concerning the following question:
ABC1D A1D
Say I want to match the following regex: A(BC|)(.*)D which will match either AD.*D or ABC.*D. Now I have the following code:how can i make it not print BC and only print the numbers? Thanx a lot in advance.@matches = ($_ =~ /A(BC|)D/g) if(@matches != 0){ foreach(@matches){ print "$_.\n"; } } } the code prints 1 BC 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to make // not return what is in a parenthesis?
by AnomalousMonk (Archbishop) on Aug 01, 2010 at 01:54 UTC | |
by beanryu (Novice) on Aug 01, 2010 at 02:04 UTC | |
|
Re: how to make // not return what is in a parenthesis?
by ww (Archbishop) on Aug 01, 2010 at 02:21 UTC | |
by AnomalousMonk (Archbishop) on Aug 01, 2010 at 02:54 UTC | |
|
Re: how to make // not return what is in a parenthesis?
by chromatic (Archbishop) on Aug 01, 2010 at 01:52 UTC | |
by beanryu (Novice) on Aug 01, 2010 at 01:58 UTC |