/[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 203 by ph10, Fri Aug 3 10:09:57 2007 UTC revision 226 by ph10, Tue Aug 21 11:46:08 2007 UTC
# Line 240  pair of characters that indicate a line Line 240  pair of characters that indicate a line
240  convention affects the handling of the dot, circumflex, and dollar  convention affects the handling of the dot, circumflex, and dollar
241  metacharacters, the handling of #-comments in /x mode, and, when CRLF is a  metacharacters, the handling of #-comments in /x mode, and, when CRLF is a
242  recognized line ending sequence, the match position advancement for a  recognized line ending sequence, the match position advancement for a
243  non-anchored pattern. The choice of newline convention does not affect the  non-anchored pattern. There is more detail about this in the
244  interpretation of the \en or \er escape sequences.  .\" HTML <a href="#execoptions">
245    .\" </a>
246    section on \fBpcre_exec()\fP options
247    .\"
248    below. The choice of newline convention does not affect the interpretation of
249    the \en or \er escape sequences.
250  .  .
251  .  .
252  .SH MULTITHREADING  .SH MULTITHREADING
# Line 601  page. Line 606  page.
606    PCRE_NO_UTF8_CHECK    PCRE_NO_UTF8_CHECK
607  .sp  .sp
608  When PCRE_UTF8 is set, the validity of the pattern as a UTF-8 string is  When PCRE_UTF8 is set, the validity of the pattern as a UTF-8 string is
609  automatically checked. If an invalid UTF-8 sequence of bytes is found,  automatically checked. There is a discussion about the
610  \fBpcre_compile()\fP returns an error. If you already know that your pattern is  .\" HTML <a href="pcre.html#utf8strings">
611  valid, and you want to skip this check for performance reasons, you can set the  .\" </a>
612  PCRE_NO_UTF8_CHECK option. When it is set, the effect of passing an invalid  validity of UTF-8 strings
613  UTF-8 string as a pattern is undefined. It may cause your program to crash.  .\"
614  Note that this option can also be passed to \fBpcre_exec()\fP and  in the main
615  \fBpcre_dfa_exec()\fP, to suppress the UTF-8 validity checking of subject  .\" HREF
616  strings.  \fBpcre\fP
617    .\"
618    page. If an invalid UTF-8 sequence of bytes is found, \fBpcre_compile()\fP
619    returns an error. If you already know that your pattern is valid, and you want
620    to skip this check for performance reasons, you can set the PCRE_NO_UTF8_CHECK
621    option. When it is set, the effect of passing an invalid UTF-8 string as a
622    pattern is undefined. It may cause your program to crash. Note that this option
623    can also be passed to \fBpcre_exec()\fP and \fBpcre_dfa_exec()\fP, to suppress
624    the UTF-8 validity checking of subject strings.
625  .  .
626  .  .
627  .SH "COMPILATION ERROR CODES"  .SH "COMPILATION ERROR CODES"
# Line 874  table indicating a fixed set of bytes fo Line 887  table indicating a fixed set of bytes fo
887  string, a pointer to the table is returned. Otherwise NULL is returned. The  string, a pointer to the table is returned. Otherwise NULL is returned. The
888  fourth argument should point to an \fBunsigned char *\fP variable.  fourth argument should point to an \fBunsigned char *\fP variable.
889  .sp  .sp
890      PCRE_INFO_HASCRORLF
891    .sp
892    Return 1 if the pattern contains any explicit matches for CR or LF characters,
893    otherwise 0. The fourth argument should point to an \fBint\fP variable.
894    .sp
895    PCRE_INFO_JCHANGED    PCRE_INFO_JCHANGED
896  .sp  .sp
897  Return 1 if the (?J) option setting is used in the pattern, otherwise 0. The  Return 1 if the (?J) option setting is used in the pattern, otherwise 0. The
# Line 1161  called. See the Line 1179  called. See the
1179  .\"  .\"
1180  documentation for a discussion of saving compiled patterns for later use.  documentation for a discussion of saving compiled patterns for later use.
1181  .  .
1182    .\" HTML <a name="execoptions"></a>
1183  .SS "Option bits for \fBpcre_exec()\fP"  .SS "Option bits for \fBpcre_exec()\fP"
1184  .rs  .rs
1185  .sp  .sp
# Line 1186  the pattern was compiled. For details, s Line 1205  the pattern was compiled. For details, s
1205  \fBpcre_compile()\fP above. During matching, the newline choice affects the  \fBpcre_compile()\fP above. During matching, the newline choice affects the
1206  behaviour of the dot, circumflex, and dollar metacharacters. It may also alter  behaviour of the dot, circumflex, and dollar metacharacters. It may also alter
1207  the way the match position is advanced after a match failure for an unanchored  the way the match position is advanced after a match failure for an unanchored
1208  pattern. When PCRE_NEWLINE_CRLF, PCRE_NEWLINE_ANYCRLF, or PCRE_NEWLINE_ANY is  pattern.
1209  set, and a match attempt fails when the current position is at a CRLF sequence,  .P
1210  the match position is advanced by two characters instead of one, in other  When PCRE_NEWLINE_CRLF, PCRE_NEWLINE_ANYCRLF, or PCRE_NEWLINE_ANY is set, and a
1211  words, to after the CRLF.  match attempt for an unanchored pattern fails when the current position is at a
1212    CRLF sequence, and the pattern contains no explicit matches for CR or NL
1213    characters, the match position is advanced by two characters instead of one, in
1214    other words, to after the CRLF.
1215    .P
1216    The above rule is a compromise that makes the most common cases work as
1217    expected. For example, if the pattern is .+A (and the PCRE_DOTALL option is not
1218    set), it does not match the string "\er\enA" because, after failing at the
1219    start, it skips both the CR and the LF before retrying. However, the pattern
1220    [\er\en]A does match that string, because it contains an explicit CR or LF
1221    reference, and so advances only by one character after the first failure.
1222    Note than an explicit CR or LF reference occurs for negated character classes
1223    such as [^X] because they can match CR or LF characters.
1224    .P
1225    Notwithstanding the above, anomalous effects may still occur when CRLF is a
1226    valid newline sequence and explicit \er or \en escapes appear in the pattern.
1227  .sp  .sp
1228    PCRE_NOTBOL    PCRE_NOTBOL
1229  .sp  .sp
# Line 1232  code that demonstrates how to do this in Line 1266  code that demonstrates how to do this in
1266  When PCRE_UTF8 is set at compile time, the validity of the subject as a UTF-8  When PCRE_UTF8 is set at compile time, the validity of the subject as a UTF-8
1267  string is automatically checked when \fBpcre_exec()\fP is subsequently called.  string is automatically checked when \fBpcre_exec()\fP is subsequently called.
1268  The value of \fIstartoffset\fP is also checked to ensure that it points to the  The value of \fIstartoffset\fP is also checked to ensure that it points to the
1269  start of a UTF-8 character. If an invalid UTF-8 sequence of bytes is found,  start of a UTF-8 character. There is a discussion about the validity of UTF-8
1270  \fBpcre_exec()\fP returns the error PCRE_ERROR_BADUTF8. If \fIstartoffset\fP  strings in the
1271  contains an invalid value, PCRE_ERROR_BADUTF8_OFFSET is returned.  .\" HTML <a href="pcre.html#utf8strings">
1272    .\" </a>
1273    section on UTF-8 support
1274    .\"
1275    in the main
1276    .\" HREF
1277    \fBpcre\fP
1278    .\"
1279    page. If an invalid UTF-8 sequence of bytes is found, \fBpcre_exec()\fP returns
1280    the error PCRE_ERROR_BADUTF8. If \fIstartoffset\fP contains an invalid value,
1281    PCRE_ERROR_BADUTF8_OFFSET is returned.
1282  .P  .P
1283  If you already know that your subject is valid, and you want to skip these  If you already know that your subject is valid, and you want to skip these
1284  checks for performance reasons, you can set the PCRE_NO_UTF8_CHECK option when  checks for performance reasons, you can set the PCRE_NO_UTF8_CHECK option when
# Line 1635  example is shown in the Line 1679  example is shown in the
1679  .\" HREF  .\" HREF
1680  \fBpcrepattern\fP  \fBpcrepattern\fP
1681  .\"  .\"
1682  documentation.  documentation.
1683  .P  .P
1684  When duplicates are present, \fBpcre_copy_named_substring()\fP and  When duplicates are present, \fBpcre_copy_named_substring()\fP and
1685  \fBpcre_get_named_substring()\fP return the first substring corresponding to  \fBpcre_get_named_substring()\fP return the first substring corresponding to
# Line 1868  Cambridge CB2 3QH, England. Line 1912  Cambridge CB2 3QH, England.
1912  .rs  .rs
1913  .sp  .sp
1914  .nf  .nf
1915  Last updated: 30 July 2007  Last updated: 21 August 2007
1916  Copyright (c) 1997-2007 University of Cambridge.  Copyright (c) 1997-2007 University of Cambridge.
1917  .fi  .fi

Legend:
Removed from v.203  
changed lines
  Added in v.226

  ViewVC Help
Powered by ViewVC 1.1.5