| 104 |
compilation. It should be zero if no options are required. Those options that |
compilation. It should be zero if no options are required. Those options that |
| 105 |
are compabible with Perl can also be set at compile time from within the |
are compabible with Perl can also be set at compile time from within the |
| 106 |
pattern (see the detailed description of regular expressions below) and all |
pattern (see the detailed description of regular expressions below) and all |
| 107 |
options except PCRE_EXTENDED and PCRE_EXTRA can be set at the time of matching. |
options except PCRE_EXTENDED, PCRE_EXTRA and PCRE_UNGREEDY can be set at the |
| 108 |
|
time of matching. |
| 109 |
.PP |
.PP |
| 110 |
If \fIerrptr\fR is NULL, \fBpcre_compile()\fR returns NULL immediately. |
If \fIerrptr\fR is NULL, \fBpcre_compile()\fR returns NULL immediately. |
| 111 |
Otherwise, if compilation of a pattern fails, \fBpcre_compile()\fR returns |
Otherwise, if compilation of a pattern fails, \fBpcre_compile()\fR returns |
| 183 |
(2) Once a subpattern enclosed in (?>subpat) brackets has matched, |
(2) Once a subpattern enclosed in (?>subpat) brackets has matched, |
| 184 |
backtracking never goes back into the pattern. |
backtracking never goes back into the pattern. |
| 185 |
|
|
| 186 |
See below for further details of both of these. |
See below for further details of both of these. PCRE_EXTRA can be set by a (?X) |
| 187 |
|
option setting within the pattern, but this must precede anything in the |
| 188 |
|
pattern which relies on its being set. |
| 189 |
|
|
| 190 |
|
PCRE_UNGREEDY |
| 191 |
|
|
| 192 |
|
This option inverts the "greediness" of the quantifiers so that they are not |
| 193 |
|
greedy by default, but become greedy if followed by "?". It is not compatible |
| 194 |
|
with Perl. It can also be set by a (?U) option setting within the pattern. |
| 195 |
|
|
| 196 |
|
|
| 197 |
|
|
| 428 |
faulted. There is also a new kind of parenthesized subpattern starting with (?> |
faulted. There is also a new kind of parenthesized subpattern starting with (?> |
| 429 |
which has a block on backtracking into it once it has matched. |
which has a block on backtracking into it once it has matched. |
| 430 |
|
|
| 431 |
|
(c) If PCRE_UNGREEDY is set, the greediness of the repetition quantifiers is |
| 432 |
|
inverted, that is, by default they are not greedy, but if followed by a |
| 433 |
|
question mark they are. |
| 434 |
|
|
| 435 |
|
|
| 436 |
.SH REGULAR EXPRESSION DETAILS |
.SH REGULAR EXPRESSION DETAILS |
| 437 |
The syntax and semantics of the regular expressions supported by PCRE are |
The syntax and semantics of the regular expressions supported by PCRE are |
| 879 |
which matches one digit by preference, but can match two if that is the only |
which matches one digit by preference, but can match two if that is the only |
| 880 |
way the rest of the pattern matches. |
way the rest of the pattern matches. |
| 881 |
|
|
| 882 |
|
If the PCRE_UNGREEDY option is set (an option which is not available in Perl) |
| 883 |
|
then the quantifiers are not greedy by default, but individual ones can be made |
| 884 |
|
greedy by following they by a question mark. In other words, it inverts the |
| 885 |
|
default behaviour. |
| 886 |
|
|
| 887 |
When a parenthesized subpattern is quantified with a minimum repeat count that |
When a parenthesized subpattern is quantified with a minimum repeat count that |
| 888 |
is greater than 1 or with a limited maximum, more store is required for the |
is greater than 1 or with a limited maximum, more store is required for the |
| 889 |
compiled pattern, in proportion to the size of the minimum or maximum. |
compiled pattern, in proportion to the size of the minimum or maximum. |
| 1004 |
comment that lasts till the next newline. The option applies to the whole |
comment that lasts till the next newline. The option applies to the whole |
| 1005 |
pattern, not just to the portion that follows it. |
pattern, not just to the portion that follows it. |
| 1006 |
|
|
| 1007 |
|
If the sequence (?U) occurs anywhere in a pattern, it has the effect of setting |
| 1008 |
|
the PCRE_UNGREEDY option which inverts the greediness of quantifiers. This is |
| 1009 |
|
an extension to Perl's facilities. |
| 1010 |
|
|
| 1011 |
|
If the sequence (?X) occurs in a pattern, it has the effect of setting the |
| 1012 |
|
PCRE_EXTRA flag, which turns on some additional features not found in Perl. |
| 1013 |
|
This flag setting is special in that it must occur earlier in the pattern than |
| 1014 |
|
any of the additional features. It is best put at the start. |
| 1015 |
|
|
| 1016 |
If more than one option is required, they can be specified jointly, for example |
If more than one option is required, they can be specified jointly, for example |
| 1017 |
as (?ix) or (?mi). |
as (?ix) or (?mi). |
| 1018 |
|
|