/[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 461 by ph10, Mon Oct 5 10:59:35 2009 UTC revision 469 by ph10, Mon Oct 19 14:38:48 2009 UTC
# Line 2050  ways the + and * repeats can carve up th Line 2050  ways the + and * repeats can carve up th
2050  before failure can be reported.  before failure can be reported.
2051  </P>  </P>
2052  <P>  <P>
2053  At the end of a match, the values set for any capturing subpatterns are those  At the end of a match, the values of capturing parentheses are those from
2054  from the outermost level of the recursion at which the subpattern value is set.  the outermost level. If you want to obtain intermediate values, a callout
2055  If you want to obtain intermediate values, a callout function can be used (see  function can be used (see below and the
 below and the  
2056  <a href="pcrecallout.html"><b>pcrecallout</b></a>  <a href="pcrecallout.html"><b>pcrecallout</b></a>
2057  documentation). If the pattern above is matched against  documentation). If the pattern above is matched against
2058  <pre>  <pre>
2059    (ab(cd)ef)    (ab(cd)ef)
2060  </pre>  </pre>
2061  the value for the capturing parentheses is "ef", which is the last value taken  the value for the inner capturing parentheses (numbered 2) is "ef", which is
2062  on at the top level. If additional parentheses are added, giving  the last value taken on at the top level. If a capturing subpattern is not
2063  <pre>  matched at the top level, its final value is unset, even if it is (temporarily)
2064    \( ( ( [^()]++ | (?R) )* ) \)  set at a deeper level.
2065       ^                        ^  </P>
2066       ^                        ^  <P>
2067  </pre>  If there are more than 15 capturing parentheses in a pattern, PCRE has to
2068  the string they capture is "ab(cd)ef", the contents of the top level  obtain extra memory to store data during a recursion, which it does by using
2069  parentheses. If there are more than 15 capturing parentheses in a pattern, PCRE  <b>pcre_malloc</b>, freeing it via <b>pcre_free</b> afterwards. If no memory can
2070  has to obtain extra memory to store data during a recursion, which it does by  be obtained, the match fails with the PCRE_ERROR_NOMEMORY error.
 using <b>pcre_malloc</b>, freeing it via <b>pcre_free</b> afterwards. If no  
 memory can be obtained, the match fails with the PCRE_ERROR_NOMEMORY error.  
2071  </P>  </P>
2072  <P>  <P>
2073  Do not confuse the (?R) item with the condition (R), which tests for recursion.  Do not confuse the (?R) item with the condition (R), which tests for recursion.
# Line 2183  is used, it does match "sense and respon Line 2180  is used, it does match "sense and respon
2180  strings. Another example is given in the discussion of DEFINE above.  strings. Another example is given in the discussion of DEFINE above.
2181  </P>  </P>
2182  <P>  <P>
2183  Like recursive subpatterns, a "subroutine" call is always treated as an atomic  Like recursive subpatterns, a subroutine call is always treated as an atomic
2184  group. That is, once it has matched some of the subject string, it is never  group. That is, once it has matched some of the subject string, it is never
2185  re-entered, even if it contains untried alternatives and there is a subsequent  re-entered, even if it contains untried alternatives and there is a subsequent
2186  matching failure.  matching failure. Any capturing parentheses that are set during the subroutine
2187    call revert to their previous values afterwards.
2188  </P>  </P>
2189  <P>  <P>
2190  When a subpattern is used as a subroutine, processing options such as  When a subpattern is used as a subroutine, processing options such as
# Line 2267  failing negative assertion, they cause a Line 2265  failing negative assertion, they cause a
2265  <b>pcre_dfa_exec()</b>.  <b>pcre_dfa_exec()</b>.
2266  </P>  </P>
2267  <P>  <P>
2268  If any of these verbs are used in an assertion subpattern, their effect is  If any of these verbs are used in an assertion or subroutine subpattern
2269  confined to that subpattern; it does not extend to the surrounding pattern.  (including recursive subpatterns), their effect is confined to that subpattern;
2270  Note that assertion subpatterns are processed as anchored at the point where  it does not extend to the surrounding pattern. Note that such subpatterns are
2271  they are tested.  processed as anchored at the point where they are tested.
2272  </P>  </P>
2273  <P>  <P>
2274  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
# Line 2388  Cambridge CB2 3QH, England. Line 2386  Cambridge CB2 3QH, England.
2386  </P>  </P>
2387  <br><a name="SEC28" href="#TOC1">REVISION</a><br>  <br><a name="SEC28" href="#TOC1">REVISION</a><br>
2388  <P>  <P>
2389  Last updated: 04 October 2009  Last updated: 18 October 2009
2390  <br>  <br>
2391  Copyright &copy; 1997-2009 University of Cambridge.  Copyright &copy; 1997-2009 University of Cambridge.
2392  <br>  <br>

Legend:
Removed from v.461  
changed lines
  Added in v.469

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12