Regular expression

xiaoxiao2021-03-06  73

.

Match any single character. For example, regular expression R.T matches these strings: RAT, RUT, R T, but does not match root.

$

Match line end of the match. For example, regular expressions Weasel $ can match the end of the string "He's a weasel", but cannot match the string "They Are A Bunch of Weasels.".

^

Match the beginning of a row. For example, regular expressions ^ WHEN IN can match the beginning of string "WHEN in the courts", but cannot match "What and when".

*

Match 0 or more characters just before it. For example, a regular expression. * Means that any number of characters can be matched.

/

This is the reference to the preparation, which is used to match these metad characters listed here as normal characters. For example, regular expression / $ is used to match the dollar symbol, not the tail, similar, regular expression /. Used to match the point character, not a wildcard of any character.

[]

[C1-C2]

[^ C1-C2]

Match any of the characters in brackets. For example, regular expression r [aou] t matches RAT, ROT and RUT, but does not match RET. You can use the cell in parentheses to specify the interval of characters, such as regular expressions [0-9] can match any numeric characters; it can also make multiple intervals, such as regular expressions [A-ZA-Z], can match any Case written letters. Another important usage is "exclude", to match characters except the specified interval - the so-called replenishment - use between parentheses and first characters on the left, such as regular expressions [ ^ 269A-Z] will match any characters other than 2, 6, 9 and all uppercase letters.

/

The start (/ <) and end (/>) of the matching word (Word). For example, regular expressions /

/ (/)

The expression between / (and /) is defined as "Group" and saves the character of this expression to a temporary area (up to 9 in a regular expression), which can be used / 1 to / 9 symbols are referenced.

|

The two matching conditions are logically "or" (OR) operations. For example, regular expressions (HIM | HER) matches "IT Belongs to Him" ​​and "IT Belongs to Her", but cannot match "IT Belongs to the THEM.". Note: This element is not supported by all software.

Match 1 or more characters just before it. For example, regular expression 9 matches 9, 99, 999, etc. Note: This element is not supported by all software.

?

Match 0 or 1 characters before it. Note: This element is not supported by all software.

/ {I /}

/ {i, j /}

Match the specified number of characters, these characters are defined before it. For example, regular expressions A [0-9] / {3 /} can match the character "a" followed by a string just 3 digital characters, such as A123, A348, etc., but do not match the A1234. Regular expression [0-9] / {4, 6 /} matches continuous four, 5 or 6 numeric characters. Note: This element is not supported by all software.

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

New Post(0)