The characters commonly used character of the regular expression:
Symbol |
Describe |
/.. / |
Represents the beginning and end of a pattern |
^ |
Match the start of a string |
$ |
Match the end of a string |
\s |
Any whitespace character |
\s |
Any non-whitespace character |
\d |
Matches a numeric character, equivalent to [1-9] |
\d |
Any character other than a number, equivalent to [^0-9] |
\w |
Match a number, underscore, or alphabetic character, equivalent to [a-za-z0-9] |
\w |
Any non-single character, equivalent to [^a-za-z0-9] |
. |
Any character other than line breaks |
Repeating characters for regular expressions
Symbol |
Describe |
N |
Matches the previous n times |
{N,} |
Matches the previous item n times, or multiple times |
{N,m} |
Match the previous item at least n times, but not more than m times |
* |
Matches the previous item 0 or more times, equivalent to {0,} |
+ |
Matches the previous item 1 or more times, equivalent to {1,} |
? |
Matches the previous item 0 or 1 times, which means the previous item is optional, equivalent to {0,1} |
|
|
Use of JS Regular expressions