Common regular Expression Matching code introduction _ Regular Expression

Source: Internet
Author: User
Tags regular expression

Regular expressions, also known as formal representations, general representations. (English: Regular Expression, often abbreviated as regex, RegExp, or re) in code, a concept of computer science. A regular expression uses a single string to describe and match a sequence of rules that conform to a certain syntactic rule. In many text editors, regular expressions are often used to retrieve and replace text that conforms to a pattern.

* * RMB amount Check/
var testrmb = function (v) {
var reg =/^ ([1-9][\d]{0,7}|0) (\.[ \d]{1,2})? $/;
return Reg.test (v);
12345678.12
}/
* Positive integer checksum
/var Testzzs = function (v) {
var reg =/^[0-9]*[1-9][0-9]*$/;
return Reg.test (v);
12345678.12
}

The above is a small set for you to introduce the common regular expression matching code introduction, I hope to help you, if you have any questions welcome to my message, small series will promptly reply to everyone!

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.