http://qs321.pair.com?node_id=329814


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 $@;