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

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

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

revision 440 by ph10, Wed Sep 9 10:14:40 2009 UTC revision 454 by ph10, Tue Sep 22 09:42:11 2009 UTC
# Line 427  If \fIerrptr\fP is NULL, \fBpcre_compile Line 427  If \fIerrptr\fP is NULL, \fBpcre_compile
427  Otherwise, if compilation of a pattern fails, \fBpcre_compile()\fP returns  Otherwise, if compilation of a pattern fails, \fBpcre_compile()\fP returns
428  NULL, and sets the variable pointed to by \fIerrptr\fP to point to a textual  NULL, and sets the variable pointed to by \fIerrptr\fP to point to a textual
429  error message. This is a static string that is part of the library. You must  error message. This is a static string that is part of the library. You must
430  not try to free it. The offset from the start of the pattern to the character  not try to free it. The byte offset from the start of the pattern to the
431  where the error was discovered is placed in the variable pointed to by  character that was being processes when the error was discovered is placed in
432  \fIerroffset\fP, which must not be NULL. If it is, an immediate error is given.  the variable pointed to by \fIerroffset\fP, which must not be NULL. If it is,
433    an immediate error is given. Some errors are not detected until checks are
434    carried out when the whole pattern has been scanned; in this case the offset is
435    set to the end of the pattern.
436  .P  .P
437  If \fBpcre_compile2()\fP is used instead of \fBpcre_compile()\fP, and the  If \fBpcre_compile2()\fP is used instead of \fBpcre_compile()\fP, and the
438  \fIerrorcodeptr\fP argument is not NULL, a non-zero error code number is  \fIerrorcodeptr\fP argument is not NULL, a non-zero error code number is
# Line 1246  documentation for a discussion of saving Line 1249  documentation for a discussion of saving
1249  .sp  .sp
1250  The unused bits of the \fIoptions\fP argument for \fBpcre_exec()\fP must be  The unused bits of the \fIoptions\fP argument for \fBpcre_exec()\fP must be
1251  zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEWLINE_\fIxxx\fP,  zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEWLINE_\fIxxx\fP,
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  .sp  .sp
1256    PCRE_ANCHORED    PCRE_ANCHORED
1257  .sp  .sp
# Line 1322  match the empty string, the entire match Line 1326  match the empty string, the entire match
1326  .sp  .sp
1327    a?b?    a?b?
1328  .sp  .sp
1329  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
1330  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
1331  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".
1332  .P  .sp
1333  Perl has no direct equivalent of PCRE_NOTEMPTY, but it does make a special case    PCRE_NOTEMPTY_ATSTART
1334  of a pattern match of the empty string within its \fBsplit()\fP function, and  .sp
1335  when using the /g modifier. It is possible to emulate Perl's behaviour after  This is like PCRE_NOTEMPTY, except that an empty string match that is not at
1336  matching a null string by first trying the match again at the same offset with  the start of the subject is permitted. If the pattern is anchored, such a match
1337  PCRE_NOTEMPTY and PCRE_ANCHORED, and then if that fails by advancing the  can occur only if the pattern contains \eK.
1338  starting offset (see below) and trying an ordinary match again. There is some  .P
1339  code that demonstrates how to do this in the  Perl has no direct equivalent of PCRE_NOTEMPTY or PCRE_NOTEMPTY_ATSTART, but it
1340    does make a special case of a pattern match of the empty string within its
1341    \fBsplit()\fP function, and when using the /g modifier. It is possible to
1342    emulate Perl's behaviour after matching a null string by first trying the match
1343    again at the same offset with PCRE_NOTEMPTY_ATSTART and PCRE_ANCHORED, and then
1344    if that fails, by advancing the starting offset (see below) and trying an
1345    ordinary match again. There is some code that demonstrates how to do this in
1346    the
1347  .\" HREF  .\" HREF
1348  \fBpcredemo\fP  \fBpcredemo\fP
1349  .\"  .\"
# Line 1875  Here is an example of a simple call to \ Line 1886  Here is an example of a simple call to \
1886  .sp  .sp
1887  The unused bits of the \fIoptions\fP argument for \fBpcre_dfa_exec()\fP must be  The unused bits of the \fIoptions\fP argument for \fBpcre_dfa_exec()\fP must be
1888  zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEWLINE_\fIxxx\fP,  zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEWLINE_\fIxxx\fP,
1889  PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_UTF8_CHECK, PCRE_PARTIAL_HARD,  PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NOTEMPTY_ATSTART,
1890  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,
1891  four of these are exactly the same as for \fBpcre_exec()\fP, so their  and PCRE_DFA_RESTART. All but the last four of these are exactly the same as
1892  description is not repeated here.  for \fBpcre_exec()\fP, so their description is not repeated here.
1893  .sp  .sp
1894    PCRE_PARTIAL_HARD    PCRE_PARTIAL_HARD
1895    PCRE_PARTIAL_SOFT    PCRE_PARTIAL_SOFT
# Line 2012  Cambridge CB2 3QH, England. Line 2023  Cambridge CB2 3QH, England.
2023  .rs  .rs
2024  .sp  .sp
2025  .nf  .nf
2026  Last updated: 09 September 2009  Last updated: 22 September 2009
2027  Copyright (c) 1997-2009 University of Cambridge.  Copyright (c) 1997-2009 University of Cambridge.
2028  .fi  .fi

Legend:
Removed from v.440  
changed lines
  Added in v.454

  ViewVC Help
Powered by ViewVC 1.1.5