| 2644 |
overall match fails. If (*THEN) is not directly inside an alternation, it acts |
overall match fails. If (*THEN) is not directly inside an alternation, it acts |
| 2645 |
like (*PRUNE). |
like (*PRUNE). |
| 2646 |
. |
. |
| 2647 |
|
.P |
| 2648 |
|
The above verbs provide four different "strengths" of control when subsequent |
| 2649 |
|
matching fails. (*THEN) is the weakest, carrying on the match at the next |
| 2650 |
|
alternation. (*PRUNE) comes next, failing the match at the current starting |
| 2651 |
|
position, but allowing an advance to the next character (for an unanchored |
| 2652 |
|
pattern). (*SKIP) is similar, except that the advance may be more than one |
| 2653 |
|
character. (*COMMIT) is the strongest, causing the entire match to fail. |
| 2654 |
|
.P |
| 2655 |
|
If more than one is present in a pattern, the "stongest" one wins. For example, |
| 2656 |
|
consider this pattern, where A, B, etc. are complex pattern fragments: |
| 2657 |
|
.sp |
| 2658 |
|
(A(*COMMIT)B(*THEN)C|D) |
| 2659 |
|
.sp |
| 2660 |
|
Once A has matched, PCRE is committed to this match, at the current starting |
| 2661 |
|
position. If subsequently B matches, but C does not, the normal (*THEN) action |
| 2662 |
|
of trying the next alternation (that is, D) does not happen because (*COMMIT) |
| 2663 |
|
overrides. |
| 2664 |
|
. |
| 2665 |
. |
. |
| 2666 |
.SH "SEE ALSO" |
.SH "SEE ALSO" |
| 2667 |
.rs |
.rs |