in reply to Re: Pattern Search on HTML source.
in thread Pattern Search on HTML source.

The problem is that is the tags has sometihing like:

my $output = "<!-- 1st table --> What I want 1<!-- /1st table -->more stuff...<!-- 2st movie --> What I want 2<!-- /2st movie -->...more stuff...<!-- 3st movie -->What + I want 3<!-- /3st movie -->...more stuff";


Like a carriage return or something like that I can't get it to match.

Replies are listed 'Best First'.
Re^3: Pattern Search on HTML source.
by ww (Archbishop) on Dec 31, 2007 at 19:20 UTC
    am: use the download download link beneath the code to capture it rather than copy-pasting... or remove the newlines from what you copy-pasted until you have the $output as a single line in your editor.

    and... updating the previous: I realized, belatedly, that you appear to want to capture the contents of all the tag pairs, rather than just the first. Sorry, the code I posted captures only the first and so far, I haven't worked out a simple (aka, "elegant") and understandable way to do them all with a regex. CF advise to use an html parser or (new suggestion) a module designed to deal with matching pairs. Perhaps wiser monks will offer more particular suggestions.