Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: RegEx for Matching paranthesis

by I0 (Priest)
on Feb 18, 2004 at 01:49 UTC ( #329814=note: print w/replies, xml ) Need Help??


in reply to RegEx for Matching paranthesis

$_ = qq(For eg., if the text is given as <code start>I am (giving this (text to (tell you) that this) will give +) you the result. <code end> In this case, I need the phrase, (giving this (text to (tel +l you) that this) will give) This should hold for any number of nested paranthesis.); (my $re = $_) =~ s/((\()|(\))|.)/${['(','']}[!$2]\Q$1\E${[')','']}[!$3 +]/gs; print eval{(/$re/)[0]},"\n"; warn $@ if $@;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://329814]
help
Chatterbox?
[1nickt]: Gonna be having some elote with a Salvadoran tamal later, mmmm
[erix]: mightier ...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (13)
As of 2016-12-06 16:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (109 votes). Check out past polls.