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

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

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

revision 99 by ph10, Tue Mar 6 12:27:42 2007 UTC revision 211 by ph10, Thu Aug 9 09:52:43 2007 UTC
# Line 7  Line 7 
7  <p>  <p>
8  Return to the <a href="index.html">PCRE index page</a>.  Return to the <a href="index.html">PCRE index page</a>.
9  </p>  </p>
10  <p>  <p>
11  This page is part of the PCRE HTML documentation. It was generated automatically  This page is part of the PCRE HTML documentation. It was generated automatically
12  from the original man page. If there is any nonsense in it, please consult the  from the original man page. If there is any nonsense in it, please consult the
13  man page, in case the conversion went wrong.  man page, in case the conversion went wrong.
14  <br>  <br>
15  <ul>  <ul>
16  <li><a name="TOC1" href="#SEC1">INTRODUCTION</a>  <li><a name="TOC1" href="#SEC1">INTRODUCTION</a>
17  <li><a name="TOC2" href="#SEC2">USER DOCUMENTATION</a>  <li><a name="TOC2" href="#SEC2">USER DOCUMENTATION</a>
# Line 58  supported by PCRE are given in separate Line 58  supported by PCRE are given in separate
58  <a href="pcrepattern.html"><b>pcrepattern</b></a>  <a href="pcrepattern.html"><b>pcrepattern</b></a>
59  and  and
60  <a href="pcrecompat.html"><b>pcrecompat</b></a>  <a href="pcrecompat.html"><b>pcrecompat</b></a>
61  pages.  pages. There is a syntax summary in the
62    <a href="pcresyntax.html"><b>pcresyntax</b></a>
63    page.
64  </P>  </P>
65  <P>  <P>
66  Some features of PCRE can be included, excluded, or changed when the library is  Some features of PCRE can be included, excluded, or changed when the library is
# Line 88  all the sections are concatenated, for e Line 90  all the sections are concatenated, for e
90  follows:  follows:
91  <pre>  <pre>
92    pcre              this document    pcre              this document
93      pcre-config       show PCRE installation configuration information
94    pcreapi           details of PCRE's native C API    pcreapi           details of PCRE's native C API
95    pcrebuild         options for building PCRE    pcrebuild         options for building PCRE
96    pcrecallout       details of the callout feature    pcrecallout       details of the callout feature
# Line 97  follows: Line 100  follows:
100    pcrematching      discussion of the two matching algorithms    pcrematching      discussion of the two matching algorithms
101    pcrepartial       details of the partial matching facility    pcrepartial       details of the partial matching facility
102    pcrepattern       syntax and semantics of supported regular expressions    pcrepattern       syntax and semantics of supported regular expressions
103      pcresyntax        quick syntax reference
104    pcreperform       discussion of performance issues    pcreperform       discussion of performance issues
105    pcreposix         the POSIX-compatible C API    pcreposix         the POSIX-compatible C API
106    pcreprecompile    details of saving and re-using precompiled patterns    pcreprecompile    details of saving and re-using precompiled patterns
# Line 123  documentation for details). In these cas Line 127  documentation for details). In these cas
127  However, the speed of execution is slower.  However, the speed of execution is slower.
128  </P>  </P>
129  <P>  <P>
130  All values in repeating quantifiers must be less than 65536. The maximum  All values in repeating quantifiers must be less than 65536.
 compiled length of subpattern with an explicit repeat count is 30000 bytes. The  
 maximum number of capturing subpatterns is 65535.  
