the following collectively referred to as metacharacters. matches any single character except \ n (newline) a.b can be AXB, a8b ... The [] character group, which matches any single character in brackets A[aeoujf]b, indicates that a single character between A and B can only be any one of the characters in AEOUJF a[0123456789]b before optimization a[0-9Between]b A and B 0-any single character of 9 A[a-za-z]b A and B appear between a Aany single character between z (case insensitive) A[a-za-z0-9]b self-evident ... a[axz.] b when. The meaning of the wildcard character is lost in the brackets, which indicates a common point|a very low priority, the last to calculate it a (x|y) b indicates that A and B are not X or Y, () that the priority Z|Food z or food (z|f) Ood Zood or food, () meaning:1. Change the priority level;2the Extraction Group (grouping) {n} indicates that the preceding expression must appear n times {n}, indicating that the preceding expression appears at least n times, up to an infinite number of times {n,m} indicates at least n times, with a maximum of M times (n-m times) A[a-z]{3}b represents a and B match 3 times A-Z-----------Qualifier-----------* indicates that (a previous single character or a single expression) appears 0 or more times {0,}+ indicates that (a previous single character or a single expression) appears 1 or more times {1,}? Indicates that (either a single character or a single expression) appears 0 or 1 times {0,1} ?The other means: Stop greedy mode Colou?R means u appears or does not appear (Colou)?R indicates that Colou appears or does not appear--------^ with $--------^ indicates the beginning of the string (called Shirt6) also represents non-!^Hello means that the string must start with Hello, or it must start with H, followed by elloa[^0-9a-za-z (&]b = between A and b except 0-9, A-z,a-z, (,&A line of $ indicates the end of the string a$ that the end of the string must be a-------Shorthand Expression--\d said [0-9] Full-width numbers (not normal 0-9) a[0-9]ba\db \d says 0-9\d said [^0-9]\s indicates that all whitespace embox the space \s the angle^\s\w says [a-za-z0-9_] Also matches all Chinese characters because. NET defaults to match in Uniconde Way, so \w can also match all kanji \w Representations [^a-za-z0-9_]\b represents the boundary of a word (there are no characters on either side of the word, and all \w) character classes, and \b represents backspace. In replace mode, \b always represents backspace hello,welcome to our conutry.thanks[\s\s] any character [\w\w] Any character for metacharacters, qualifiers, and so on, if you want to match the character itself must be escaped (at the front plus a \ OK) \* \+ \. \[ \- \{2,3} \\d, etc. ignores all metacharacters, similar to the @ symbol in C #strings = Regex.escape (@"\d{5,7}"), the ID number (15 or 18) can be both, but obviously the second kind of good:^([1-9][0-9]{ -}| [1-9][0-9]{ -}[0-9Xx]) $^[1-9][0-9]{ -}([0-9]{2}[0-9XX])? $
Self-organizing regular expression usage