-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregexp2_tut.html
More file actions
101 lines (96 loc) · 7.35 KB
/
regexp2_tut.html
File metadata and controls
101 lines (96 loc) · 7.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!-- saved from url=(0238)http://regexlib.com/(X(1)A(i1plmkU_bCxCFDANqHY1ROurUsmgLrAGy02WcyJoL8pht-E-3qZirXyldUmCosV0uLPv5sPm2JfjlFtikgWfyk2sotMGWTC46QMIFslI9IfS25eAzXPrvNEUZkPxEFMLdzRrSDFqoT7rFOkmr3jB5T98k8ouAEOOnQQxVbQB7G9GXbjTHL8HKp7EZEd3pyyZ0))/CheatSheet.aspx -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>
RegExLib.com Regular Expression Cheat Sheet (.NET Framework)
</title><link href="./regexp2_tut_files/default.css" type="text/css" rel="stylesheet"><link href="./regexp2_tut_files/Form.css" type="text/css" rel="stylesheet"><link href="./regexp2_tut_files/Tester.css" type="text/css" rel="stylesheet"></head>
<body class="whiteBg">
<table class="pageTop outerTable">
<tbody><tr>
<td class="imageCell">
<a href="http://regexlib.com/"><img src="./regexp2_tut_files/RegExLib_logo.png" alt="RegExLib - Regular Expression Library"></a></td>
<td style="vertical-align: middle;"><h1>RegExLib.com Regular Expression Cheat Sheet (.NET)</h1></td>
</tr>
</tbody></table>
<table class="outerTable">
<tbody><tr>
<td>
<table border="1" class="innerTable">
<tbody><tr class="heading"><th scope="colgroup" colspan="2"><h2>Metacharacters Defined</h2></th></tr>
<tr><th scope="col">MChar</th><th scope="col">Definition</th></tr>
<tr><td>^</td><td>Start of a string.</td></tr>
<tr><td>$</td><td>End of a string.</td></tr>
<tr><td>.</td><td>Any character (except \n newline)</td></tr>
<tr><td>|</td><td>Alternation.</td></tr>
<tr><td>{...}</td><td>Explicit quantifier notation.</td></tr>
<tr><td>[...]</td><td>Explicit set of characters to match.</td></tr>
<tr><td>(...)</td><td>Logical grouping of part of an expression.</td></tr>
<tr><td>*</td><td>0 or more of previous expression.</td></tr>
<tr><td>+</td><td>1 or more of previous expression.</td></tr>
<tr><td>?</td><td>0 or 1 of previous expression; also forces minimal matching when an expression might match several strings within a search string.</td></tr>
<tr><td>\</td><td>Preceding one of the above, it makes it a literal instead of a special character. Preceding a special matching character, see below.</td></tr>
</tbody></table>
</td>
<td width="26%">
<table border="1" class="innerTable" id="Table1">
<tbody><tr class="heading">
<th scope="colgroup" colspan="2"><h2>Metacharacter Examples</h2></th></tr>
<tr><th scope="col">Pattern</th><th scope="col">Sample Matches</th></tr>
<tr><td>^abc</td><td>abc, abcdefg, abc123, ...</td></tr>
<tr><td>abc$</td><td>abc, endsinabc, 123abc, ...</td></tr>
<tr><td>a.c</td><td>abc, aac, acc, adc, aec, ...</td></tr>
<tr><td>bill|ted</td><td>ted, bill</td></tr>
<tr><td>ab{2}c</td><td>abbc</td></tr>
<tr><td>a[bB]c</td><td>abc, aBc</td></tr>
<tr><td>(abc){2}</td><td>abcabc</td></tr>
<tr><td>ab*c</td><td>ac, abc, abbc, abbbc, ...</td></tr>
<tr><td>ab+c</td><td>abc, abbc, abbbc, ...</td></tr>
<tr><td>ab?c</td><td>ac, abc</td></tr>
<tr><td>a\sc</td><td>a c</td></tr>
</tbody></table>
</td>
</tr>
</tbody></table>
<table border="1" class="innerTable">
<tbody><tr class="heading">
<th scope="colgroup" colspan="2"><h2>Character Escapes <a href="http://tinyurl.com/5wm3wl">http://tinyurl.com/5wm3wl</a></h2></th></tr>
<tr><th scope="col">Escaped Char</th><th scope="col">Description</th></tr>
<tr><td>ordinary characters</td><td>Characters other than . $ ^ { [ ( | ) ] } * + ? \ match themselves.</td></tr>
<tr><td>\a</td><td>Matches a bell (alarm) \u0007.</td></tr>
<tr><td>\b</td><td>Matches a backspace \u0008 if in a []; otherwise matches a word boundary (between \w and \W characters).</td></tr>
<tr><td>\t</td><td>Matches a tab \u0009.</td></tr>
<tr><td>\r</td><td>Matches a carriage return \u000D.</td></tr>
<tr><td>\v</td><td>Matches a vertical tab \u000B.</td></tr>
<tr><td>\f</td><td>Matches a form feed \u000C.</td></tr>
<tr><td>\n</td><td>Matches a new line \u000A.</td></tr>
<tr><td>\e</td><td>Matches an escape \u001B.</td></tr>
<tr><td>\040</td><td>Matches an ASCII character as octal (up to three digits); numbers with no leading zero are backreferences if they have only one digit or if they correspond to a capturing group number. (For more information, see Backreferences.) For example, the character \040 represents a space.</td></tr>
<tr>
<td>\x20</td><td>Matches an ASCII character using hexadecimal representation (exactly two digits).</td></tr>
<tr><td>\cC</td><td>Matches an ASCII control character; for example \cC is control-C.</td></tr>
<tr><td>\u0020</td><td>Matches a Unicode character using a hexadecimal representation (exactly four digits).</td></tr>
<tr><td>\*</td><td>When followed by a character that is not recognized as an escaped character, matches that character. For example, <b>\*</b> is the same as <b>\x2A</b>.</td></tr>
</tbody></table>
<table border="1" class="innerTable">
<tbody><tr class="heading">
<th scope="colgroup" colspan="2"><h2>Character Classes <a href="http://tinyurl.com/5ck4ll">http://tinyurl.com/5ck4ll</a></h2></th></tr>
<tr><th scope="col">Char Class</th><th scope="col">Description</th></tr>
<tr><td>.</td><td>Matches any character except \n. If modified by the Singleline option, a period character matches any character. For more information, see Regular Expression Options.</td></tr>
<tr><td>[aeiou]</td><td>Matches any single character included in the specified set of characters.</td></tr>
<tr><td>[^aeiou]</td><td>Matches any single character not in the specified set of characters.</td></tr>
<tr><td>[0-9a-fA-F]</td><td>Use of a hyphen (–) allows specification of contiguous character ranges.</td></tr>
<tr><td>\p{name}</td><td>Matches any character in the named character class specified by {name}. Supported names are Unicode groups and block ranges. For example, Ll, Nd, Z, IsGreek, IsBoxDrawing.</td></tr>
<tr><td>\P{name}</td><td>Matches text not included in groups and block ranges specified in {name}.</td></tr>
<tr><td>\w</td><td>Matches any word character. Equivalent to the Unicode character categories
[\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Pc}]. If ECMAScript-compliant behavior is specified with the ECMAScript option, \w is equivalent to [a-zA-Z_0-9].</td></tr>
<tr><td>\W</td><td>Matches any nonword character. Equivalent to the Unicode categories [^\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Pc}]. If ECMAScript-compliant behavior is specified with the ECMAScript option, \W is equivalent to [^a-zA-Z_0-9].</td></tr>
<tr><td>\s</td><td>Matches any white-space character. Equivalent to the Unicode character categories [\f\n\r\t\v\x85\p{Z}]. If ECMAScript-compliant behavior is specified with the ECMAScript option, \s is equivalent to [ \f\n\r\t\v].</td></tr>
<tr><td>\S</td><td>Matches any non-white-space character. Equivalent to the Unicode character categories [^\f\n\r\t\v\x85\p{Z}]. If ECMAScript-compliant behavior is specified with the ECMAScript option, \S is equivalent to [^ \f\n\r\t\v].</td></tr>
<tr><td>\d</td><td>Matches any decimal digit. Equivalent to \p{Nd} for Unicode and [0-9] for non-Unicode, ECMAScript behavior.</td></tr>
<tr><td>\D</td><td>Matches any nondigit. Equivalent to \P{Nd} for Unicode and [^0-9] for non-Unicode, ECMAScript behavior.</td></tr>
</tbody></table>
<script src="./regexp2_tut_files/urchin.js.descarga" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-470225-2";
urchinTracker();
</script>
</body></html>