JavaScript verifies URL format is legitimate

Source: Internet
Author: User

1function Isurl (str_url) {//Verify URL2     varStrregex ="^ ((https|http|ftp|rtsp|mms)?:/ /)"3+"? ([0-9a-z_!~* ' (). &=+$%-]+:)? [0-9a-z_!~* ' (). &=+$%-] [email protected])?" //FTP [email protected]4+"([0-9]{1,3}\.) {3} [0-9] {1,3}" //URL-199.194.52.184 in IP form5+"|" //Allow IP and domain (domain name)6+"([0-9a-z_!~* ' ()-]+\.) *" //domain name-www.7+"([0-9a-z][0-9a-z-]{0,61})? [0-9a-z]\." //level two domain name8+"[a-z]{2,6}]" //First level domain-. com or. Museum9+"(: [0-9]{1,4})?" //Port-:Ten+"((/?)|" //a slash isn ' t required if there is no file name One+"(/[0-9a-z_!~* ' ().;?: @&=+$,%#-]+) +/?) $"; A     varRe =NewRegExp (Strregex); -     returnre.test (str_url); -}

JavaScript verifies URL format is legitimate

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.