in reply to Why this regexp doesn't match nested parens?
use Regexp::Common; my @examples = qw/ (*********) (***(*)***) ((***)) (((***))) ((**)**(**)) (((()))) /; for( @examples ) { chomp; print "$_: "; print $& if $_ =~ $RE{balanced}{-parens=>'()'}; print "\n"; } __output__ (*********): (*********) (***(*)***): (***(*)***) ((***)): ((***)) (((***))): (((***))) ((**)**(**)): ((**)**(**)) (((()))): (((())))
_________
broquaint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Why this regexp doesn't match nested parens?
by ccn (Vicar) on Apr 26, 2004 at 16:44 UTC |