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

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

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

revision 452 by ph10, Tue Sep 1 16:10:16 2009 UTC revision 453 by ph10, Fri Sep 18 19:12:35 2009 UTC
# Line 175  documentation describes how to compile a Line 175  documentation describes how to compile a
175  A second matching function, <b>pcre_dfa_exec()</b>, which is not  A second matching function, <b>pcre_dfa_exec()</b>, which is not
176  Perl-compatible, is also provided. This uses a different algorithm for the  Perl-compatible, is also provided. This uses a different algorithm for the
177  matching. The alternative algorithm finds all possible matches (at a given  matching. The alternative algorithm finds all possible matches (at a given
178  point in the subject), and scans the subject just once. However, this algorithm  point in the subject), and scans the subject just once (unless there are
179  does not return captured substrings. A description of the two matching  lookbehind assertions). However, this algorithm does not return captured
180  algorithms and their advantages and disadvantages is given in the  substrings. A description of the two matching algorithms and their advantages
181    and disadvantages is given in the
182  <a href="pcrematching.html"><b>pcrematching</b></a>  <a href="pcrematching.html"><b>pcrematching</b></a>
183  documentation.  documentation.
184  </P>  </P>
# Line 1017  different for each compiled pattern. Line 1018  different for each compiled pattern.
1018  <pre>  <pre>
1019    PCRE_INFO_OKPARTIAL    PCRE_INFO_OKPARTIAL
1020  </pre>  </pre>
1021  Return 1 if the pattern can be used for partial matching, otherwise 0. The  Return 1 if the pattern can be used for partial matching with
1022  fourth argument should point to an <b>int</b> variable. From release 8.00, this  <b>pcre_exec()</b>, otherwise 0. The fourth argument should point to an
1023  always returns 1, because the restrictions that previously applied to partial  <b>int</b> variable. From release 8.00, this always returns 1, because the
1024  matching have been lifted. The  restrictions that previously applied to partial matching have been lifted. The
1025  <a href="pcrepartial.html"><b>pcrepartial</b></a>  <a href="pcrepartial.html"><b>pcrepartial</b></a>
1026  documentation gives details of partial matching.  documentation gives details of partial matching.
1027  <pre>  <pre>
# Line 1224  PCRE_EXTRA_MATCH_LIMIT_RECURSION is set Line 1225  PCRE_EXTRA_MATCH_LIMIT_RECURSION is set
1225  is exceeded, <b>pcre_exec()</b> returns PCRE_ERROR_RECURSIONLIMIT.  is exceeded, <b>pcre_exec()</b> returns PCRE_ERROR_RECURSIONLIMIT.
1226  </P>  </P>
1227  <P>  <P>
1228  The <i>pcre_callout</i> field is used in conjunction with the "callout" feature,  The <i>callout_data</i> field is used in conjunction with the "callout" feature,
1229  which is described in the  and is described in the
1230  <a href="pcrecallout.html"><b>pcrecallout</b></a>  <a href="pcrecallout.html"><b>pcrecallout</b></a>
1231  documentation.  documentation.
1232  </P>  </P>
# Line 1248  Option bits for <b>pcre_exec()</b> Line 1249  Option bits for <b>pcre_exec()</b>
1249  <P>  <P>
1250  The unused bits of the <i>options</i> argument for <b>pcre_exec()</b> must be  The unused bits of the <i>options</i> argument for <b>pcre_exec()</b> must be
1251  zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEWLINE_<i>xxx</i>,  zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEWLINE_<i>xxx</i>,
1252  PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_START_OPTIMIZE,  PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NOTEMPTY_ATSTART,
1253  PCRE_NO_UTF8_CHECK, PCRE_PARTIAL_SOFT, and PCRE_PARTIAL_HARD.  PCRE_NO_START_OPTIMIZE, PCRE_NO_UTF8_CHECK, PCRE_PARTIAL_SOFT, and
1254    PCRE_PARTIAL_HARD.
1255  <pre>  <pre>
1256    PCRE_ANCHORED    PCRE_ANCHORED
1257  </pre>  </pre>
# Line 1328  match the empty string, the entire match Line 1330  match the empty string, the entire match
1330  <pre>  <pre>
1331    a?b?    a?b?
1332  </pre>  </pre>
1333  is applied to a string not beginning with "a" or "b", it matches the empty  is applied to a string not beginning with "a" or "b", it matches an empty
1334  string at the start of the subject. With PCRE_NOTEMPTY set, this match is not  string at the start of the subject. With PCRE_NOTEMPTY set, this match is not
1335  valid, so PCRE searches further into the string for occurrences of "a" or "b".  valid, so PCRE searches further into the string for occurrences of "a" or "b".
1336    <pre>
1337      PCRE_NOTEMPTY_ATSTART
1338    </pre>
1339    This is like PCRE_NOTEMPTY, except that an empty string match that is not at
1340    the start of the subject is permitted. If the pattern is anchored, such a match
1341    can occur only if the pattern contains \K.
1342  </P>  </P>
1343  <P>  <P>
1344  Perl has no direct equivalent of PCRE_NOTEMPTY, but it does make a special case  Perl has no direct equivalent of PCRE_NOTEMPTY or PCRE_NOTEMPTY_ATSTART, but it
1345  of a pattern match of the empty string within its <b>split()</b> function, and  does make a special case of a pattern match of the empty string within its
1346  when using the /g modifier. It is possible to emulate Perl's behaviour after  <b>split()</b> function, and when using the /g modifier. It is possible to
1347  matching a null string by first trying the match again at the same offset with  emulate Perl's behaviour after matching a null string by first trying the match
1348  PCRE_NOTEMPTY and PCRE_ANCHORED, and then if that fails by advancing the  again at the same offset with PCRE_NOTEMPTY_ATSTART and PCRE_ANCHORED, and then
1349  starting offset (see below) and trying an ordinary match again. There is some  if that fails, by advancing the starting offset (see below) and trying an
1350  code that demonstrates how to do this in the  ordinary match again. There is some code that demonstrates how to do this in
1351    the
1352  <a href="pcredemo.html"><b>pcredemo</b></a>  <a href="pcredemo.html"><b>pcredemo</b></a>
1353  sample program.  sample program.
1354  <pre>  <pre>
# Line 1389  PCRE_PARTIAL_HARD is set, <b>pcre_exec() Line 1398  PCRE_PARTIAL_HARD is set, <b>pcre_exec()
1398  PCRE_ERROR_PARTIAL. Otherwise, if PCRE_PARTIAL_SOFT is set, matching continues  PCRE_ERROR_PARTIAL. Otherwise, if PCRE_PARTIAL_SOFT is set, matching continues
1399  by testing any other alternatives. Only if they all fail is PCRE_ERROR_PARTIAL  by testing any other alternatives. Only if they all fail is PCRE_ERROR_PARTIAL
1400  returned (instead of PCRE_ERROR_NOMATCH). The portion of the string that  returned (instead of PCRE_ERROR_NOMATCH). The portion of the string that
1401  provided the partial match is set as the first matching string. There is a more  was inspected when the partial match was found is set as the first matching
1402  detailed discussion in the  string. There is a more detailed discussion in the
1403  <a href="pcrepartial.html"><b>pcrepartial</b></a>  <a href="pcrepartial.html"><b>pcrepartial</b></a>
1404  documentation.  documentation.
1405  </P>  </P>
# Line 1837  a compiled pattern, using a matching alg Line 1846  a compiled pattern, using a matching alg
1846  just once, and does not backtrack. This has different characteristics to the  just once, and does not backtrack. This has different characteristics to the
1847  normal algorithm, and is not compatible with Perl. Some of the features of PCRE  normal algorithm, and is not compatible with Perl. Some of the features of PCRE
1848  patterns are not supported. Nevertheless, there are times when this kind of  patterns are not supported. Nevertheless, there are times when this kind of
1849  matching can be useful. For a discussion of the two matching algorithms, see  matching can be useful. For a discussion of the two matching algorithms, and a
1850  the  list of features that <b>pcre_dfa_exec()</b> does not support, see the
1851  <a href="pcrematching.html"><b>pcrematching</b></a>  <a href="pcrematching.html"><b>pcrematching</b></a>
1852  documentation.  documentation.
1853  </P>  </P>
# Line 1880  Option bits for <b>pcre_dfa_exec()</b> Line 1889  Option bits for <b>pcre_dfa_exec()</b>
1889  <P>  <P>
1890  The unused bits of the <i>options</i> argument for <b>pcre_dfa_exec()</b> must be  The unused bits of the <i>options</i> argument for <b>pcre_dfa_exec()</b> must be
1891  zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEWLINE_<i>xxx</i>,  zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEWLINE_<i>xxx</i>,
1892  PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_UTF8_CHECK, PCRE_PARTIAL_HARD,  PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NOTEMPTY_ATSTART,
1893  PCRE_PARTIAL_SOFT, PCRE_DFA_SHORTEST, and PCRE_DFA_RESTART. All but the last  PCRE_NO_UTF8_CHECK, PCRE_PARTIAL_HARD, PCRE_PARTIAL_SOFT, PCRE_DFA_SHORTEST,
1894  four of these are exactly the same as for <b>pcre_exec()</b>, so their  and PCRE_DFA_RESTART. All but the last four of these are exactly the same as
1895  description is not repeated here.  for <b>pcre_exec()</b>, so their description is not repeated here.
1896  <pre>  <pre>
1897    PCRE_PARTIAL_HARD    PCRE_PARTIAL_HARD
1898    PCRE_PARTIAL_SOFT    PCRE_PARTIAL_SOFT
# Line 1896  additional characters. This happens even Line 1905  additional characters. This happens even
1905  been found. When PCRE_PARTIAL_SOFT is set, the return code PCRE_ERROR_NOMATCH  been found. When PCRE_PARTIAL_SOFT is set, the return code PCRE_ERROR_NOMATCH
1906  is converted into PCRE_ERROR_PARTIAL if the end of the subject is reached,  is converted into PCRE_ERROR_PARTIAL if the end of the subject is reached,
1907  there have been no complete matches, but there is still at least one matching  there have been no complete matches, but there is still at least one matching
1908  possibility. The portion of the string that provided the longest partial match  possibility. The portion of the string that was inspected when the longest
1909  is set as the first matching string in both cases.  partial match was found is set as the first matching string in both cases.
1910  <pre>  <pre>
1911    PCRE_DFA_SHORTEST    PCRE_DFA_SHORTEST
1912  </pre>  </pre>
# Line 2009  Cambridge CB2 3QH, England. Line 2018  Cambridge CB2 3QH, England.
2018  </P>  </P>
2019  <br><a name="SEC22" href="#TOC1">REVISION</a><br>  <br><a name="SEC22" href="#TOC1">REVISION</a><br>
2020  <P>  <P>
2021  Last updated: 01 September 2009  Last updated: 11 September 2009
2022  <br>  <br>
2023  Copyright &copy; 1997-2009 University of Cambridge.  Copyright &copy; 1997-2009 University of Cambridge.
2024  <br>  <br>

Legend:
Removed from v.452  
changed lines
  Added in v.453

  ViewVC Help
Powered by ViewVC 1.1.5