131  </P>  </P>
132  <P>  <P>
133  There is no limit to the number of parenthesized subpatterns, but there can be  There is no limit to the number of parenthesized subpatterns, but there can be
# Line 177  documentation. Only the short names for Line 179  documentation. Only the short names for
179  \p{L} matches a letter. Its Perl synonym, \p{Letter}, is not supported.  \p{L} matches a letter. Its Perl synonym, \p{Letter}, is not supported.
180  Furthermore, in Perl, many properties may optionally be prefixed by "Is", for  Furthermore, in Perl, many properties may optionally be prefixed by "Is", for
181  compatibility with Perl 5.6. PCRE does not support this.  compatibility with Perl 5.6. PCRE does not support this.
182  </P>  <a name="utf8strings"></a></P>
183  <P>  <br><b>
184  The following comments apply when PCRE is running in UTF-8 mode:  Validity of UTF-8 strings
185  </P>  </b><br>
186  <P>  <P>
187  1. When you set the PCRE_UTF8 flag, the strings passed as patterns and subjects  When you set the PCRE_UTF8 flag, the strings passed as patterns and subjects
188  are checked for validity on entry to the relevant functions. If an invalid  are (by default) checked for validity on entry to the relevant functions. From
189  UTF-8 string is passed, an error return is given. In some situations, you may  release 7.3 of PCRE, the check is according the rules of RFC 3629, which are
190  already know that your strings are valid, and therefore want to skip these  themselves derived from the Unicode specification. Earlier releases of PCRE
191  checks in order to improve performance. If you set the PCRE_NO_UTF8_CHECK flag  followed the rules of RFC 2279, which allows the full range of 31-bit values (0
192  at compile time or at run time, PCRE assumes that the pattern or subject it  to 0x7FFFFFFF). The current check allows only values in the range U+0 to
193  is given (respectively) contains only valid UTF-8 codes. In this case, it does  U+10FFFF, excluding U+D800 to U+DFFF.
194  not diagnose an invalid UTF-8 string. If you pass an invalid UTF-8 string to  </P>
195  PCRE when PCRE_NO_UTF8_CHECK is set, the results are undefined. Your program  <P>
196  may crash.  The excluded code points are the "Low Surrogate Area" of Unicode, of which the
197  </P>  Unicode Standard says this: "The Low Surrogate Area does not contain any
198    character assignments, consequently no character code charts or namelists are
199    provided for this area. Surrogates are reserved for use with UTF-16 and then
200    must be used in pairs." The code points that are encoded by UTF-16 pairs are
201    available as independent code points in the UTF-8 encoding. (In other words,
202    the whole surrogate thing is a fudge for UTF-16 which unfortunately messes up
203    UTF-8.)
204    </P>
205    <P>
206    If an invalid UTF-8 string is passed to PCRE, an error return
207    (PCRE_ERROR_BADUTF8) is given. In some situations, you may already know that
208    your strings are valid, and therefore want to skip these checks in order to
209    improve performance. If you set the PCRE_NO_UTF8_CHECK flag at compile time or
210    at run time, PCRE assumes that the pattern or subject it is given
211    (respectively) contains only valid UTF-8 codes. In this case, it does not
212    diagnose an invalid UTF-8 string.
213    </P>
214    <P>
215    If you pass an invalid UTF-8 string when PCRE_NO_UTF8_CHECK is set, what
216    happens depends on why the string is invalid. If the string conforms to the
217    "old" definition of UTF-8 (RFC 2279), it is processed as a string of characters
218    in the range 0 to 0x7FFFFFFF. In other words, apart from the initial validity
219    test, PCRE (when in UTF-8 mode) handles strings according to the more liberal
220    rules of RFC 2279. However, if the string does not even conform to RFC 2279,
221    the result is undefined. Your program may crash.
222    </P>
223    <P>
224    If you want to process strings of values in the full range 0 to 0x7FFFFFFF,
225    encoded in a UTF-8-like manner as per the old RFC, you can set
226    PCRE_NO_UTF8_CHECK to bypass the more restrictive test. However, in this
227    situation, you will have to apply your own validity check.
228    </P>
229    <br><b>
230    General comments about UTF-8 mode
231    </b><br>
232  <P>  <P>
233  2. An unbraced hexadecimal escape sequence (such as \xb3) matches a two-byte  1. An unbraced hexadecimal escape sequence (such as \xb3) matches a two-byte
234  UTF-8 character if the value is greater than 127.  UTF-8 character if the value is greater than 127.
235  </P>  </P>
236  <P>  <P>
237  3. Octal numbers up to \777 are recognized, and match two-byte UTF-8  2. Octal numbers up to \777 are recognized, and match two-byte UTF-8
238  characters for values greater than \177.  characters for values greater than \177.
239  </P>  </P>
240  <P>  <P>
241  4. Repeat quantifiers apply to complete UTF-8 characters, not to individual  3. Repeat quantifiers apply to complete UTF-8 characters, not to individual
242  bytes, for example: \x{100}{3}.  bytes, for example: \x{100}{3}.
243  </P>  </P>
244  <P>  <P>
245  5. The dot metacharacter matches one UTF-8 character instead of a single byte.  4. The dot metacharacter matches one UTF-8 character instead of a single byte.
246  </P>  </P>
247  <P>  <P>
248  6. The escape sequence \C can be used to match a single byte in UTF-8 mode,  5. The escape sequence \C can be used to match a single byte in UTF-8 mode,
249  but its use can lead to some strange effects. This facility is not available in  but its use can lead to some strange effects. This facility is not available in
250  the alternative matching function, <b>pcre_dfa_exec()</b>.  the alternative matching function, <b>pcre_dfa_exec()</b>.
251  </P>  </P>
252  <P>  <P>
253  7. The character escapes \b, \B, \d, \D, \s, \S, \w, and \W correctly  6. The character escapes \b, \B, \d, \D, \s, \S, \w, and \W correctly
254  test characters of any code value, but the characters that PCRE recognizes as  test characters of any code value, but the characters that PCRE recognizes as
255  digits, spaces, or word characters remain the same set as before, all with  digits, spaces, or word characters remain the same set as before, all with
256  values less than 256. This remains true even when PCRE includes Unicode  values less than 256. This remains true even when PCRE includes Unicode
# Line 223  cases. If you really want to test for a Line 259  cases. If you really want to test for a
259  must use Unicode property tests such as \p{Nd}.  must use Unicode property tests such as \p{Nd}.
260  </P>  </P>
261  <P>  <P>
262  8. Similarly, characters that match the POSIX named character classes are all  7. Similarly, characters that match the POSIX named character classes are all
263  low-valued characters.  low-valued characters.
264  </P>  </P>
265  <P>  <P>
266    8. However, the Perl 5.10 horizontal and vertical whitespace matching escapes
267    (\h, \H, \v, and \V) do match all the appropriate Unicode characters.
268    </P>
269    <P>
270  9. Case-insensitive matching applies only to characters whose values are less  9. Case-insensitive matching applies only to characters whose values are less
271  than 128, unless PCRE is built with Unicode property support. Even when Unicode  than 128, unless PCRE is built with Unicode property support. Even when Unicode
272  property support is available, PCRE still uses its own character tables when  property support is available, PCRE still uses its own character tables when
# Line 248  Cambridge CB2 3QH, England. Line 288  Cambridge CB2 3QH, England.
288  </P>  </P>
289  <P>  <P>
290  Putting an actual email address here seems to have been a spam magnet, so I've  Putting an actual email address here seems to have been a spam magnet, so I've
291  taken it away. If you want to email me, use my initial and surname, separated  taken it away. If you want to email me, use my two initials, followed by the
292  by a dot, at the domain ucs.cam.ac.uk.  two digits 10, at the domain cam.ac.uk.
293  </P>  </P>
294  <br><a name="SEC6" href="#TOC1">REVISION</a><br>  <br><a name="SEC6" href="#TOC1">REVISION</a><br>
295  <P>  <P>
296  Last updated: 06 March 2007  Last updated: 09 August 2007
297  <br>  <br>
298  Copyright &copy; 1997-2007 University of Cambridge.  Copyright &copy; 1997-2007 University of Cambridge.
299  <br>  <br>

Legend:
Removed from v.99  
changed lines
  Added in v.211

  ViewVC Help
Powered by ViewVC 1.1.5