gopalr has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
I tried the following code to match the whole brackets which are inside the Main Brackets.
use strict; my $text='(one dfd(two(three)four()(five)df())df)'; print $& if $text=~m#(\([^()]*(\([^()]*\))+[^)]*\))+#;
It Prints only
(two(three)four()
But I need Out put Whole Opened and Closed Brackets
Need Output:
(one dfd(two(three)four()(five)df())df)
Please advice me in regulare expression
Thanks in Advance,
Gopal R.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Regexp for Match Brackets
by davido (Cardinal) on May 05, 2006 at 06:47 UTC | |
Re: Regexp for Match Brackets
by Samy_rio (Vicar) on May 05, 2006 at 07:12 UTC | |
Re: Regexp for Match Brackets
by blazar (Canon) on May 05, 2006 at 08:48 UTC | |
by johngg (Canon) on May 05, 2006 at 09:48 UTC | |
by japhy (Canon) on May 05, 2006 at 13:56 UTC | |
by blazar (Canon) on May 05, 2006 at 14:02 UTC | |
Re: Regexp for Match Brackets
by sen (Hermit) on May 05, 2006 at 06:50 UTC | |
by turo (Friar) on May 05, 2006 at 13:19 UTC | |
Re: Regexp for Match Brackets
by ruzam (Curate) on May 05, 2006 at 16:28 UTC | |
Re: Regexp for Match Brackets
by gube (Parson) on May 05, 2006 at 07:15 UTC |
Back to
Seekers of Perl Wisdom