$_ = "";
while (/<(.*?)>(.*?)<\/\1>/g) {
print "tag $1 which has $2 inside\n";
}
Paul M wrote:
Hi:
Given the following list:
I want to know all the "elements" within elem1. (Note: It is seriously
MALFORMED XML, that is why I am attempting to use regexp).
Any ideas. I can get $1
From: mer...@stonehenge.com (Randal L. Schwartz)
> > "Paul" == Paul M writes:
>
> Paul> Note: It is seriously
> Paul> MALFORMED XML
>
> That's a nonsense phrase, like "somewhat pregnant". It's either XML, or
> it isn't. And if it isn't, get after the vendor for spewing angle-bracketish
> s
> "Paul" == Paul M writes:
Paul> Note: It is seriously
Paul> MALFORMED XML
That's a nonsense phrase, like "somewhat pregnant". It's either XML, or
it isn't. And if it isn't, get after the vendor for spewing angle-bracketish
stuff at you.
--
Randal L. Schwartz - Stonehenge Consulting Serv
From: Paul M
> Hi:
>
> Given the following list:
>
>
>
>
>
>
>
> I want to know all the "elements" within elem1. (Note: It is
> seriously MALFORMED XML, that is why I am attempting to use regexp).
It's hard to say, but it might be easier to fix the XML and then use
normal XML tools. Beside
nt = $1;
# unless( $element =~ m{ \A \/ }msx ){
print "$1\n";
# }
}
}
Any ideas...
The [^<]* works to strip out "descendants text nodes" but not when < and > are
present.
--- On Mon, 1/5/09, Mr. Shawn H. Corey wrote:
From
On Mon, 2009-01-05 at 08:17 -0800, Paul M wrote:
> If it were true XML, I would say all children's Node Names.
> so:
>
>
You mean all the descendants. The children of elem1 are elema and
elemb. The descendants of elem1 are elema, elemb, and elemc.
#!/usr/bin/perl
use strict;
use warnings
If it were true XML, I would say all children's Node Names.
so:
--- On Mon, 1/5/09, Mr. Shawn H. Corey wrote:
From: Mr. Shawn H. Corey
Subject: Re: RegExp Searching within
To: pjm...@yahoo.com
Cc: beginners@perl.org
Date: Monday, January 5, 2009, 8:10 AM
On Mon, 2009-01-05 at 08:02
On Mon, 2009-01-05 at 08:02 -0800, Paul M wrote:
> I want to know all the "elements" within elem1. (Note: It is
> seriously MALFORMED XML, that is why I am attempting to use regexp).
Do you want to know all the children or all the descendants?
--
Just my 0.0002 million dollars worth,
Sha