259 lines
14 KiB
HTML
259 lines
14 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE html
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html lang="en-us" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="security" content="public" />
|
|
<meta name="Robots" content="index,follow" />
|
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
|
<meta name="DC.Type" content="topic" />
|
|
<meta name="DC.Title" content="Regular expression notation for HTTP Server" />
|
|
<meta name="abstract" content="This topic provides a general overview of regular expression notation." />
|
|
<meta name="description" content="This topic provides a general overview of regular expression notation." />
|
|
<meta name="DC.Relation" scheme="URI" content="rzaieprogramming.htm" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2002,2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2002,2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="rzaieregexpnot" />
|
|
<meta name="DC.Language" content="en-us" />
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
|
<title>Regular expression notation for HTTP Server</title>
|
|
</head>
|
|
<body id="rzaieregexpnot"><a name="rzaieregexpnot"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Regular expression notation for HTTP Server</h1>
|
|
<div><p>This topic provides a general overview of regular expression notation.</p>
|
|
<div class="important"><span class="importanttitle">Important:</span> Information
|
|
for this topic supports the latest PTF levels for HTTP Server for i5/OS .
|
|
It is recommended that you install the latest PTFs to upgrade to the latest
|
|
level of the HTTP Server for i5/OS. Some of the topics documented here are
|
|
not available prior to this update. See <a href="http://www-03.ibm.com/servers/eserver/iseries/software/http/services/service.html" target="_blank">http://www.ibm.com/servers/eserver/iseries/software/http/services/service.htm</a> <img src="www.gif" alt="Link outside Information Center" /> for more information. </div>
|
|
<p>A regular expression notation specifies a pattern of character strings.
|
|
One or more regular expressions can be used to create a matching pattern.
|
|
Certain characters (sometimes called wildcards) have special meanings. The
|
|
table below describes the pattern matching scheme. </p>
|
|
<p><strong>Regular expression pattern matching </strong> </p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><thead align="left"><tr><th valign="top" width="21.21212121212121%" id="d0e34">Pattern</th>
|
|
<th valign="top" width="78.78787878787878%" id="d0e36">Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>string </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p> string with no special characters matches the values
|
|
that contain the string. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>[set] </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Match a single character specified by the set of
|
|
single characters within the square brackets. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>[a-z] </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Match a character in the range specified within the
|
|
square brackets. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>[^abc] </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Match any single character not specified in the set
|
|
of single characters within the square brackets. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>{n} </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Match exactly n times. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>{n,} </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Match at least n times. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>{n,m} </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Match at least n times, but no more than m times. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>^ </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Match the start of the string. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>$</tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Match the end of the string. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>. </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Match any character (except Newline). </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>* </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Match zero or more of preceding character. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>+ </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Match one or more of preceding character. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>? </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Match one or zero of preceding character. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>string1|string2</tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Match string1 or string2. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\ </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Signifies an escape character. When preceding any
|
|
of the characters that have special meaning, the escape character removes
|
|
any special meaning from the character. For example, the backslash is useful
|
|
to remove special meaning from a period in an IP address. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>(group) </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Group a character in a regular expression. If a match
|
|
is found the first group can be accessed using $1. The second group can be
|
|
accessed using $2 and so on. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\w </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Match an alphanumeric character. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\s </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Match a white-space character. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\t </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Tab character. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\n</tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Newline character. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\r </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Return character. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\f </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Form feed character. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\v </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Vertical tab character.</p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\a </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Bell character. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\e </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Escape character. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\Onn </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Octal character, for example \O76. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\xnn </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Hex character, for example \xff. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\cn </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Control character, for example \c[. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\l </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Lowercase next character. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\L </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Lowercase until \E. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\u </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Uppercase next character. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\U </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Uppercase until \E.</p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\E </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>End modification. </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.21212121212121%" headers="d0e34 "><tt>\Q </tt></td>
|
|
<td valign="top" width="78.78787878787878%" headers="d0e36 "><p>Quote until \E. </p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<p><strong>Examples of regular expression pattern matching </strong></p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><thead align="left"><tr><th valign="top" width="21.31979695431472%" id="d0e286">Pattern</th>
|
|
<th valign="top" width="78.68020304568529%" id="d0e288">Examples of strings that match</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr><td valign="top" width="21.31979695431472%" headers="d0e286 "><tt>ibm </tt></td>
|
|
<td valign="top" width="78.68020304568529%" headers="d0e288 "><tt>ibm01, myibm, aibmbc</tt></td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.31979695431472%" headers="d0e286 "><tt>^ibm$ </tt></td>
|
|
<td valign="top" width="78.68020304568529%" headers="d0e288 "><tt>ibm </tt></td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.31979695431472%" headers="d0e286 "><tt>^ibm0[0-4][0-9]$ </tt></td>
|
|
<td valign="top" width="78.68020304568529%" headers="d0e288 "><tt>ibm000 through ibm049 </tt></td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.31979695431472%" headers="d0e286 "><tt>ibm[3-8] </tt></td>
|
|
<td valign="top" width="78.68020304568529%" headers="d0e288 "><tt>ibm3, myibm4, aibm5b </tt></td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.31979695431472%" headers="d0e286 "><tt>^ibm </tt></td>
|
|
<td valign="top" width="78.68020304568529%" headers="d0e288 "><tt>ibm01, ibm </tt></td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.31979695431472%" headers="d0e286 "><tt>ibm$ </tt></td>
|
|
<td valign="top" width="78.68020304568529%" headers="d0e288 "><tt>myibm, ibm, 3ibm </tt></td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.31979695431472%" headers="d0e286 "><tt>ibm... </tt></td>
|
|
<td valign="top" width="78.68020304568529%" headers="d0e288 "><tt>ibm123, myibmabc, aibm09bcd </tt></td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.31979695431472%" headers="d0e286 "><tt>ibm*1</tt></td>
|
|
<td valign="top" width="78.68020304568529%" headers="d0e288 "><tt>ibm1, myibm1, aibm1abc, ibmkkkkk12 </tt></td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.31979695431472%" headers="d0e286 "><tt>^ibm0.. </tt></td>
|
|
<td valign="top" width="78.68020304568529%" headers="d0e288 "><tt>ibm001, ibm099, ibm0abcd </tt></td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.31979695431472%" headers="d0e286 "><tt>^ibm0..$ </tt></td>
|
|
<td valign="top" width="78.68020304568529%" headers="d0e288 "><tt>ibm001, ibm099 </tt></td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.31979695431472%" headers="d0e286 "><tt>10.2.1.9 </tt></td>
|
|
<td valign="top" width="78.68020304568529%" headers="d0e288 "><tt>10.2.1.9, 10.2.139.6, 10.231.98.6 </tt></td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.31979695431472%" headers="d0e286 "><tt>^10\.2\.1\.9$ </tt></td>
|
|
<td valign="top" width="78.68020304568529%" headers="d0e288 "><tt>10.2.1.9 </tt></td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.31979695431472%" headers="d0e286 "><tt>^10\.2\.1\.1[0-5]$</tt></td>
|
|
<td valign="top" width="78.68020304568529%" headers="d0e288 "><tt>10.2.1.10, 10.2.1.11, 10.2.1.12, 10.2.1.13, 10.2.1.14,
|
|
10.2.1.15</tt></td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.31979695431472%" headers="d0e286 "><tt>^192.\.168\..*\..*$</tt></td>
|
|
<td valign="top" width="78.68020304568529%" headers="d0e288 "><p>(All addresses on class B subnet 192.168.0.0) </p>
|
|
</td>
|
|
</tr>
|
|
<tr><td valign="top" width="21.31979695431472%" headers="d0e286 "><tt>^192.\.168\.10\..*$</tt></td>
|
|
<td valign="top" width="78.68020304568529%" headers="d0e288 "><p>(All addresses on class C subnet 192.168.10.0) </p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaieprogramming.htm" title="This topic provides information on CGI, directives, APIs, and other programming topics.">Programming</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |