jS验证网址地址是否正确

ar reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;

 

 

http://www.baidu.com   -------正确

www.baidu.com         -------正确

baidu.com       -------错误

http://123.com     -------正确

转载于:https://www.cnblogs.com/lr-blog/p/5301744.html

你可能感兴趣的:(jS验证网址地址是否正确)