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

Contents of /code/trunk/doc/pcre.3

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1756 - (show annotations)
Mon Jul 22 11:12:47 2019 UTC (4 weeks, 1 day ago) by ph10
File size: 9277 byte(s)
Error occurred while calculating annotation data.
Fix minor documentation typos.
1 .TH PCRE 3 "10 February 2015" "PCRE 8.37"
2 .SH NAME
3 PCRE - Perl-compatible regular expressions (original API)
4 .SH "PLEASE TAKE NOTE"
5 .rs
6 .sp
7 This document relates to PCRE releases that use the original API,
8 with library names libpcre, libpcre16, and libpcre32. January 2015 saw the
9 first release of a new API, known as PCRE2, with release numbers starting at
10 10.00 and library names libpcre2-8, libpcre2-16, and libpcre2-32. The old
11 libraries (now called PCRE1) are still being maintained for bug fixes, but
12 there will be no new development. New projects are advised to use the new PCRE2
13 libraries.
14 .
15 .
16 .SH INTRODUCTION
17 .rs
18 .sp
19 The PCRE library is a set of functions that implement regular expression
20 pattern matching using the same syntax and semantics as Perl, with just a few
21 differences. Some features that appeared in Python and PCRE before they
22 appeared in Perl are also available using the Python syntax, there is some
23 support for one or two .NET and Oniguruma syntax items, and there is an option
24 for requesting some minor changes that give better JavaScript compatibility.
25 .P
26 Starting with release 8.30, it is possible to compile two separate PCRE
27 libraries: the original, which supports 8-bit character strings (including
28 UTF-8 strings), and a second library that supports 16-bit character strings
29 (including UTF-16 strings). The build process allows either one or both to be
30 built. The majority of the work to make this possible was done by Zoltan
31 Herczeg.
32 .P
33 Starting with release 8.32 it is possible to compile a third separate PCRE
34 library that supports 32-bit character strings (including UTF-32 strings). The
35 build process allows any combination of the 8-, 16- and 32-bit libraries. The
36 work to make this possible was done by Christian Persch.
37 .P
38 The three libraries contain identical sets of functions, except that the names
39 in the 16-bit library start with \fBpcre16_\fP instead of \fBpcre_\fP, and the
40 names in the 32-bit library start with \fBpcre32_\fP instead of \fBpcre_\fP. To
41 avoid over-complication and reduce the documentation maintenance load, most of
42 the documentation describes the 8-bit library, with the differences for the
43 16-bit and 32-bit libraries described separately in the
44 .\" HREF
45 \fBpcre16\fP
46 and
47 .\" HREF
48 \fBpcre32\fP
49 .\"
50 pages. References to functions or structures of the form \fIpcre[16|32]_xxx\fP
51 should be read as meaning "\fIpcre_xxx\fP when using the 8-bit library,
52 \fIpcre16_xxx\fP when using the 16-bit library, or \fIpcre32_xxx\fP when using
53 the 32-bit library".
54 .P
55 The current implementation of PCRE corresponds approximately with Perl 5.12,
56 including support for UTF-8/16/32 encoded strings and Unicode general category
57 properties. However, UTF-8/16/32 and Unicode support has to be explicitly
58 enabled; it is not the default. The Unicode tables correspond to Unicode
59 release 6.3.0.
60 .P
61 In addition to the Perl-compatible matching function, PCRE contains an
62 alternative function that matches the same compiled patterns in a different
63 way. In certain circumstances, the alternative function has some advantages.
64 For a discussion of the two matching algorithms, see the
65 .\" HREF
66 \fBpcrematching\fP
67 .\"
68 page.
69 .P
70 PCRE is written in C and released as a C library. A number of people have
71 written wrappers and interfaces of various kinds. In particular, Google Inc.
72 have provided a comprehensive C++ wrapper for the 8-bit library. This is now
73 included as part of the PCRE distribution. The
74 .\" HREF
75 \fBpcrecpp\fP
76 .\"
77 page has details of this interface. Other people's contributions can be found
78 in the \fIContrib\fP directory at the primary FTP site, which is:
79 .sp
80 .\" HTML <a href="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre">
81 .\" </a>
82 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre
83 .\"
84 .P
85 Details of exactly which Perl regular expression features are and are not
86 supported by PCRE are given in separate documents. See the
87 .\" HREF
88 \fBpcrepattern\fP
89 .\"
90 and
91 .\" HREF
92 \fBpcrecompat\fP
93 .\"
94 pages. There is a syntax summary in the
95 .\" HREF
96 \fBpcresyntax\fP
97 .\"
98 page.
99 .P
100 Some features of PCRE can be included, excluded, or changed when the library is
101 built. The
102 .\" HREF
103 \fBpcre_config()\fP
104 .\"
105 function makes it possible for a client to discover which features are
106 available. The features themselves are described in the
107 .\" HREF
108 \fBpcrebuild\fP
109 .\"
110 page. Documentation about building PCRE for various operating systems can be
111 found in the
112 .\" HTML <a href="README.txt">
113 .\" </a>
114 \fBREADME\fP
115 .\"
116 and
117 .\" HTML <a href="NON-AUTOTOOLS-BUILD.txt">
118 .\" </a>
119 \fBNON-AUTOTOOLS_BUILD\fP
120 .\"
121 files in the source distribution.
122 .P
123 The libraries contains a number of undocumented internal functions and data
124 tables that are used by more than one of the exported external functions, but
125 which are not intended for use by external callers. Their names all begin with
126 "_pcre_" or "_pcre16_" or "_pcre32_", which hopefully will not provoke any name
127 clashes. In some environments, it is possible to control which external symbols
128 are exported when a shared library is built, and in these cases the
129 undocumented symbols are not exported.
130 .
131 .
132 .SH "SECURITY CONSIDERATIONS"
133 .rs
134 .sp
135 If you are using PCRE in a non-UTF application that permits users to supply
136 arbitrary patterns for compilation, you should be aware of a feature that
137 allows users to turn on UTF support from within a pattern, provided that PCRE
138 was built with UTF support. For example, an 8-bit pattern that begins with
139 "(*UTF8)" or "(*UTF)" turns on UTF-8 mode, which interprets patterns and
140 subjects as strings of UTF-8 characters instead of individual 8-bit characters.
141 This causes both the pattern and any data against which it is matched to be
142 checked for UTF-8 validity. If the data string is very long, such a check might
143 use sufficiently many resources as to cause your application to lose
144 performance.
145 .P
146 One way of guarding against this possibility is to use the
147 \fBpcre_fullinfo()\fP function to check the compiled pattern's options for UTF.
148 Alternatively, from release 8.33, you can set the PCRE_NEVER_UTF option at
149 compile time. This causes a compile time error if a pattern contains a
150 UTF-setting sequence.
151 .P
152 If your application is one that supports UTF, be aware that validity checking
153 can take time. If the same data string is to be matched many times, you can use
154 the PCRE_NO_UTF[8|16|32]_CHECK option for the second and subsequent matches to
155 save redundant checks.
156 .P
157 Another way that performance can be hit is by running a pattern that has a very
158 large search tree against a string that will never match. Nested unlimited
159 repeats in a pattern are a common example. PCRE provides some protection
160 against this: see the PCRE_EXTRA_MATCH_LIMIT feature in the
161 .\" HREF
162 \fBpcreapi\fP
163 .\"
164 page.
165 .
166 .
167 .SH "USER DOCUMENTATION"
168 .rs
169 .sp
170 The user documentation for PCRE comprises a number of different sections. In
171 the "man" format, each of these is a separate "man page". In the HTML format,
172 each is a separate page, linked from the index page. In the plain text format,
173 the descriptions of the \fBpcregrep\fP and \fBpcretest\fP programs are in files
174 called \fBpcregrep.txt\fP and \fBpcretest.txt\fP, respectively. The remaining
175 sections, except for the \fBpcredemo\fP section (which is a program listing),
176 are concatenated in \fBpcre.txt\fP, for ease of searching. The sections are as
177 follows:
178 .sp
179 pcre this document
180 pcre-config show PCRE installation configuration information
181 pcre16 details of the 16-bit library
182 pcre32 details of the 32-bit library
183 pcreapi details of PCRE's native C API
184 pcrebuild building PCRE
185 pcrecallout details of the callout feature
186 pcrecompat discussion of Perl compatibility
187 pcrecpp details of the C++ wrapper for the 8-bit library
188 pcredemo a demonstration C program that uses PCRE
189 pcregrep description of the \fBpcregrep\fP command (8-bit only)
190 pcrejit discussion of the just-in-time optimization support
191 pcrelimits details of size and other limits
192 pcrematching discussion of the two matching algorithms
193 pcrepartial details of the partial matching facility
194 .\" JOIN
195 pcrepattern syntax and semantics of supported
196 regular expressions
197 pcreperform discussion of performance issues
198 pcreposix the POSIX-compatible C API for the 8-bit library
199 pcreprecompile details of saving and re-using precompiled patterns
200 pcresample discussion of the pcredemo program
201 pcrestack discussion of stack usage
202 pcresyntax quick syntax reference
203 pcretest description of the \fBpcretest\fP testing command
204 pcreunicode discussion of Unicode and UTF-8/16/32 support
205 .sp
206 In the "man" and HTML formats, there is also a short page for each C library
207 function, listing its arguments and results.
208 .
209 .
210 .SH AUTHOR
211 .rs
212 .sp
213 .nf
214 Philip Hazel
215 University Computing Service
216 Cambridge CB2 3QH, England.
217 .fi
218 .P
219 Putting an actual email address here seems to have been a spam magnet, so I've
220 taken it away. If you want to email me, use my two initials, followed by the
221 two digits 10, at the domain cam.ac.uk.
222 .
223 .
224 .SH REVISION
225 .rs
226 .sp
227 .nf
228 Last updated: 10 February 2015
229 Copyright (c) 1997-2015 University of Cambridge.
230 .fi

Properties

Name Value
svn:eol-style native
svn:keywords "Author Date Id Revision Url"

  ViewVC Help
Powered by ViewVC 1.1.5