JS Check for URL code
in a lot of time to check whether for the URL code, verify that the URL is the correct format Oh, the following provides a JS authentication URL function, he can verify the HTTPS tutorial |http|ftp|rtsp|mms, there are ports.
**
* Check for URL
*
* @param {}
* Str_url
* @return {Boolean} true: URL,false:<b> not </b> URL;
*/
This.isurl = function (Str_url) {//Verify URL
var Strregex = "^ (HTTPS|HTTP|FTP|RTSP|MMS)?:/ /)"
+ "? ([0-9a-z_!~* ' (). &=+$%-]+:)? [0-9a-z_!~* ' (). &=+$%-]+@)? " FTP user@
+ "([0-9]{1,3}.) {3} [0-9] {1,3} "//IP form of url-199.194.52.184
+ "|"//Allow IP and domain (domains)
+ "([0-9a-z_!~* ' ()-]+.) * "//Domain name-www."
+ "([0-9a-z][0-9a-z-]{0,61})? [0-9a-z]. Level two domain
+ "[a-z]{2,6}]"//domain-. com or. Museum
+ "(: [0-9]{1,4})"//Port-: 80
+ "((/?)|" A slash isn ' t required if there is no file name
+ "(/[0-9a-z_!~* ' ();?: @&=+$,%#-]+) +/?) $";
var re = new RegExp (Strregex);
return Re.test (Str_url);
}