| 24 |
<P> |
<P> |
| 25 |
The PCRE library is a set of functions that implement regular expression |
The PCRE library is a set of functions that implement regular expression |
| 26 |
pattern matching using the same syntax and semantics as Perl, with just a few |
pattern matching using the same syntax and semantics as Perl, with just a few |
| 27 |
differences. (Certain features that appeared in Python and PCRE before they |
differences. Some features that appeared in Python and PCRE before they |
| 28 |
appeared in Perl are also available using the Python syntax.) |
appeared in Perl are also available using the Python syntax, there is some |
| 29 |
|
support for one or two .NET and Oniguruma syntax items, and there is an option |
| 30 |
|
for requesting some minor changes that give better JavaScript compatibility. |
| 31 |
</P> |
</P> |
| 32 |
<P> |
<P> |
| 33 |
The current implementation of PCRE (release 7.x) corresponds approximately with |
The current implementation of PCRE corresponds approximately with Perl 5.10, |
| 34 |
Perl 5.10, including support for UTF-8 encoded strings and Unicode general |
including support for UTF-8 encoded strings and Unicode general category |
| 35 |
category properties. However, UTF-8 and Unicode support has to be explicitly |
properties. However, UTF-8 and Unicode support has to be explicitly enabled; it |
| 36 |
enabled; it is not the default. The Unicode tables correspond to Unicode |
is not the default. The Unicode tables correspond to Unicode release 5.2.0. |
|
release 5.0.0. |
|
| 37 |
</P> |
</P> |
| 38 |
<P> |
<P> |
| 39 |
In addition to the Perl-compatible matching function, PCRE contains an |
In addition to the Perl-compatible matching function, PCRE contains an |
| 40 |
alternative matching function that matches the same compiled patterns in a |
alternative function that matches the same compiled patterns in a different |
| 41 |
different way. In certain circumstances, the alternative function has some |
way. In certain circumstances, the alternative function has some advantages. |
| 42 |
advantages. For a discussion of the two matching algorithms, see the |
For a discussion of the two matching algorithms, see the |
| 43 |
<a href="pcrematching.html"><b>pcrematching</b></a> |
<a href="pcrematching.html"><b>pcrematching</b></a> |
| 44 |
page. |
page. |
| 45 |
</P> |
</P> |
| 71 |
available. The features themselves are described in the |
available. The features themselves are described in the |
| 72 |
<a href="pcrebuild.html"><b>pcrebuild</b></a> |
<a href="pcrebuild.html"><b>pcrebuild</b></a> |
| 73 |
page. Documentation about building PCRE for various operating systems can be |
page. Documentation about building PCRE for various operating systems can be |
| 74 |
found in the <b>README</b> file in the source distribution. |
found in the <b>README</b> and <b>NON-UNIX-USE</b> files in the source |
| 75 |
|
distribution. |
| 76 |
</P> |
</P> |
| 77 |
<P> |
<P> |
| 78 |
The library contains a number of undocumented internal functions and data |
The library contains a number of undocumented internal functions and data |
| 88 |
The user documentation for PCRE comprises a number of different sections. In |
The user documentation for PCRE comprises a number of different sections. In |
| 89 |
the "man" format, each of these is a separate "man page". In the HTML format, |
the "man" format, each of these is a separate "man page". In the HTML format, |
| 90 |
each is a separate page, linked from the index page. In the plain text format, |
each is a separate page, linked from the index page. In the plain text format, |
| 91 |
all the sections are concatenated, for ease of searching. The sections are as |
all the sections, except the <b>pcredemo</b> section, are concatenated, for ease |
| 92 |
follows: |
of searching. The sections are as follows: |
| 93 |
<pre> |
<pre> |
| 94 |
pcre this document |
pcre this document |
| 95 |
pcre-config show PCRE installation configuration information |
pcre-config show PCRE installation configuration information |
| 98 |
pcrecallout details of the callout feature |
pcrecallout details of the callout feature |
| 99 |
pcrecompat discussion of Perl compatibility |
pcrecompat discussion of Perl compatibility |
| 100 |
pcrecpp details of the C++ wrapper |
pcrecpp details of the C++ wrapper |
| 101 |
|
pcredemo a demonstration C program that uses PCRE |
| 102 |
pcregrep description of the <b>pcregrep</b> command |
pcregrep description of the <b>pcregrep</b> command |
| 103 |
pcrematching discussion of the two matching algorithms |
pcrematching discussion of the two matching algorithms |
| 104 |
pcrepartial details of the partial matching facility |
pcrepartial details of the partial matching facility |
| 105 |
pcrepattern syntax and semantics of supported regular expressions |
pcrepattern syntax and semantics of supported regular expressions |
|
pcresyntax quick syntax reference |
|
| 106 |
pcreperform discussion of performance issues |
pcreperform discussion of performance issues |
| 107 |
pcreposix the POSIX-compatible C API |
pcreposix the POSIX-compatible C API |
| 108 |
pcreprecompile details of saving and re-using precompiled patterns |
pcreprecompile details of saving and re-using precompiled patterns |
| 109 |
pcresample discussion of the sample program |
pcresample discussion of the pcredemo program |
| 110 |
pcrestack discussion of stack usage |
pcrestack discussion of stack usage |
| 111 |
|
pcresyntax quick syntax reference |
| 112 |
pcretest description of the <b>pcretest</b> testing command |
pcretest description of the <b>pcretest</b> testing command |
| 113 |
</pre> |
</pre> |
| 114 |
In addition, in the "man" and HTML formats, there is a short page for each |
In addition, in the "man" and HTML formats, there is a short page for each |
| 161 |
In order process UTF-8 strings, you must build PCRE to include UTF-8 support in |
In order process UTF-8 strings, you must build PCRE to include UTF-8 support in |
| 162 |
the code, and, in addition, you must call |
the code, and, in addition, you must call |
| 163 |
<a href="pcre_compile.html"><b>pcre_compile()</b></a> |
<a href="pcre_compile.html"><b>pcre_compile()</b></a> |
| 164 |
with the PCRE_UTF8 option flag. When you do this, both the pattern and any |
with the PCRE_UTF8 option flag, or the pattern must start with the sequence |
| 165 |
subject strings that are matched against it are treated as UTF-8 strings |
(*UTF8). When either of these is the case, both the pattern and any subject |
| 166 |
instead of just strings of bytes. |
strings that are matched against it are treated as UTF-8 strings instead of |
| 167 |
|
strings of 1-byte characters. |
| 168 |
</P> |
</P> |
| 169 |
<P> |
<P> |
| 170 |
If you compile PCRE with UTF-8 support, but do not use it at run time, the |
If you compile PCRE with UTF-8 support, but do not use it at run time, the |
| 260 |
values less than 256. This remains true even when PCRE includes Unicode |
values less than 256. This remains true even when PCRE includes Unicode |
| 261 |
property support, because to do otherwise would slow down PCRE in many common |
property support, because to do otherwise would slow down PCRE in many common |
| 262 |
cases. If you really want to test for a wider sense of, say, "digit", you |
cases. If you really want to test for a wider sense of, say, "digit", you |
| 263 |
must use Unicode property tests such as \p{Nd}. |
must use Unicode property tests such as \p{Nd}. Note that this also applies to |
| 264 |
|
\b, because it is defined in terms of \w and \W. |
| 265 |
</P> |
</P> |
| 266 |
<P> |
<P> |
| 267 |
7. Similarly, characters that match the POSIX named character classes are all |
7. Similarly, characters that match the POSIX named character classes are all |
| 298 |
</P> |
</P> |
| 299 |
<br><a name="SEC6" href="#TOC1">REVISION</a><br> |
<br><a name="SEC6" href="#TOC1">REVISION</a><br> |
| 300 |
<P> |
<P> |
| 301 |
Last updated: 09 August 2007 |
Last updated: 01 March 2010 |
| 302 |
<br> |
<br> |
| 303 |
Copyright © 1997-2007 University of Cambridge. |
Copyright © 1997-2010 University of Cambridge. |
| 304 |
<br> |
<br> |
| 305 |
<p> |
<p> |
| 306 |
Return to the <a href="index.html">PCRE index page</a>. |
Return to the <a href="index.html">PCRE index page</a>. |