| 318 |
.SS "Absolute and relative subroutine calls" |
.SS "Absolute and relative subroutine calls" |
| 319 |
.rs |
.rs |
| 320 |
.sp |
.sp |
| 321 |
For compatibility with Oniguruma, the non-Perl syntax \eg followed by a name or |
For compatibility with Oniguruma, the non-Perl syntax \eg followed by a name or |
| 322 |
a number enclosed either in angle brackets or single quotes, is an alternative |
a number enclosed either in angle brackets or single quotes, is an alternative |
| 323 |
syntax for referencing a subpattern as a "subroutine". Details are discussed |
syntax for referencing a subpattern as a "subroutine". Details are discussed |
| 324 |
.\" HTML <a href="#onigurumasubroutines"> |
.\" HTML <a href="#onigurumasubroutines"> |
| 325 |
.\" </a> |
.\" </a> |
| 326 |
later. |
later. |
| 327 |
.\" |
.\" |
| 328 |
Note that \eg{...} (Perl syntax) and \eg<...> (Oniguruma syntax) are \fInot\fP |
Note that \eg{...} (Perl syntax) and \eg<...> (Oniguruma syntax) are \fInot\fP |
| 329 |
synonymous. The former is a back reference; the latter is a subroutine call. |
synonymous. The former is a back reference; the latter is a subroutine call. |
| 330 |
. |
. |
| 331 |
. |
. |
| 1259 |
which may be several bytes long (and they may be of different lengths). |
which may be several bytes long (and they may be of different lengths). |
| 1260 |
.P |
.P |
| 1261 |
The quantifier {0} is permitted, causing the expression to behave as if the |
The quantifier {0} is permitted, causing the expression to behave as if the |
| 1262 |
previous item and the quantifier were not present. This may be useful for |
previous item and the quantifier were not present. This may be useful for |
| 1263 |
subpatterns that are referenced as |
subpatterns that are referenced as |
| 1264 |
.\" HTML <a href="#subpatternsassubroutines"> |
.\" HTML <a href="#subpatternsassubroutines"> |
| 1265 |
.\" </a> |
.\" </a> |
| 1266 |
subroutines |
subroutines |
| 1267 |
.\" |
.\" |
| 1268 |
from elsewhere in the pattern. Items other than subpatterns that have a {0} |
from elsewhere in the pattern. Items other than subpatterns that have a {0} |
| 1269 |
quantifier are omitted from the compiled pattern. |
quantifier are omitted from the compiled pattern. |
| 1270 |
.P |
.P |
| 1271 |
For convenience, the three most common quantifiers have single-character |
For convenience, the three most common quantifiers have single-character |
| 2053 |
.SH "ONIGURUMA SUBROUTINE SYNTAX" |
.SH "ONIGURUMA SUBROUTINE SYNTAX" |
| 2054 |
.rs |
.rs |
| 2055 |
.sp |
.sp |
| 2056 |
For compatibility with Oniguruma, the non-Perl syntax \eg followed by a name or |
For compatibility with Oniguruma, the non-Perl syntax \eg followed by a name or |
| 2057 |
a number enclosed either in angle brackets or single quotes, is an alternative |
a number enclosed either in angle brackets or single quotes, is an alternative |
| 2058 |
syntax for referencing a subpattern as a subroutine, possibly recursively. Here |
syntax for referencing a subpattern as a subroutine, possibly recursively. Here |
| 2059 |
are two of the examples used above, rewritten using this syntax: |
are two of the examples used above, rewritten using this syntax: |
| 2060 |
.sp |
.sp |
| 2061 |
(?<pn> \e( ( (?>[^()]+) | \eg<pn> )* \e) ) |
(?<pn> \e( ( (?>[^()]+) | \eg<pn> )* \e) ) |
| 2062 |
(sens|respons)e and \eg'1'ibility |
(sens|respons)e and \eg'1'ibility |
| 2063 |
.sp |
.sp |
| 2064 |
PCRE supports an extension to Oniguruma: if a number is preceded by a |
PCRE supports an extension to Oniguruma: if a number is preceded by a |
| 2065 |
plus or a minus sign it is taken as a relative reference. For example: |
plus or a minus sign it is taken as a relative reference. For example: |
| 2066 |
.sp |
.sp |
| 2067 |
(abc)(?i:\eg<-1>) |
(abc)(?i:\eg<-1>) |
| 2068 |
.sp |
.sp |
| 2069 |
Note that \eg{...} (Perl syntax) and \eg<...> (Oniguruma syntax) are \fInot\fP |
Note that \eg{...} (Perl syntax) and \eg<...> (Oniguruma syntax) are \fInot\fP |
| 2070 |
synonymous. The former is a back reference; the latter is a subroutine call. |
synonymous. The former is a back reference; the latter is a subroutine call. |
| 2071 |
. |
. |
| 2072 |
. |
. |
| 2117 |
.P |
.P |
| 2118 |
Since these verbs are specifically related to backtracking, most of them can be |
Since these verbs are specifically related to backtracking, most of them can be |
| 2119 |
used only when the pattern is to be matched using \fBpcre_exec()\fP, which uses |
used only when the pattern is to be matched using \fBpcre_exec()\fP, which uses |
| 2120 |
a backtracking algorithm. With the exception of (*FAIL), which behaves like a |
a backtracking algorithm. With the exception of (*FAIL), which behaves like a |
| 2121 |
failing negative assertion, they cause an error if encountered by |
failing negative assertion, they cause an error if encountered by |
| 2122 |
\fBpcre_dfa_exec()\fP. |
\fBpcre_dfa_exec()\fP. |
| 2123 |
.P |
.P |