# regular expression

# 1. Simple regular without inclusion grouping Simple with inclusion grouping

Example: Extract 4 digits Regular:d{4} query "12345" , extract "1234" and "2345“

# 2. If a grouping is included, extract the first grouping as an entity

Example: Extract 4 digits, but exclude others that are longer or shorter Regular:(?<!d])(d{4})(?!d]) query "1212345" , Does Not Match query "abc1234def," extract "1234"

Note: Syntax can always be used (?😃 Not captured, or (?=) 、 (?!) 、 (?<=) 、 (?<!) Zero-width assertion, skipping the grouping makes the desired grouping the first

# 3. Common grouping patterns

(?: Prefix 1|Prefix 2|Prefix 3)(.?)(?: Suffix 1|Suffix 2|Suffix 3) Extract the content between the prefix and the suffix. The prefixes and prefixes must exist at the same time ((?<= Prefix)(.)|(.*?)(? = Suffix)) There is only one of them, either before or after the prefix.

# 4. Common problem

English is case-insensitive by default, unless the entity is named with _cased ending

After editing the regular, click the publish button to take effect

The current system is GBK encoding, each Chinese character is equivalent to 2 characters in the regular, so even a Chinese character optional condition must be bracketed (please)? Character sets are not available either [One, two, three] , can only be used (one|two|three)

Restricted by perl Regex engine, zero-wide assertion (?=) 、 (?!) 、 (?<=) 、 (?<!) If the use or condition in | Each condition must be equally wide, Not capture (?😃 There is no such restriction