http://qs321.pair.com?node_id=835477


in reply to Re: Isn't /m for multiline regex?
in thread Isn't /m for multiline regex?

The parent node overreaches.

While it's true that it's not generally a good idea to try to parse html with regexen, "(t)hat simply can't work is not.

It can be done... and often is for simple cases... but is fraught with so many difficulties that it's inadvisable. What's more, trying to parse html of any complexity with tools other than the well-tested modules referenced above flies in the face of the mantra 'don't re-invent the wheel.'

Replies are listed 'Best First'.
Re^3: Isn't /m for multiline regex?
by GertMT (Hermit) on Apr 20, 2010 at 07:18 UTC
    from perlfaq6

    Here's code that finds everything between START and END in a paragraph:
    undef $/; # read in whole file, not just one line or paragraph while ( <> ) { while ( /START(.*?)END/sgm ) { print "$1\n"; } }