| 44 |
call the native ones, it is also necessary to add \fB-lpcre\fP. |
call the native ones, it is also necessary to add \fB-lpcre\fP. |
| 45 |
.P |
.P |
| 46 |
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 |
| 47 |
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 |
| 48 |
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 |
| 49 |
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 |
| 50 |
a replacement library. Other POSIX options are not even defined. |
library. Other POSIX options are not even defined. |
| 51 |
.P |
.P |
| 52 |
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 |
| 53 |
in style. The syntax and semantics of the regular expressions themselves are |
in style. The syntax and semantics of the regular expressions themselves are |
| 71 |
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 |
| 72 |
is passed in the argument \fIpattern\fP. The \fIpreg\fP argument is a pointer |
is passed in the argument \fIpattern\fP. The \fIpreg\fP argument is a pointer |
| 73 |
to a \fBregex_t\fP structure that is used as a base for storing information |
to a \fBregex_t\fP structure that is used as a base for storing information |
| 74 |
about the compiled expression. |
about the compiled regular expression. |
| 75 |
.P |
.P |
| 76 |
The argument \fIcflags\fP is either zero, or contains one or more of the bits |
The argument \fIcflags\fP is either zero, or contains one or more of the bits |
| 77 |
defined by the following macros: |
defined by the following macros: |
| 78 |
.sp |
.sp |
| 79 |
REG_DOTALL |
REG_DOTALL |
| 80 |
.sp |
.sp |
| 81 |
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 |
| 82 |
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 |
| 83 |
|
POSIX standard. |
| 84 |
.sp |
.sp |
| 85 |
REG_ICASE |
REG_ICASE |
| 86 |
.sp |
.sp |
| 87 |
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 |
| 88 |
to the native function. |
compilation to the native function. |
| 89 |
.sp |
.sp |
| 90 |
REG_NEWLINE |
REG_NEWLINE |
| 91 |
.sp |
.sp |
| 92 |
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 |
| 93 |
to the native function. Note that this does \fInot\fP mimic the defined POSIX |
compilation to the native function. Note that this does \fInot\fP mimic the |
| 94 |
behaviour for REG_NEWLINE (see the following section). |
defined POSIX behaviour for REG_NEWLINE (see the following section). |
| 95 |
|
.sp |
| 96 |
|
REG_NOSUB |
| 97 |
|
.sp |
| 98 |
|
The PCRE_NO_AUTO_CAPTURE option is set when the regular expression is passed |
| 99 |
|
for compilation to the native function. In addition, when a pattern that is |
| 100 |
|
compiled with this flag is passed to \fBregexec()\fP for matching, the |
| 101 |
|
\fInmatch\fP and \fIpmatch\fP arguments are ignored, and no captured strings |
| 102 |
|
are returned. |
| 103 |
|
.sp |
| 104 |
|
REG_UTF8 |
| 105 |
|
.sp |
| 106 |
|
The PCRE_UTF8 option is set when the regular expression is passed for |
| 107 |
|
compilation to the native function. This causes the pattern itself and all data |
| 108 |
|
strings used for matching it to be treated as UTF-8 strings. Note that REG_UTF8 |
| 109 |
|
is not part of the POSIX standard. |
| 110 |
.P |
.P |
| 111 |
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. |
| 112 |
This means the the regex is compiled with PCRE default semantics. In |
This means the the regex is compiled with PCRE default semantics. In |
| 174 |
The PCRE_NOTEOL option is set when calling the underlying PCRE matching |
The PCRE_NOTEOL option is set when calling the underlying PCRE matching |
| 175 |
function. |
function. |
| 176 |
.P |
.P |
| 177 |
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 |
| 178 |
are returned via the \fIpmatch\fP argument, which points to an array of |
strings is returned. The \fInmatch\fP and \fIpmatch\fP arguments of |
| 179 |
\fInmatch\fP structures of type \fIregmatch_t\fP, containing the members |
\fBregexec()\fP are ignored. |
| 180 |
\fIrm_so\fP and \fIrm_eo\fP. These contain the offset to the first character of |
.P |
| 181 |
each substring and the offset to the first character after the end of each |
Otherwise,the portion of the string that was matched, and also any captured |
| 182 |
substring, respectively. The 0th element of the vector relates to the entire |
substrings, are returned via the \fIpmatch\fP argument, which points to an |
| 183 |
portion of \fIstring\fP that was matched; subsequent elements relate to the |
array of \fInmatch\fP structures of type \fIregmatch_t\fP, containing the |
| 184 |
capturing subpatterns of the regular expression. Unused entries in the array |
members \fIrm_so\fP and \fIrm_eo\fP. These contain the offset to the first |
| 185 |
have both structure members set to -1. |
character of each substring and the offset to the first character after the end |
| 186 |
|
of each substring, respectively. The 0th element of the vector relates to the |
| 187 |
|
entire portion of \fIstring\fP that was matched; subsequent elements relate to |
| 188 |
|
the capturing subpatterns of the regular expression. Unused entries in the |
| 189 |
|
array have both structure members set to -1. |
| 190 |
.P |
.P |
| 191 |
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 |
| 192 |
header file, of which REG_NOMATCH is the "expected" failure code. |
header file, of which REG_NOMATCH is the "expected" failure code. |
| 221 |
Cambridge CB2 3QG, England. |
Cambridge CB2 3QG, England. |
| 222 |
.P |
.P |
| 223 |
.in 0 |
.in 0 |
| 224 |
Last updated: 28 February 2005 |
Last updated: 16 January 2006 |
| 225 |
.br |
.br |
| 226 |
Copyright (c) 1997-2005 University of Cambridge. |
Copyright (c) 1997-2006 University of Cambridge. |