character | description |
---|---|
\ |
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. Serial " \\ ," matching " \ " and " \( " the match ( " ." |
^ |
Matches the beginning of the string. If the object is set RegExp Multiline property, ^ also matches " \n " or " \r position" after. |
$ |
Matches the input end of the string. If the RegExp object's Multiline property is set, $ also matches " \n " or " \r position before." |
* |
Matches the preceding subexpression zero or more times. For example, zo matches " z " and zoo " ." It is equivalent to {0}. |
+ |
Matches the preceding subexpression one or more times. For example, " zo+ " can match " zo " and zoo " ", but can not match z " ." + Is equivalent to {1}. |
? |
Matches the preceding subexpression zero or one. For example, " do(es)? " matches " does " or " does " in do " ." ? Is equivalent to {0,1}. |
{*n*} |
n is a nonnegative integer. Matching the determined n times. For example, " o{2} " does not match the " Bob " in o " ", but can match the " food " in the two o. |
{*n*,} |
n is a nonnegative integer. Matching at least n times. For example, " o{2,} " does not match the " Bob " in o " ", but it can match " foooood all o" in. " o{1,} " Is equivalent to o+ " ." " o{0,} " Is equivalent to o* " ." |
{*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 no spaces between the comma and the two numbers. |
? |
When the character immediately to any other qualifiers ( , +,?, { N- }, { n- ,}, { n- , m *}) when the rear, non-greedy matching pattern. Non-greedy pattern matches as little as possible the search string, and the default greedy pattern matches as much of the string search. For example, the string oooo " ", " o+? " will match a single o " " and " o+ " matches all the o " ." |
. |
In addition to matching " \ n any single character other than" in. To match including " \ n " any characters, including use as " (.|\n) " model. |
(pattern) |
Match the pattern and get the match. The matching can be obtained from the Matches have been used in collection SubMatches VBScript, JScript is used in the $ 0 ... $ 9 properties. To match parentheses characters, use " \( " or \) " ." |
(?:pattern) |
But not to acquire matching pattern matching results, that this is a non-access match, not stored for later use. This "use or character (|) " to a combination of the various parts of the model is useful. For example, " industr(?:y|ies) " it is more than a ' industry|industries ' more brief expressions. |
(?=pattern) |
Forward definitely pre-investigation, matching the search string at the beginning of the string any pattern matching. This is a non-access match, that is, the match does not need to obtain for later use. For example, " Windows(?=95|98|NT|2000) " matches " Windows2000 " in Windows " ", but not " Windows3.1 " the Windows " ." Pre-check does not consume characters, that is, after a match occurs, the last match after the next match to start the search immediately, rather than starting from the characters that contains pre-investigation. |
(?!pattern) |
Forward negative pre-investigation, matching the search string at the beginning of any match pattern string. This is a non-access match, that is, the match does not need to obtain for later use. For example " Windows(?!95|98|NT|2000) " matches " Windows3.1 " in Windows " ", but not " Windows2000 " the Windows " ." Pre-check does not consume characters, that is, after a match occurs, after the last match started immediately next match search, rather than starting from the characters that contains pre-investigation |
(?<=pattern) |
Reverse certainly pre-investigation, and certainly pre-investigation Quasi forward, but in the opposite direction. For example, " (?<=95|98|NT|2000)Windows " matches " 2000Windows " in Windows " ", but not " 3.1Windows " the Windows " ." |
(?<!pattern) |
Reverse negative pre-check, with a negative pre-investigation Quasi forward, but in the opposite direction. For example, " (?”能匹配“ 3.1Windows ”中的“ Windows ”,但不能匹配“ 2000Windows ”中的“ Windows ”。 | | the X- |
Regular expression syntax table
Guess you like
Origin www.cnblogs.com/wbyixx/p/12234150.html
Recommended
Ranking