I think this is not possible, since it is also a valid directory name?
www.google.com/scripts/myscript.js
I assume that only http: // can be filtered.
I do not know what you plan to do, but perhaps you can use file_exists () to check if there is a file in the ur file system.
, URL :
$text = preg_replace("
#((http|https|ftp)://(\S*?\.\S*?))(\s|\;|\)|\]|\[|\{|\}|,|\"|'|:|\<|$|\.\s)#ie",
"'<a href=\"$1\" target=\"_blank\">$3</a>$4'",
$text
);
, filter_var()
var_dump(filter_var('example.com', FILTER_VALIDATE_URL);