Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Answer: Strip that XML!

( #745438=categorized answer: print w/ replies, xml ) Need Help??

Q&A > regular expressions > Strip that XML! contributed by ramrod

Here's another easy method:
$_ = <<EOF; <xml> <email></email><name>Toto</name> <email></email><name>Tata</name> <email></email><name>Tutu</name> </xml> EOF my @email = /<email>(.*?)<\/email>/g; my @name = /<name>(.*?)<\/name>/g;
(Note that it leaves XML entities undecoded, as noted in the reply.)

Comment on Answer: Strip that XML!
Download Code
Replies are listed 'Best First'.
Re: Answer: Strip that XML!
by Anonymous Monk on Mar 01, 2009 at 08:19 UTC
    That doesn't decode entities (its broken).
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2016-02-06 19:09 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (235 votes), past polls