1<html>
2<head>
3<title>pcre specification</title>
4</head>
5<body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
6<h1>pcre man page</h1>
7<p>
8Return to the <a href="index.html">PCRE index page</a>.
9</p>
10<p>
11This page is part of the PCRE HTML documentation. It was generated automatically
12from the original man page. If there is any nonsense in it, please consult the
13man page, in case the conversion went wrong.
14<br>
15<ul>
16<li><a name="TOC1" href="#SEC1">INTRODUCTION</a>
17<li><a name="TOC2" href="#SEC2">USER DOCUMENTATION</a>
18<li><a name="TOC3" href="#SEC3">AUTHOR</a>
19<li><a name="TOC4" href="#SEC4">REVISION</a>
20</ul>
21<br><a name="SEC1" href="#TOC1">INTRODUCTION</a><br>
22<P>
23The PCRE library is a set of functions that implement regular expression
24pattern matching using the same syntax and semantics as Perl, with just a few
25differences. Some features that appeared in Python and PCRE before they
26appeared in Perl are also available using the Python syntax, there is some
27support for one or two .NET and Oniguruma syntax items, and there is an option
28for requesting some minor changes that give better JavaScript compatibility.
29</P>
30<P>
31Starting with release 8.30, it is possible to compile two separate PCRE
32libraries: the original, which supports 8-bit character strings (including
33UTF-8 strings), and a second library that supports 16-bit character strings
34(including UTF-16 strings). The build process allows either one or both to be
35built. The majority of the work to make this possible was done by Zoltan
36Herczeg.
37</P>
38<P>
39The two libraries contain identical sets of functions, except that the names in
40the 16-bit library start with <b>pcre16_</b> instead of <b>pcre_</b>. To avoid
41over-complication and reduce the documentation maintenance load, most of the
42documentation describes the 8-bit library, with the differences for the 16-bit
43library described separately in the
44<a href="pcre16.html"><b>pcre16</b></a>
45page. References to functions or structures of the form <i>pcre[16]_xxx</i>
46should be read as meaning "<i>pcre_xxx</i> when using the 8-bit library and
47<i>pcre16_xxx</i> when using the 16-bit library".
48</P>
49<P>
50The current implementation of PCRE corresponds approximately with Perl 5.12,
51including support for UTF-8/16 encoded strings and Unicode general category
52properties. However, UTF-8/16 and Unicode support has to be explicitly enabled;
53it is not the default. The Unicode tables correspond to Unicode release 6.0.0.
54</P>
55<P>
56In addition to the Perl-compatible matching function, PCRE contains an
57alternative function that matches the same compiled patterns in a different
58way. In certain circumstances, the alternative function has some advantages.
59For a discussion of the two matching algorithms, see the
60<a href="pcrematching.html"><b>pcrematching</b></a>
61page.
62</P>
63<P>
64PCRE is written in C and released as a C library. A number of people have
65written wrappers and interfaces of various kinds. In particular, Google Inc.
66have provided a comprehensive C++ wrapper for the 8-bit library. This is now
67included as part of the PCRE distribution. The
68<a href="pcrecpp.html"><b>pcrecpp</b></a>
69page has details of this interface. Other people's contributions can be found
70in the <i>Contrib</i> directory at the primary FTP site, which is:
71<a href="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre</a>
72</P>
73<P>
74Details of exactly which Perl regular expression features are and are not
75supported by PCRE are given in separate documents. See the
76<a href="pcrepattern.html"><b>pcrepattern</b></a>
77and
78<a href="pcrecompat.html"><b>pcrecompat</b></a>
79pages. There is a syntax summary in the
80<a href="pcresyntax.html"><b>pcresyntax</b></a>
81page.
82</P>
83<P>
84Some features of PCRE can be included, excluded, or changed when the library is
85built. The
86<a href="pcre_config.html"><b>pcre_config()</b></a>
87function makes it possible for a client to discover which features are
88available. The features themselves are described in the
89<a href="pcrebuild.html"><b>pcrebuild</b></a>
90page. Documentation about building PCRE for various operating systems can be
91found in the <b>README</b> and <b>NON-UNIX-USE</b> files in the source
92distribution.
93</P>
94<P>
95The libraries contains a number of undocumented internal functions and data
96tables that are used by more than one of the exported external functions, but
97which are not intended for use by external callers. Their names all begin with
98"_pcre_" or "_pcre16_", which hopefully will not provoke any name clashes. In
99some environments, it is possible to control which external symbols are
100exported when a shared library is built, and in these cases the undocumented
101symbols are not exported.
102</P>
103<br><a name="SEC2" href="#TOC1">USER DOCUMENTATION</a><br>
104<P>
105The user documentation for PCRE comprises a number of different sections. In
106the "man" format, each of these is a separate "man page". In the HTML format,
107each is a separate page, linked from the index page. In the plain text format,
108all the sections, except the <b>pcredemo</b> section, are concatenated, for ease
109of searching. The sections are as follows:
110<pre>
111  pcre              this document
112  pcre16            details of the 16-bit library
113  pcre-config       show PCRE installation configuration information
114  pcreapi           details of PCRE's native C API
115  pcrebuild         options for building PCRE
116  pcrecallout       details of the callout feature
117  pcrecompat        discussion of Perl compatibility
118  pcrecpp           details of the C++ wrapper for the 8-bit library
119  pcredemo          a demonstration C program that uses PCRE
120  pcregrep          description of the <b>pcregrep</b> command (8-bit only)
121  pcrejit           discussion of the just-in-time optimization support
122  pcrelimits        details of size and other limits
123  pcrematching      discussion of the two matching algorithms
124  pcrepartial       details of the partial matching facility
125  pcrepattern       syntax and semantics of supported regular expressions
126  pcreperform       discussion of performance issues
127  pcreposix         the POSIX-compatible C API for the 8-bit library
128  pcreprecompile    details of saving and re-using precompiled patterns
129  pcresample        discussion of the pcredemo program
130  pcrestack         discussion of stack usage
131  pcresyntax        quick syntax reference
132  pcretest          description of the <b>pcretest</b> testing command
133  pcreunicode       discussion of Unicode and UTF-8/16 support
134</pre>
135In addition, in the "man" and HTML formats, there is a short page for each
1368-bit C library function, listing its arguments and results.
137</P>
138<br><a name="SEC3" href="#TOC1">AUTHOR</a><br>
139<P>
140Philip Hazel
141<br>
142University Computing Service
143<br>
144Cambridge CB2 3QH, England.
145<br>
146</P>
147<P>
148Putting an actual email address here seems to have been a spam magnet, so I've
149taken it away. If you want to email me, use my two initials, followed by the
150two digits 10, at the domain cam.ac.uk.
151</P>
152<br><a name="SEC4" href="#TOC1">REVISION</a><br>
153<P>
154Last updated: 10 January 2012
155<br>
156Copyright &copy; 1997-2012 University of Cambridge.
157<br>
158<p>
159Return to the <a href="index.html">PCRE index page</a>.
160</p>
161