![]() |
|
laziness, impatience, and hubris | |
PerlMonks |
Re: Balancing Parensby Anonymous Monk |
on Aug 17, 2000 at 10:12 UTC ( #28271=note: print w/replies, xml ) | Need Help?? |
$_ = "blah,blah(blah,blah(blah,blah(blah))),blah"; #$_="blah1,blah2(blah3,blah4(blah5,blah6(blah7))),blah8"; ($re=$_)=~s/((\()|(\))|.)/$2\Q$1\E$3/gs; @$ = (eval{/$re/}); die $@ if $@=~/unmatched/; $re = join'|',map{quotemeta}@$; print join"\n",/((?:$re|[^,])+)/g;
In Section
Seekers of Perl Wisdom
|
|