Four REGEXP
Format:
var expression =/pattern/flags;
1.flags is a sign. Are G, I, M respectively.
G: Represents the global pattern. That is, the pattern will match all the strings, not stop immediately when the first match is found.
I: indicates case insensitive.
M: represents multiline mode, which will continue to look for the next line when it reaches the end of a line of text.
Properties of 2.REGEXP Instances
Global: Whether the G mark is set;
IgnoreCase: Whether the I flag is set;
LastIndex: Indicates the character position at which to start searching for the next occurrence, starting from 0;
Multiline: Whether the M flag is set;
Source: A string representation of a pattern
var pattern =/\[bc\]at/i;alert (Pattern1.global); Falsealert (pattern1.ignorecase); True alert (); Falsealert (); 0alert (); "\[bc\]at"
3.RegExp instance method
EXEC () receives 1 parameters. A string that applies a pattern to the drug.
var text = "Father and mother I love You"; var pattern =/I love you/gi; var matched = pattern.exec (text);
JavaScript Learning Notes-Reference type REGEXP