in reply to Grabing a Page and Need to Parse it..

Will the block always be wrapped by those comments?
Unless I misunderstand your question, a simple regexp will remove all of that.
$webpage =~ s/<!-- Begin MRTG Block -->.*<!-- End MRTG Block -->//os;
Does the table occur more than once in the webpage? If so, add the 'g' (global - as often as it's encountered) option to the Regexp.

Replies are listed 'Best First'.
Re: Re: Grabing a Page and Need to Parse it..
by merlyn (Sage) on May 07, 2001 at 20:23 UTC
      also keep in mind that '.' does not match newlines. so you may be looking for [.\n]*? instead.

      update: I should have known that I was missing something. It seemed most out of character for merlyn to miss something like that.

      Ok, this is beyond the scope of the initial question, but I'm curious anyways - the /o caches the Regexp so it doesn't need to be re-compiled, correct? I'm not familiar with the innards of the interpreter, but in the event we returned to this RE, wouldn't that be an (albeit extremely minimal) optimization?