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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.5