Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Multiple line regex match

by edan (Curate)
on Nov 29, 2004 at 15:12 UTC ( [id://410939]=note: print w/replies, xml ) Need Help??


in reply to Multiple line regex match

The textbook answer will be "Don't use a Regex to parse HTML, use a parser!" (such as HTML::Parser, HTML::TokeParser).

If you're really bent on doing it the quick and dirty (and wrong) way, you might want to look at turning your .*'s into .*?, and read on up greediness in perlre to see why.

--
edan

Replies are listed 'Best First'.
Re^2: Multiple line regex match
by dogen (Acolyte) on Nov 29, 2004 at 15:33 UTC
    Thanks, the .*? worked, as follows (used with the s option ath the end of the regex):
    my $order_reg = "<p>Transaction Number:<\/p>.*?<\/td>.*?<td .*?>(.*?)< +\/td>";

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-16 04:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found