Add is_URL()

This commit is contained in:
sullrich 2009-11-27 20:43:01 -05:00
parent 772d312133
commit 5e9dd72acc

View File

@ -1099,4 +1099,19 @@ function color($color = "0m") {
}
}
/****f* util/is_URL
* NAME
* is_URL
* INPUTS
* string to check
* RESULT
* Returns true if item is a URL
******/
function is_URL($url) {
$match = preg_match("'\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))'", $url);
if($match)
return true;
return false;
}
?>