Anyone have a function to check if a URL is valid?
I tried this but its not picking up http:/
If it is missing one / .
From cflib.org
Thanks in advance.
<CFSCRIPT>
/**
* A quick way to test if a string is a URL.
* Regex by Gruber: http://daringfireball.net/2010/07/improved_regex_for_matching_urls
*
* @param stringToCheck The string to check. (Required)
* @return Returns a boolean.
* @author Nathan Dintenfass (nathan@changemedia.com)
* @version 2, August 5, 2010
*/
function isURL(stringToCheck){
var URLRegEx = "(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'"".,<>?«»ββββ]))";
return isValid("regex", stringToCheck, URLRegex);
}
</CFSCRIPT>