Regular expression 2

xiaoxiao2021-03-06  177

[^ XYZ] Negative character set. Match any of the characters that are not included. For example, '[^ ABC]' can match 'P' in "Plain".

[A-Z] character range. Match any of the characters within the specified range. For example, '[a-z]' can match any lowercase letters character in the 'A' to 'Z' range.

[^ a-z] Negative character range. Match any of any characters that are not within the specified range. For example, '[^ a-z]' can match any of any characters that are not in the 'A' to 'Z'.

/ b Match a word boundary, that is, the location of the words and spaces. For example, 'er / b' can match 'ER' in "Never", but do not match 'Er' in "Verb".

/ B matches non-word boundary. 'ER / B' Match 'Er' in "Verb", but does not match 'Er' in "Never".

/ CX matches the control character indicated by x. For example, / cm matches a Control-M or a carrier. The value of x must be one of A-Z or A-Z. Otherwise, the C is treated as a protact 'c' character.

/ d Match a numeric character. Equivalent to [0-9].

/ D Match a non-digital character. Equivalent to [^ 0-9].

/ f Match a change page. Equivalent to / x0c and / cl.

/ n Match a newline. Equivalent to / x0a and / cj.

/ r Match a carriage return. Equivalent to / X0D and / cm.

/ s Match any blank character, including spaces, tabs, change page, and the like. Equivalent to [/ f / n / r / t / v].

/ S Match any non-blank character. Equivalent to [^ / f / N / R / T / V].

/ t matches a tab. Equivalent to / x09 and / ci.

/ v Match a vertical tab. Equivalent to / x0b and / ck.

/ w Match any word character that includes underscore. Equivalent to '[A-ZA-Z0-9_]'.

/ W Match any non-word characters. Equivalent to '[^ a-za-z0-9_]'. / XN matches n, where n is a hexadecimal escape value. The hexadecimal escape value must be a long two numbers. For example, '/ x41' matches "a". '/ x041' is equivalent to '/ x04' & "1". ASCII coding can be used in regular expressions. .

/ NUM matches NUM, where NUM is a positive integer. References to the acquired match. For example, '(.) / 1' matches two consecutive identical characters.

/ n identifies an octal escape value or a rearward reference. If the sub-expression of at least N before / N, n is a backward reference. Otherwise, if n is an octal number (0-7), then n is an eight-input escape value. / Nm identifies an octal escape value or a backward reference. If the / nm has at least IS Preceded by Least NM acquired a sub-expression, the nm is a backward reference. If there is at least n acquisition before / nm, then n is a rear reference reference of a post-written word M. If the previous conditions are not satisfied, if n and m are octal numbers (0-7), the / nm will match the eight-way escape value Nm.

/ NML If n is an octal number (0-3), and M and L are eight-input numbers (0-7), match the eight-en-enamded escape value NML.

转载请注明原文地址:https://www.9cbs.com/read-128487.html

New Post(0)