This function validates a URL using regular expressions. You can specify the prefixRequired parameter (set it to true) to force the function to only accept URLs starting with http://, https://, or ftp://, otherwise this prefix will be optional. function isUrl(str, prefixRequired) {strExp = '^(((http(s?))|(ftp))\:\/\/)'; if (arguments.length == 1 && arguments[1] != false) strExp += '?'; strExp += '(www.|[a-zA-Z].)[a-zA-Z0-9\-\.]+\.(\.[a-z]{2,4})' + '(\:[0-9]+)*(\/($|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-]+))*$'; objRegExp = new RegExp(strExp); return objRegExp.test(str); }
| Attributes | Values |
|---|
| rdfs:label
| |
| rdfs:comment
| - This function validates a URL using regular expressions. You can specify the prefixRequired parameter (set it to true) to force the function to only accept URLs starting with <a href="http://,">http://,</a> https://, or ftp://, otherwise this prefix will be optional. function isUrl(str, prefixRequired) {strExp = '^(((http(s?))|(ftp))\:\/\/)'; if (arguments.length == 1 && arguments[1] != false) strExp += '?'; strExp += '(www.|[a-zA-Z].)[a-zA-Z0-9\-\.]+\.(\.[a-z]{2,4})' + '(\:[0-9]+)*(\/($|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-]+))*$'; objRegExp = new RegExp(strExp); return objRegExp.test(str); }
|
| dcterms:subject
| |
| abstract
| - This function validates a URL using regular expressions. You can specify the prefixRequired parameter (set it to true) to force the function to only accept URLs starting with <a href="http://,">http://,</a> https://, or ftp://, otherwise this prefix will be optional. function isUrl(str, prefixRequired) {strExp = '^(((http(s?))|(ftp))\:\/\/)'; if (arguments.length == 1 && arguments[1] != false) strExp += '?'; strExp += '(www.|[a-zA-Z].)[a-zA-Z0-9\-\.]+\.(\.[a-z]{2,4})' + '(\:[0-9]+)*(\/($|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-]+))*$'; objRegExp = new RegExp(strExp); return objRegExp.test(str); }
|