| 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>
|
| 8 |
Return to the <a href="index.html">PCRE index page</a>.
|
| 9 |
</p>
|
| 10 |
<p>
|
| 11 |
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
|
| 13 |
man 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>
|
| 23 |
The PCRE library is a set of functions that implement regular expression
|
| 24 |
pattern matching using the same syntax and semantics as Perl, with just a few
|
| 25 |
differences. Some features that appeared in Python and PCRE before they
|
| 26 |
appeared in Perl are also available using the Python syntax, there is some
|
| 27 |
support for one or two .NET and Oniguruma syntax items, and there is an option
|
| 28 |
for requesting some minor changes that give better JavaScript compatibility.
|
| 29 |
</P>
|
| 30 |
<P>
|
| 31 |
Starting with release 8.30, it is possible to compile two separate PCRE
|
| 32 |
libraries: the original, which supports 8-bit character strings (including
|
| 33 |
UTF-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
|
| 35 |
built. The majority of the work to make this possible was done by Zoltan
|
| 36 |
Herczeg.
|
| 37 |
</P>
|
| 38 |
<P>
|
| 39 |
The two libraries contain identical sets of functions, except that the names in
|
| 40 |
the 16-bit library start with <b>pcre16_</b> instead of <b>pcre_</b>. To avoid
|
| 41 |
over-complication and reduce the documentation maintenance load, most of the
|
| 42 |
documentation describes the 8-bit library, with the differences for the 16-bit
|
| 43 |
library described separately in the
|
| 44 |
<a href="pcre16.html"><b>pcre16</b></a>
|
| 45 |
page. References to functions or structures of the form <i>pcre[16]_xxx</i>
|
| 46 |
should 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>
|
| 50 |
The current implementation of PCRE corresponds approximately with Perl 5.12,
|
| 51 |
including support for UTF-8/16 encoded strings and Unicode general category
|
| 52 |
properties. However, UTF-8/16 and Unicode support has to be explicitly enabled;
|
| 53 |
it is not the default. The Unicode tables correspond to Unicode release 6.0.0.
|
| 54 |
</P>
|
| 55 |
<P>
|
| 56 |
In addition to the Perl-compatible matching function, PCRE contains an
|
| 57 |
alternative function that matches the same compiled patterns in a different
|
| 58 |
way. In certain circumstances, the alternative function has some advantages.
|
| 59 |
For a discussion of the two matching algorithms, see the
|
| 60 |
<a href="pcrematching.html"><b>pcrematching</b></a>
|
| 61 |
page.
|
| 62 |
</P>
|
| 63 |
<P>
|
| 64 |
PCRE is written in C and released as a C library. A number of people have
|
| 65 |
written wrappers and interfaces of various kinds. In particular, Google Inc.
|
| 66 |
have provided a comprehensive C++ wrapper for the 8-bit library. This is now
|
| 67 |
included as part of the PCRE distribution. The
|
| 68 |
<a href="pcrecpp.html"><b>pcrecpp</b></a>
|
| 69 |
page has details of this interface. Other people's contributions can be found
|
| 70 |
in 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>
|
| 74 |
Details of exactly which Perl regular expression features are and are not
|
| 75 |
supported by PCRE are given in separate documents. See the
|
| 76 |
<a href="pcrepattern.html"><b>pcrepattern</b></a>
|
| 77 |
and
|
| 78 |
<a href="pcrecompat.html"><b>pcrecompat</b></a>
|
| 79 |
pages. There is a syntax summary in the
|
| 80 |
<a href="pcresyntax.html"><b>pcresyntax</b></a>
|
| 81 |
page.
|
| 82 |
</P>
|
| 83 |
<P>
|
| 84 |
Some features of PCRE can be included, excluded, or changed when the library is
|
| 85 |
built. The
|
| 86 |
<a href="pcre_config.html"><b>pcre_config()</b></a>
|
| 87 |
function makes it possible for a client to discover which features are
|
| 88 |
available. The features themselves are described in the
|
| 89 |
<a href="pcrebuild.html"><b>pcrebuild</b></a>
|
| 90 |
page. Documentation about building PCRE for various operating systems can be
|
| 91 |
found in the <b>README</b> and <b>NON-UNIX-USE</b> files in the source
|
| 92 |
distribution.
|
| 93 |
</P>
|
| 94 |
<P>
|
| 95 |
The libraries contains a number of undocumented internal functions and data
|
| 96 |
tables that are used by more than one of the exported external functions, but
|
| 97 |
which 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
|
| 99 |
some environments, it is possible to control which external symbols are
|
| 100 |
exported when a shared library is built, and in these cases the undocumented
|
| 101 |
symbols are not exported.
|
| 102 |
</P>
|
| 103 |
<br><a name="SEC2" href="#TOC1">USER DOCUMENTATION</a><br>
|
| 104 |
<P>
|
| 105 |
The user documentation for PCRE comprises a number of different sections. In
|
| 106 |
the "man" format, each of these is a separate "man page". In the HTML format,
|
| 107 |
each is a separate page, linked from the index page. In the plain text format,
|
| 108 |
all the sections, except the <b>pcredemo</b> section, are concatenated, for ease
|
| 109 |
of 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>
|
| 135 |
In addition, in the "man" and HTML formats, there is a short page for each
|
| 136 |
8-bit C library function, listing its arguments and results.
|
| 137 |
</P>
|
| 138 |
<br><a name="SEC3" href="#TOC1">AUTHOR</a><br>
|
| 139 |
<P>
|
| 140 |
Philip Hazel
|
| 141 |
<br>
|
| 142 |
University Computing Service
|
| 143 |
<br>
|
| 144 |
Cambridge CB2 3QH, England.
|
| 145 |
<br>
|
| 146 |
</P>
|
| 147 |
<P>
|
| 148 |
Putting an actual email address here seems to have been a spam magnet, so I've
|
| 149 |
taken it away. If you want to email me, use my two initials, followed by the
|
| 150 |
two digits 10, at the domain cam.ac.uk.
|
| 151 |
</P>
|
| 152 |
<br><a name="SEC4" href="#TOC1">REVISION</a><br>
|
| 153 |
<P>
|
| 154 |
Last updated: 10 January 2012
|
| 155 |
<br>
|
| 156 |
Copyright © 1997-2012 University of Cambridge.
|
| 157 |
<br>
|
| 158 |
<p>
|
| 159 |
Return to the <a href="index.html">PCRE index page</a>.
|
| 160 |
</p>
|