JS Domain name (support level two domain name) URL validation function

Source: Internet
Author: User
Tags tld

JS Domain name (support level two domain name) URL validation function
Verify path (under Liunx)

function C_path (v) {
if (V.length >) return false;
var reg =/^ (/w+) {1,30}/$/;
return Reg.test (v);
}

Verify Domain Name

function C_zone (V,C_CN) {
var arr = v.split ('. ');
var SLD = Arr.shift ();
var TLD = Arr.join ('. ');
if (sld.length<3) return false;
if (c_cn===undefined) {
if (/bcnb/i.test (TLD) &&/(?: 64|89|sex)/i.test (SLD)) return false;
}
var reg =/^ (?: [0-9a-z]+ (?:-[0-9a-z]+) *.) +[a-z]{2,4}$/;
return Reg.test (v);
}

Verify level Two domain name

function C_second_zone (v) {
Return/^ (?!) bbsb|mailsb|mailb|forumb|ns1b|ns2b| [0-9a-z]*www[0-9a-z]*b) [0-9a-z]{4,8}$/i.test (v);
}

Verifying URLs in http://format

function C_url (v) {
Return/^http://([^/:]+) (:(d+))? (/.*) $/i.test (v);
}

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.