/[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 166 by ph10, Wed May 9 14:48:28 2007 UTC revision 167 by ph10, Wed May 9 15:53:54 2007 UTC
# Line 1515  recursion, a pseudo-condition called DEF Line 1515  recursion, a pseudo-condition called DEF
1515  .sp  .sp
1516  If the text between the parentheses consists of a sequence of digits, the  If the text between the parentheses consists of a sequence of digits, the
1517  condition is true if the capturing subpattern of that number has previously  condition is true if the capturing subpattern of that number has previously
1518  matched.  matched. An alternative notation is to precede the digits with a plus or minus
1519    sign. In this case, the subpattern number is relative rather than absolute.
1520    The most recently opened parentheses can be referenced by (?(-1), the next most
1521    recent by (?(-2), and so on. In looping constructs it can also make sense to
1522    refer to subsequent groups with constructs such as (?(+2).
1523  .P  .P
1524  Consider the following pattern, which contains non-significant white space to  Consider the following pattern, which contains non-significant white space to
1525  make it more readable (assume the PCRE_EXTENDED option) and to divide it into  make it more readable (assume the PCRE_EXTENDED option) and to divide it into
# Line 1532  the condition is true, and so the yes-pa Line 1536  the condition is true, and so the yes-pa
1536  parenthesis is required. Otherwise, since no-pattern is not present, the  parenthesis is required. Otherwise, since no-pattern is not present, the
1537  subpattern matches nothing. In other words, this pattern matches a sequence of  subpattern matches nothing. In other words, this pattern matches a sequence of
1538  non-parentheses, optionally enclosed in parentheses.  non-parentheses, optionally enclosed in parentheses.
1539    .P
1540    If you were embedding this pattern in a larger one, you could use a relative
1541    reference:
1542    .sp
1543      ...other stuff... ( \e( )?    [^()]+    (?(-1) \e) ) ...
1544    .sp
1545    This makes the fragment independent of the parentheses in the larger pattern.
1546  .  .
1547  .SS "Checking for a used subpattern by name"  .SS "Checking for a used subpattern by name"
1548  .rs  .rs
# Line 1842  Cambridge CB2 3QH, England. Line 1853  Cambridge CB2 3QH, England.
1853  .rs  .rs
1854  .sp  .sp
1855  .nf  .nf
1856  Last updated: 06 March 2007  Last updated: 09 May 2007
1857  Copyright (c) 1997-2007 University of Cambridge.  Copyright (c) 1997-2007 University of Cambridge.
1858  .fi  .fi

Legend:
Removed from v.166  
changed lines
  Added in v.167

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12