The ECMAScript uses RegExp to support regular expressions. Using the following Perl-like syntax, you can create a regular expression.
var Expression=/pattern/flags;
As above code:
The pattern---pattern section can be any simple or complex regular expression that can contain character classes, qualifiers, groupings, forward lookups, and reverse references.
Falgs---each regular expression can have one or more flags (flags) that indicate the behavior of the regular expression;
The following are the 3 flags supported by the matching pattern of the regular expression:
G: Represents the global pattern, which means that the pattern will be applied to all strings, rather than stopping immediately when the first occurrence is found;
I: Indicates case-insensitive mode, that is, the case of the pattern and the string are ignored when the match is determined;
M: represents multiline mode, that is, when you reach the end of a line of text, you also continue to find out if the next row has an item that matches the pattern
RegExp type of JavaScript reference type (regular expression)