Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Balancing Parens

by Anonymous Monk
on Aug 17, 2000 at 10:12 UTC ( [id://28271]=note: print w/replies, xml ) Need Help??


in reply to Balancing Parens

$_ = "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;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://28271]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-24 12:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found