Fix: bad regular expression

This commit is contained in:
Regis Houssin 2009-10-24 05:22:40 +00:00
parent 0cdf7aef61
commit cb380db18d

View File

@ -256,12 +256,12 @@ function isValidUrl($url,$http=0,$pass=0,$port=0,$path=0,$query=0,$anchor=0)
// PATH // PATH
if ($path) $urlregex .= "(\/([a-z0-9+\$_-]\.?)+)*\/"; if ($path) $urlregex .= "(\/([a-z0-9+\$_-]\.?)+)*\/";
// GET Query // GET Query
if ($query) $urlregex .= "(\?[a-z+&\$_.-][a-z0-9;:@/&%=+\$_.-]*)"; if ($query) $urlregex .= "(\?[a-z+&\$_.-][a-z0-9;:@\/&%=+\$_.-]*)";
// ANCHOR // ANCHOR
if ($anchor) $urlregex .= "(#[a-z_.-][a-z0-9+\$_.-]*)$/i"; if ($anchor) $urlregex .= "(#[a-z_.-][a-z0-9+\$_.-]*)$";
// check // check
if (preg_match('!'.$urlregex.'!', $url)) if (preg_match('/'.$urlregex.'/i', $url))
{ {
$ValidUrl = 1; $ValidUrl = 1;
} }