What is a regular expression?
Regular expressions, also called regular notation, regular notation (Regular expression), regular expressions use a single string to describe and match a series of strings that conform to a certain syntax rule. In many text editors, regular expressions are often used to retrieve and replace text that conforms to a pattern.
The C # Zhongzheng expression class is a Regex class that is located under the System.Text.RegularExpressions namespace.
Symbol
Some commonly used meta-characters
. Match any character other than line break (\ n)
\w match Letters or numbers or underscores or kanji
\w matches any characters that are not letters, numbers, underscores, kanji
\s matches any whitespace character (TAB, line break, Chinese full-width space)
\s matches any character that is not a white letter
\d Matching numbers
\d matches any non-numeric character ; equivalent to [^0-9]
\b Match the beginning or end of a word
\b Match is not where the word starts or ends
^ start of matching string
[^x] matches any character except x (inverse)
$ match end of string
\ escape character, if you want to match \ Write \ \
Some of the commonly used qualifiers
* Repeat 0 or more times
+ Repeat 1 or more times
? Repeat 0 or 1 times
{n} repeats n times
{n,} repeats n or more times
{n,m} repeats n times to M
| Or
[] matches the characters within [], e.g. [a] matches a
() Increase the priority level
Test tool: Http://pan.baidu.com/s/1nttiOPj
"Initial knowledge" regular expression