Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Answer: How would I find a piece of html from a sourcefile.html?

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

Q&A > regular expressions > How would I find a piece of html from a sourcefile.html? contributed by dsb

This regular expression will grap the entire tag, brackets and all.
$data =~ m/(<[^>]+>)/; print $1, "\n"; # print the tag
This regex will leave out the brackets and print only the string inside them:
$data =~ m/<([^>]+)>/; print $1, "\n"; # print the tag
Use modifiers, or loops as you need too. -kel

Comment on Answer: How would I find a piece of html from a sourcefile.html?
Select or Download Code
Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2015-01-27 07:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My top resolution in 2015 is:

















    Results (197 votes), past polls