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

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

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

revision 172 by ph10, Tue Jun 5 10:40:13 2007 UTC revision 461 by ph10, Mon Oct 5 10:59:35 2009 UTC
# Line 39  For example, this pattern has two callou Line 39  For example, this pattern has two callou
39  <pre>  <pre>
40    (?C1)abc(?C2)def    (?C1)abc(?C2)def
41  </pre>  </pre>
42  If the PCRE_AUTO_CALLOUT option bit is set when <b>pcre_compile()</b> is called,  If the PCRE_AUTO_CALLOUT option bit is set when <b>pcre_compile()</b> or
43  PCRE automatically inserts callouts, all with number 255, before each item in  <b>pcre_compile2()</b> is called, PCRE automatically inserts callouts, all with
44  the pattern. For example, if PCRE_AUTO_CALLOUT is used with the pattern  number 255, before each item in the pattern. For example, if PCRE_AUTO_CALLOUT
45    is used with the pattern
46  <pre>  <pre>
47    A(\d{2}|--)    A(\d{2}|--)
48  </pre>  </pre>
# Line 62  trying to optimize the performance of a Line 63  trying to optimize the performance of a
63  <br><a name="SEC2" href="#TOC1">MISSING CALLOUTS</a><br>  <br><a name="SEC2" href="#TOC1">MISSING CALLOUTS</a><br>
64  <P>  <P>
65  You should be aware that, because of optimizations in the way PCRE matches  You should be aware that, because of optimizations in the way PCRE matches
66  patterns, callouts sometimes do not happen. For example, if the pattern is  patterns by default, callouts sometimes do not happen. For example, if the
67    pattern is
68  <pre>  <pre>
69    ab(?C4)cd    ab(?C4)cd
70  </pre>  </pre>
# Line 71  string is "abyz", the lack of "d" means Line 73  string is "abyz", the lack of "d" means
73  the callout is never reached. However, with "abyd", though the result is still  the callout is never reached. However, with "abyd", though the result is still
74  no match, the callout is obeyed.  no match, the callout is obeyed.
75  </P>  </P>
76    <P>
77    If the pattern is studied, PCRE knows the minimum length of a matching string,
78    and will immediately give a "no match" return without actually running a match
79    if the subject is not long enough, or, for unanchored patterns, if it has
80    been scanned far enough.
81    </P>
82    <P>
83    You can disable these optimizations by passing the PCRE_NO_START_OPTIMIZE
84    option to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>. This slows down the
85    matching process, but does ensure that callouts such as the example above are
86    obeyed.
87    </P>
88  <br><a name="SEC3" href="#TOC1">THE CALLOUT INTERFACE</a><br>  <br><a name="SEC3" href="#TOC1">THE CALLOUT INTERFACE</a><br>
89  <P>  <P>
90  During matching, when PCRE reaches a callout point, the external function  During matching, when PCRE reaches a callout point, the external function
# Line 172  The external callout function returns an Line 186  The external callout function returns an
186  matching proceeds as normal. If the value is greater than zero, matching fails  matching proceeds as normal. If the value is greater than zero, matching fails
187  at the current point, but the testing of other matching possibilities goes  at the current point, but the testing of other matching possibilities goes
188  ahead, just as if a lookahead assertion had failed. If the value is less than  ahead, just as if a lookahead assertion had failed. If the value is less than
189  zero, the match is abandoned, and <b>pcre_exec()</b> (or <b>pcre_dfa_exec()</b>)  zero, the match is abandoned, and <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b>
190  returns the negative value.  returns the negative value.
191  </P>  </P>
192  <P>  <P>
# Line 192  Cambridge CB2 3QH, England. Line 206  Cambridge CB2 3QH, England.
206  </P>  </P>
207  <br><a name="SEC6" href="#TOC1">REVISION</a><br>  <br><a name="SEC6" href="#TOC1">REVISION</a><br>
208  <P>  <P>
209  Last updated: 29 May 2007  Last updated: 29 September 2009
210  <br>  <br>
211  Copyright &copy; 1997-2007 University of Cambridge.  Copyright &copy; 1997-2009 University of Cambridge.
212  <br>  <br>
213  <p>  <p>
214  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.172  
changed lines
  Added in v.461

  ViewVC Help
Powered by ViewVC 1.1.5