/[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 428 by ph10, Sat Apr 11 14:34:02 2009 UTC revision 429 by ph10, Tue Sep 1 16:10:16 2009 UTC
# Line 164  Applications can use these to include su Line 164  Applications can use these to include su
164  The functions <b>pcre_compile()</b>, <b>pcre_compile2()</b>, <b>pcre_study()</b>,  The functions <b>pcre_compile()</b>, <b>pcre_compile2()</b>, <b>pcre_study()</b>,
165  and <b>pcre_exec()</b> are used for compiling and matching regular expressions  and <b>pcre_exec()</b> are used for compiling and matching regular expressions
166  in a Perl-compatible manner. A sample program that demonstrates the simplest  in a Perl-compatible manner. A sample program that demonstrates the simplest
167  way of using them is provided in the file called <i>pcredemo.c</i> in the source  way of using them is provided in the file called <i>pcredemo.c</i> in the PCRE
168  distribution. The  source distribution. A listing of this program is given in the
169    <a href="pcredemo.html"><b>pcredemo</b></a>
170    documentation, and the
171  <a href="pcresample.html"><b>pcresample</b></a>  <a href="pcresample.html"><b>pcresample</b></a>
172  documentation describes how to compile and run it.  documentation describes how to compile and run it.
173  </P>  </P>
# Line 1016  different for each compiled pattern. Line 1018  different for each compiled pattern.
1018    PCRE_INFO_OKPARTIAL    PCRE_INFO_OKPARTIAL
1019  </pre>  </pre>
1020  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, otherwise 0. The
1021  fourth argument should point to an <b>int</b> variable. The  fourth argument should point to an <b>int</b> variable. From release 8.00, this
1022    always returns 1, because the restrictions that previously applied to partial
1023    matching have been lifted. The
1024  <a href="pcrepartial.html"><b>pcrepartial</b></a>  <a href="pcrepartial.html"><b>pcrepartial</b></a>
1025  documentation lists the restrictions that apply to patterns when partial  documentation gives details of partial matching.
 matching is used.  
1026  <pre>  <pre>
1027    PCRE_INFO_OPTIONS    PCRE_INFO_OPTIONS
1028  </pre>  </pre>
# Line 1246  Option bits for pcre_exec() Line 1249  Option bits for pcre_exec()
1249  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
1250  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>,
1251  PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_START_OPTIMIZE,  PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_START_OPTIMIZE,
1252  PCRE_NO_UTF8_CHECK and PCRE_PARTIAL.  PCRE_NO_UTF8_CHECK, PCRE_PARTIAL_SOFT, and PCRE_PARTIAL_HARD.
1253  <pre>  <pre>
1254    PCRE_ANCHORED    PCRE_ANCHORED
1255  </pre>  </pre>
# Line 1336  when using the /g modifier. It is possib Line 1339  when using the /g modifier. It is possib
1339  matching a null string by first trying the match again at the same offset with  matching a null string by first trying the match again at the same offset with
1340  PCRE_NOTEMPTY and PCRE_ANCHORED, and then if that fails by advancing the  PCRE_NOTEMPTY and PCRE_ANCHORED, and then if that fails by advancing the
1341  starting offset (see below) and trying an ordinary match again. There is some  starting offset (see below) and trying an ordinary match again. There is some
1342  code that demonstrates how to do this in the <i>pcredemo.c</i> sample program.  code that demonstrates how to do this in the
1343    <a href="pcredemo.html"><b>pcredemo</b></a>
1344    sample program.
1345  <pre>  <pre>
1346    PCRE_NO_START_OPTIMIZE    PCRE_NO_START_OPTIMIZE
1347  </pre>  </pre>
# Line 1373  PCRE_NO_UTF8_CHECK is set, the effect of Line 1378  PCRE_NO_UTF8_CHECK is set, the effect of
1378  subject, or a value of <i>startoffset</i> that does not point to the start of a  subject, or a value of <i>startoffset</i> that does not point to the start of a
1379  UTF-8 character, is undefined. Your program may crash.  UTF-8 character, is undefined. Your program may crash.
1380  <pre>  <pre>
1381    PCRE_PARTIAL    PCRE_PARTIAL_HARD
1382      PCRE_PARTIAL_SOFT
1383  </pre>  </pre>
1384  This option turns on the partial matching feature. If the subject string fails  These options turn on the partial matching feature. For backwards
1385  to match the pattern, but at some point during the matching process the end of  compatibility, PCRE_PARTIAL is a synonym for PCRE_PARTIAL_SOFT. A partial match
1386  the subject was reached (that is, the subject partially matches the pattern and  occurs if the end of the subject string is reached successfully, but there are
1387  the failure to match occurred only because there were not enough subject  not enough subject characters to complete the match. If this happens when
1388  characters), <b>pcre_exec()</b> returns PCRE_ERROR_PARTIAL instead of  PCRE_PARTIAL_HARD is set, <b>pcre_exec()</b> immediately returns
1389  PCRE_ERROR_NOMATCH. When PCRE_PARTIAL is used, there are restrictions on what  PCRE_ERROR_PARTIAL. Otherwise, if PCRE_PARTIAL_SOFT is set, matching continues
1390  may appear in the pattern. These are discussed in the  by testing any other alternatives. Only if they all fail is PCRE_ERROR_PARTIAL
1391    returned (instead of PCRE_ERROR_NOMATCH). The portion of the string that
1392    provided the partial match is set as the first matching string. There is a more
1393    detailed discussion in the
1394  <a href="pcrepartial.html"><b>pcrepartial</b></a>  <a href="pcrepartial.html"><b>pcrepartial</b></a>
1395  documentation.  documentation.
1396  </P>  </P>
# Line 1582  documentation for details of partial mat Line 1591  documentation for details of partial mat
1591  <pre>  <pre>
1592    PCRE_ERROR_BADPARTIAL     (-13)    PCRE_ERROR_BADPARTIAL     (-13)
1593  </pre>  </pre>
1594  The PCRE_PARTIAL option was used with a compiled pattern containing items that  This code is no longer in use. It was formerly returned when the PCRE_PARTIAL
1595  are not supported for partial matching. See the  option was used with a compiled pattern containing items that were not
1596  <a href="pcrepartial.html"><b>pcrepartial</b></a>  supported for partial matching. From release 8.00 onwards, there are no
1597  documentation for details of partial matching.  restrictions on partial matching.
1598  <pre>  <pre>
1599    PCRE_ERROR_INTERNAL       (-14)    PCRE_ERROR_INTERNAL       (-14)
1600  </pre>  </pre>
# Line 1871  Option bits for pcre_dfa_exec() Line 1880  Option bits for pcre_dfa_exec()
1880  <P>  <P>
1881  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
1882  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>,
1883  PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_UTF8_CHECK, PCRE_PARTIAL,  PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_UTF8_CHECK, PCRE_PARTIAL_HARD,
1884  PCRE_DFA_SHORTEST, and PCRE_DFA_RESTART. All but the last three of these are  PCRE_PARTIAL_SOFT, PCRE_DFA_SHORTEST, and PCRE_DFA_RESTART. All but the last
1885  the same as for <b>pcre_exec()</b>, so their description is not repeated here.  four of these are exactly the same as for <b>pcre_exec()</b>, so their
1886  <pre>  description is not repeated here.
1887    PCRE_PARTIAL  <pre>
1888  </pre>    PCRE_PARTIAL_HARD
1889  This has the same general effect as it does for <b>pcre_exec()</b>, but the    PCRE_PARTIAL_SOFT
1890  details are slightly different. When PCRE_PARTIAL is set for  </pre>
1891  <b>pcre_dfa_exec()</b>, the return code PCRE_ERROR_NOMATCH is converted into  These have the same general effect as they do for <b>pcre_exec()</b>, but the
1892  PCRE_ERROR_PARTIAL if the end of the subject is reached, there have been no  details are slightly different. When PCRE_PARTIAL_HARD is set for
1893  complete matches, but there is still at least one matching possibility. The  <b>pcre_dfa_exec()</b>, it returns PCRE_ERROR_PARTIAL if the end of the subject
1894  portion of the string that provided the partial match is set as the first  is reached and there is still at least one matching possibility that requires
1895  matching string.  additional characters. This happens even if some complete matches have also
1896    been found. When PCRE_PARTIAL_SOFT is set, the return code PCRE_ERROR_NOMATCH
1897    is converted into PCRE_ERROR_PARTIAL if the end of the subject is reached,
1898    there have been no complete matches, but there is still at least one matching
1899    possibility. The portion of the string that provided the longest partial match
1900    is set as the first matching string in both cases.
1901  <pre>  <pre>
1902    PCRE_DFA_SHORTEST    PCRE_DFA_SHORTEST
1903  </pre>  </pre>
# Line 1894  matching point in the subject string. Line 1908  matching point in the subject string.
1908  <pre>  <pre>
1909    PCRE_DFA_RESTART    PCRE_DFA_RESTART
1910  </pre>  </pre>
1911  When <b>pcre_dfa_exec()</b> is called with the PCRE_PARTIAL option, and returns  When <b>pcre_dfa_exec()</b> returns a partial match, it is possible to call it
1912  a partial match, it is possible to call it again, with additional subject  again, with additional subject characters, and have it continue with the same
1913  characters, and have it continue with the same match. The PCRE_DFA_RESTART  match. The PCRE_DFA_RESTART option requests this action; when it is set, the
1914  option requests this action; when it is set, the <i>workspace</i> and  <i>workspace</i> and <i>wscount</i> options must reference the same vector as
1915  <i>wscount</i> options must reference the same vector as before because data  before because data about the match so far is left in them after a partial
1916  about the match so far is left in them after a partial match. There is more  match. There is more discussion of this facility in the
 discussion of this facility in the  
1917  <a href="pcrepartial.html"><b>pcrepartial</b></a>  <a href="pcrepartial.html"><b>pcrepartial</b></a>
1918  documentation.  documentation.
1919  </P>  </P>
# Line 1996  Cambridge CB2 3QH, England. Line 2009  Cambridge CB2 3QH, England.
2009  </P>  </P>
2010  <br><a name="SEC22" href="#TOC1">REVISION</a><br>  <br><a name="SEC22" href="#TOC1">REVISION</a><br>
2011  <P>  <P>
2012  Last updated: 11 April 2009  Last updated: 01 September 2009
2013  <br>  <br>
2014  Copyright &copy; 1997-2009 University of Cambridge.  Copyright &copy; 1997-2009 University of Cambridge.
2015  <br>  <br>

Legend:
Removed from v.428  
changed lines
  Added in v.429

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12