Js native regular expression

The role of the regular expression:

Determining whether the string complies with rules

Create a regular expression:

var reg = / a / g; // create a literal
var reg = new RegExp ( "a ", "g"); // constructor to create
a regular is divided into two parts, one is a regular matching content, the other is Qualifiers

Modifiers:

i case insensitive
g novo find global tail
m match a plurality of rows

Guess you like

Origin www.cnblogs.com/zmlAliIqsgu/p/12168669.html