The direct variable character of the regular expression:
Character |
Match |
\ O |
NUL characters |
\ T |
Tab |
\ N |
Line Break |
\ V |
Vertical Tab |
\ F |
Page feed |
\ R |
Enter |
\ Xnn |
The Latin character specified by the hexadecimal nn, for example, \ x0A is equivalent to \ n. |
\ Uxxxx |
Unicode characters |
\ CX |
Control Character ^ X |
Js reference of the regular expression: var sEnd = new RegExp ("s $"); -- string matching ending with s
Regular Expression:
Verified characters:
Which has special meanings in Regular Expressions: ^ $. * +! : | \/() [] {}. If you use these Punctuation Marks directly in a regular expression, you must add "\" (Escape Character ). Other characters (for example, @ and quotation marks) do not have special meanings. In a regular expression, they only match themselves by quantity. Note: \ -- "\"
Question: "A [B] C [D] E [F] G" is divided into two Arrays: ACEG and [B] [D] [F].
Question:
They are all looking for [B] [D] [F] arrays. Which one is better?
Method 1: var test1 = test. match (/\ [(\ w) * \]/g );
Method 2: var s =/\ [(\ w) * \]/g;
Var result;
Var test1 = [];
While (result = s.exe c (test ))! = Null ){
Test1.push (result [0]);
}