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


dkubb - 4:07 am on Feb 1, 2004 (gmt 0)


The following should work without any kludges. It uses a negative look-ahead assertion to look for the exact word "error" that is not followed by the word "pages".

Also note that some of the other examples in this thread would mistakenly match words that have error as a substring, like "terror" or "errors". You can account for this by using \b to match the word boundaries.

if($response->is_success and $response->content !~ /\berror\b(?!\s+pages)/i) {
return $response->content;
}
else {
$Error_msg = $response->message;
return undef;
}


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