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

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

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

revision 1266 by ph10, Sun Mar 3 11:14:26 2013 UTC revision 1287 by ph10, Fri Mar 15 15:54:54 2013 UTC
# Line 1  Line 1 
1  .TH PCREPATTERN 3 "03 March 2013" "PCRE 8.33"  .TH PCREPATTERN 3 "15 March 2013" "PCRE 8.33"
2  .SH NAME  .SH NAME
3  PCRE - Perl-compatible regular expressions  PCRE - Perl-compatible regular expressions
4  .SH "PCRE REGULAR EXPRESSION DETAILS"  .SH "PCRE REGULAR EXPRESSION DETAILS"
# Line 2769  starting point (see (*SKIP) below). Line 2769  starting point (see (*SKIP) below).
2769  A name is always required with this verb. There may be as many instances of  A name is always required with this verb. There may be as many instances of
2770  (*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.
2771  .P  .P
2772  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),
2773  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
2774    caller as described in the section entitled
2775  .\" HTML <a href="pcreapi.html#extradata">  .\" HTML <a href="pcreapi.html#extradata">
2776  .\" </a>  .\" </a>
2777  "Extra data for \fBpcre_exec()\fP"  "Extra data for \fBpcre_exec()\fP"
# Line 2795  indicates which of the two alternatives Line 2796  indicates which of the two alternatives
2796  of obtaining this information than putting each alternative in its own  of obtaining this information than putting each alternative in its own
2797  capturing parentheses.  capturing parentheses.
2798  .P  .P
2799  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
2800  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
2801  assertions.  for negative assertions.
2802  .P  .P
2803  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
2804  (*MARK) in the entire match process is returned. For example:  entire match process is returned. For example:
2805  .sp  .sp
2806      re> /X(*MARK:A)Y|X(*MARK:B)Z/K      re> /X(*MARK:A)Y|X(*MARK:B)Z/K
2807    data> XP    data> XP
# Line 2876  reached, or when matching to the right o Line 2877  reached, or when matching to the right o
2877  the right, backtracking cannot cross (*PRUNE). In simple cases, the use of  the right, backtracking cannot cross (*PRUNE). In simple cases, the use of
2878  (*PRUNE) is just an alternative to an atomic group or possessive quantifier,  (*PRUNE) is just an alternative to an atomic group or possessive quantifier,
2879  but there are some uses of (*PRUNE) that cannot be expressed in any other way.  but there are some uses of (*PRUNE) that cannot be expressed in any other way.
2880  The behaviour of (*PRUNE:NAME) is the same as (*MARK:NAME)(*PRUNE). In an  In an anchored pattern (*PRUNE) has the same effect as (*COMMIT).
2881  anchored pattern (*PRUNE) has the same effect as (*COMMIT).  .P
2882    The behaviour of (*PRUNE:NAME) is the not the same as (*MARK:NAME)(*PRUNE).
2883    It is like (*MARK:NAME) in that the name is remembered for passing back to the
2884    caller. However, (*SKIP:NAME) searches only for names set with (*MARK).
2885  .sp  .sp
2886    (*SKIP)    (*SKIP)
2887  .sp  .sp
# Line 2904  searched for the most recent (*MARK) tha Line 2908  searched for the most recent (*MARK) tha
2908  the "bumpalong" advance is to the subject position that corresponds to that  the "bumpalong" advance is to the subject position that corresponds to that
2909  (*MARK) instead of to where (*SKIP) was encountered. If no (*MARK) with a  (*MARK) instead of to where (*SKIP) was encountered. If no (*MARK) with a
2910  matching name is found, the (*SKIP) is ignored.  matching name is found, the (*SKIP) is ignored.
2911    .P
2912    Note that (*SKIP:NAME) searches only for names set by (*MARK:NAME). It ignores
2913    names that are set by (*PRUNE:NAME) or (*THEN:NAME).
2914  .sp  .sp
2915    (*THEN) or (*THEN:NAME)    (*THEN) or (*THEN:NAME)
2916  .sp  .sp
# Line 2916  be used for a pattern-based if-then-else Line 2923  be used for a pattern-based if-then-else
2923  .sp  .sp
2924  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
2925  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
2926  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).  
2927  If (*THEN) is not inside an alternation, it acts like (*PRUNE).  If (*THEN) is not inside an alternation, it acts like (*PRUNE).
2928  .P  .P
2929    The behaviour of (*THEN:NAME) is the not the same as (*MARK:NAME)(*THEN).
2930    It is like (*MARK:NAME) in that the name is remembered for passing back to the
2931    caller. However, (*SKIP:NAME) searches only for names set with (*MARK).
2932    .P
2933  Note that a subpattern that does not contain a | character is just a part of  Note that a subpattern that does not contain a | character is just a part of
2934  the enclosing alternative; it is not a nested alternation with only one  the enclosing alternative; it is not a nested alternation with only one
2935  alternative. The effect of (*THEN) extends beyond such a subpattern to the  alternative. The effect of (*THEN) extends beyond such a subpattern to the
# Line 2996  Cambridge CB2 3QH, England. Line 3006  Cambridge CB2 3QH, England.
3006  .rs  .rs
3007  .sp  .sp
3008  .nf  .nf
3009  Last updated: 03 March 2013  Last updated: 15 March 2013
3010  Copyright (c) 1997-2013 University of Cambridge.  Copyright (c) 1997-2013 University of Cambridge.
3011  .fi  .fi

Legend:
Removed from v.1266  
changed lines
  Added in v.1287

  ViewVC Help
Powered by ViewVC 1.1.5