regular_expression_reference
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
regular_expression_reference [2009/01/14 03:54] – stephen | regular_expression_reference [2017/01/01 20:05] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== .NET Regular Expression Reference ====== | ||
+ | |||
+ | ===== Favourite Regexs ===== | ||
+ | |||
+ | ==== Email Address ==== | ||
+ | |||
+ | < | ||
+ | ^([\w-\.]+)@((\[[0-9]{1, | ||
+ | </ | ||
+ | |||
+ | ==== Log4Net Match Thread Id ==== | ||
+ | |||
+ | < | ||
+ | ^\d{4}-\d{2}-\d{2} \d{2}: | ||
+ | </ | ||
+ | |||
+ | |||
===== Characters that Match Location in Strings ===== | ===== Characters that Match Location in Strings ===== | ||
Line 36: | Line 53: | ||
| {n} | The n is a non-negative integer. Matches exactly n times. For example, “o{2}” does not match the “o” in “Bob” but does match the two “o”s in “food”. | | | {n} | The n is a non-negative integer. Matches exactly n times. For example, “o{2}” does not match the “o” in “Bob” but does match the two “o”s in “food”. | | ||
| {n,} | The n is a non-negative integer. Matches at least n times. For example, “o{2,}” does not match the “o” in “Bob” and does match all the “o”s in “foooood”. The sequence “o{1,}” is equivalent to “o+”. The sequence “o{0,}” is equivalent to “o*”. | | | {n,} | The n is a non-negative integer. Matches at least n times. For example, “o{2,}” does not match the “o” in “Bob” and does match all the “o”s in “foooood”. The sequence “o{1,}” is equivalent to “o+”. The sequence “o{0,}” is equivalent to “o*”. | | ||
- | | {n,m} | The m and n are non-negative integers, where “n <= m”. Matches at least n and at most m times. For example, “o{1, | + | | {n,m} | The m and n are non-negative integers, where “n ≤ m”. Matches at least n and at most m times. For example, “o{1, |
| ? | When this character immediately follows any of the other quantifiers (*, +, ?, {n}, {n,}, {n,m}), the matching pattern is non-greedy. A non-greedy pattern matches as little of the searched string as possible, whereas the default greedy pattern matches as much of the searched string as possible. For example, in the string “oooo”, “o+?” matches a single “o”, whereas “o+” matches all “o”s. | | | ? | When this character immediately follows any of the other quantifiers (*, +, ?, {n}, {n,}, {n,m}), the matching pattern is non-greedy. A non-greedy pattern matches as little of the searched string as possible, whereas the default greedy pattern matches as much of the searched string as possible. For example, in the string “oooo”, “o+?” matches a single “o”, whereas “o+” matches all “o”s. | | ||
| . | Matches any single character except “\n”. To match any character including the “\n”, use a pattern such as “[\s\S]”. | | | . | Matches any single character except “\n”. To match any character including the “\n”, use a pattern such as “[\s\S]”. | | ||
Line 52: | Line 69: | ||
| \W | Matches any non-word character. Equivalent to “'' | | \W | Matches any non-word character. Equivalent to “'' | ||
- | {{tag> | + | {{tag> |
regular_expression_reference.1231905266.txt.gz · Last modified: 2017/01/01 19:51 (external edit)