in reply to How to extract a pattern in Perl regex?
I second Fletch's advice to avoid parsing HTML with regex.
However, another problem you may have is that you are not, strictly speaking, matching, but substituting (with the empty string). E.g.:
(This example only works because I've removed the ^ start-of-string anchor.) Please see perlre, perlretut and perlrequick.c:\@Work\Perl\monks>perl -wMstrict -le "my $urlresult = 'an Alt Img and another ALT IMG here'; print qq{string has 'alt img': '$urlresult'}; ;; if ($urlresult =~ s/(alt img)//igm) { print qq{string had 'alt img', but no more: '$urlresult'}; } " string has 'alt img': 'an Alt Img and another ALT IMG here' string had 'alt img', but no more: 'an and another here'
If you have more questions, please feel free to ask. Please see How do I post a question effectively?, Short, Self-Contained, Correct Example and How to ask better questions using Test::More and sample data.
Give a man a fish: <%-{-{-{-<
|
|---|