Ananda has asked for the wisdom of the Perl Monks concerning the following question:
I am trying a regex to extrace a specifig piece string using the below.
my $string = '<School type="content" name="Schoolpage"><section name=" +Graduation"><grade name="Iyear"><!-- Set description for BBCA --><des +cription>'; if($string=~ m/(<section (.*)">?)/) { print "Here :: $1 \n"; }else {print "regex failed";}
Output of the above is :::
Here :: <section name="Graduation"><grade name="Iyear">
What I want is '<section name="Graduation">'.
Please advice.
Thanks in advance
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex help reqd
by prasadbabu (Prior) on Jun 27, 2005 at 06:38 UTC | |
by Ananda (Pilgrim) on Jun 27, 2005 at 07:23 UTC | |
by Anonymous Monk on Jun 27, 2005 at 07:11 UTC | |
by Anonymous Monk on Jun 27, 2005 at 07:20 UTC | |
|
Re: Regex help reqd
by gopalr (Priest) on Jun 27, 2005 at 06:25 UTC |