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!