| 1175 |
.sp |
.sp |
| 1176 |
/(?|(abc)|(def))(?1)/ |
/(?|(abc)|(def))(?1)/ |
| 1177 |
.sp |
.sp |
|
.P |
|
| 1178 |
An alternative approach to using the "branch reset" feature is to use |
An alternative approach to using the "branch reset" feature is to use |
| 1179 |
duplicate named subpatterns, as described in the next section. |
duplicate named subpatterns, as described in the next section. |
| 1180 |
. |
. |
| 1215 |
is also a convenience function for extracting a captured substring by name. |
is also a convenience function for extracting a captured substring by name. |
| 1216 |
.P |
.P |
| 1217 |
By default, a name must be unique within a pattern, but it is possible to relax |
By default, a name must be unique within a pattern, but it is possible to relax |
| 1218 |
this constraint by setting the PCRE_DUPNAMES option at compile time. This can |
this constraint by setting the PCRE_DUPNAMES option at compile time. (Duplicate |
| 1219 |
be useful for patterns where only one instance of the named parentheses can |
names are also always permitted for subpatterns with the same number, set up as |
| 1220 |
match. Suppose you want to match the name of a weekday, either as a 3-letter |
described in the previous section.) Duplicate names can be useful for patterns |
| 1221 |
abbreviation or as the full name, and in both cases you want to extract the |
where only one instance of the named parentheses can match. Suppose you want to |
| 1222 |
abbreviation. This pattern (ignoring the line breaks) does the job: |
match the name of a weekday, either as a 3-letter abbreviation or as the full |
| 1223 |
|
name, and in both cases you want to extract the abbreviation. This pattern |
| 1224 |
|
(ignoring the line breaks) does the job: |
| 1225 |
.sp |
.sp |
| 1226 |
(?<DN>Mon|Fri|Sun)(?:day)?| |
(?<DN>Mon|Fri|Sun)(?:day)?| |
| 1227 |
(?<DN>Tue)(?:sday)?| |
(?<DN>Tue)(?:sday)?| |
| 1245 |
documentation. |
documentation. |
| 1246 |
.P |
.P |
| 1247 |
\fBWarning:\fP You cannot use different names to distinguish between two |
\fBWarning:\fP You cannot use different names to distinguish between two |
| 1248 |
subpatterns with the same number (see the previous section) because PCRE uses |
subpatterns with the same number because PCRE uses only the numbers when |
| 1249 |
only the numbers when matching. |
matching. For this reason, an error is given at compile time if different names |
| 1250 |
|
are given to subpatterns with the same number. However, you can give the same |
| 1251 |
|
name to subpatterns with the same number, even when PCRE_DUPNAMES is not set. |
| 1252 |
. |
. |
| 1253 |
. |
. |
| 1254 |
.SH REPETITION |
.SH REPETITION |
| 2391 |
.rs |
.rs |
| 2392 |
.sp |
.sp |
| 2393 |
.nf |
.nf |
| 2394 |
Last updated: 30 September 2009 |
Last updated: 03 October 2009 |
| 2395 |
Copyright (c) 1997-2009 University of Cambridge. |
Copyright (c) 1997-2009 University of Cambridge. |
| 2396 |
.fi |
.fi |