Table 1. Common metacharacters
. Match any character except linefeed
\ W matches letters, numbers, underscores, and Chinese characters
\ S matches any blank space character
\ D matching number
\ B matches the start or end of a word
^ Match the start of a string
$ End of matching string
Table 2. Common delimiter code/syntax descriptions
* 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
Table 3. Commonly Used codes/syntaxes for negative Codes
\ W matches any character that is not a letter, number, underline, or Chinese Character
\ S matches any character that is not a blank character
\ D matches any non-numeric characters
\ B matching is not the start or end position of a word
[^ X] matches any character except x
[^ Aeiou] matches any character except aeiou.
Table 4. Common grouping syntax classification code/syntax description
Capture (exp) matches exp, and capture text to automatically named group
(? <Name> exp) matches exp and captures the text to a group named name. It can also be written (? 'Name' exp)
(? : Exp) matches exp, does not capture the matched text, and does not assign group numbers to this group.
Assertion with Zero Width (? = Exp) match the position before exp
(? <= Exp) match the position behind exp
(?! Exp) the position behind the matching is not the exp position.
(? <! Exp) match the position not above exp
Note (? # Comment) this type of grouping does not affect the processing of regular expressions. It is used to provide comments for reading.
Table 5. Lazy qualifier code/syntax description
*? Repeat any time, but as few as possible
+? Repeat once or more times, but as few as possible
?? Repeated 0 or 1 times, but as few as possible
{N, m }? Repeat n to m times, but as few as possible
{N ,}? Repeated more than N times, but as few as possible
Table 6. Descriptions of common processing options
Ignorecase (case-insensitive) is case insensitive.
Multiline (multiline mode) modifies the meanings of ^ and $ so that they match the beginning and end of a row, not just the beginning and end of the entire string. (In this mode, the exact meaning of $ is: match the position before \ n and the position before the string ends .)
Singleline (single line mode) changes the meaning of. To match each character (including line break \ n ).
Ignorepatternwhitespace (ignore white space) ignores non-escape white space in the expression and enables annotation marked.
Explicitcapture (explicit capture) only captures groups that have been explicitly named.
The introduction here is very simple. If you need more detailed information and have not installed the msdn library on your computer, you can view the msdn online documentation on the regular expression language elements.
Table 7. Syntax code/syntax descriptions not discussed in detail
\ A alarm character (print it to a computer)
\ B is usually the division of words, but if it is used in the character class, it indicates the return
\ T tab, Tab
\ R press ENTER
\ V vertical Tab
\ F page feed
\ N linefeed
\ E escape
\ 0nn ASCII code contains characters whose octal code is NN.
Characters in \ xnn ASCII code with hexadecimal code NN
Characters in the \ unnnn Unicode Code whose hexadecimal code is NNNN
\ Cn ascii control characters. For example, \ CC stands for Ctrl + c
\ A string (similar to ^, but not affected by the option to process multiple rows)
\ Z string end or end of line (not affected by the option of processing multiple lines)
\ Z string end (similar to $, but not affected by the option to process multiple rows)
\ G start of the current search
The character class named name in \ P {name} Unicode, for example, \ P {isgreek}
(?> Exp) greedy subexpression
(? <X>-<Y> exp) balancing group
(? Im-NSX: exp) change the processing option in the sub-expression exp
(? Im-NSX) is the partial change processing option after the expression
(? (Exp) Yes | no) Use exp as a zero-width forward positive asserted. If this position can match, use yes as the expression of this group; otherwise, use no
(? (Exp) Yes) Same as above, just use an empty expression as no
(? (Name) Yes | no) if the content is captured by the group named name, use yes as the expression; otherwise, use no
(? (Name) Yes) Same as above, but uses an empty expression as no