use Regexp::Common; my @examples = qw/ (*********) (***(*)***) ((***)) (((***))) ((**)**(**)) (((()))) /; for( @examples ) { chomp; print "$_: "; print $& if $_ =~ $RE{balanced}{-parens=>'()'}; print "\n"; } __output__ (*********): (*********) (***(*)***): (***(*)***) ((***)): ((***)) (((***))): (((***))) ((**)**(**)): ((**)**(**)) (((()))): (((())))
_________
broquaint
In reply to Re: Why this regexp doesn't match nested parens?
by broquaint
in thread Why this regexp doesn't match nested parens?
by ccn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |