<
div id="global_content">
<
table cellspacing="0" cellpadding="0" border="0" width="100%">
<
td height="6%" valign="top" width="100%">
<
span class="page_title">
Regular expressions
<
table cellspacing="0" cellpadding="0" border="0" width="100%">
<
td height="8%" valign="middle" width="100%"><
span class="section_title">Introduction<
/span><
/td>
<
table cellspacing="0" cellpadding="0" border="0" width="100%">
<
td valign="top" width="100%">
A regular expression is a character sequence that is an abbreviated
definition of a set of strings. A string is said to match a regular
expression if it is a member of the set described by the regular expression.
A regular expression is allowed to match anywhere within a string,
unless the regular expression is explicitly anchored to the beginning
or end of the string
(by using operators <
code>^<
/code> and
/or <
code>$<
/code>
).
<
td width="3%" valign="top"> <
/td>
<
table cellspacing="0" cellpadding="0" border="0" width="100%">
<
td height="8%" valign="middle" width="100%"><
span class="section_title">Syntax<
/span><
/td>
<
table cellspacing="0" cellpadding="0" border="0" width="100%">
<
td valign="top" width="100%">
<
p>The following character sequences are recognized:<
/p>
<
code class="code">.<
/code> matches any single character except
newline
<
code class="code">*<
/code>
(postfix
) matches the previous expression
zero, one or several times
<
code class="code">+<
/code>
(postfix
) matches the previous expression
one or several times
<
li><
code>
[+
]<
/code> matches a "+" character
(escape mechanism
)<
/li>
<
code class="code">?<
/code>
(postfix
) matches the previous expression
once or not at all
<
code class="code">
[
]<
/code> is a character set
ranges are denoted with a hyphen "<code class="code">-</code>",
an initial caret
"<code class="code">^</code>", as in <
code class="code">
[^
0-
9]<
/code>,
complements the set (i.e., any character, except a lowercase letter from a to z, is accepted)
<
li><
code>
[[]<
/code> matches a "
[" character
(escape mechanism
)<
/li>
<
li><
code>
[]]<
/code> matches a "
]" character
(escape mechanism
)<
/li>
<
li><
code class="code">^<
/code> matches at beginning of line<
/li>
<
li><
code class="code">|<
/code>
(infix
) alternative between two expressions<
/li>
<
code class="code">
(
)<
/code> grouping of the enclosed expression
<
li><
code>
[(]<
/code> matches a "
(" character
(escape mechanism
)<
/li>
<
li><
code>
[)]<
/code> matches a "
)" character
(escape mechanism
)<
/li>
<
code class="code">\<
/code> escapes special characters
(<
em>i.e.<
/em>,
<ul>
<li><code>\n</code> matches a newline character</li>
<li><code>\.</code> matches a dot "." character</li>
<li><code>\'<
/code> matches a quote "<
code>
'</code>" character</li>
<li>
<code class="code">\</code> cannot be escaped; to search for
a backslash, use <code class="code">.</code> to match any single
character
</li>
</ul>
</li>
</ul>
</td>
<td width="2%" valign="top"> </td>
<td width="20%"> </td>
</tr>
</table>
</div>
<div class="clear"></div>
</div>