Ananda has asked for the wisdom of the Perl Monks concerning the following question:
Given a String:: '<vertical name="abc"><description> Replicant consists of Icon, Title1, Title2, Description, MOre Title, and More Hyperlink (minimum=0, maximum=10)</description><item min-allowed="1" max-allowed="20">'
Goals:
a) Check if the string contains "item" node.
if exits:
b) Pick the immediate preceding elements viz "description" and "item" (case insensitive) Condition : The "description" element may or may not exist.
b-1)move the "<description>.*</description>" content to a variable.
b-2)capture the attributes of the "item" element in a variable.
I have tried using something like this
"<item .(*)?><description>(.*)?</description><replicant (.*)?>"
as search pattern but didnt succeed .
please advice.
Thanks in advance
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: some more Regex help reqd
by Joost (Canon) on Jun 27, 2005 at 10:42 UTC | |
by holli (Abbot) on Jun 27, 2005 at 10:50 UTC | |
|
Re: some more Regex help reqd
by rev_1318 (Chaplain) on Jun 27, 2005 at 10:51 UTC | |
|
Re: some more Regex help reqd
by anonymized user 468275 (Curate) on Jun 27, 2005 at 13:56 UTC | |
|
Re: some more Regex help reqd
by graff (Chancellor) on Jun 28, 2005 at 02:51 UTC |