/[pcre]/code/trunk/doc/html/pcrepattern.html
ViewVC logotype

Diff of /code/trunk/doc/html/pcrepattern.html

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1297 by ph10, Sun Nov 11 20:27:03 2012 UTC revision 1298 by ph10, Fri Mar 22 16:13:13 2013 UTC
# Line 806  Unicode table. Line 806  Unicode table.
806  </P>  </P>
807  <P>  <P>
808  Specifying caseless matching does not affect these escape sequences. For  Specifying caseless matching does not affect these escape sequences. For
809  example, \p{Lu} always matches only upper case letters.  example, \p{Lu} always matches only upper case letters. This is different from
810    the behaviour of current versions of Perl.
811  </P>  </P>
812  <P>  <P>
813  Matching characters by Unicode property is not fast, because PCRE has to do a  Matching characters by Unicode property is not fast, because PCRE has to do a
# Line 871  PCRE's additional properties Line 872  PCRE's additional properties
872  As well as the standard Unicode properties described above, PCRE supports four  As well as the standard Unicode properties described above, PCRE supports four
873  more that make it possible to convert traditional escape sequences such as \w  more that make it possible to convert traditional escape sequences such as \w
874  and \s and POSIX character classes to use Unicode properties. PCRE uses these  and \s and POSIX character classes to use Unicode properties. PCRE uses these
875  non-standard, non-Perl properties internally when PCRE_UCP is set. They are:  non-standard, non-Perl properties internally when PCRE_UCP is set. However,
876    they may also be used explicitly. These properties are:
877  <pre>  <pre>
878    Xan   Any alphanumeric character    Xan   Any alphanumeric character
879    Xps   Any POSIX space character    Xps   Any POSIX space character
# Line 883  property. Xps matches the characters tab Line 885  property. Xps matches the characters tab
885  carriage return, and any other character that has the Z (separator) property.  carriage return, and any other character that has the Z (separator) property.
886  Xsp is the same as Xps, except that vertical tab is excluded. Xwd matches the  Xsp is the same as Xps, except that vertical tab is excluded. Xwd matches the
887  same characters as Xan, plus underscore.  same characters as Xan, plus underscore.
888    </P>
889    <P>
890    There is another non-standard property, Xuc, which matches any character that
891    can be represented by a Universal Character Name in C++ and other programming
892    languages. These are the characters $, @, ` (grave accent), and all characters
893    with Unicode code points greater than or equal to U+00A0, except for the
894    surrogates U+D800 to U+DFFF. Note that most base (ASCII) characters are
895    excluded. (Universal Character Names are of the form \uHHHH or \UHHHHHHHH
896    where H is a hexadecimal digit. Note that the Xuc property does not match these
897    sequences but the characters that they represent.)
898  <a name="resetmatchstart"></a></P>  <a name="resetmatchstart"></a></P>
899  <br><b>  <br><b>
900  Resetting the match start  Resetting the match start
# Line 1950  except that it does not cause the curren Line 1962  except that it does not cause the curren
1962  Assertion subpatterns are not capturing subpatterns. If such an assertion  Assertion subpatterns are not capturing subpatterns. If such an assertion
1963  contains capturing subpatterns within it, these are counted for the purposes of  contains capturing subpatterns within it, these are counted for the purposes of
1964  numbering the capturing subpatterns in the whole pattern. However, substring  numbering the capturing subpatterns in the whole pattern. However, substring
1965  capturing is carried out only for positive assertions, because it does not make  capturing is carried out only for positive assertions. (Perl sometimes, but not
1966  sense for negative assertions.  always, does do capturing in negative assertions.)
1967  </P>  </P>
1968  <P>  <P>
1969  For compatibility with Perl, assertion subpatterns may be repeated; though  For compatibility with Perl, assertion subpatterns may be repeated; though
# Line 2605  For example, this pattern has two callou Line 2617  For example, this pattern has two callou
2617  </pre>  </pre>
2618  If the PCRE_AUTO_CALLOUT flag is passed to a compiling function, callouts are  If the PCRE_AUTO_CALLOUT flag is passed to a compiling function, callouts are
2619  automatically installed before each item in the pattern. They are all numbered  automatically installed before each item in the pattern. They are all numbered
2620  255.  255. If there is a conditional group in the pattern whose condition is an
2621    assertion, an additional callout is inserted just before the condition. An
2622    explicit callout may also be set at this position, as in this example:
2623    <pre>
2624      (?(?C9)(?=a)abc|def)
2625    </pre>
2626    Note that this applies only to assertion conditions, not to other types of
2627    condition.
2628  </P>  </P>
2629  <P>  <P>
2630  During matching, when PCRE reaches a callout point, the external function is  During matching, when PCRE reaches a callout point, the external function is
# Line 2620  documentation. Line 2639  documentation.
2639  <br><a name="SEC26" href="#TOC1">BACKTRACKING CONTROL</a><br>  <br><a name="SEC26" href="#TOC1">BACKTRACKING CONTROL</a><br>
2640  <P>  <P>
2641  Perl 5.10 introduced a number of "Special Backtracking Control Verbs", which  Perl 5.10 introduced a number of "Special Backtracking Control Verbs", which
2642  are described in the Perl documentation as "experimental and subject to change  are still described in the Perl documentation as "experimental and subject to
2643  or removal in a future version of Perl". It goes on to say: "Their usage in  change or removal in a future version of Perl". It goes on to say: "Their usage
2644  production code should be noted to avoid problems during upgrades." The same  in production code should be noted to avoid problems during upgrades." The same
2645  remarks apply to the PCRE features described in this section.  remarks apply to the PCRE features described in this section.
2646  </P>  </P>
2647  <P>  <P>
 Since these verbs are specifically related to backtracking, most of them can be  
 used only when the pattern is to be matched using one of the traditional  
 matching functions, which use a backtracking algorithm. With the exception of  
 (*FAIL), which behaves like a failing negative assertion, they cause an error  
 if encountered by a DFA matching function.  
 </P>  
 <P>  
 If any of these verbs are used in an assertion or in a subpattern that is  
 called as a subroutine (whether or not recursively), their effect is confined  
 to that subpattern; it does not extend to the surrounding pattern, with one  
 exception: the name from a *(MARK), (*PRUNE), or (*THEN) that is encountered in  
 a successful positive assertion <i>is</i> passed back when a match succeeds  
 (compare capturing parentheses in assertions). Note that such subpatterns are  
 processed as anchored at the point where they are tested. Note also that Perl's  
 treatment of subroutines and assertions is different in some cases.  
 </P>  
 <P>  
2648  The new verbs make use of what was previously invalid syntax: an opening  The new verbs make use of what was previously invalid syntax: an opening
2649  parenthesis followed by an asterisk. They are generally of the form  parenthesis followed by an asterisk. They are generally of the form
2650  (*VERB) or (*VERB:NAME). Some may take either form, with differing behaviour,  (*VERB) or (*VERB:NAME). Some may take either form, with differing behaviour,
2651  depending on whether or not an argument is present. A name is any sequence of  depending on whether or not a name is present. A name is any sequence of
2652  characters that does not include a closing parenthesis. The maximum length of  characters that does not include a closing parenthesis. The maximum length of
2653  name is 255 in the 8-bit library and 65535 in the 16-bit and 32-bit library.  name is 255 in the 8-bit library and 65535 in the 16-bit and 32-bit libraries.
2654  If the name is empty, that is, if the closing parenthesis immediately follows  If the name is empty, that is, if the closing parenthesis immediately follows
2655  the colon, the effect is as if the colon were not there. Any number of these  the colon, the effect is as if the colon were not there. Any number of these
2656  verbs may occur in a pattern.  verbs may occur in a pattern.
2657    </P>
2658    <P>
2659    Since these verbs are specifically related to backtracking, most of them can be
2660    used only when the pattern is to be matched using one of the traditional
2661    matching functions, because these use a backtracking algorithm. With the
2662    exception of (*FAIL), which behaves like a failing negative assertion, the
2663    backtracking control verbs cause an error if encountered by a DFA matching
2664    function.
2665    </P>
2666    <P>
2667    The behaviour of these verbs in
2668    <a href="#btrepeat">repeated groups,</a>
2669    <a href="#btassert">assertions,</a>
2670    and in
2671    <a href="#btsub">subpatterns called as subroutines</a>
2672    (whether or not recursively) is documented below.
2673  <a name="nooptimize"></a></P>  <a name="nooptimize"></a></P>
2674  <br><b>  <br><b>
2675  Optimizations that affect backtracking verbs  Optimizations that affect backtracking verbs
# Line 2660  Optimizations that affect backtracking v Line 2678  Optimizations that affect backtracking v
2678  PCRE contains some optimizations that are used to speed up matching by running  PCRE contains some optimizations that are used to speed up matching by running
2679  some checks at the start of each match attempt. For example, it may know the  some checks at the start of each match attempt. For example, it may know the
2680  minimum length of matching subject, or that a particular character must be  minimum length of matching subject, or that a particular character must be
2681  present. When one of these optimizations suppresses the running of a match, any  present. When one of these optimizations bypasses the running of a match, any
2682  included backtracking verbs will not, of course, be processed. You can suppress  included backtracking verbs will not, of course, be processed. You can suppress
2683  the start-of-match optimizations by setting the PCRE_NO_START_OPTIMIZE option  the start-of-match optimizations by setting the PCRE_NO_START_OPTIMIZE option
2684  when calling <b>pcre_compile()</b> or <b>pcre_exec()</b>, or by starting the  when calling <b>pcre_compile()</b> or <b>pcre_exec()</b>, or by starting the
# Line 2687  followed by a name. Line 2705  followed by a name.
2705  This verb causes the match to end successfully, skipping the remainder of the  This verb causes the match to end successfully, skipping the remainder of the
2706  pattern. However, when it is inside a subpattern that is called as a  pattern. However, when it is inside a subpattern that is called as a
2707  subroutine, only that subpattern is ended successfully. Matching then continues  subroutine, only that subpattern is ended successfully. Matching then continues
2708  at the outer level. If (*ACCEPT) is inside capturing parentheses, the data so  at the outer level. If (*ACCEPT) in triggered in a positive assertion, the
2709  far is captured. For example:  assertion succeeds; in a negative assertion, the assertion fails.
2710    </P>
2711    <P>
2712    If (*ACCEPT) is inside capturing parentheses, the data so far is captured. For
2713    example:
2714  <pre>  <pre>
2715    A((?:A|B(*ACCEPT)|C)D)    A((?:A|B(*ACCEPT)|C)D)
2716  </pre>  </pre>
# Line 2722  A name is always required with this verb Line 2744  A name is always required with this verb
2744  (*MARK) as you like in a pattern, and their names do not have to be unique.  (*MARK) as you like in a pattern, and their names do not have to be unique.
2745  </P>  </P>
2746  <P>  <P>
2747  When a match succeeds, the name of the last-encountered (*MARK) on the matching  When a match succeeds, the name of the last-encountered (*MARK:NAME),
2748  path is passed back to the caller as described in the section entitled  (*PRUNE:NAME), or (*THEN:NAME) on the matching path is passed back to the
2749    caller as described in the section entitled
2750  <a href="pcreapi.html#extradata">"Extra data for <b>pcre_exec()</b>"</a>  <a href="pcreapi.html#extradata">"Extra data for <b>pcre_exec()</b>"</a>
2751  in the  in the
2752  <a href="pcreapi.html"><b>pcreapi</b></a>  <a href="pcreapi.html"><b>pcreapi</b></a>
# Line 2744  of obtaining this information than putti Line 2767  of obtaining this information than putti
2767  capturing parentheses.  capturing parentheses.
2768  </P>  </P>
2769  <P>  <P>
2770  If (*MARK) is encountered in a positive assertion, its name is recorded and  If a verb with a name is encountered in a positive assertion, its name is
2771  passed back if it is the last-encountered. This does not happen for negative  recorded and passed back if it is the last-encountered. This does not happen
2772  assertions.  for negative assertions.
2773  </P>  </P>
2774  <P>  <P>
2775  After a partial match or a failed match, the name of the last encountered  After a partial match or a failed match, the last encountered name in the
2776  (*MARK) in the entire match process is returned. For example:  entire match process is returned. For example:
2777  <pre>  <pre>
2778      re&#62; /X(*MARK:A)Y|X(*MARK:B)Z/K      re&#62; /X(*MARK:A)Y|X(*MARK:B)Z/K
2779    data&#62; XP    data&#62; XP
# Line 2774  Verbs that act after backtracking Line 2797  Verbs that act after backtracking
2797  The following verbs do nothing when they are encountered. Matching continues  The following verbs do nothing when they are encountered. Matching continues
2798  with what follows, but if there is no subsequent match, causing a backtrack to  with what follows, but if there is no subsequent match, causing a backtrack to
2799  the verb, a failure is forced. That is, backtracking cannot pass to the left of  the verb, a failure is forced. That is, backtracking cannot pass to the left of
2800  the verb. However, when one of these verbs appears inside an atomic group, its  the verb. However, when one of these verbs appears inside an atomic group or an
2801  effect is confined to that group, because once the group has been matched,  assertion, its effect is confined to that group, because once the group has
2802  there is never any backtracking into it. In this situation, backtracking can  been matched, there is never any backtracking into it. In this situation,
2803  "jump back" to the left of the entire atomic group. (Remember also, as stated  backtracking can "jump back" to the left of the entire atomic group or
2804  above, that this localization also applies in subroutine calls and assertions.)  assertion. (Remember also, as stated above, that this localization also applies
2805    in subroutine calls.)
2806  </P>  </P>
2807  <P>  <P>
2808  These verbs differ in exactly what kind of failure occurs when backtracking  These verbs differ in exactly what kind of failure occurs when backtracking
# Line 2787  reaches them. Line 2811  reaches them.
2811    (*COMMIT)    (*COMMIT)
2812  </pre>  </pre>
2813  This verb, which may not be followed by a name, causes the whole match to fail  This verb, which may not be followed by a name, causes the whole match to fail
2814  outright if the rest of the pattern does not match. Even if the pattern is  outright if there is a later matching failure that causes backtracking to reach
2815  unanchored, no further attempts to find a match by advancing the starting point  it. Even if the pattern is unanchored, no further attempts to find a match by
2816  take place. Once (*COMMIT) has been passed, <b>pcre_exec()</b> is committed to  advancing the starting point take place. If (*COMMIT) is the only backtracking
2817  finding a match at the current starting point, or not at all. For example:  verb that is encountered, once it has been passed <b>pcre_exec()</b> is
2818    committed to finding a match at the current starting point, or not at all. For
2819    example:
2820  <pre>  <pre>
2821    a+(*COMMIT)b    a+(*COMMIT)b
2822  </pre>  </pre>
# Line 2800  recently passed (*MARK) in the path is p Line 2826  recently passed (*MARK) in the path is p
2826  match failure.  match failure.
2827  </P>  </P>
2828  <P>  <P>
2829    If there is more than one backtracking verb in a pattern, a different one that
2830    follows (*COMMIT) may be triggered first, so merely passing (*COMMIT) during a
2831    match does not always guarantee that a match must be at this starting point.
2832    </P>
2833    <P>
2834  Note that (*COMMIT) at the start of a pattern is not the same as an anchor,  Note that (*COMMIT) at the start of a pattern is not the same as an anchor,
2835  unless PCRE's start-of-match optimizations are turned off, as shown in this  unless PCRE's start-of-match optimizations are turned off, as shown in this
2836  <b>pcretest</b> example:  <b>pcretest</b> example:
# Line 2819  starting points. Line 2850  starting points.
2850    (*PRUNE) or (*PRUNE:NAME)    (*PRUNE) or (*PRUNE:NAME)
2851  </pre>  </pre>
2852  This verb causes the match to fail at the current starting position in the  This verb causes the match to fail at the current starting position in the
2853  subject if the rest of the pattern does not match. If the pattern is  subject if there is a later matching failure that causes backtracking to reach
2854  unanchored, the normal "bumpalong" advance to the next starting character then  it. If the pattern is unanchored, the normal "bumpalong" advance to the next
2855  happens. Backtracking can occur as usual to the left of (*PRUNE), before it is  starting character then happens. Backtracking can occur as usual to the left of
2856  reached, or when matching to the right of (*PRUNE), but if there is no match to  (*PRUNE), before it is reached, or when matching to the right of (*PRUNE), but
2857  the right, backtracking cannot cross (*PRUNE). In simple cases, the use of  if there is no match to the right, backtracking cannot cross (*PRUNE). In
2858  (*PRUNE) is just an alternative to an atomic group or possessive quantifier,  simple cases, the use of (*PRUNE) is just an alternative to an atomic group or
2859  but there are some uses of (*PRUNE) that cannot be expressed in any other way.  possessive quantifier, but there are some uses of (*PRUNE) that cannot be
2860  The behaviour of (*PRUNE:NAME) is the same as (*MARK:NAME)(*PRUNE). In an  expressed in any other way. In an anchored pattern (*PRUNE) has the same effect
2861  anchored pattern (*PRUNE) has the same effect as (*COMMIT).  as (*COMMIT).
2862    </P>
2863    <P>
2864    The behaviour of (*PRUNE:NAME) is the not the same as (*MARK:NAME)(*PRUNE).
2865    It is like (*MARK:NAME) in that the name is remembered for passing back to the
2866    caller. However, (*SKIP:NAME) searches only for names set with (*MARK).
2867  <pre>  <pre>
2868    (*SKIP)    (*SKIP)
2869  </pre>  </pre>
# Line 2848  instead of skipping on to "c". Line 2884  instead of skipping on to "c".
2884  <pre>  <pre>
2885    (*SKIP:NAME)    (*SKIP:NAME)
2886  </pre>  </pre>
2887  When (*SKIP) has an associated name, its behaviour is modified. If the  When (*SKIP) has an associated name, its behaviour is modified. When it is
2888  following pattern fails to match, the previous path through the pattern is  triggered, the previous path through the pattern is searched for the most
2889  searched for the most recent (*MARK) that has the same name. If one is found,  recent (*MARK) that has the same name. If one is found, the "bumpalong" advance
2890  the "bumpalong" advance is to the subject position that corresponds to that  is to the subject position that corresponds to that (*MARK) instead of to where
2891  (*MARK) instead of to where (*SKIP) was encountered. If no (*MARK) with a  (*SKIP) was encountered. If no (*MARK) with a matching name is found, the
2892  matching name is found, the (*SKIP) is ignored.  (*SKIP) is ignored.
2893    </P>
2894    <P>
2895    Note that (*SKIP:NAME) searches only for names set by (*MARK:NAME). It ignores
2896    names that are set by (*PRUNE:NAME) or (*THEN:NAME).
2897  <pre>  <pre>
2898    (*THEN) or (*THEN:NAME)    (*THEN) or (*THEN:NAME)
2899  </pre>  </pre>
2900  This verb causes a skip to the next innermost alternative if the rest of the  This verb causes a skip to the next innermost alternative when backtracking
2901  pattern does not match. That is, it cancels pending backtracking, but only  reaches it. That is, it cancels any further backtracking within the current
2902  within the current alternative. Its name comes from the observation that it can  alternative. Its name comes from the observation that it can be used for a
2903  be used for a pattern-based if-then-else block:  pattern-based if-then-else block:
2904  <pre>  <pre>
2905    ( COND1 (*THEN) FOO | COND2 (*THEN) BAR | COND3 (*THEN) BAZ ) ...    ( COND1 (*THEN) FOO | COND2 (*THEN) BAR | COND3 (*THEN) BAZ ) ...
2906  </pre>  </pre>
2907  If the COND1 pattern matches, FOO is tried (and possibly further items after  If the COND1 pattern matches, FOO is tried (and possibly further items after
2908  the end of the group if FOO succeeds); on failure, the matcher skips to the  the end of the group if FOO succeeds); on failure, the matcher skips to the
2909  second alternative and tries COND2, without backtracking into COND1. The  second alternative and tries COND2, without backtracking into COND1.
 behaviour of (*THEN:NAME) is exactly the same as (*MARK:NAME)(*THEN).  
2910  If (*THEN) is not inside an alternation, it acts like (*PRUNE).  If (*THEN) is not inside an alternation, it acts like (*PRUNE).
2911  </P>  </P>
2912  <P>  <P>
2913  Note that a subpattern that does not contain a | character is just a part of  The behaviour of (*THEN:NAME) is the not the same as (*MARK:NAME)(*THEN).
2914  the enclosing alternative; it is not a nested alternation with only one  It is like (*MARK:NAME) in that the name is remembered for passing back to the
2915    caller. However, (*SKIP:NAME) searches only for names set with (*MARK).
2916    </P>
2917    <P>
2918    A subpattern that does not contain a | character is just a part of the
2919    enclosing alternative; it is not a nested alternation with only one
2920  alternative. The effect of (*THEN) extends beyond such a subpattern to the  alternative. The effect of (*THEN) extends beyond such a subpattern to the
2921  enclosing alternative. Consider this pattern, where A, B, etc. are complex  enclosing alternative. Consider this pattern, where A, B, etc. are complex
2922  pattern fragments that do not contain any | characters at this level:  pattern fragments that do not contain any | characters at this level:
# Line 2892  because there are no more alternatives t Line 2936  because there are no more alternatives t
2936  backtrack into A.  backtrack into A.
2937  </P>  </P>
2938  <P>  <P>
2939  Note also that a conditional subpattern is not considered as having two  Note that a conditional subpattern is not considered as having two
2940  alternatives, because only one is ever used. In other words, the | character in  alternatives, because only one is ever used. In other words, the | character in
2941  a conditional subpattern has a different meaning. Ignoring white space,  a conditional subpattern has a different meaning. Ignoring white space,
2942  consider:  consider:
# Line 2916  unanchored pattern). (*SKIP) is similar, Line 2960  unanchored pattern). (*SKIP) is similar,
2960  than one character. (*COMMIT) is the strongest, causing the entire match to  than one character. (*COMMIT) is the strongest, causing the entire match to
2961  fail.  fail.
2962  </P>  </P>
2963    <br><b>
2964    More than one backtracking verb
2965    </b><br>
2966    <P>
2967    If more than one backtracking verb is present in a pattern, the one that is
2968    backtracked onto first acts. For example, consider this pattern, where A, B,
2969    etc. are complex pattern fragments:
2970    <pre>
2971      (A(*COMMIT)B(*THEN)C|ABD)
2972    </pre>
2973    If A matches but B fails, the backtrack to (*COMMIT) causes the entire match to
2974    fail. However, if A and B match, but C fails, the backtrack to (*THEN) causes
2975    the next alternative (ABD) to be tried. This behaviour is consistent, but is
2976    not always the same as Perl's. It means that if two or more backtracking verbs
2977    appear in succession, all the the last of them has no effect. Consider this
2978    example:
2979    <pre>
2980      ...(*COMMIT)(*PRUNE)...
2981    </pre>
2982    If there is a matching failure to the right, backtracking onto (*PRUNE) cases
2983    it to be triggered, and its action is taken. There can never be a backtrack
2984    onto (*COMMIT).
2985    <a name="btrepeat"></a></P>
2986    <br><b>
2987    Backtracking verbs in repeated groups
2988    </b><br>
2989    <P>
2990    PCRE differs from Perl in its handling of backtracking verbs in repeated
2991    groups. For example, consider:
2992    <pre>
2993      /(a(*COMMIT)b)+ac/
2994    </pre>
2995    If the subject is "abac", Perl matches, but PCRE fails because the (*COMMIT) in
2996    the second repeat of the group acts.
2997    <a name="btassert"></a></P>
2998    <br><b>
2999    Backtracking verbs in assertions
3000    </b><br>
3001    <P>
3002    (*FAIL) in an assertion has its normal effect: it forces an immediate backtrack.
3003    </P>
3004    <P>
3005    (*ACCEPT) in a positive assertion causes the assertion to succeed without any
3006    further processing. In a negative assertion, (*ACCEPT) causes the assertion to
3007    fail without any further processing.
3008    </P>
3009    <P>
3010    The other backtracking verbs are not treated specially if they appear in an
3011    assertion. In particular, (*THEN) skips to the next alternative in the
3012    innermost enclosing group that has alternations, whether or not this is within
3013    the assertion.
3014    <a name="btsub"></a></P>
3015    <br><b>
3016    Backtracking verbs in subroutines
3017    </b><br>
3018    <P>
3019    These behaviours occur whether or not the subpattern is called recursively.
3020    Perl's treatment of subroutines is different in some cases.
3021    </P>
3022    <P>
3023    (*FAIL) in a subpattern called as a subroutine has its normal effect: it forces
3024    an immediate backtrack.
3025    </P>
3026    <P>
3027    (*ACCEPT) in a subpattern called as a subroutine causes the subroutine match to
3028    succeed without any further processing. Matching then continues after the
3029    subroutine call.
3030    </P>
3031    <P>
3032    (*COMMIT), (*SKIP), and (*PRUNE) in a subpattern called as a subroutine cause
3033    the subroutine match to fail.
3034    </P>
3035  <P>  <P>
3036  If more than one such verb is present in a pattern, the "strongest" one wins.  (*THEN) skips to the next alternative in the innermost enclosing group within
3037  For example, consider this pattern, where A, B, etc. are complex pattern  the subpattern that has alternatives. If there is no such group within the
3038  fragments:  subpattern, (*THEN) causes the subroutine match to fail.
 <pre>  
   (A(*COMMIT)B(*THEN)C|D)  
 </pre>  
 Once A has matched, PCRE is committed to this match, at the current starting  
 position. If subsequently B matches, but C does not, the normal (*THEN) action  
 of trying the next alternative (that is, D) does not happen because (*COMMIT)  
 overrides.  
3039  </P>  </P>
3040  <br><a name="SEC27" href="#TOC1">SEE ALSO</a><br>  <br><a name="SEC27" href="#TOC1">SEE ALSO</a><br>
3041  <P>  <P>
# Line 2944  Cambridge CB2 3QH, England. Line 3053  Cambridge CB2 3QH, England.
3053  </P>  </P>
3054  <br><a name="SEC29" href="#TOC1">REVISION</a><br>  <br><a name="SEC29" href="#TOC1">REVISION</a><br>
3055  <P>  <P>
3056  Last updated: 11 November 2012  Last updated: 22 March 2013
3057  <br>  <br>
3058  Copyright &copy; 1997-2012 University of Cambridge.  Copyright &copy; 1997-2013 University of Cambridge.
3059  <br>  <br>
3060  <p>  <p>
3061  Return to the <a href="index.html">PCRE index page</a>.  Return to the <a href="index.html">PCRE index page</a>.

Legend:
Removed from v.1297  
changed lines
  Added in v.1298

  ViewVC Help
Powered by ViewVC 1.1.5