Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by athomason (Curate)
on May 26, 2000 at 14:27 UTC ( #14943=categorized answer: print w/replies, xml ) Need Help??

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

Comments make HTML extraction even more difficult than it usually is. However, if you're dealing with fairly standard HTML you could use
$page =~ /<!--\w+(.*)\w*-->;/; $commented = $1;
This will grab the string inside the comment; add appropriate qualifiers to the regexp as necessary (or use another on $commented) if you only want to pick certain stuff out.

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[Corion]: Oooh. I had hoped that X::Tiny would be an X11 client or X11 server, but it is an exception framework :-)
[MidLifeXis]: How many languages would that 'Ex' alias handle. ETOOCUTE

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2017-02-27 11:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (383 votes). Check out past polls.