Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I need to extract a text in between nested paranthesis, and I would like to have the text in between the outermost one. 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 (tell you) that this) will give)
This should hold for any number of nested paranthesis. Is there a way to achieve this using Regular Expressions? Or is it the conventional way that is best suited for this? Is there a function which can give the matching paranthesis locations in a given string?
As I am a beginner to Regular Expressions of Perl, a code snippet would be of immense help to me.