Page is a not externally linkable
- Code, Content, and Presentation
-- Perl Server Side CGI Scripting
---- Ignoring certain regex matches


sugarkane - 7:32 pm on Jan 28, 2004 (gmt 0)


Change your regex to:

/(error.*?){2,}/gi

and it should work.

Another way is a bit more of a kludge, but may be useful in a wider context (eg you don't know how many times 'Error Pages' appears in the document, but wanted to ignore them all) would be to do a regex substitution on 'Error Pages' before and after the test so that it no longer matches, eg:

$content=~s/Error Pages/Er1234567ror Pages/g;
# Do your test here
$content=~s/Er1234567ror Pages/Error Pages/g;


Thread source:: http://www.webmasterworld.com/perl/3438.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com