Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Answer: Strip that XML!

by ramrod (Curate)
on Feb 20, 2009 at 20:38 UTC ( #745438=categorized answer: print w/replies, xml ) Need Help??

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

Here's another easy method:
$_ = <<EOF; <xml> <email>toto@foo.com</email><name>Toto</name> <email>tata@bar.com</email><name>Tata</name> <email>tutu@baz.com</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.)

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?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2016-12-07 22:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (132 votes). Check out past polls.