| 19 |
<li><a name="TOC4" href="#SEC4">SAVING PRECOMPILED PATTERNS FOR LATER USE</a> |
<li><a name="TOC4" href="#SEC4">SAVING PRECOMPILED PATTERNS FOR LATER USE</a> |
| 20 |
<li><a name="TOC5" href="#SEC5">CHECKING BUILD-TIME OPTIONS</a> |
<li><a name="TOC5" href="#SEC5">CHECKING BUILD-TIME OPTIONS</a> |
| 21 |
<li><a name="TOC6" href="#SEC6">COMPILING A PATTERN</a> |
<li><a name="TOC6" href="#SEC6">COMPILING A PATTERN</a> |
| 22 |
<li><a name="TOC7" href="#SEC7">STUDYING A PATTERN</a> |
<li><a name="TOC7" href="#SEC7">COMPILATION ERROR CODES</a> |
| 23 |
<li><a name="TOC8" href="#SEC8">LOCALE SUPPORT</a> |
<li><a name="TOC8" href="#SEC8">STUDYING A PATTERN</a> |
| 24 |
<li><a name="TOC9" href="#SEC9">INFORMATION ABOUT A PATTERN</a> |
<li><a name="TOC9" href="#SEC9">LOCALE SUPPORT</a> |
| 25 |
<li><a name="TOC10" href="#SEC10">OBSOLETE INFO FUNCTION</a> |
<li><a name="TOC10" href="#SEC10">INFORMATION ABOUT A PATTERN</a> |
| 26 |
<li><a name="TOC11" href="#SEC11">MATCHING A PATTERN</a> |
<li><a name="TOC11" href="#SEC11">OBSOLETE INFO FUNCTION</a> |
| 27 |
<li><a name="TOC12" href="#SEC12">EXTRACTING CAPTURED SUBSTRINGS BY NUMBER</a> |
<li><a name="TOC12" href="#SEC12">REFERENCE COUNTS</a> |
| 28 |
<li><a name="TOC13" href="#SEC13">EXTRACTING CAPTURED SUBSTRINGS BY NAME</a> |
<li><a name="TOC13" href="#SEC13">MATCHING A PATTERN: THE TRADITIONAL FUNCTION</a> |
| 29 |
|
<li><a name="TOC14" href="#SEC14">EXTRACTING CAPTURED SUBSTRINGS BY NUMBER</a> |
| 30 |
|
<li><a name="TOC15" href="#SEC15">EXTRACTING CAPTURED SUBSTRINGS BY NAME</a> |
| 31 |
|
<li><a name="TOC16" href="#SEC16">FINDING ALL POSSIBLE MATCHES</a> |
| 32 |
|
<li><a name="TOC17" href="#SEC17">MATCHING A PATTERN: THE ALTERNATIVE FUNCTION</a> |
| 33 |
</ul> |
</ul> |
| 34 |
<br><a name="SEC1" href="#TOC1">PCRE NATIVE API</a><br> |
<br><a name="SEC1" href="#TOC1">PCRE NATIVE API</a><br> |
| 35 |
<P> |
<P> |
| 41 |
<b>const unsigned char *<i>tableptr</i>);</b> |
<b>const unsigned char *<i>tableptr</i>);</b> |
| 42 |
</P> |
</P> |
| 43 |
<P> |
<P> |
| 44 |
|
<b>pcre *pcre_compile2(const char *<i>pattern</i>, int <i>options</i>,</b> |
| 45 |
|
<b>int *<i>errorcodeptr</i>,</b> |
| 46 |
|
<b>const char **<i>errptr</i>, int *<i>erroffset</i>,</b> |
| 47 |
|
<b>const unsigned char *<i>tableptr</i>);</b> |
| 48 |
|
</P> |
| 49 |
|
<P> |
| 50 |
<b>pcre_extra *pcre_study(const pcre *<i>code</i>, int <i>options</i>,</b> |
<b>pcre_extra *pcre_study(const pcre *<i>code</i>, int <i>options</i>,</b> |
| 51 |
<b>const char **<i>errptr</i>);</b> |
<b>const char **<i>errptr</i>);</b> |
| 52 |
</P> |
</P> |
| 56 |
<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>);</b> |
<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>);</b> |
| 57 |
</P> |
</P> |
| 58 |
<P> |
<P> |
| 59 |
|
<b>int pcre_dfa_exec(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b> |
| 60 |
|
<b>const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b> |
| 61 |
|
<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b> |
| 62 |
|
<b>int *<i>workspace</i>, int <i>wscount</i>);</b> |
| 63 |
|
</P> |
| 64 |
|
<P> |
| 65 |
<b>int pcre_copy_named_substring(const pcre *<i>code</i>,</b> |
<b>int pcre_copy_named_substring(const pcre *<i>code</i>,</b> |
| 66 |
<b>const char *<i>subject</i>, int *<i>ovector</i>,</b> |
<b>const char *<i>subject</i>, int *<i>ovector</i>,</b> |
| 67 |
<b>int <i>stringcount</i>, const char *<i>stringname</i>,</b> |
<b>int <i>stringcount</i>, const char *<i>stringname</i>,</b> |
| 109 |
<b>*<i>firstcharptr</i>);</b> |
<b>*<i>firstcharptr</i>);</b> |
| 110 |
</P> |
</P> |
| 111 |
<P> |
<P> |
| 112 |
|
<b>int pcre_refcount(pcre *<i>code</i>, int <i>adjust</i>);</b> |
| 113 |
|
</P> |
| 114 |
|
<P> |
| 115 |
<b>int pcre_config(int <i>what</i>, void *<i>where</i>);</b> |
<b>int pcre_config(int <i>what</i>, void *<i>where</i>);</b> |
| 116 |
</P> |
</P> |
| 117 |
<P> |
<P> |
| 134 |
</P> |
</P> |
| 135 |
<br><a name="SEC2" href="#TOC1">PCRE API OVERVIEW</a><br> |
<br><a name="SEC2" href="#TOC1">PCRE API OVERVIEW</a><br> |
| 136 |
<P> |
<P> |
| 137 |
PCRE has its own native API, which is described in this document. There is also |
PCRE has its own native API, which is described in this document. There is |
| 138 |
a set of wrapper functions that correspond to the POSIX regular expression API. |
also a set of wrapper functions that correspond to the POSIX regular expression |
| 139 |
These are described in the |
API. These are described in the |
| 140 |
<a href="pcreposix.html"><b>pcreposix</b></a> |
<a href="pcreposix.html"><b>pcreposix</b></a> |
| 141 |
documentation. |
documentation. Both of these APIs define a set of C function calls. A C++ |
| 142 |
|
wrapper is distributed with PCRE. It is documented in the |
| 143 |
|
<a href="pcrecpp.html"><b>pcrecpp</b></a> |
| 144 |
|
page. |
| 145 |
</P> |
</P> |
| 146 |
<P> |
<P> |
| 147 |
The native API function prototypes are defined in the header file <b>pcre.h</b>, |
The native API C function prototypes are defined in the header file |
| 148 |
and on Unix systems the library itself is called <b>libpcre</b>. It can |
<b>pcre.h</b>, and on Unix systems the library itself is called <b>libpcre</b>. |
| 149 |
normally be accessed by adding <b>-lpcre</b> to the command for linking an |
It can normally be accessed by adding <b>-lpcre</b> to the command for linking |
| 150 |
application that uses PCRE. The header file defines the macros PCRE_MAJOR and |
an application that uses PCRE. The header file defines the macros PCRE_MAJOR |
| 151 |
PCRE_MINOR to contain the major and minor release numbers for the library. |
and PCRE_MINOR to contain the major and minor release numbers for the library. |
| 152 |
Applications can use these to include support for different releases of PCRE. |
Applications can use these to include support for different releases of PCRE. |
| 153 |
</P> |
</P> |
| 154 |
<P> |
<P> |
| 155 |
The functions <b>pcre_compile()</b>, <b>pcre_study()</b>, and <b>pcre_exec()</b> |
The functions <b>pcre_compile()</b>, <b>pcre_compile2()</b>, <b>pcre_study()</b>, |
| 156 |
are used for compiling and matching regular expressions. A sample program that |
and <b>pcre_exec()</b> are used for compiling and matching regular expressions |
| 157 |
demonstrates the simplest way of using them is provided in the file called |
in a Perl-compatible manner. A sample program that demonstrates the simplest |
| 158 |
<i>pcredemo.c</i> in the source distribution. The |
way of using them is provided in the file called <i>pcredemo.c</i> in the source |
| 159 |
|
distribution. The |
| 160 |
<a href="pcresample.html"><b>pcresample</b></a> |
<a href="pcresample.html"><b>pcresample</b></a> |
| 161 |
documentation describes how to run it. |
documentation describes how to run it. |
| 162 |
</P> |
</P> |
| 163 |
<P> |
<P> |
| 164 |
|
A second matching function, <b>pcre_dfa_exec()</b>, which is not |
| 165 |
|
Perl-compatible, is also provided. This uses a different algorithm for the |
| 166 |
|
matching. This allows it to find all possible matches (at a given point in the |
| 167 |
|
subject), not just one. However, this algorithm does not return captured |
| 168 |
|
substrings. A description of the two matching algorithms and their advantages |
| 169 |
|
and disadvantages is given in the |
| 170 |
|
<a href="pcrematching.html"><b>pcrematching</b></a> |
| 171 |
|
documentation. |
| 172 |
|
</P> |
| 173 |
|
<P> |
| 174 |
In addition to the main compiling and matching functions, there are convenience |
In addition to the main compiling and matching functions, there are convenience |
| 175 |
functions for extracting captured substrings from a matched subject string. |
functions for extracting captured substrings from a subject string that is |
| 176 |
They are: |
matched by <b>pcre_exec()</b>. They are: |
| 177 |
<pre> |
<pre> |
| 178 |
<b>pcre_copy_substring()</b> |
<b>pcre_copy_substring()</b> |
| 179 |
<b>pcre_copy_named_substring()</b> |
<b>pcre_copy_named_substring()</b> |
| 187 |
</P> |
</P> |
| 188 |
<P> |
<P> |
| 189 |
The function <b>pcre_maketables()</b> is used to build a set of character tables |
The function <b>pcre_maketables()</b> is used to build a set of character tables |
| 190 |
in the current locale for passing to <b>pcre_compile()</b> or <b>pcre_exec()</b>. |
in the current locale for passing to <b>pcre_compile()</b>, <b>pcre_exec()</b>, |
| 191 |
This is an optional facility that is provided for specialist use. Most |
or <b>pcre_dfa_exec()</b>. This is an optional facility that is provided for |
| 192 |
commonly, no special tables are passed, in which case internal tables that are |
specialist use. Most commonly, no special tables are passed, in which case |
| 193 |
generated when PCRE is built are used. |
internal tables that are generated when PCRE is built are used. |
| 194 |
</P> |
</P> |
| 195 |
<P> |
<P> |
| 196 |
The function <b>pcre_fullinfo()</b> is used to find out information about a |
The function <b>pcre_fullinfo()</b> is used to find out information about a |
| 200 |
version of PCRE and its date of release. |
version of PCRE and its date of release. |
| 201 |
</P> |
</P> |
| 202 |
<P> |
<P> |
| 203 |
|
The function <b>pcre_refcount()</b> maintains a reference count in a data block |
| 204 |
|
containing a compiled pattern. This is provided for the benefit of |
| 205 |
|
object-oriented applications. |
| 206 |
|
</P> |
| 207 |
|
<P> |
| 208 |
The global variables <b>pcre_malloc</b> and <b>pcre_free</b> initially contain |
The global variables <b>pcre_malloc</b> and <b>pcre_free</b> initially contain |
| 209 |
the entry points of the standard <b>malloc()</b> and <b>free()</b> functions, |
the entry points of the standard <b>malloc()</b> and <b>free()</b> functions, |
| 210 |
respectively. PCRE calls the memory management functions via these variables, |
respectively. PCRE calls the memory management functions via these variables, |
| 215 |
The global variables <b>pcre_stack_malloc</b> and <b>pcre_stack_free</b> are also |
The global variables <b>pcre_stack_malloc</b> and <b>pcre_stack_free</b> are also |
| 216 |
indirections to memory management functions. These special functions are used |
indirections to memory management functions. These special functions are used |
| 217 |
only when PCRE is compiled to use the heap for remembering data, instead of |
only when PCRE is compiled to use the heap for remembering data, instead of |
| 218 |
recursive function calls. This is a non-standard way of building PCRE, for use |
recursive function calls, when running the <b>pcre_exec()</b> function. This is |
| 219 |
in environments that have limited stacks. Because of the greater use of memory |
a non-standard way of building PCRE, for use in environments that have limited |
| 220 |
management, it runs more slowly. Separate functions are provided so that |
stacks. Because of the greater use of memory management, it runs more slowly. |
| 221 |
special-purpose external code can be used for this case. When used, these |
Separate functions are provided so that special-purpose external code can be |
| 222 |
functions are always called in a stack-like manner (last obtained, first |
used for this case. When used, these functions are always called in a |
| 223 |
freed), and always for memory blocks of the same size. |
stack-like manner (last obtained, first freed), and always for memory blocks of |
| 224 |
|
the same size. |
| 225 |
</P> |
</P> |
| 226 |
<P> |
<P> |
| 227 |
The global variable <b>pcre_callout</b> initially contains NULL. It can be set |
The global variable <b>pcre_callout</b> initially contains NULL. It can be set |
| 304 |
<pre> |
<pre> |
| 305 |
PCRE_CONFIG_STACKRECURSE |
PCRE_CONFIG_STACKRECURSE |
| 306 |
</pre> |
</pre> |
| 307 |
The output is an integer that is set to one if internal recursion is |
The output is an integer that is set to one if internal recursion when running |
| 308 |
implemented by recursive function calls that use the stack to remember their |
<b>pcre_exec()</b> is implemented by recursive function calls that use the stack |
| 309 |
state. This is the usual way that PCRE is compiled. The output is zero if PCRE |
to remember their state. This is the usual way that PCRE is compiled. The |
| 310 |
was compiled to use blocks of data on the heap instead of recursive function |
output is zero if PCRE was compiled to use blocks of data on the heap instead |
| 311 |
calls. In this case, <b>pcre_stack_malloc</b> and <b>pcre_stack_free</b> are |
of recursive function calls. In this case, <b>pcre_stack_malloc</b> and |
| 312 |
called to manage memory blocks on the heap, thus avoiding the use of the stack. |
<b>pcre_stack_free</b> are called to manage memory blocks on the heap, thus |
| 313 |
|
avoiding the use of the stack. |
| 314 |
</P> |
</P> |
| 315 |
<br><a name="SEC6" href="#TOC1">COMPILING A PATTERN</a><br> |
<br><a name="SEC6" href="#TOC1">COMPILING A PATTERN</a><br> |
| 316 |
<P> |
<P> |
| 317 |
<b>pcre *pcre_compile(const char *<i>pattern</i>, int <i>options</i>,</b> |
<b>pcre *pcre_compile(const char *<i>pattern</i>, int <i>options</i>,</b> |
| 318 |
<b>const char **<i>errptr</i>, int *<i>erroffset</i>,</b> |
<b>const char **<i>errptr</i>, int *<i>erroffset</i>,</b> |
| 319 |
<b>const unsigned char *<i>tableptr</i>);</b> |
<b>const unsigned char *<i>tableptr</i>);</b> |
| 320 |
|
<b>pcre *pcre_compile2(const char *<i>pattern</i>, int <i>options</i>,</b> |
| 321 |
|
<b>int *<i>errorcodeptr</i>,</b> |
| 322 |
|
<b>const char **<i>errptr</i>, int *<i>erroffset</i>,</b> |
| 323 |
|
<b>const unsigned char *<i>tableptr</i>);</b> |
| 324 |
|
</P> |
| 325 |
|
<P> |
| 326 |
|
Either of the functions <b>pcre_compile()</b> or <b>pcre_compile2()</b> can be |
| 327 |
|
called to compile a pattern into an internal form. The only difference between |
| 328 |
|
the two interfaces is that <b>pcre_compile2()</b> has an additional argument, |
| 329 |
|
<i>errorcodeptr</i>, via which a numerical error code can be returned. |
| 330 |
</P> |
</P> |
| 331 |
<P> |
<P> |
| 332 |
The function <b>pcre_compile()</b> is called to compile a pattern into an |
The pattern is a C string terminated by a binary zero, and is passed in the |
| 333 |
internal form. The pattern is a C string terminated by a binary zero, and |
<i>pattern</i> argument. A pointer to a single block of memory that is obtained |
| 334 |
is passed in the <i>pattern</i> argument. A pointer to a single block of memory |
via <b>pcre_malloc</b> is returned. This contains the compiled code and related |
| 335 |
that is obtained via <b>pcre_malloc</b> is returned. This contains the compiled |
data. The <b>pcre</b> type is defined for the returned block; this is a typedef |
| 336 |
code and related data. The <b>pcre</b> type is defined for the returned block; |
for a structure whose contents are not externally defined. It is up to the |
| 337 |
this is a typedef for a structure whose contents are not externally defined. It |
caller to free the memory when it is no longer required. |
|
is up to the caller to free the memory when it is no longer required. |
|
| 338 |
</P> |
</P> |
| 339 |
<P> |
<P> |
| 340 |
Although the compiled code of a PCRE regex is relocatable, that is, it does not |
Although the compiled code of a PCRE regex is relocatable, that is, it does not |
| 363 |
<i>erroffset</i>, which must not be NULL. If it is, an immediate error is given. |
<i>erroffset</i>, which must not be NULL. If it is, an immediate error is given. |
| 364 |
</P> |
</P> |
| 365 |
<P> |
<P> |
| 366 |
|
If <b>pcre_compile2()</b> is used instead of <b>pcre_compile()</b>, and the |
| 367 |
|
<i>errorcodeptr</i> argument is not NULL, a non-zero error code number is |
| 368 |
|
returned via this argument in the event of an error. This is in addition to the |
| 369 |
|
textual error message. Error codes and messages are listed below. |
| 370 |
|
</P> |
| 371 |
|
<P> |
| 372 |
If the final argument, <i>tableptr</i>, is NULL, PCRE uses a default set of |
If the final argument, <i>tableptr</i>, is NULL, PCRE uses a default set of |
| 373 |
character tables that are built when PCRE is compiled, using the default C |
character tables that are built when PCRE is compiled, using the default C |
| 374 |
locale. Otherwise, <i>tableptr</i> must be an address that is the result of a |
locale. Otherwise, <i>tableptr</i> must be an address that is the result of a |
| 412 |
</pre> |
</pre> |
| 413 |
If this bit is set, letters in the pattern match both upper and lower case |
If this bit is set, letters in the pattern match both upper and lower case |
| 414 |
letters. It is equivalent to Perl's /i option, and it can be changed within a |
letters. It is equivalent to Perl's /i option, and it can be changed within a |
| 415 |
pattern by a (?i) option setting. When running in UTF-8 mode, case support for |
pattern by a (?i) option setting. In UTF-8 mode, PCRE always understands the |
| 416 |
high-valued characters is available only when PCRE is built with Unicode |
concept of case for characters whose values are less than 128, so caseless |
| 417 |
character property support. |
matching is always possible. For characters with higher values, the concept of |
| 418 |
|
case is supported if PCRE is compiled with Unicode property support, but not |
| 419 |
|
otherwise. If you want to use caseless matching for characters 128 and above, |
| 420 |
|
you must ensure that PCRE is compiled with Unicode property support as well as |
| 421 |
|
with UTF-8 support. |
| 422 |
<pre> |
<pre> |
| 423 |
PCRE_DOLLAR_ENDONLY |
PCRE_DOLLAR_ENDONLY |
| 424 |
</pre> |
</pre> |
| 463 |
controlled by this option. It can also be set by a (?X) option setting within a |
controlled by this option. It can also be set by a (?X) option setting within a |
| 464 |
pattern. |
pattern. |
| 465 |
<pre> |
<pre> |
| 466 |
|
PCRE_FIRSTLINE |
| 467 |
|
</pre> |
| 468 |
|
If this option is set, an unanchored pattern is required to match before or at |
| 469 |
|
the first newline character in the subject string, though the matched text may |
| 470 |
|
continue over the newline. |
| 471 |
|
<pre> |
| 472 |
PCRE_MULTILINE |
PCRE_MULTILINE |
| 473 |
</pre> |
</pre> |
| 474 |
By default, PCRE treats the subject string as consisting of a single line of |
By default, PCRE treats the subject string as consisting of a single line of |
| 520 |
valid, and you want to skip this check for performance reasons, you can set the |
valid, and you want to skip this check for performance reasons, you can set the |
| 521 |
PCRE_NO_UTF8_CHECK option. When it is set, the effect of passing an invalid |
PCRE_NO_UTF8_CHECK option. When it is set, the effect of passing an invalid |
| 522 |
UTF-8 string as a pattern is undefined. It may cause your program to crash. |
UTF-8 string as a pattern is undefined. It may cause your program to crash. |
| 523 |
Note that this option can also be passed to <b>pcre_exec()</b>, to suppress the |
Note that this option can also be passed to <b>pcre_exec()</b> and |
| 524 |
UTF-8 validity checking of subject strings. |
<b>pcre_dfa_exec()</b>, to suppress the UTF-8 validity checking of subject |
| 525 |
|
strings. |
| 526 |
|
</P> |
| 527 |
|
<br><a name="SEC7" href="#TOC1">COMPILATION ERROR CODES</a><br> |
| 528 |
|
<P> |
| 529 |
|
The following table lists the error codes than may be returned by |
| 530 |
|
<b>pcre_compile2()</b>, along with the error messages that may be returned by |
| 531 |
|
both compiling functions. |
| 532 |
|
<pre> |
| 533 |
|
0 no error |
| 534 |
|
1 \ at end of pattern |
| 535 |
|
2 \c at end of pattern |
| 536 |
|
3 unrecognized character follows \ |
| 537 |
|
4 numbers out of order in {} quantifier |
| 538 |
|
5 number too big in {} quantifier |
| 539 |
|
6 missing terminating ] for character class |
| 540 |
|
7 invalid escape sequence in character class |
| 541 |
|
8 range out of order in character class |
| 542 |
|
9 nothing to repeat |
| 543 |
|
10 operand of unlimited repeat could match the empty string |
| 544 |
|
11 internal error: unexpected repeat |
| 545 |
|
12 unrecognized character after (? |
| 546 |
|
13 POSIX named classes are supported only within a class |
| 547 |
|
14 missing ) |
| 548 |
|
15 reference to non-existent subpattern |
| 549 |
|
16 erroffset passed as NULL |
| 550 |
|
17 unknown option bit(s) set |
| 551 |
|
18 missing ) after comment |
| 552 |
|
19 parentheses nested too deeply |
| 553 |
|
20 regular expression too large |
| 554 |
|
21 failed to get memory |
| 555 |
|
22 unmatched parentheses |
| 556 |
|
23 internal error: code overflow |
| 557 |
|
24 unrecognized character after (?< |
| 558 |
|
25 lookbehind assertion is not fixed length |
| 559 |
|
26 malformed number after (?( |
| 560 |
|
27 conditional group contains more than two branches |
| 561 |
|
28 assertion expected after (?( |
| 562 |
|
29 (?R or (?digits must be followed by ) |
| 563 |
|
30 unknown POSIX class name |
| 564 |
|
31 POSIX collating elements are not supported |
| 565 |
|
32 this version of PCRE is not compiled with PCRE_UTF8 support |
| 566 |
|
33 spare error |
| 567 |
|
34 character value in \x{...} sequence is too large |
| 568 |
|
35 invalid condition (?(0) |
| 569 |
|
36 \C not allowed in lookbehind assertion |
| 570 |
|
37 PCRE does not support \L, \l, \N, \U, or \u |
| 571 |
|
38 number after (?C is > 255 |
| 572 |
|
39 closing ) for (?C expected |
| 573 |
|
40 recursive call could loop indefinitely |
| 574 |
|
41 unrecognized character after (?P |
| 575 |
|
42 syntax error after (?P |
| 576 |
|
43 two named groups have the same name |
| 577 |
|
44 invalid UTF-8 string |
| 578 |
|
45 support for \P, \p, and \X has not been compiled |
| 579 |
|
46 malformed \P or \p sequence |
| 580 |
|
47 unknown property name after \P or \p |
| 581 |
|
</PRE> |
| 582 |
</P> |
</P> |
| 583 |
<br><a name="SEC7" href="#TOC1">STUDYING A PATTERN</a><br> |
<br><a name="SEC8" href="#TOC1">STUDYING A PATTERN</a><br> |
| 584 |
<P> |
<P> |
| 585 |
<b>pcre_extra *pcre_study(const pcre *<i>code</i>, int <i>options</i>,</b> |
<b>pcre_extra *pcre_study(const pcre *<i>code</i>, int <i>options</i></b> |
| 586 |
<b>const char **<i>errptr</i>);</b> |
<b>const char **<i>errptr</i>);</b> |
| 587 |
</P> |
</P> |
| 588 |
<P> |
<P> |
| 603 |
in the section on matching a pattern. |
in the section on matching a pattern. |
| 604 |
</P> |
</P> |
| 605 |
<P> |
<P> |
| 606 |
If studying the pattern does not produce any additional information, |
If studying the pattern does not produce any additional information |
| 607 |
<b>pcre_study()</b> returns NULL. In that circumstance, if the calling program |
<b>pcre_study()</b> returns NULL. In that circumstance, if the calling program |
| 608 |
wants to pass any of the other fields to <b>pcre_exec()</b>, it must set up its |
wants to pass any of the other fields to <b>pcre_exec()</b>, it must set up its |
| 609 |
own <b>pcre_extra</b> block. |
own <b>pcre_extra</b> block. |
| 632 |
not have a single fixed starting character. A bitmap of possible starting |
not have a single fixed starting character. A bitmap of possible starting |
| 633 |
bytes is created. |
bytes is created. |
| 634 |
<a name="localesupport"></a></P> |
<a name="localesupport"></a></P> |
| 635 |
<br><a name="SEC8" href="#TOC1">LOCALE SUPPORT</a><br> |
<br><a name="SEC9" href="#TOC1">LOCALE SUPPORT</a><br> |
| 636 |
<P> |
<P> |
| 637 |
PCRE handles caseless matching, and determines whether characters are letters, |
PCRE handles caseless matching, and determines whether characters are letters |
| 638 |
digits, or whatever, by reference to a set of tables, indexed by character |
digits, or whatever, by reference to a set of tables, indexed by character |
| 639 |
value. (When running in UTF-8 mode, this applies only to characters with codes |
value. When running in UTF-8 mode, this applies only to characters with codes |
| 640 |
less than 128. Higher-valued codes never match escapes such as \w or \d, but |
less than 128. Higher-valued codes never match escapes such as \w or \d, but |
| 641 |
can be tested with \p if PCRE is built with Unicode character property |
can be tested with \p if PCRE is built with Unicode character property |
| 642 |
support.) |
support. |
| 643 |
</P> |
</P> |
| 644 |
<P> |
<P> |
| 645 |
An internal set of tables is created in the default C locale when PCRE is |
An internal set of tables is created in the default C locale when PCRE is |
| 680 |
one in which it was compiled. Passing table pointers at run time is discussed |
one in which it was compiled. Passing table pointers at run time is discussed |
| 681 |
below in the section on matching a pattern. |
below in the section on matching a pattern. |
| 682 |
</P> |
</P> |
| 683 |
<br><a name="SEC9" href="#TOC1">INFORMATION ABOUT A PATTERN</a><br> |
<br><a name="SEC10" href="#TOC1">INFORMATION ABOUT A PATTERN</a><br> |
| 684 |
<P> |
<P> |
| 685 |
<b>int pcre_fullinfo(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b> |
<b>int pcre_fullinfo(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b> |
| 686 |
<b>int <i>what</i>, void *<i>where</i>);</b> |
<b>int <i>what</i>, void *<i>where</i>);</b> |
| 729 |
Return the number of capturing subpatterns in the pattern. The fourth argument |
Return the number of capturing subpatterns in the pattern. The fourth argument |
| 730 |
should point to an <b>int</b> variable. |
should point to an <b>int</b> variable. |
| 731 |
<pre> |
<pre> |
| 732 |
PCRE_INFO_DEFAULTTABLES |
PCRE_INFO_DEFAULT_TABLES |
| 733 |
</pre> |
</pre> |
| 734 |
Return a pointer to the internal default character tables within PCRE. The |
Return a pointer to the internal default character tables within PCRE. The |
| 735 |
fourth argument should point to an <b>unsigned char *</b> variable. This |
fourth argument should point to an <b>unsigned char *</b> variable. This |
| 851 |
created by <b>pcre_study()</b>. The fourth argument should point to a |
created by <b>pcre_study()</b>. The fourth argument should point to a |
| 852 |
<b>size_t</b> variable. |
<b>size_t</b> variable. |
| 853 |
</P> |
</P> |
| 854 |
<br><a name="SEC10" href="#TOC1">OBSOLETE INFO FUNCTION</a><br> |
<br><a name="SEC11" href="#TOC1">OBSOLETE INFO FUNCTION</a><br> |
| 855 |
<P> |
<P> |
| 856 |
<b>int pcre_info(const pcre *<i>code</i>, int *<i>optptr</i>, int</b> |
<b>int pcre_info(const pcre *<i>code</i>, int *<i>optptr</i>, int</b> |
| 857 |
<b>*<i>firstcharptr</i>);</b> |
<b>*<i>firstcharptr</i>);</b> |
| 875 |
it is used to pass back information about the first character of any matched |
it is used to pass back information about the first character of any matched |
| 876 |
string (see PCRE_INFO_FIRSTBYTE above). |
string (see PCRE_INFO_FIRSTBYTE above). |
| 877 |
</P> |
</P> |
| 878 |
<br><a name="SEC11" href="#TOC1">MATCHING A PATTERN</a><br> |
<br><a name="SEC12" href="#TOC1">REFERENCE COUNTS</a><br> |
| 879 |
|
<P> |
| 880 |
|
<b>int pcre_refcount(pcre *<i>code</i>, int <i>adjust</i>);</b> |
| 881 |
|
</P> |
| 882 |
|
<P> |
| 883 |
|
The <b>pcre_refcount()</b> function is used to maintain a reference count in the |
| 884 |
|
data block that contains a compiled pattern. It is provided for the benefit of |
| 885 |
|
applications that operate in an object-oriented manner, where different parts |
| 886 |
|
of the application may be using the same compiled pattern, but you want to free |
| 887 |
|
the block when they are all done. |
| 888 |
|
</P> |
| 889 |
|
<P> |
| 890 |
|
When a pattern is compiled, the reference count field is initialized to zero. |
| 891 |
|
It is changed only by calling this function, whose action is to add the |
| 892 |
|
<i>adjust</i> value (which may be positive or negative) to it. The yield of the |
| 893 |
|
function is the new value. However, the value of the count is constrained to |
| 894 |
|
lie between 0 and 65535, inclusive. If the new value is outside these limits, |
| 895 |
|
it is forced to the appropriate limit value. |
| 896 |
|
</P> |
| 897 |
|
<P> |
| 898 |
|
Except when it is zero, the reference count is not correctly preserved if a |
| 899 |
|
pattern is compiled on one host and then transferred to a host whose byte-order |
| 900 |
|
is different. (This seems a highly unlikely scenario.) |
| 901 |
|
</P> |
| 902 |
|
<br><a name="SEC13" href="#TOC1">MATCHING A PATTERN: THE TRADITIONAL FUNCTION</a><br> |
| 903 |
<P> |
<P> |
| 904 |
<b>int pcre_exec(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b> |
<b>int pcre_exec(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b> |
| 905 |
<b>const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b> |
<b>const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b> |
| 909 |
The function <b>pcre_exec()</b> is called to match a subject string against a |
The function <b>pcre_exec()</b> is called to match a subject string against a |
| 910 |
compiled pattern, which is passed in the <i>code</i> argument. If the |
compiled pattern, which is passed in the <i>code</i> argument. If the |
| 911 |
pattern has been studied, the result of the study should be passed in the |
pattern has been studied, the result of the study should be passed in the |
| 912 |
<i>extra</i> argument. |
<i>extra</i> argument. This function is the main matching facility of the |
| 913 |
|
library, and it operates in a Perl-like manner. For specialist use there is |
| 914 |
|
also an alternative matching function, which is described |
| 915 |
|
<a href="#dfamatch">below</a> |
| 916 |
|
in the section about the <b>pcre_dfa_exec()</b> function. |
| 917 |
</P> |
</P> |
| 918 |
<P> |
<P> |
| 919 |
In most applications, the pattern will have been compiled (and optionally |
In most applications, the pattern will have been compiled (and optionally |
| 937 |
0, /* start at offset 0 in the subject */ |
0, /* start at offset 0 in the subject */ |
| 938 |
0, /* default options */ |
0, /* default options */ |
| 939 |
ovector, /* vector of integers for substring information */ |
ovector, /* vector of integers for substring information */ |
| 940 |
30); /* number of elements in the vector (NOT size in bytes) */ |
30); /* number of elements (NOT size in bytes) */ |
| 941 |
<a name="extradata"></a></PRE> |
<a name="extradata"></a></PRE> |
| 942 |
</P> |
</P> |
| 943 |
<br><b> |
<br><b> |
| 1196 |
subpatterns there are in a compiled pattern. The smallest size for |
subpatterns there are in a compiled pattern. The smallest size for |
| 1197 |
<i>ovector</i> that will allow for <i>n</i> captured substrings, in addition to |
<i>ovector</i> that will allow for <i>n</i> captured substrings, in addition to |
| 1198 |
the offsets of the substring matched by the whole pattern, is (<i>n</i>+1)*3. |
the offsets of the substring matched by the whole pattern, is (<i>n</i>+1)*3. |
| 1199 |
</P> |
<a name="errorlist"></a></P> |
| 1200 |
<br><b> |
<br><b> |
| 1201 |
Return values from <b>pcre_exec()</b> |
Return values from <b>pcre_exec()</b> |
| 1202 |
</b><br> |
</b><br> |
| 1267 |
The UTF-8 byte sequence that was passed as a subject was valid, but the value |
The UTF-8 byte sequence that was passed as a subject was valid, but the value |
| 1268 |
of <i>startoffset</i> did not point to the beginning of a UTF-8 character. |
of <i>startoffset</i> did not point to the beginning of a UTF-8 character. |
| 1269 |
<pre> |
<pre> |
| 1270 |
PCRE_ERROR_PARTIAL (-12) |
PCRE_ERROR_PARTIAL (-12) |
| 1271 |
</pre> |
</pre> |
| 1272 |
The subject string did not match, but it did match partially. See the |
The subject string did not match, but it did match partially. See the |
| 1273 |
<a href="pcrepartial.html"><b>pcrepartial</b></a> |
<a href="pcrepartial.html"><b>pcrepartial</b></a> |
| 1274 |
documentation for details of partial matching. |
documentation for details of partial matching. |
| 1275 |
<pre> |
<pre> |
| 1276 |
PCRE_ERROR_BAD_PARTIAL (-13) |
PCRE_ERROR_BADPARTIAL (-13) |
| 1277 |
</pre> |
</pre> |
| 1278 |
The PCRE_PARTIAL option was used with a compiled pattern containing items that |
The PCRE_PARTIAL option was used with a compiled pattern containing items that |
| 1279 |
are not supported for partial matching. See the |
are not supported for partial matching. See the |
| 1280 |
<a href="pcrepartial.html"><b>pcrepartial</b></a> |
<a href="pcrepartial.html"><b>pcrepartial</b></a> |
| 1281 |
documentation for details of partial matching. |
documentation for details of partial matching. |
| 1282 |
<pre> |
<pre> |
| 1283 |
PCRE_ERROR_INTERNAL (-14) |
PCRE_ERROR_INTERNAL (-14) |
| 1284 |
</pre> |
</pre> |
| 1285 |
An unexpected internal error has occurred. This error could be caused by a bug |
An unexpected internal error has occurred. This error could be caused by a bug |
| 1286 |
in PCRE or by overwriting of the compiled pattern. |
in PCRE or by overwriting of the compiled pattern. |
| 1287 |
<pre> |
<pre> |
| 1288 |
PCRE_ERROR_BADCOUNT (-15) |
PCRE_ERROR_BADCOUNT (-15) |
| 1289 |
</pre> |
</pre> |
| 1290 |
This error is given if the value of the <i>ovecsize</i> argument is negative. |
This error is given if the value of the <i>ovecsize</i> argument is negative. |
| 1291 |
</P> |
</P> |
| 1292 |
<br><a name="SEC12" href="#TOC1">EXTRACTING CAPTURED SUBSTRINGS BY NUMBER</a><br> |
<br><a name="SEC14" href="#TOC1">EXTRACTING CAPTURED SUBSTRINGS BY NUMBER</a><br> |
| 1293 |
<P> |
<P> |
| 1294 |
<b>int pcre_copy_substring(const char *<i>subject</i>, int *<i>ovector</i>,</b> |
<b>int pcre_copy_substring(const char *<i>subject</i>, int *<i>ovector</i>,</b> |
| 1295 |
<b>int <i>stringcount</i>, int <i>stringnumber</i>, char *<i>buffer</i>,</b> |
<b>int <i>stringcount</i>, int <i>stringnumber</i>, char *<i>buffer</i>,</b> |
| 1377 |
<b>pcre_free</b> directly; it is for these cases that the functions are |
<b>pcre_free</b> directly; it is for these cases that the functions are |
| 1378 |
provided. |
provided. |
| 1379 |
</P> |
</P> |
| 1380 |
<br><a name="SEC13" href="#TOC1">EXTRACTING CAPTURED SUBSTRINGS BY NAME</a><br> |
<br><a name="SEC15" href="#TOC1">EXTRACTING CAPTURED SUBSTRINGS BY NAME</a><br> |
| 1381 |
<P> |
<P> |
| 1382 |
<b>int pcre_get_stringnumber(const pcre *<i>code</i>,</b> |
<b>int pcre_get_stringnumber(const pcre *<i>code</i>,</b> |
| 1383 |
<b>const char *<i>name</i>);</b> |
<b>const char *<i>name</i>);</b> |
| 1428 |
then call <i>pcre_copy_substring()</i> or <i>pcre_get_substring()</i>, as |
then call <i>pcre_copy_substring()</i> or <i>pcre_get_substring()</i>, as |
| 1429 |
appropriate. |
appropriate. |
| 1430 |
</P> |
</P> |
| 1431 |
|
<br><a name="SEC16" href="#TOC1">FINDING ALL POSSIBLE MATCHES</a><br> |
| 1432 |
|
<P> |
| 1433 |
|
The traditional matching function uses a similar algorithm to Perl, which stops |
| 1434 |
|
when it finds the first match, starting at a given point in the subject. If you |
| 1435 |
|
want to find all possible matches, or the longest possible match, consider |
| 1436 |
|
using the alternative matching function (see below) instead. If you cannot use |
| 1437 |
|
the alternative function, but still need to find all possible matches, you |
| 1438 |
|
can kludge it up by making use of the callout facility, which is described in |
| 1439 |
|
the |
| 1440 |
|
<a href="pcrecallout.html"><b>pcrecallout</b></a> |
| 1441 |
|
documentation. |
| 1442 |
|
</P> |
| 1443 |
|
<P> |
| 1444 |
|
What you have to do is to insert a callout right at the end of the pattern. |
| 1445 |
|
When your callout function is called, extract and save the current matched |
| 1446 |
|
substring. Then return 1, which forces <b>pcre_exec()</b> to backtrack and try |
| 1447 |
|
other alternatives. Ultimately, when it runs out of matches, <b>pcre_exec()</b> |
| 1448 |
|
will yield PCRE_ERROR_NOMATCH. |
| 1449 |
|
<a name="dfamatch"></a></P> |
| 1450 |
|
<br><a name="SEC17" href="#TOC1">MATCHING A PATTERN: THE ALTERNATIVE FUNCTION</a><br> |
| 1451 |
|
<P> |
| 1452 |
|
<b>int pcre_dfa_exec(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b> |
| 1453 |
|
<b>const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b> |
| 1454 |
|
<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b> |
| 1455 |
|
<b>int *<i>workspace</i>, int <i>wscount</i>);</b> |
| 1456 |
|
</P> |
| 1457 |
|
<P> |
| 1458 |
|
The function <b>pcre_dfa_exec()</b> is called to match a subject string against |
| 1459 |
|
a compiled pattern, using a "DFA" matching algorithm. This has different |
| 1460 |
|
characteristics to the normal algorithm, and is not compatible with Perl. Some |
| 1461 |
|
of the features of PCRE patterns are not supported. Nevertheless, there are |
| 1462 |
|
times when this kind of matching can be useful. For a discussion of the two |
| 1463 |
|
matching algorithms, see the |
| 1464 |
|
<a href="pcrematching.html"><b>pcrematching</b></a> |
| 1465 |
|
documentation. |
| 1466 |
|
</P> |
| 1467 |
|
<P> |
| 1468 |
|
The arguments for the <b>pcre_dfa_exec()</b> function are the same as for |
| 1469 |
|
<b>pcre_exec()</b>, plus two extras. The <i>ovector</i> argument is used in a |
| 1470 |
|
different way, and this is described below. The other common arguments are used |
| 1471 |
|
in the same way as for <b>pcre_exec()</b>, so their description is not repeated |
| 1472 |
|
here. |
| 1473 |
|
</P> |
| 1474 |
|
<P> |
| 1475 |
|
The two additional arguments provide workspace for the function. The workspace |
| 1476 |
|
vector should contain at least 20 elements. It is used for keeping track of |
| 1477 |
|
multiple paths through the pattern tree. More workspace will be needed for |
| 1478 |
|
patterns and subjects where there are a lot of possible matches. |
| 1479 |
|
</P> |
| 1480 |
|
<P> |
| 1481 |
|
Here is an example of a simple call to <b>pcre_exec()</b>: |
| 1482 |
|
<pre> |
| 1483 |
|
int rc; |
| 1484 |
|
int ovector[10]; |
| 1485 |
|
int wspace[20]; |
| 1486 |
|
rc = pcre_exec( |
| 1487 |
|
re, /* result of pcre_compile() */ |
| 1488 |
|
NULL, /* we didn't study the pattern */ |
| 1489 |
|
"some string", /* the subject string */ |
| 1490 |
|
11, /* the length of the subject string */ |
| 1491 |
|
0, /* start at offset 0 in the subject */ |
| 1492 |
|
0, /* default options */ |
| 1493 |
|
ovector, /* vector of integers for substring information */ |
| 1494 |
|
10, /* number of elements (NOT size in bytes) */ |
| 1495 |
|
wspace, /* working space vector */ |
| 1496 |
|
20); /* number of elements (NOT size in bytes) */ |
| 1497 |
|
</PRE> |
| 1498 |
|
</P> |
| 1499 |
|
<br><b> |
| 1500 |
|
Option bits for <b>pcre_dfa_exec()</b> |
| 1501 |
|
</b><br> |
| 1502 |
|
<P> |
| 1503 |
|
The unused bits of the <i>options</i> argument for <b>pcre_dfa_exec()</b> must be |
| 1504 |
|
zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NOTBOL, |
| 1505 |
|
PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_UTF8_CHECK, PCRE_PARTIAL, |
| 1506 |
|
PCRE_DFA_SHORTEST, and PCRE_DFA_RESTART. All but the last three of these are |
| 1507 |
|
the same as for <b>pcre_exec()</b>, so their description is not repeated here. |
| 1508 |
|
<pre> |
| 1509 |
|
PCRE_PARTIAL |
| 1510 |
|
</pre> |
| 1511 |
|
This has the same general effect as it does for <b>pcre_exec()</b>, but the |
| 1512 |
|
details are slightly different. When PCRE_PARTIAL is set for |
| 1513 |
|
<b>pcre_dfa_exec()</b>, the return code PCRE_ERROR_NOMATCH is converted into |
| 1514 |
|
PCRE_ERROR_PARTIAL if the end of the subject is reached, there have been no |
| 1515 |
|
complete matches, but there is still at least one matching possibility. The |
| 1516 |
|
portion of the string that provided the partial match is set as the first |
| 1517 |
|
matching string. |
| 1518 |
|
<pre> |
| 1519 |
|
PCRE_DFA_SHORTEST |
| 1520 |
|
</pre> |
| 1521 |
|
Setting the PCRE_DFA_SHORTEST option causes the matching algorithm to stop as |
| 1522 |
|
soon as it has found one match. Because of the way the DFA algorithm works, |
| 1523 |
|
this is necessarily the shortest possible match at the first possible matching |
| 1524 |
|
point in the subject string. |
| 1525 |
|
<pre> |
| 1526 |
|
PCRE_DFA_RESTART |
| 1527 |
|
</pre> |
| 1528 |
|
When <b>pcre_dfa_exec()</b> is called with the PCRE_PARTIAL option, and returns |
| 1529 |
|
a partial match, it is possible to call it again, with additional subject |
| 1530 |
|
characters, and have it continue with the same match. The PCRE_DFA_RESTART |
| 1531 |
|
option requests this action; when it is set, the <i>workspace</i> and |
| 1532 |
|
<i>wscount</i> options must reference the same vector as before because data |
| 1533 |
|
about the match so far is left in them after a partial match. There is more |
| 1534 |
|
discussion of this facility in the |
| 1535 |
|
<a href="pcrepartial.html"><b>pcrepartial</b></a> |
| 1536 |
|
documentation. |
| 1537 |
|
</P> |
| 1538 |
|
<br><b> |
| 1539 |
|
Successful returns from <b>pcre_dfa_exec()</b> |
| 1540 |
|
</b><br> |
| 1541 |
|
<P> |
| 1542 |
|
When <b>pcre_dfa_exec()</b> succeeds, it may have matched more than one |
| 1543 |
|
substring in the subject. Note, however, that all the matches from one run of |
| 1544 |
|
the function start at the same point in the subject. The shorter matches are |
| 1545 |
|
all initial substrings of the longer matches. For example, if the pattern |
| 1546 |
|
<pre> |
| 1547 |
|
<.*> |
| 1548 |
|
</pre> |
| 1549 |
|
is matched against the string |
| 1550 |
|
<pre> |
| 1551 |
|
This is <something> <something else> <something further> no more |
| 1552 |
|
</pre> |
| 1553 |
|
the three matched strings are |
| 1554 |
|
<pre> |
| 1555 |
|
<something> |
| 1556 |
|
<something> <something else> |
| 1557 |
|
<something> <something else> <something further> |
| 1558 |
|
</pre> |
| 1559 |
|
On success, the yield of the function is a number greater than zero, which is |
| 1560 |
|
the number of matched substrings. The substrings themselves are returned in |
| 1561 |
|
<i>ovector</i>. Each string uses two elements; the first is the offset to the |
| 1562 |
|
start, and the second is the offset to the end. All the strings have the same |
| 1563 |
|
start offset. (Space could have been saved by giving this only once, but it was |
| 1564 |
|
decided to retain some compatibility with the way <b>pcre_exec()</b> returns |
| 1565 |
|
data, even though the meaning of the strings is different.) |
| 1566 |
|
</P> |
| 1567 |
|
<P> |
| 1568 |
|
The strings are returned in reverse order of length; that is, the longest |
| 1569 |
|
matching string is given first. If there were too many matches to fit into |
| 1570 |
|
<i>ovector</i>, the yield of the function is zero, and the vector is filled with |
| 1571 |
|
the longest matches. |
| 1572 |
|
</P> |
| 1573 |
|
<br><b> |
| 1574 |
|
Error returns from <b>pcre_dfa_exec()</b> |
| 1575 |
|
</b><br> |
| 1576 |
|
<P> |
| 1577 |
|
The <b>pcre_dfa_exec()</b> function returns a negative number when it fails. |
| 1578 |
|
Many of the errors are the same as for <b>pcre_exec()</b>, and these are |
| 1579 |
|
described |
| 1580 |
|
<a href="#errorlist">above.</a> |
| 1581 |
|
There are in addition the following errors that are specific to |
| 1582 |
|
<b>pcre_dfa_exec()</b>: |
| 1583 |
|
<pre> |
| 1584 |
|
PCRE_ERROR_DFA_UITEM (-16) |
| 1585 |
|
</pre> |
| 1586 |
|
This return is given if <b>pcre_dfa_exec()</b> encounters an item in the pattern |
| 1587 |
|
that it does not support, for instance, the use of \C or a back reference. |
| 1588 |
|
<pre> |
| 1589 |
|
PCRE_ERROR_DFA_UCOND (-17) |
| 1590 |
|
</pre> |
| 1591 |
|
This return is given if <b>pcre_dfa_exec()</b> encounters a condition item in a |
| 1592 |
|
pattern that uses a back reference for the condition. This is not supported. |
| 1593 |
|
<pre> |
| 1594 |
|
PCRE_ERROR_DFA_UMLIMIT (-18) |
| 1595 |
|
</pre> |
| 1596 |
|
This return is given if <b>pcre_dfa_exec()</b> is called with an <i>extra</i> |
| 1597 |
|
block that contains a setting of the <i>match_limit</i> field. This is not |
| 1598 |
|
supported (it is meaningless). |
| 1599 |
|
<pre> |
| 1600 |
|
PCRE_ERROR_DFA_WSSIZE (-19) |
| 1601 |
|
</pre> |
| 1602 |
|
This return is given if <b>pcre_dfa_exec()</b> runs out of space in the |
| 1603 |
|
<i>workspace</i> vector. |
| 1604 |
|
<pre> |
| 1605 |
|
PCRE_ERROR_DFA_RECURSE (-20) |
| 1606 |
|
</pre> |
| 1607 |
|
When a recursive subpattern is processed, the matching function calls itself |
| 1608 |
|
recursively, using private vectors for <i>ovector</i> and <i>workspace</i>. This |
| 1609 |
|
error is given if the output vector is not large enough. This should be |
| 1610 |
|
extremely rare, as a vector of size 1000 is used. |
| 1611 |
|
</P> |
| 1612 |
<P> |
<P> |
| 1613 |
Last updated: 09 September 2004 |
Last updated: 16 May 2005 |
| 1614 |
<br> |
<br> |
| 1615 |
Copyright © 1997-2004 University of Cambridge. |
Copyright © 1997-2005 University of Cambridge. |
| 1616 |
<p> |
<p> |
| 1617 |
Return to the <a href="index.html">PCRE index page</a>. |
Return to the <a href="index.html">PCRE index page</a>. |
| 1618 |
</p> |
</p> |