In JavaScript, the regular expression consists of two parts: the matching pattern text of the regular expression, and the modifier that matches the pattern text;
Modifier:
Modifier |
Description |
I |
Ignore case |
G |
Perform a global match |
M |
Perform multi-line matching |
The matching pattern text includes the following:
Parentheses: Finds characters in a range:
(Red|blue|green)
expression |
|
[abc] |
any one of the brackets can be |
[^abc] /td> |
|
[0-9] |
number 0-9 can be |
One of three |
Metacharacters: A character with a special meaning
metacharacters |
description |
. | The
finds a single character, in addition to line breaks and line terminators. |
\w |
to find word characters. |
\w |
to find non-word characters. |
\d |
to find numbers. |
\d |
to find non-numeric characters. |
\s |
to find white space characters. |
\s |
to find non-whitespace characters. |
\b |
matches the word boundary. |
\b |
matches non-word boundaries. |
\ |
find NUL characters. |
\ n |
find line breaks. |
\f |
Find a page break. |
\ r |
find a carriage return. |
\ t |
find tabs. |
\v |
to find vertical tabs. |
\xxx |
to find characters that are specified in octal number XXX. |
\xdd |
to find the characters specified in hexadecimal digits dd. |
\uxxxx |
finds Unicode characters that are specified in hexadecimal number xxxx. |
javascript--Regular Expression (REGEXP, String) (not completed)