Definition
var re1 = new RegExp("abc");
var re2 = /abc/;
\n |
Will be preserved, rather than ignored as they are in strings, and change the meaning of the pattern |
? |
It may occur zero or one time |
| |
Denotes a choice between the pattern to its left and the pattern to its right |
* |
It indicates that the element may be repeated more than once but also allows the pattern to match zero times |
+ |
It indicates that the element may be repeated more than once |
ˆ |
To express that you want to match any character except the ones in the set |
A dash (- ) between two characters |
To indicate a range of characters.[0-9] covers all of them and matches any digit |
\d |
Any digit character |
\w |
An alphanumeric character (“word character”) |
\s |
Any whitespace character (space, tab, newline, and similar) |
\D |
A character that is not a digit |
\W |
A nonalphanumeric character |
\S |
A nonwhitespace character |
. |
Any character except for newline |
Like this:
Like Loading...
Related