Common metacharacters in Regular Expressions
/B matches the start or end of a word, for example,/BHI/B matches the word hi, but the word his fails to match.
. Match any character except line breaks
* The content on the front can be repeated for any time. Note: * The content must be included in the front.
. * When connected, it means any number of characters that do not contain line breaks.
/D match any number
The number of times that {2} matches the previous content. Note: The first character or Metacharacter
/S matches any blank characters, including spaces, tabs, line breaks, and Chinese fullwidth spaces.
/W matches letters, numbers, underscores, and Chinese characters.
/D + matches one or more consecutive numbers. Here, the "+" is similar to the "*" metacharacters. The difference is that * matches any number of times (which may be 0 times), while "+" matches the same number once or more times.
^ Match the start of a string
$ End of matching string
Note: The difference between ^ and $ and/B: the meaning of ^ and $ changes to the start and end of the matching row, for example, expression ^. * A $ matching s asa results in a matching failure. And/BA. * A/B matches S ASA successfully, and the result is ASA
^/W + match the first word in a row
Repeat:
* Repeated zero or more times
+ Repeat once or more times
? Zero or one repetition
{N} repeated n times
{N,} repeat n times or more times
{N, m} repeat n to m times
Negative:
/W match any character that is not a letter, number, underline, or Chinese Character
/S match any character that is not a blank character
/D: match any non-numeric characters.
/B matching is not the start or end of a word
[^ X] matches any character except x
[^ Aeiou] matches any character except aeiou.
Example:/S + matches strings that do not contain blank characters.
<A [^>] +> match a string prefixed with a enclosed in angle brackets.
| Equivalent to or