F() to check valid URL

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>
1 Like

Don’t now how I missed that. I initially looked at that but missed the url par. lol thanks!