/[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 547 by ph10, Mon Jun 21 14:06:54 2010 UTC revision 566 by ph10, Wed Nov 3 18:32:55 2010 UTC
# Line 765  out of use. To avoid confusion, they hav Line 765  out of use. To avoid confusion, they hav
765    50  [this code is not in use]    50  [this code is not in use]
766    51  octal value is greater than \e377 (not in UTF-8 mode)    51  octal value is greater than \e377 (not in UTF-8 mode)
767    52  internal error: overran compiling workspace    52  internal error: overran compiling workspace
768    53  internal error: previously-checked referenced subpattern    53  internal error: previously-checked referenced subpattern
769          not found          not found
770    54  DEFINE group contains more than one branch    54  DEFINE group contains more than one branch
771    55  repeating a DEFINE group is not allowed    55  repeating a DEFINE group is not allowed
# Line 779  out of use. To avoid confusion, they hav Line 779  out of use. To avoid confusion, they hav
779    62  subpattern name expected    62  subpattern name expected
780    63  digit expected after (?+    63  digit expected after (?+
781    64  ] is an invalid data character in JavaScript compatibility mode    64  ] is an invalid data character in JavaScript compatibility mode
782    65  different names for subpatterns of the same number are    65  different names for subpatterns of the same number are
783          not allowed          not allowed
784    66  (*MARK) must have an argument    66  (*MARK) must have an argument
785    67  this version of PCRE is not compiled with PCRE_UCP support    67  this version of PCRE is not compiled with PCRE_UCP support
# Line 849  single fixed starting character. A bitma Line 849  single fixed starting character. A bitma
849  created. This speeds up finding a position in the subject at which to start  created. This speeds up finding a position in the subject at which to start
850  matching.  matching.
851  .P  .P
852  The two optimizations just described can be disabled by setting the  The two optimizations just described can be disabled by setting the
853  PCRE_NO_START_OPTIMIZE option when calling \fBpcre_exec()\fP or  PCRE_NO_START_OPTIMIZE option when calling \fBpcre_exec()\fP or
854  \fBpcre_dfa_exec()\fP. You might want to do this if your pattern contains  \fBpcre_dfa_exec()\fP. You might want to do this if your pattern contains
855  callouts, or make use of (*MARK), and you make use of these in cases where  callouts, or make use of (*MARK), and you make use of these in cases where
856  matching fails. See the discussion of PCRE_NO_START_OPTIMIZE  matching fails. See the discussion of PCRE_NO_START_OPTIMIZE
857  .\" HTML <a href="#execoptions">  .\" HTML <a href="#execoptions">
858  .\" </a>  .\" </a>
# Line 1450  the Line 1450  the
1450  .\" HREF  .\" HREF
1451  \fBpcredemo\fP  \fBpcredemo\fP
1452  .\"  .\"
1453  sample program.  sample program. In the most general case, you have to check to see if the
1454    newline convention recognizes CRLF as a newline, and if so, and the current
1455    character is CR followed by LF, advance the starting offset by two characters
1456    instead of one.
1457  .sp  .sp
1458    PCRE_NO_START_OPTIMIZE    PCRE_NO_START_OPTIMIZE
1459  .sp  .sp
# Line 1460  unanchored match must start with a speci Line 1463  unanchored match must start with a speci
1463  for that character, and fails immediately if it cannot find it, without  for that character, and fails immediately if it cannot find it, without
1464  actually running the main matching function. This means that a special item  actually running the main matching function. This means that a special item
1465  such as (*COMMIT) at the start of a pattern is not considered until after a  such as (*COMMIT) at the start of a pattern is not considered until after a
1466  suitable starting point for the match has been found. When callouts or (*MARK)  suitable starting point for the match has been found. When callouts or (*MARK)
1467  items are in use, these "start-up" optimizations can cause them to be skipped  items are in use, these "start-up" optimizations can cause them to be skipped
1468  if the pattern is never actually used. The start-up optimizations are in effect  if the pattern is never actually used. The start-up optimizations are in effect
1469  a pre-scan of the subject that takes place before the pattern is run.  a pre-scan of the subject that takes place before the pattern is run.
# Line 1475  Consider the pattern Line 1478  Consider the pattern
1478    (*COMMIT)ABC    (*COMMIT)ABC
1479  .sp  .sp
1480  When this is compiled, PCRE records the fact that a match must start with the  When this is compiled, PCRE records the fact that a match must start with the
1481  character "A". Suppose the subject string is "DEFABC". The start-up  character "A". Suppose the subject string is "DEFABC". The start-up
1482  optimization scans along the subject, finds "A" and runs the first match  optimization scans along the subject, finds "A" and runs the first match
1483  attempt from there. The (*COMMIT) item means that the pattern must match the  attempt from there. The (*COMMIT) item means that the pattern must match the
1484  current starting position, which in this case, it does. However, if the same  current starting position, which in this case, it does. However, if the same
1485  match is run with PCRE_NO_START_OPTIMIZE set, the initial scan along the  match is run with PCRE_NO_START_OPTIMIZE set, the initial scan along the
1486  subject string does not happen. The first match attempt is run starting from  subject string does not happen. The first match attempt is run starting from
1487  "D" and when this fails, (*COMMIT) prevents any further matches being tried, so  "D" and when this fails, (*COMMIT) prevents any further matches being tried, so
1488  the overall result is "no match". If the pattern is studied, more start-up  the overall result is "no match". If the pattern is studied, more start-up
1489  optimizations may be used. For example, a minimum length for the subject may be  optimizations may be used. For example, a minimum length for the subject may be
# Line 1488  recorded. Consider the pattern Line 1491  recorded. Consider the pattern
1491  .sp  .sp
1492    (*MARK:A)(X|Y)    (*MARK:A)(X|Y)
1493  .sp  .sp
1494  The minimum length for a match is one character. If the subject is "ABC", there  The minimum length for a match is one character. If the subject is "ABC", there
1495  will be attempts to match "ABC", "BC", "C", and then finally an empty string.  will be attempts to match "ABC", "BC", "C", and then finally an empty string.
1496  If the pattern is studied, the final attempt does not take place, because PCRE  If the pattern is studied, the final attempt does not take place, because PCRE
1497  knows that the subject is too short, and so the (*MARK) is never encountered.  knows that the subject is too short, and so the (*MARK) is never encountered.
1498  In this case, studying the pattern does not affect the overall match result,  In this case, studying the pattern does not affect the overall match result,
1499  which is still "no match", but it does affect the auxiliary information that is  which is still "no match", but it does affect the auxiliary information that is
1500  returned.  returned.
1501  .sp  .sp
1502    PCRE_NO_UTF8_CHECK    PCRE_NO_UTF8_CHECK
# Line 1532  These options turn on the partial matchi Line 1535  These options turn on the partial matchi
1535  compatibility, PCRE_PARTIAL is a synonym for PCRE_PARTIAL_SOFT. A partial match  compatibility, PCRE_PARTIAL is a synonym for PCRE_PARTIAL_SOFT. A partial match
1536  occurs if the end of the subject string is reached successfully, but there are  occurs if the end of the subject string is reached successfully, but there are
1537  not enough subject characters to complete the match. If this happens when  not enough subject characters to complete the match. If this happens when
1538  PCRE_PARTIAL_HARD is set, \fBpcre_exec()\fP immediately returns  PCRE_PARTIAL_SOFT (but not PCRE_PARTIAL_HARD) is set, matching continues by
1539  PCRE_ERROR_PARTIAL. Otherwise, if PCRE_PARTIAL_SOFT is set, matching continues  testing any remaining alternatives. Only if no complete match can be found is
1540  by testing any other alternatives. Only if they all fail is PCRE_ERROR_PARTIAL  PCRE_ERROR_PARTIAL returned instead of PCRE_ERROR_NOMATCH. In other words,
1541  returned (instead of PCRE_ERROR_NOMATCH). The portion of the string that  PCRE_PARTIAL_SOFT says that the caller is prepared to handle a partial match,
1542  was inspected when the partial match was found is set as the first matching  but only if no complete match can be found.
1543  string. There is a more detailed discussion in the  .P
1544    If PCRE_PARTIAL_HARD is set, it overrides PCRE_PARTIAL_SOFT. In this case, if a
1545    partial match is found, \fBpcre_exec()\fP immediately returns
1546    PCRE_ERROR_PARTIAL, without considering any other alternatives. In other words,
1547    when PCRE_PARTIAL_HARD is set, a partial match is considered to be more
1548    important that an alternative complete match.
1549    .P
1550    In both cases, the portion of the string that was inspected when the partial
1551    match was found is set as the first matching string. There is a more detailed
1552    discussion of partial and multi-segment matching, with examples, in the
1553  .\" HREF  .\" HREF
1554  \fBpcrepartial\fP  \fBpcrepartial\fP
1555  .\"  .\"
# Line 2059  is converted into PCRE_ERROR_PARTIAL if Line 2071  is converted into PCRE_ERROR_PARTIAL if
2071  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
2072  possibility. The portion of the string that was inspected when the longest  possibility. The portion of the string that was inspected when the longest
2073  partial match was found is set as the first matching string in both cases.  partial match was found is set as the first matching string in both cases.
2074    There is a more detailed discussion of partial and multi-segment matching, with
2075    examples, in the
2076    .\" HREF
2077    \fBpcrepartial\fP
2078    .\"
2079    documentation.
2080  .sp  .sp
2081    PCRE_DFA_SHORTEST    PCRE_DFA_SHORTEST
2082  .sp  .sp
# Line 2178  Cambridge CB2 3QH, England. Line 2196  Cambridge CB2 3QH, England.
2196  .rs  .rs
2197  .sp  .sp
2198  .nf  .nf
2199  Last updated: 21 June 2010  Last updated: 01 November 2010
2200  Copyright (c) 1997-2010 University of Cambridge.  Copyright (c) 1997-2010 University of Cambridge.
2201  .fi  .fi

Legend:
Removed from v.547  
changed lines
  Added in v.566

  ViewVC Help
Powered by ViewVC 1.1.5