Rev 2 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 13 | ||
---|---|---|---|
1 | <div id="global_content"> |
1 | <div id="global_content"> |
2 | <div id="reg_in_regexp"> |
2 | <div id="reg_in_regexp"> |
3 | 3 | ||
4 | <table cellspacing="0" cellpadding="0" border="0" width="100%"> |
4 | <table cellspacing="0" cellpadding="0" border="0" width="100%"> |
5 | <tr> |
5 | <tr> |
6 | <td height="6%" valign="top" width="100%"> |
6 | <td height="6%" valign="top" width="100%"> |
7 | <span class="page_title"> |
7 | <span class="page_title"> |
8 | Regular expressions |
8 | Regular expressions |
9 | </span> |
9 | </span> |
10 | </td> |
10 | </td> |
11 | </tr> |
11 | </tr> |
12 | </table><br><a name="introduction"></a> |
12 | </table><br><a name="introduction"></a> |
13 | <table cellspacing="0" cellpadding="0" border="0" width="100%"> |
13 | <table cellspacing="0" cellpadding="0" border="0" width="100%"> |
14 | <tr> |
14 | <tr> |
15 | <td height="8%" valign="middle" width="100%"><span class="section_title">Introduction</span></td> |
15 | <td height="8%" valign="middle" width="100%"><span class="section_title">Introduction</span></td> |
16 | </tr> |
16 | </tr> |
17 | </table> |
17 | </table> |
18 | <table cellspacing="0" cellpadding="0" border="0" width="100%"> |
18 | <table cellspacing="0" cellpadding="0" border="0" width="100%"> |
19 | <tr> |
19 | <tr> |
20 | <td valign="top" width="100%"> |
20 | <td valign="top" width="100%"> |
21 | 21 | ||
22 | <p> |
22 | <p> |
23 | A regular expression is a character sequence that is an abbreviated |
23 | A regular expression is a character sequence that is an abbreviated |
24 | definition of a set of strings. A string is said to match a regular |
24 | definition of a set of strings. A string matches a regular |
25 | expression if it is a member of the set described by the regular expression. |
25 | expression if it is a member of the set described by the regular expression. |
26 | </p> |
26 | </p> |
27 | <p> |
27 | <p> |
28 | A regular expression is allowed to match anywhere within a string, |
28 | A regular expression is allowed to match anywhere within a string, |
29 | unless the regular expression is explicitly anchored to the beginning |
29 | unless the regular expression is explicitly anchored to the beginning (operator <code>^</code>) |
30 | or end of the string (by using operators <code>^</code> and/or <code>$</code>). |
30 | or end (operator <code>$</code>) of the string. |
31 | </p> |
31 | </p> |
32 | 32 | ||
33 | </td> |
33 | </td> |
34 | 34 | ||
35 | 35 | ||
36 | 36 | ||
37 | <td width="3%" valign="top"> </td> |
37 | <td width="3%" valign="top"> </td> |
38 | 38 | ||
39 | 39 | ||
40 | 40 | ||
41 | <td width="20%"> </td> |
41 | <td width="20%"> </td> |
42 | 42 | ||
43 | 43 | ||
44 | 44 | ||
45 | </tr> |
45 | </tr> |
46 | 46 | ||
47 | 47 | ||
48 | 48 | ||
49 | </table> |
49 | </table> |
50 | 50 | ||
51 | <a name="syntax"></a> |
51 | <a name="syntax"></a> |
52 | <table cellspacing="0" cellpadding="0" border="0" width="100%"> |
52 | <table cellspacing="0" cellpadding="0" border="0" width="100%"> |
53 | 53 | ||
54 | 54 | ||
55 | 55 | ||
56 | <tr> |
56 | <tr> |
57 | 57 | ||
58 | 58 | ||
59 | 59 | ||
60 | 60 | ||
61 | 61 | ||
62 | 62 | ||
63 | <td height="8%" valign="middle" width="100%"><span class="section_title">Syntax</span></td> |
63 | <td height="8%" valign="middle" width="100%"><span class="section_title">Syntax</span></td> |
64 | 64 | ||
65 | 65 | ||
66 | 66 | ||
67 | 67 | ||
68 | 68 | ||
69 | </tr> |
69 | </tr> |
70 | 70 | ||
71 | 71 | ||
72 | 72 | ||
73 | </table> |
73 | </table> |
74 | 74 | ||
75 | 75 | ||
76 | 76 | ||
77 | <table cellspacing="0" cellpadding="0" border="0" width="100%"> |
77 | <table cellspacing="0" cellpadding="0" border="0" width="100%"> |
78 | 78 | ||
79 | 79 | ||
80 | 80 | ||
81 | <tr> |
81 | <tr> |
82 | 82 | ||
83 | 83 | ||
84 | 84 | ||
85 | 85 | ||
86 | 86 | ||
87 | 87 | ||
88 | <td valign="top" width="100%"> |
88 | <td valign="top" width="100%"> |
89 | <p>The following character sequences are recognized:</p> |
89 | <p>The following character sequences are recognized:</p> |
90 | <ul> |
90 | <ul> |
91 | <li> |
91 | <li> |
92 | <code class="code">.</code> matches any single character except |
92 | <code class="code">.</code> matches any single character except |
93 | newline |
93 | newline |
94 | </li> |
94 | </li> |
95 | <li> |
95 | <li> |
96 | <code class="code">*</code> (postfix) matches the previous expression |
96 | <code class="code">*</code> (postfix) matches the previous expression |
97 | zero, one or several times |
97 | zero, one or several times |
98 | </li> |
98 | </li> |
99 | <li> |
99 | <li> |
100 | <code class="code">+</code> (postfix) matches the previous expression |
100 | <code class="code">+</code> (postfix) matches the previous expression |
101 | one or several times |
101 | one or several times |
102 | <ul> |
102 | <ul> |
103 | <li><code>[+]</code> matches a "+" character (escape mechanism)</li> |
103 | <li><code>[+]</code> matches a "+" character (escape mechanism)</li> |
104 | </ul> |
104 | </ul> |
105 | </li> |
105 | </li> |
106 | <li> |
106 | <li> |
107 | <code class="code">?</code> (postfix) matches the previous expression |
107 | <code class="code">?</code> (postfix) matches the previous expression |
108 | once or not at all |
108 | once or not at all |
109 | </li> |
109 | </li> |
110 | <li> |
110 | <li> |
111 | <code class="code">[ ]</code> is a character set |
111 | <code class="code">[ ]</code> is a character set |
112 | <ul> |
112 | <ul> |
113 | <li> |
113 | <li> |
114 | ranges are denoted with a hyphen "<code class="code">-</code>", |
114 | ranges are denoted with a hyphen "<code class="code">-</code>", |
115 | as in <code class="code">[a-z]</code> |
115 | as in <code class="code">[a-z]</code> |
116 | </li> |
116 | </li> |
117 | <li> |
117 | <li> |
118 | an initial caret "<code class="code">^</code>", as in <code class="code">[^0-9]</code>, |
118 | an initial caret "<code class="code">^</code>", as in <code class="code">[^0-9]</code>, |
119 | complements the set (i.e., any character, except a lowercase letter from a to z, is accepted) |
119 | complements the set (i.e., any character, except a lowercase letter from a to z, is accepted) |
120 | </li> |
120 | </li> |
121 | <li><code>[[]</code> matches a "[" character (escape mechanism)</li> |
121 | <li><code>[[]</code> matches a "[" character (escape mechanism)</li> |
122 | <li><code>[]]</code> matches a "]" character (escape mechanism)</li> |
122 | <li><code>[]]</code> matches a "]" character (escape mechanism)</li> |
123 | </ul> |
123 | </ul> |
124 | </li> |
124 | </li> |
125 | <li><code class="code">^</code> matches at beginning of line</li> |
125 | <li><code class="code">^</code> matches at beginning of line</li> |
126 | <li><code class="code">$</code> matches at end of line</li> |
126 | <li><code class="code">$</code> matches at end of line</li> |
127 | <li><code class="code">|</code> (infix) alternative between two expressions</li> |
127 | <li><code class="code">|</code> (infix) alternative between two expressions</li> |
128 | <li> |
128 | <li> |
129 | <code class="code">( )</code> grouping of the enclosed expression |
129 | <code class="code">( )</code> grouping of the enclosed expression |
130 | <ul> |
130 | <ul> |
131 | <li><code>[(]</code> matches a "(" character (escape mechanism)</li> |
131 | <li><code>[(]</code> matches a "(" character (escape mechanism)</li> |
132 | <li><code>[)]</code> matches a ")" character (escape mechanism)</li> |
132 | <li><code>[)]</code> matches a ")" character (escape mechanism)</li> |
133 | </ul> |
133 | </ul> |
134 | </li> |
134 | </li> |
135 | <li> |
135 | <li> |
136 | <code class="code">\</code> escapes special characters (<em>i.e.</em>, |
136 | <code class="code">\</code> escapes special characters (<em>i.e.</em>, |
137 | <code>^.[$|*?{'</code>): |
137 | <code>^.[$|*?{'</code>): |
138 | <ul> |
138 | <ul> |
139 | <li><code>\n</code> matches a newline character</li> |
139 | <li><code>\n</code> matches a newline character</li> |
140 | <li><code>\.</code> matches a dot "." character</li> |
140 | <li><code>\.</code> matches a dot "." character</li> |
141 | <li><code>\'</code> matches a quote "<code>'</code>" character</li> |
141 | <li><code>\'</code> matches a quote "<code>'</code>" character</li> |
142 | <li> |
142 | <li> |
143 | <code class="code">\</code> cannot be escaped; to search for |
143 | <code class="code">\</code> cannot be escaped; to search for |
144 | a backslash, use <code class="code">.</code> to match any single |
144 | a backslash, use <code class="code">.</code> to match any single |
145 | character |
145 | character |
146 | </li> |
146 | </li> |
147 | </ul> |
147 | </ul> |
148 | </li> |
148 | </li> |
149 | </ul> |
149 | </ul> |
150 | </td> |
150 | </td> |
151 | <td width="2%" valign="top"> </td> |
151 | <td width="2%" valign="top"> </td> |
152 | <td width="20%"> </td> |
152 | <td width="20%"> </td> |
153 | </tr> |
153 | </tr> |
154 | </table> |
154 | </table> |
155 | 155 | ||
156 | </div> |
156 | </div> |
157 | <div class="clear"></div> |
157 | <div class="clear"></div> |
158 | </div> |
158 | </div> |
159 | 159 |