Regular Expression matching code

Source: Internet
Author: User

Regular Expression matching code

Regular Expressions, also known as regular and regular expressions. (English: Regular Expression, often abbreviated as regex, regexp or RE in code), a concept of computer science. Regular Expressions use a single string to describe and match a series of syntaxes. In many text editors, regular expressions are usually used to retrieve and replace texts that match a certain pattern.

/* RMB amount verification */var testRMB = function (v) {var reg =/^ ([1-9] [\ d] {0, 7} | 0 )(\. [\ d] {1, 2 })? $/; Return reg. test (v); // 12345678.12}/* positive integer verification */var testZZS = function (v) {var reg =/^ [0-9] * [1-9] [0-9] * $/; return reg. test (v); // 12345678.12}

The above is an introduction to the common Regular Expression matching Code introduced by the small Editor. I hope it will be helpful to you. If you have any questions, please leave a message. The small editor will reply to you in time!

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.