in reply to Pattern Search on HTML source.
Although you have correctly made your regex non-greedy, it "can't get a match" because 1nd (in the regex) does not match 1st (in the data):
cheerfully spits outmy $output = "<!-- 1st table -->What I want 1<!-- /1st table -->more s +tuff...<!-- 2st movie -->What I want 2<!-- /2st movie -->...more stuf +f...<!-- 3st movie -->What I want 3<!-- /3st movie -->...more stuff"; if ($output =~ /<!-- 1st table -->(.*?)<!-- \/1st table -->/g) { print $1; } else{ print "Nothing Here!"; }
perl 23.plHowever
What I want 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Pattern Search on HTML source.
by Anonymous Monk on Dec 31, 2007 at 19:05 UTC | |
by ww (Archbishop) on Dec 31, 2007 at 19:20 UTC |