in reply to Pattern Search on HTML source.

While strongly agreeing with the previous 2 posts(Use an HTML parser module), one of the issues you may run into, with your code is described in Death to Dot Star!.

for a quick hack, I'd suggest using

([^<]+)
instead.

     "As you get older three things happen. The first is your memory goes, and I can't remember the other two... " - Sir Norman Wisdom

Replies are listed 'Best First'.
Re^2: Pattern Search on HTML source.
by Anonymous Monk on Dec 31, 2007 at 20:47 UTC
    Why something like this doesn't work?

    if ( $line_test=~/<!-- 1st table -->\s*(.*?)\s*<!-- \/1st table -->/g) +{print $1;}


    If it has a carriage return or new line.
      Try adding an "s" modifer, along with your"g".

      s

      Treat string as single line. That is, change "." to match any character whatsoever, even a newline, which normally it would not match.

           "As you get older three things happen. The first is your memory goes, and I can't remember the other two... " - Sir Norman Wisdom