Regular expressions are a variety of different styles. The following table is a Ghost in the PCRE regular expression characters and their behavior in the context of a complete list:
| Character | Description |
|---|---|
| \ | Will be the next character is marked as a special character, or a literal character, or a backward reference, or an octal escape. For example, "n" matches the character "n". "\ N" matches a newline character. Sequence "\ \" matches "\" and "\ (" the match "(." |
| ^ | Match the input string starting position. If you set the RegExp object's Multiline property, ^ also matches the "\ n" or "\ r" after the location. |
| $ | Enter the string matching the end position. If you set the RegExp object's Multiline property, $ also matches the "\ n" or "\ r" before the position. |
| * | Match the preceding subexpression zero or more times. For example, zo * to match the "z" and "zoo". * Is equivalent to (0). |
| + | Match the preceding subexpression one or more times. For example, "zo +" to match "zo" and "zoo", but can not match the "z". + Is equivalent to (1,). |
| ? | Match the preceding subexpression zero or one. For example, "do (es)?" Matches "do" or "does" in the "do". ? Is equivalent to (0,1). |
| (N) | n is a non-negative integers. Matching of the n times. For example, "o (2)" can not match the "Bob" in the "o", but can match the "food" in the two o. |
| (N,) | n is a non-negative integers. Match at least n times. For example, "o (2,)" can not match the "Bob" in the "o", but it can match "foooood" all of the o. "O (1,)" is equivalent to "o +". "O (0,)" is equivalent to "o *". |
| } (N, m) | 均为非负整数,其中n <= m 。 m and n are non-negative integers, where n <= m. 次。 Match at least n times and match up to m times. For example, "o (1,3)" will match "fooooood" in the first three o. "O (0,1)" is equivalent to "o?". Please note that the comma and no space between the two numbers. |
| ? | ,},{ n , m })后面时,匹配模式是非贪婪的。 When the characters followed in any other qualifier (*,+,?,{ n), (n,), (n, m)) back when the non-greedy matching pattern. Non-greedy pattern matches as little as possible the search string, and the default greedy pattern matches as much as possible the search string. For example, the string "oooo", "o +?" Will match a single "o", and "o +" will match all the "o". |
| . | Match except "\ n" beyond any single character. ]”的模式。 To match including "\ n", including any characters, please use something like "[. \ N]" of the model. |
| (Pattern) | Match the pattern and get the match. Match can be obtained from the resulting Matches collection are, in VBScript using SubMatches collection in JScript is used in the $ 0 ... $ 9 properties. To match parentheses characters, use "\ (" or "\)." |
| (?: Pattern) | Match the pattern but do not get matching results, that this is a non-access match, not to store for later use. This use of "or" character (|) to combine the various parts of a model is useful. For example, "industr (?: Y | ies) is a ratio of" industry | industries' more simple expressions. |
| (? = Pattern) | Positive pre-investigation, in any matching string pattern matching to find the beginning of the string. This is a non-access match, that is, the match does not need access to for future use. For example, "Windows (? = 95 | 98 | NT | 2000)" can match "Windows2000" in the "Windows", but can not match "Windows3.1" in the "Windows". Pre-check does not consume characters, that is, in a match occurs, the last match in the next match started immediately after the search, rather than from the characters that contains pre-investigation began after. |
| (?! Pattern) | Negative pre-investigation, in any string does not match the pattern matches the beginning of search string. This is a non-access match, that is, the match does not need access to for future use. For example "Windows (?! 95 | 98 | NT | 2000)" can match "Windows3.1" in the "Windows", but can not match "Windows2000" in the "Windows". Pre-check do not consume characters, that is, in a match occurs, the last match in the next match started immediately after the search, not including pre-check of the characters from the beginning after |
| x | y | Match x or y. For example, "z | food" can match the "z" or "food". "(Z | f) ood" the match "zood" or "food". |
| [Xyz] | Character set. Matches any character included. For example, "[abc]" matches "plain" in the "a". |
| [^ Xyz] | Negative character set. Matches any character not included. For example, "[^ abc]" matches "plain" in the "p". |
| [Az] | Character range. Matches any character within the specified range. For example, "[az]" matches "a" to "z" within the scope of any lowercase alphabetic characters. |
| [^ Az] | Range of negative characters. Does not match any arbitrary character within the specified range. For example, "[^ az]" can not match any "a" to "z" within the scope of any character. |
| \ B | Match a word boundary, that is, that space between words and the location. For example, "er \ b" matches "never" in "er", but can not match the "verb" in the "er". |
| \ B | Match non-word boundary. "Er \ B" to match "verb" in the "er", but can not match "never" in "er". |
| \ Cx | Match x specified by the control characters. For example, \ cM matches a Control-M or carriage return. x value must be one of AZ or az. Otherwise, c as a literal "c" character. |
| \ D | Match a digit character. Is equivalent to [0-9]. |
| \ D | Match a non-numeric characters. Is equivalent to [^ 0-9]. |
| \ F | Match a feed character. Is equivalent to \ x0c and \ cL. |
| \ N | Match a newline. Is equivalent to \ x0a and \ cJ. |
| \ R | Matches a carriage return. Is equivalent to \ x0d and \ cM. |
| \ S | Matches any white space characters, including spaces, tabs, page breaks, etc. change. Is equivalent to [\ f \ n \ r \ t \ v]. |
| \ S | Match any non-blank character. Is equivalent to [^ \ f \ n \ r \ t \ v]. |
| \ T | Match a tab character. Is equivalent to \ x09 and \ cI. |
| \ V | Matches a vertical tab. Is equivalent to \ x0b and \ cK. |
| \ W | Match any word character including underscore. Is equivalent to "[A-Za-z0-9_]". |
| \ W | Matches any non word character. Is equivalent to "[^ A-Za-z0-9_]". |
| \ X n | 为十六进制转义值。 Match n, where n is a hexadecimal escape value. Hexadecimal escape values must be determined by two numbers long. For example, "\ x41" matches "A". "\ X041" is equivalent to "\ x04" & "1". Regular expressions can be used in ASCII encoding. . |
| \ Num | 是一个正整数。 Match num, where num is a positive integer. Get on the matching references. For example ,"(.) \ 1 "matches two consecutive identical characters. |
| \ N | Identifies an octal escape value or a backward reference. 个获取的子表达式,则n为向后引用。 If the \ n at least n months to obtain prior to the sub-expression, then n to refer back to. 为一个八进制转义值。 Otherwise, if n is an octal digit (0-7), then n is an octal escape value. |
| \ Nm | Identifies an octal escape value or a backward reference. 个获得子表达式,则nm为向后引用。 If \ nm nm were obtained at least before the sub-expression, then nm to refer back to. 个获取,则n为一个后跟文字m的向后引用。 If \ nm at least n months before the acquisition, followed by the text is n m for a backward reference. 均为八进制数字(0-7),则\ nm将匹配八进制转义值nm 。 If the preceding conditions are not met, if n and m are octal digits (0-7), then \ nm matches octal escape value nm. |
| \ Nml | 均为八进制数字(0-7),则匹配八进制转义值nm l。 If n is an octal digit (0-3), and m and l are octal digits (0-7), then match the octal escape value nm l. |
| \ U n | 是一个用四个十六进制数字表示的Unicode字符。 Match n, where n is a hexadecimal digits in four of Unicode characters. For example, \ u00A9 matches the copyright symbol (©). |
Popularity: 27%








