| 30 |
PCRE when its main matching function, \fBpcre_exec()\fP, is used. |
PCRE when its main matching function, \fBpcre_exec()\fP, is used. |
| 31 |
From release 6.0, PCRE offers a second matching function, |
From release 6.0, PCRE offers a second matching function, |
| 32 |
\fBpcre_dfa_exec()\fP, which matches using a different algorithm that is not |
\fBpcre_dfa_exec()\fP, which matches using a different algorithm that is not |
| 33 |
Perl-compatible. The advantages and disadvantages of the alternative function, |
Perl-compatible. Some of the features discussed below are not available when |
| 34 |
and how it differs from the normal function, are discussed in the |
\fBpcre_dfa_exec()\fP is used. The advantages and disadvantages of the |
| 35 |
|
alternative function, and how it differs from the normal function, are |
| 36 |
|
discussed in the |
| 37 |
.\" HREF |
.\" HREF |
| 38 |
\fBpcrematching\fP |
\fBpcrematching\fP |
| 39 |
.\" |
.\" |
| 521 |
properties in PCRE. |
properties in PCRE. |
| 522 |
. |
. |
| 523 |
. |
. |
| 524 |
|
.\" HTML <a name="resetmatchstart"></a> |
| 525 |
|
.SS "Resetting the match start" |
| 526 |
|
.rs |
| 527 |
|
.sp |
| 528 |
|
The escape sequence \eK, which is a Perl 5.10 feature, causes any previously |
| 529 |
|
matched characters not to be included in the final matched sequence. For |
| 530 |
|
example, the pattern: |
| 531 |
|
.sp |
| 532 |
|
foo\eKbar |
| 533 |
|
.sp |
| 534 |
|
matches "foobar", but reports that it has matched "bar". This feature is |
| 535 |
|
similar to a lookbehind assertion |
| 536 |
|
.\" HTML <a href="#lookbehind"> |
| 537 |
|
.\" </a> |
| 538 |
|
(described below). |
| 539 |
|
.\" |
| 540 |
|
However, in this case, the part of the subject before the real match does not |
| 541 |
|
have to be of fixed length, as lookbehind assertions do. The use of \eK does |
| 542 |
|
not interfere with the setting of |
| 543 |
|
.\" HTML <a href="#subpattern"> |
| 544 |
|
.\" </a> |
| 545 |
|
captured substrings. |
| 546 |
|
.\" |
| 547 |
|
For example, when the pattern |
| 548 |
|
.sp |
| 549 |
|
(foo)\eKbar |
| 550 |
|
.sp |
| 551 |
|
matches "foobar", the first substring is still set to "foo". |
| 552 |
|
. |
| 553 |
|
. |
| 554 |
.\" HTML <a name="smallassertions"></a> |
.\" HTML <a name="smallassertions"></a> |
| 555 |
.SS "Simple assertions" |
.SS "Simple assertions" |
| 556 |
.rs |
.rs |
| 1453 |
.sp |
.sp |
| 1454 |
(?<=abc|abde) |
(?<=abc|abde) |
| 1455 |
.sp |
.sp |
| 1456 |
|
In some cases, the Perl 5.10 escape sequence \eK |
| 1457 |
|
.\" HTML <a href="#resetmatchstart"> |
| 1458 |
|
.\" </a> |
| 1459 |
|
(see above) |
| 1460 |
|
.\" |
| 1461 |
|
can be used instead of a lookbehind assertion; this is not restricted to a |
| 1462 |
|
fixed-length. |
| 1463 |
|
.P |
| 1464 |
The implementation of lookbehind assertions is, for each alternative, to |
The implementation of lookbehind assertions is, for each alternative, to |
| 1465 |
temporarily move the current position back by the fixed length and then try to |
temporarily move the current position back by the fixed length and then try to |
| 1466 |
match. If there are insufficient characters before the current position, the |
match. If there are insufficient characters before the current position, the |
| 1893 |
.rs |
.rs |
| 1894 |
.sp |
.sp |
| 1895 |
.nf |
.nf |
| 1896 |
Last updated: 09 May 2007 |
Last updated: 29 May 2007 |
| 1897 |
Copyright (c) 1997-2007 University of Cambridge. |
Copyright (c) 1997-2007 University of Cambridge. |
| 1898 |
.fi |
.fi |