Regular expressions common to native JavaScript

Source: Internet
Author: User

//positive integers/^[0-9]*[1-9][0-9]*$/;//Negative integer/^-[0-9]*[1-9][0-9]*$/;//positive floating point number/^ ([0-9]+\. [0-9]*[1-9][0-9]*) | ([0-9]*[1-9][0-9]*\. [0-9]+) | ([0-9]*[1-9][0-9]*)) $/;//Negative floating point number/^ (-([0-9]+\. [0-9]*[1-9][0-9]*) | ([0-9]*[1-9][0-9]*\. [0-9]+) | ([0-9]*[1-9][0-9]*))) $/;//floating point number/^ (-?\d+) (\.\d+) $/;//Email Address/^[\w-]+ (\.[ \w-]+) *@[\w-]+ (\.[ \w-]+) +$/;//URL address/^[a-za-z]+://(\w+ (-\w+) *) (\. ( \w+ (-\w+) *) * (\?\s*) $/;//year/month/day (year-month-day, year, month, day)/^ (19|20) \d\d[-/.] (0[1-9]|1[012]) [- /.] (0[1-9]| [12] [0-9]|3[01]) $/;//match Chinese characters/[\u4e00-\u9fa5]/;//matches the account number is legal (the letter begins, allows 5-10 bytes, allows alphanumeric underline)/^[a-za-z][a-za-z0-9_]{4,9}$/;//Regular expressions that match blank lines/\n\s*\r/;//Match China postcode/[1-9]\D{5} (?! \d)/;//Match ID/\d{15}|\d{18}/;//Match domestic phone number/(\d{3}-|\d{4}-)? (\d{8}|\d{7})?;//Match IP Address/((2[0-4]\d|25[0-5]| [01]?\d\d?] \.) {3} (2[0-4]\d|25[0-5]| [01]?\d\d?] /;//Regular expressions that match the whitespace characters/^\s*|\s*$/;//regular expressions that match HTML tags< (\s*?) [^>]*>.*?| <. *? />;

Regular expressions common to native JavaScript

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.