5-3

The captured expression, as  specified by [az]+, consists of one or more letters. The second part of the regular expression is a reference to a previously captured submatch, i.e. the second match of the word is exactly matched by the bracket expression. \1 specifies the first submatch.

Word boundary metacharacters ensure that only whole words are detected. Otherwise, phrases such as "is issued" or "this is" will not be correctly recognized by this expression.

The global tag  g following the regular expression specifies that applying the expression to the input string finds as many matches as possible.

The case-insensitive  i flag at the end of an expression specifies case insensitivity.

A potential match may occur on both sides of a newline character specified by a multiline marker.

 

. Special characters such as [.] in bracket expressions  will only match  the . character, which is equivalent to  \. instead of matching all characters except the newline character  \n  .

 Difference between ^  and  [^specified string] :

^ refers to the starting position of the matched string

[^specified string] refers to a string other than the specified string

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325265194&siteId=291194637
5-3