Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Use Parsers To Get Chunk of HTML?

by polettix (Vicar)
on Jul 04, 2005 at 10:45 UTC ( [id://472193]=note: print w/replies, xml ) Need Help??


in reply to Use Parsers To Get Chunk of HTML?

$whole_thing =~ m|<some unique html start string>(.*?)<end string>|s; $good_chunk = $1;
The matching could fail here, so you should check before using $1, otherwise you'll get the value remaining from the previous positive evaluation. You could also evaluate in list context:
($good_chunk) = $whole_thing =~ m|<some unique html start string>(.*?)<end string>|s;
even if readability could suffer a bit here. This will assign $1 to $good_chunk if the regex matches, undef otherwise.

Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Don't fool yourself.

Replies are listed 'Best First'.
Re^2: Use Parsers To Get Chunk of HTML?
by Cody Pendant (Prior) on Jul 05, 2005 at 23:17 UTC
    Thanks for that, good point.


    ($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')
    =~y~b-v~a-z~s; print

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://472193]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2024-04-23 14:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found