| 59 |
</P> |
</P> |
| 60 |
<P> |
<P> |
| 61 |
I have implemented only those option bits that can be reasonably mapped to PCRE |
I have implemented only those option bits that can be reasonably mapped to PCRE |
| 62 |
native options. In addition, the options REG_EXTENDED and REG_NOSUB are defined |
native options. In addition, the option REG_EXTENDED is defined with the value |
| 63 |
with the value zero. They have no effect, but since programs that are written |
zero. This has no effect, but since programs that are written to the POSIX |
| 64 |
to the POSIX interface often use them, this makes it easier to slot in PCRE as |
interface often use it, this makes it easier to slot in PCRE as a replacement |
| 65 |
a replacement library. Other POSIX options are not even defined. |
library. Other POSIX options are not even defined. |
| 66 |
</P> |
</P> |
| 67 |
<P> |
<P> |
| 68 |
When PCRE is called via these functions, it is only the API that is POSIX-like |
When PCRE is called via these functions, it is only the API that is POSIX-like |
| 89 |
internal form. The pattern is a C string terminated by a binary zero, and |
internal form. The pattern is a C string terminated by a binary zero, and |
| 90 |
is passed in the argument <i>pattern</i>. The <i>preg</i> argument is a pointer |
is passed in the argument <i>pattern</i>. The <i>preg</i> argument is a pointer |
| 91 |
to a <b>regex_t</b> structure that is used as a base for storing information |
to a <b>regex_t</b> structure that is used as a base for storing information |
| 92 |
about the compiled expression. |
about the compiled regular expression. |
| 93 |
</P> |
</P> |
| 94 |
<P> |
<P> |
| 95 |
The argument <i>cflags</i> is either zero, or contains one or more of the bits |
The argument <i>cflags</i> is either zero, or contains one or more of the bits |
| 97 |
<pre> |
<pre> |
| 98 |
REG_DOTALL |
REG_DOTALL |
| 99 |
</pre> |
</pre> |
| 100 |
The PCRE_DOTALL option is set when the expression is passed for compilation to |
The PCRE_DOTALL option is set when the regular expression is passed for |
| 101 |
the native function. Note that REG_DOTALL is not part of the POSIX standard. |
compilation to the native function. Note that REG_DOTALL is not part of the |
| 102 |
|
POSIX standard. |
| 103 |
<pre> |
<pre> |
| 104 |
REG_ICASE |
REG_ICASE |
| 105 |
</pre> |
</pre> |
| 106 |
The PCRE_CASELESS option is set when the expression is passed for compilation |
The PCRE_CASELESS option is set when the regular expression is passed for |
| 107 |
to the native function. |
compilation to the native function. |
| 108 |
<pre> |
<pre> |
| 109 |
REG_NEWLINE |
REG_NEWLINE |
| 110 |
</pre> |
</pre> |
| 111 |
The PCRE_MULTILINE option is set when the expression is passed for compilation |
The PCRE_MULTILINE option is set when the regular expression is passed for |
| 112 |
to the native function. Note that this does <i>not</i> mimic the defined POSIX |
compilation to the native function. Note that this does <i>not</i> mimic the |
| 113 |
behaviour for REG_NEWLINE (see the following section). |
defined POSIX behaviour for REG_NEWLINE (see the following section). |
| 114 |
|
<pre> |
| 115 |
|
REG_NOSUB |
| 116 |
|
</pre> |
| 117 |
|
The PCRE_NO_AUTO_CAPTURE option is set when the regular expression is passed |
| 118 |
|
for compilation to the native function. In addition, when a pattern that is |
| 119 |
|
compiled with this flag is passed to <b>regexec()</b> for matching, the |
| 120 |
|
<i>nmatch</i> and <i>pmatch</i> arguments are ignored, and no captured strings |
| 121 |
|
are returned. |
| 122 |
|
<pre> |
| 123 |
|
REG_UTF8 |
| 124 |
|
</pre> |
| 125 |
|
The PCRE_UTF8 option is set when the regular expression is passed for |
| 126 |
|
compilation to the native function. This causes the pattern itself and all data |
| 127 |
|
strings used for matching it to be treated as UTF-8 strings. Note that REG_UTF8 |
| 128 |
|
is not part of the POSIX standard. |
| 129 |
</P> |
</P> |
| 130 |
<P> |
<P> |
| 131 |
In the absence of these flags, no options are passed to the native function. |
In the absence of these flags, no options are passed to the native function. |
| 193 |
function. |
function. |
| 194 |
</P> |
</P> |
| 195 |
<P> |
<P> |
| 196 |
The portion of the string that was matched, and also any captured substrings, |
If the pattern was compiled with the REG_NOSUB flag, no data about any matched |
| 197 |
are returned via the <i>pmatch</i> argument, which points to an array of |
strings is returned. The <i>nmatch</i> and <i>pmatch</i> arguments of |
| 198 |
<i>nmatch</i> structures of type <i>regmatch_t</i>, containing the members |
<b>regexec()</b> are ignored. |
| 199 |
<i>rm_so</i> and <i>rm_eo</i>. These contain the offset to the first character of |
</P> |
| 200 |
each substring and the offset to the first character after the end of each |
<P> |
| 201 |
substring, respectively. The 0th element of the vector relates to the entire |
Otherwise,the portion of the string that was matched, and also any captured |
| 202 |
portion of <i>string</i> that was matched; subsequent elements relate to the |
substrings, are returned via the <i>pmatch</i> argument, which points to an |
| 203 |
capturing subpatterns of the regular expression. Unused entries in the array |
array of <i>nmatch</i> structures of type <i>regmatch_t</i>, containing the |
| 204 |
have both structure members set to -1. |
members <i>rm_so</i> and <i>rm_eo</i>. These contain the offset to the first |
| 205 |
|
character of each substring and the offset to the first character after the end |
| 206 |
|
of each substring, respectively. The 0th element of the vector relates to the |
| 207 |
|
entire portion of <i>string</i> that was matched; subsequent elements relate to |
| 208 |
|
the capturing subpatterns of the regular expression. Unused entries in the |
| 209 |
|
array have both structure members set to -1. |
| 210 |
</P> |
</P> |
| 211 |
<P> |
<P> |
| 212 |
A successful match yields a zero return; various error codes are defined in the |
A successful match yields a zero return; various error codes are defined in the |
| 236 |
Cambridge CB2 3QG, England. |
Cambridge CB2 3QG, England. |
| 237 |
</P> |
</P> |
| 238 |
<P> |
<P> |
| 239 |
Last updated: 28 February 2005 |
Last updated: 16 January 2006 |
| 240 |
<br> |
<br> |
| 241 |
Copyright © 1997-2005 University of Cambridge. |
Copyright © 1997-2006 University of Cambridge. |
| 242 |
<p> |
<p> |
| 243 |
Return to the <a href="index.html">PCRE index page</a>. |
Return to the <a href="index.html">PCRE index page</a>. |
| 244 |
</p> |
</p> |