The regular expression is a regular expression. It seems that English is better understood than Chinese, that is, checking expression characters
Not compliant !! Regular expressions have a very powerful and complex object RegExp. In JavaScript1.2
.
Let's take a look at the introduction of regular expressions:
The regular expression object is used to regulate a standard expression (that is, the expression operator does not meet specific requirements, such as whether it is an Email
It has the attributes and methods used to check whether the given string meets the rules.
In addition, the attributes of individual regular expression objects created by using the RegExp constructor have been pre-defined.
You can use static attributes of objects at any time.
Core objects:
Available in JavaScript 1.2 and NES 3.0 and later versions.
The toSource method is added in Versions later than JavaScript 1.3.
Creation method:
Text format or RegExp constructor function.
The text format is as follows:
/Pattern/flags:/mode/flag
The constructor function method is as follows:
New RegExp ("pattern" [, "flags"]) is new RegExp ("Mode" [, "flag"])
Parameters:
Pattern)
Indicates the text of a regular expression.
Flags)
If this option is specified, flags can be one of the following nominal values:
G: global match (exact match)
I: ignore case (case insensitive)
Gi: both global match and ignore case (matching all possible values, case Insensitive)
Note: Do not Mark parameters in text format with quotation marks, while parameters in constructors must be marked with quotation marks. So the following
The expression creates the same regular expression:
/AB + c/I
New RegExp ("AB + c", "I ")
Description:
When using constructor, you must use normal strings to avoid rules (add leading characters to strings.