summaryrefslogtreecommitdiff
path: root/pcre/doc
diff options
context:
space:
mode:
authorunknown <sanja@montyprogram.com>2014-02-05 20:35:11 +0200
committerunknown <sanja@montyprogram.com>2014-02-05 20:35:11 +0200
commit52311b72e6aee3fec0dc13f4273138f7aeea7d71 (patch)
treecea3548235426688ce80bd07a46c82c24c6ea58a /pcre/doc
parentf68eac2eadb9bdb3d9c3554b37d6c253f04562d2 (diff)
parentbfdbb17990b198ff2a7e5eda5e2a365a1c6d8906 (diff)
downloadmariadb-git-52311b72e6aee3fec0dc13f4273138f7aeea7d71.tar.gz
merge 10.0-base ->10.0
Diffstat (limited to 'pcre/doc')
-rw-r--r--pcre/doc/html/NON-AUTOTOOLS-BUILD.txt4
-rw-r--r--pcre/doc/html/README.txt28
-rw-r--r--pcre/doc/html/pcre-config.html4
-rw-r--r--pcre/doc/html/pcre.html2
-rw-r--r--pcre/doc/html/pcre16.html158
-rw-r--r--pcre/doc/html/pcre32.html157
-rw-r--r--pcre/doc/html/pcre_assign_jit_stack.html14
-rw-r--r--pcre/doc/html/pcre_compile.html23
-rw-r--r--pcre/doc/html/pcre_compile2.html29
-rw-r--r--pcre/doc/html/pcre_config.html1
-rw-r--r--pcre/doc/html/pcre_copy_named_substring.html26
-rw-r--r--pcre/doc/html/pcre_copy_substring.html20
-rw-r--r--pcre/doc/html/pcre_dfa_exec.html26
-rw-r--r--pcre/doc/html/pcre_exec.html20
-rw-r--r--pcre/doc/html/pcre_fullinfo.html14
-rw-r--r--pcre/doc/html/pcre_get_named_substring.html26
-rw-r--r--pcre/doc/html/pcre_get_stringnumber.html14
-rw-r--r--pcre/doc/html/pcre_get_stringtable_entries.html14
-rw-r--r--pcre/doc/html/pcre_get_substring.html20
-rw-r--r--pcre/doc/html/pcre_get_substring_list.html14
-rw-r--r--pcre/doc/html/pcre_jit_exec.html26
-rw-r--r--pcre/doc/html/pcre_jit_stack_alloc.html14
-rw-r--r--pcre/doc/html/pcre_pattern_to_host_byte_order.html14
-rw-r--r--pcre/doc/html/pcre_study.html14
-rw-r--r--pcre/doc/html/pcre_utf16_to_host_byte_order.html4
-rw-r--r--pcre/doc/html/pcre_utf32_to_host_byte_order.html4
-rw-r--r--pcre/doc/html/pcreapi.html423
-rw-r--r--pcre/doc/html/pcrecallout.html59
-rw-r--r--pcre/doc/html/pcrecompat.html16
-rw-r--r--pcre/doc/html/pcrelimits.html18
-rw-r--r--pcre/doc/html/pcrematching.html11
-rw-r--r--pcre/doc/html/pcrepartial.html12
-rw-r--r--pcre/doc/html/pcrepattern.html426
-rw-r--r--pcre/doc/html/pcreposix.html22
-rw-r--r--pcre/doc/html/pcreprecompile.html19
-rw-r--r--pcre/doc/html/pcresyntax.html26
-rw-r--r--pcre/doc/html/pcretest.html73
-rw-r--r--pcre/doc/pcre-config.18
-rw-r--r--pcre/doc/pcre-config.txt4
-rw-r--r--pcre/doc/pcre.34
-rw-r--r--pcre/doc/pcre.txt2299
-rw-r--r--pcre/doc/pcre16.3148
-rw-r--r--pcre/doc/pcre32.3147
-rw-r--r--pcre/doc/pcre_assign_jit_stack.316
-rw-r--r--pcre/doc/pcre_compile.330
-rw-r--r--pcre/doc/pcre_compile2.339
-rw-r--r--pcre/doc/pcre_config.33
-rw-r--r--pcre/doc/pcre_copy_named_substring.334
-rw-r--r--pcre/doc/pcre_copy_substring.325
-rw-r--r--pcre/doc/pcre_dfa_exec.334
-rw-r--r--pcre/doc/pcre_exec.325
-rw-r--r--pcre/doc/pcre_fullinfo.316
-rw-r--r--pcre/doc/pcre_get_named_substring.334
-rw-r--r--pcre/doc/pcre_get_stringnumber.316
-rw-r--r--pcre/doc/pcre_get_stringtable_entries.316
-rw-r--r--pcre/doc/pcre_get_substring.325
-rw-r--r--pcre/doc/pcre_get_substring_list.316
-rw-r--r--pcre/doc/pcre_jit_exec.334
-rw-r--r--pcre/doc/pcre_jit_stack_alloc.316
-rw-r--r--pcre/doc/pcre_pattern_to_host_byte_order.316
-rw-r--r--pcre/doc/pcre_study.316
-rw-r--r--pcre/doc/pcre_utf16_to_host_byte_order.39
-rw-r--r--pcre/doc/pcre_utf32_to_host_byte_order.39
-rw-r--r--pcre/doc/pcreapi.3434
-rw-r--r--pcre/doc/pcrecallout.359
-rw-r--r--pcre/doc/pcrecompat.317
-rw-r--r--pcre/doc/pcrelimits.320
-rw-r--r--pcre/doc/pcrematching.312
-rw-r--r--pcre/doc/pcrepartial.313
-rw-r--r--pcre/doc/pcrepattern.3344
-rw-r--r--pcre/doc/pcreposix.321
-rw-r--r--pcre/doc/pcreprecompile.320
-rw-r--r--pcre/doc/pcresyntax.325
-rw-r--r--pcre/doc/pcretest.173
-rw-r--r--pcre/doc/pcretest.txt406
75 files changed, 3482 insertions, 2796 deletions
diff --git a/pcre/doc/html/NON-AUTOTOOLS-BUILD.txt b/pcre/doc/html/NON-AUTOTOOLS-BUILD.txt
index 74075f0160a..cddf3e0699b 100644
--- a/pcre/doc/html/NON-AUTOTOOLS-BUILD.txt
+++ b/pcre/doc/html/NON-AUTOTOOLS-BUILD.txt
@@ -171,8 +171,8 @@ can skip ahead to the CMake section.
pcre16_version.c
pcre16_xclass.c
- (8) If you want to build a 16-bit library (as well as, or instead of the 8-bit
- or 32-bit libraries) repeat steps 5-6 with the following files:
+ (8) If you want to build a 32-bit library (as well as, or instead of the 8-bit
+ or 16-bit libraries) repeat steps 5-6 with the following files:
pcre32_byte_order.c
pcre32_chartables.c
diff --git a/pcre/doc/html/README.txt b/pcre/doc/html/README.txt
index e14935efeba..51197df7213 100644
--- a/pcre/doc/html/README.txt
+++ b/pcre/doc/html/README.txt
@@ -9,8 +9,10 @@ from:
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.zip
There is a mailing list for discussion about the development of PCRE at
+pcre-dev@exim.org. You can access the archives and subscribe or manage your
+subscription here:
- pcre-dev@exim.org
+ https://lists.exim.org/mailman/listinfo/pcre-dev
Please read the NEWS file if you are upgrading from a previous release.
The contents of this README file are:
@@ -112,6 +114,11 @@ contributions provided support for compiling PCRE on various flavours of
Windows (I myself do not use Windows). Nowadays there is more Windows support
in the standard distribution, so these contibutions have been archived.
+A PCRE user maintains downloadable Windows binaries of the pcregrep and
+pcretest programs here:
+
+ http://www.rexegg.com/pcregrep-pcretest.html
+
Building PCRE on non-Unix-like systems
--------------------------------------
@@ -262,9 +269,17 @@ library. They are also documented in the pcrebuild man page.
on the "configure" command.
-. PCRE has a counter that can be set to limit the amount of resources it uses.
- If the limit is exceeded during a match, the match fails. The default is ten
- million. You can change the default by setting, for example,
+. PCRE has a counter that limits the depth of nesting of parentheses in a
+ pattern. This limits the amount of system stack that a pattern uses when it
+ is compiled. The default is 250, but you can change it by setting, for
+ example,
+
+ --with-parens-nest-limit=500
+
+. PCRE has a counter that can be set to limit the amount of resources it uses
+ when matching a pattern. If the limit is exceeded during a match, the match
+ fails. The default is ten million. You can change the default by setting, for
+ example,
--with-match-limit=500000
@@ -344,7 +359,8 @@ library. They are also documented in the pcrebuild man page.
report is generated by running "make coverage". If ccache is installed on
your system, it must be disabled when building PCRE for coverage reporting.
You can do this by setting the environment variable CCACHE_DISABLE=1 before
- running "make" to build PCRE.
+ running "make" to build PCRE. There is more information about coverage
+ reporting in the "pcrebuild" documentation.
. The pcregrep program currently supports only 8-bit data files, and so
requires the 8-bit PCRE library. It is possible to compile pcregrep to use
@@ -971,4 +987,4 @@ pcre_xxx, one with the name pcre16_xx, and a third with the name pcre32_xxx.
Philip Hazel
Email local part: ph10
Email domain: cam.ac.uk
-Last updated: 28 April 2013
+Last updated: 05 November 2013
diff --git a/pcre/doc/html/pcre-config.html b/pcre/doc/html/pcre-config.html
index c2e3ba28ab6..56a80604920 100644
--- a/pcre/doc/html/pcre-config.html
+++ b/pcre/doc/html/pcre-config.html
@@ -23,8 +23,8 @@ man page, in case the conversion went wrong.
<br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br>
<P>
<b>pcre-config [--prefix] [--exec-prefix] [--version] [--libs]</b>
-<b>[--libs16] [--libs32] [--libs-cpp] [--libs-posix]</b>
-<b>[--cflags] [--cflags-posix]</b>
+<b> [--libs16] [--libs32] [--libs-cpp] [--libs-posix]</b>
+<b> [--cflags] [--cflags-posix]</b>
</P>
<br><a name="SEC2" href="#TOC1">DESCRIPTION</a><br>
<P>
diff --git a/pcre/doc/html/pcre.html b/pcre/doc/html/pcre.html
index 692f651b257..93b129ecd83 100644
--- a/pcre/doc/html/pcre.html
+++ b/pcre/doc/html/pcre.html
@@ -62,7 +62,7 @@ The current implementation of PCRE corresponds approximately with Perl 5.12,
including support for UTF-8/16/32 encoded strings and Unicode general category
properties. However, UTF-8/16/32 and Unicode support has to be explicitly
enabled; it is not the default. The Unicode tables correspond to Unicode
-release 6.2.0.
+release 6.3.0.
</P>
<P>
In addition to the Perl-compatible matching function, PCRE contains an
diff --git a/pcre/doc/html/pcre16.html b/pcre/doc/html/pcre16.html
index 3ade219092c..f00859f0523 100644
--- a/pcre/doc/html/pcre16.html
+++ b/pcre/doc/html/pcre16.html
@@ -42,126 +42,126 @@ man page, in case the conversion went wrong.
<br><a name="SEC1" href="#TOC1">PCRE 16-BIT API BASIC FUNCTIONS</a><br>
<P>
<b>pcre16 *pcre16_compile(PCRE_SPTR16 <i>pattern</i>, int <i>options</i>,</b>
-<b>const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
-<b>const unsigned char *<i>tableptr</i>);</b>
-</P>
-<P>
+<b> const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
+<b> const unsigned char *<i>tableptr</i>);</b>
+<br>
+<br>
<b>pcre16 *pcre16_compile2(PCRE_SPTR16 <i>pattern</i>, int <i>options</i>,</b>
-<b>int *<i>errorcodeptr</i>,</b>
-<b>const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
-<b>const unsigned char *<i>tableptr</i>);</b>
-</P>
-<P>
+<b> int *<i>errorcodeptr</i>,</b>
+<b> const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
+<b> const unsigned char *<i>tableptr</i>);</b>
+<br>
+<br>
<b>pcre16_extra *pcre16_study(const pcre16 *<i>code</i>, int <i>options</i>,</b>
-<b>const char **<i>errptr</i>);</b>
-</P>
-<P>
+<b> const char **<i>errptr</i>);</b>
+<br>
+<br>
<b>void pcre16_free_study(pcre16_extra *<i>extra</i>);</b>
-</P>
-<P>
+<br>
+<br>
<b>int pcre16_exec(const pcre16 *<i>code</i>, const pcre16_extra *<i>extra</i>,</b>
-<b>PCRE_SPTR16 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
-<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>);</b>
-</P>
-<P>
+<b> PCRE_SPTR16 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
+<b> int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>);</b>
+<br>
+<br>
<b>int pcre16_dfa_exec(const pcre16 *<i>code</i>, const pcre16_extra *<i>extra</i>,</b>
-<b>PCRE_SPTR16 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
-<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
-<b>int *<i>workspace</i>, int <i>wscount</i>);</b>
+<b> PCRE_SPTR16 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
+<b> int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
+<b> int *<i>workspace</i>, int <i>wscount</i>);</b>
</P>
<br><a name="SEC2" href="#TOC1">PCRE 16-BIT API STRING EXTRACTION FUNCTIONS</a><br>
<P>
<b>int pcre16_copy_named_substring(const pcre16 *<i>code</i>,</b>
-<b>PCRE_SPTR16 <i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, PCRE_SPTR16 <i>stringname</i>,</b>
-<b>PCRE_UCHAR16 *<i>buffer</i>, int <i>buffersize</i>);</b>
-</P>
-<P>
+<b> PCRE_SPTR16 <i>subject</i>, int *<i>ovector</i>,</b>
+<b> int <i>stringcount</i>, PCRE_SPTR16 <i>stringname</i>,</b>
+<b> PCRE_UCHAR16 *<i>buffer</i>, int <i>buffersize</i>);</b>
+<br>
+<br>
<b>int pcre16_copy_substring(PCRE_SPTR16 <i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, int <i>stringnumber</i>, PCRE_UCHAR16 *<i>buffer</i>,</b>
-<b>int <i>buffersize</i>);</b>
-</P>
-<P>
+<b> int <i>stringcount</i>, int <i>stringnumber</i>, PCRE_UCHAR16 *<i>buffer</i>,</b>
+<b> int <i>buffersize</i>);</b>
+<br>
+<br>
<b>int pcre16_get_named_substring(const pcre16 *<i>code</i>,</b>
-<b>PCRE_SPTR16 <i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, PCRE_SPTR16 <i>stringname</i>,</b>
-<b>PCRE_SPTR16 *<i>stringptr</i>);</b>
-</P>
-<P>
+<b> PCRE_SPTR16 <i>subject</i>, int *<i>ovector</i>,</b>
+<b> int <i>stringcount</i>, PCRE_SPTR16 <i>stringname</i>,</b>
+<b> PCRE_SPTR16 *<i>stringptr</i>);</b>
+<br>
+<br>
<b>int pcre16_get_stringnumber(const pcre16 *<i>code</i>,</b>
-<b>PCRE_SPTR16 <i>name</i>);</b>
-</P>
-<P>
+<b>" PCRE_SPTR16 <i>name</i>);</b>
+<br>
+<br>
<b>int pcre16_get_stringtable_entries(const pcre16 *<i>code</i>,</b>
-<b>PCRE_SPTR16 <i>name</i>, PCRE_UCHAR16 **<i>first</i>, PCRE_UCHAR16 **<i>last</i>);</b>
-</P>
-<P>
+<b> PCRE_SPTR16 <i>name</i>, PCRE_UCHAR16 **<i>first</i>, PCRE_UCHAR16 **<i>last</i>);</b>
+<br>
+<br>
<b>int pcre16_get_substring(PCRE_SPTR16 <i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, int <i>stringnumber</i>,</b>
-<b>PCRE_SPTR16 *<i>stringptr</i>);</b>
-</P>
-<P>
+<b> int <i>stringcount</i>, int <i>stringnumber</i>,</b>
+<b> PCRE_SPTR16 *<i>stringptr</i>);</b>
+<br>
+<br>
<b>int pcre16_get_substring_list(PCRE_SPTR16 <i>subject</i>,</b>
-<b>int *<i>ovector</i>, int <i>stringcount</i>, PCRE_SPTR16 **<i>listptr</i>);</b>
-</P>
-<P>
+<b> int *<i>ovector</i>, int <i>stringcount</i>, PCRE_SPTR16 **<i>listptr</i>);</b>
+<br>
+<br>
<b>void pcre16_free_substring(PCRE_SPTR16 <i>stringptr</i>);</b>
-</P>
-<P>
+<br>
+<br>
<b>void pcre16_free_substring_list(PCRE_SPTR16 *<i>stringptr</i>);</b>
</P>
<br><a name="SEC3" href="#TOC1">PCRE 16-BIT API AUXILIARY FUNCTIONS</a><br>
<P>
<b>pcre16_jit_stack *pcre16_jit_stack_alloc(int <i>startsize</i>, int <i>maxsize</i>);</b>
-</P>
-<P>
+<br>
+<br>
<b>void pcre16_jit_stack_free(pcre16_jit_stack *<i>stack</i>);</b>
-</P>
-<P>
+<br>
+<br>
<b>void pcre16_assign_jit_stack(pcre16_extra *<i>extra</i>,</b>
-<b>pcre16_jit_callback <i>callback</i>, void *<i>data</i>);</b>
-</P>
-<P>
+<b> pcre16_jit_callback <i>callback</i>, void *<i>data</i>);</b>
+<br>
+<br>
<b>const unsigned char *pcre16_maketables(void);</b>
-</P>
-<P>
+<br>
+<br>
<b>int pcre16_fullinfo(const pcre16 *<i>code</i>, const pcre16_extra *<i>extra</i>,</b>
-<b>int <i>what</i>, void *<i>where</i>);</b>
-</P>
-<P>
+<b> int <i>what</i>, void *<i>where</i>);</b>
+<br>
+<br>
<b>int pcre16_refcount(pcre16 *<i>code</i>, int <i>adjust</i>);</b>
-</P>
-<P>
+<br>
+<br>
<b>int pcre16_config(int <i>what</i>, void *<i>where</i>);</b>
-</P>
-<P>
+<br>
+<br>
<b>const char *pcre16_version(void);</b>
-</P>
-<P>
+<br>
+<br>
<b>int pcre16_pattern_to_host_byte_order(pcre16 *<i>code</i>,</b>
-<b>pcre16_extra *<i>extra</i>, const unsigned char *<i>tables</i>);</b>
+<b> pcre16_extra *<i>extra</i>, const unsigned char *<i>tables</i>);</b>
</P>
<br><a name="SEC4" href="#TOC1">PCRE 16-BIT API INDIRECTED FUNCTIONS</a><br>
<P>
<b>void *(*pcre16_malloc)(size_t);</b>
-</P>
-<P>
+<br>
+<br>
<b>void (*pcre16_free)(void *);</b>
-</P>
-<P>
+<br>
+<br>
<b>void *(*pcre16_stack_malloc)(size_t);</b>
-</P>
-<P>
+<br>
+<br>
<b>void (*pcre16_stack_free)(void *);</b>
-</P>
-<P>
+<br>
+<br>
<b>int (*pcre16_callout)(pcre16_callout_block *);</b>
</P>
<br><a name="SEC5" href="#TOC1">PCRE 16-BIT API 16-BIT-ONLY FUNCTION</a><br>
<P>
<b>int pcre16_utf16_to_host_byte_order(PCRE_UCHAR16 *<i>output</i>,</b>
-<b>PCRE_SPTR16 <i>input</i>, int <i>length</i>, int *<i>byte_order</i>,</b>
-<b>int <i>keep_boms</i>);</b>
+<b> PCRE_SPTR16 <i>input</i>, int <i>length</i>, int *<i>byte_order</i>,</b>
+<b> int <i>keep_boms</i>);</b>
</P>
<br><a name="SEC6" href="#TOC1">THE PCRE 16-BIT LIBRARY</a><br>
<P>
diff --git a/pcre/doc/html/pcre32.html b/pcre/doc/html/pcre32.html
index 2155ee88173..f96876e7502 100644
--- a/pcre/doc/html/pcre32.html
+++ b/pcre/doc/html/pcre32.html
@@ -42,126 +42,125 @@ man page, in case the conversion went wrong.
<br><a name="SEC1" href="#TOC1">PCRE 32-BIT API BASIC FUNCTIONS</a><br>
<P>
<b>pcre32 *pcre32_compile(PCRE_SPTR32 <i>pattern</i>, int <i>options</i>,</b>
-<b>const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
-<b>const unsigned char *<i>tableptr</i>);</b>
-</P>
-<P>
+<b> const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
+<b> const unsigned char *<i>tableptr</i>);</b>
+<br>
+<br>
<b>pcre32 *pcre32_compile2(PCRE_SPTR32 <i>pattern</i>, int <i>options</i>,</b>
-<b>int *<i>errorcodeptr</i>,</b>
-<b>const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
-<b>const unsigned char *<i>tableptr</i>);</b>
-</P>
-<P>
+<b> int *<i>errorcodeptr</i>,</b>
+<b> const unsigned char *<i>tableptr</i>);</b>
+<br>
+<br>
<b>pcre32_extra *pcre32_study(const pcre32 *<i>code</i>, int <i>options</i>,</b>
-<b>const char **<i>errptr</i>);</b>
-</P>
-<P>
+<b> const char **<i>errptr</i>);</b>
+<br>
+<br>
<b>void pcre32_free_study(pcre32_extra *<i>extra</i>);</b>
-</P>
-<P>
+<br>
+<br>
<b>int pcre32_exec(const pcre32 *<i>code</i>, const pcre32_extra *<i>extra</i>,</b>
-<b>PCRE_SPTR32 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
-<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>);</b>
-</P>
-<P>
+<b> PCRE_SPTR32 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
+<b> int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>);</b>
+<br>
+<br>
<b>int pcre32_dfa_exec(const pcre32 *<i>code</i>, const pcre32_extra *<i>extra</i>,</b>
-<b>PCRE_SPTR32 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
-<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
-<b>int *<i>workspace</i>, int <i>wscount</i>);</b>
+<b> PCRE_SPTR32 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
+<b> int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
+<b> int *<i>workspace</i>, int <i>wscount</i>);</b>
</P>
<br><a name="SEC2" href="#TOC1">PCRE 32-BIT API STRING EXTRACTION FUNCTIONS</a><br>
<P>
<b>int pcre32_copy_named_substring(const pcre32 *<i>code</i>,</b>
-<b>PCRE_SPTR32 <i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, PCRE_SPTR32 <i>stringname</i>,</b>
-<b>PCRE_UCHAR32 *<i>buffer</i>, int <i>buffersize</i>);</b>
-</P>
-<P>
+<b> PCRE_SPTR32 <i>subject</i>, int *<i>ovector</i>,</b>
+<b> int <i>stringcount</i>, PCRE_SPTR32 <i>stringname</i>,</b>
+<b> PCRE_UCHAR32 *<i>buffer</i>, int <i>buffersize</i>);</b>
+<br>
+<br>
<b>int pcre32_copy_substring(PCRE_SPTR32 <i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, int <i>stringnumber</i>, PCRE_UCHAR32 *<i>buffer</i>,</b>
-<b>int <i>buffersize</i>);</b>
-</P>
-<P>
+<b> int <i>stringcount</i>, int <i>stringnumber</i>, PCRE_UCHAR32 *<i>buffer</i>,</b>
+<b> int <i>buffersize</i>);</b>
+<br>
+<br>
<b>int pcre32_get_named_substring(const pcre32 *<i>code</i>,</b>
-<b>PCRE_SPTR32 <i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, PCRE_SPTR32 <i>stringname</i>,</b>
-<b>PCRE_SPTR32 *<i>stringptr</i>);</b>
-</P>
-<P>
+<b> PCRE_SPTR32 <i>subject</i>, int *<i>ovector</i>,</b>
+<b> int <i>stringcount</i>, PCRE_SPTR32 <i>stringname</i>,</b>
+<b> PCRE_SPTR32 *<i>stringptr</i>);</b>
+<br>
+<br>
<b>int pcre32_get_stringnumber(const pcre32 *<i>code</i>,</b>
-<b>PCRE_SPTR32 <i>name</i>);</b>
-</P>
-<P>
+<b> PCRE_SPTR32 <i>name</i>);</b>
+<br>
+<br>
<b>int pcre32_get_stringtable_entries(const pcre32 *<i>code</i>,</b>
-<b>PCRE_SPTR32 <i>name</i>, PCRE_UCHAR32 **<i>first</i>, PCRE_UCHAR32 **<i>last</i>);</b>
-</P>
-<P>
+<b> PCRE_SPTR32 <i>name</i>, PCRE_UCHAR32 **<i>first</i>, PCRE_UCHAR32 **<i>last</i>);</b>
+<br>
+<br>
<b>int pcre32_get_substring(PCRE_SPTR32 <i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, int <i>stringnumber</i>,</b>
-<b>PCRE_SPTR32 *<i>stringptr</i>);</b>
-</P>
-<P>
+<b> int <i>stringcount</i>, int <i>stringnumber</i>,</b>
+<b> PCRE_SPTR32 *<i>stringptr</i>);</b>
+<br>
+<br>
<b>int pcre32_get_substring_list(PCRE_SPTR32 <i>subject</i>,</b>
-<b>int *<i>ovector</i>, int <i>stringcount</i>, PCRE_SPTR32 **<i>listptr</i>);</b>
-</P>
-<P>
+<b> int *<i>ovector</i>, int <i>stringcount</i>, PCRE_SPTR32 **<i>listptr</i>);</b>
+<br>
+<br>
<b>void pcre32_free_substring(PCRE_SPTR32 <i>stringptr</i>);</b>
-</P>
-<P>
+<br>
+<br>
<b>void pcre32_free_substring_list(PCRE_SPTR32 *<i>stringptr</i>);</b>
</P>
<br><a name="SEC3" href="#TOC1">PCRE 32-BIT API AUXILIARY FUNCTIONS</a><br>
<P>
<b>pcre32_jit_stack *pcre32_jit_stack_alloc(int <i>startsize</i>, int <i>maxsize</i>);</b>
-</P>
-<P>
+<br>
+<br>
<b>void pcre32_jit_stack_free(pcre32_jit_stack *<i>stack</i>);</b>
-</P>
-<P>
+<br>
+<br>
<b>void pcre32_assign_jit_stack(pcre32_extra *<i>extra</i>,</b>
-<b>pcre32_jit_callback <i>callback</i>, void *<i>data</i>);</b>
-</P>
-<P>
+<b> pcre32_jit_callback <i>callback</i>, void *<i>data</i>);</b>
+<br>
+<br>
<b>const unsigned char *pcre32_maketables(void);</b>
-</P>
-<P>
+<br>
+<br>
<b>int pcre32_fullinfo(const pcre32 *<i>code</i>, const pcre32_extra *<i>extra</i>,</b>
-<b>int <i>what</i>, void *<i>where</i>);</b>
-</P>
-<P>
+<b> int <i>what</i>, void *<i>where</i>);</b>
+<br>
+<br>
<b>int pcre32_refcount(pcre32 *<i>code</i>, int <i>adjust</i>);</b>
-</P>
-<P>
+<br>
+<br>
<b>int pcre32_config(int <i>what</i>, void *<i>where</i>);</b>
-</P>
-<P>
+<br>
+<br>
<b>const char *pcre32_version(void);</b>
-</P>
-<P>
+<br>
+<br>
<b>int pcre32_pattern_to_host_byte_order(pcre32 *<i>code</i>,</b>
-<b>pcre32_extra *<i>extra</i>, const unsigned char *<i>tables</i>);</b>
+<b> pcre32_extra *<i>extra</i>, const unsigned char *<i>tables</i>);</b>
</P>
<br><a name="SEC4" href="#TOC1">PCRE 32-BIT API INDIRECTED FUNCTIONS</a><br>
<P>
<b>void *(*pcre32_malloc)(size_t);</b>
-</P>
-<P>
+<br>
+<br>
<b>void (*pcre32_free)(void *);</b>
-</P>
-<P>
+<br>
+<br>
<b>void *(*pcre32_stack_malloc)(size_t);</b>
-</P>
-<P>
+<br>
+<br>
<b>void (*pcre32_stack_free)(void *);</b>
-</P>
-<P>
+<br>
+<br>
<b>int (*pcre32_callout)(pcre32_callout_block *);</b>
</P>
<br><a name="SEC5" href="#TOC1">PCRE 32-BIT API 32-BIT-ONLY FUNCTION</a><br>
<P>
<b>int pcre32_utf32_to_host_byte_order(PCRE_UCHAR32 *<i>output</i>,</b>
-<b>PCRE_SPTR32 <i>input</i>, int <i>length</i>, int *<i>byte_order</i>,</b>
-<b>int <i>keep_boms</i>);</b>
+<b> PCRE_SPTR32 <i>input</i>, int <i>length</i>, int *<i>byte_order</i>,</b>
+<b> int <i>keep_boms</i>);</b>
</P>
<br><a name="SEC6" href="#TOC1">THE PCRE 32-BIT LIBRARY</a><br>
<P>
diff --git a/pcre/doc/html/pcre_assign_jit_stack.html b/pcre/doc/html/pcre_assign_jit_stack.html
index d77d4e1c9b4..b2eef704db8 100644
--- a/pcre/doc/html/pcre_assign_jit_stack.html
+++ b/pcre/doc/html/pcre_assign_jit_stack.html
@@ -20,15 +20,15 @@ SYNOPSIS
</P>
<P>
<b>void pcre_assign_jit_stack(pcre_extra *<i>extra</i>,</b>
-<b>pcre_jit_callback <i>callback</i>, void *<i>data</i>);</b>
-</P>
-<P>
+<b> pcre_jit_callback <i>callback</i>, void *<i>data</i>);</b>
+<br>
+<br>
<b>void pcre16_assign_jit_stack(pcre16_extra *<i>extra</i>,</b>
-<b>pcre16_jit_callback <i>callback</i>, void *<i>data</i>);</b>
-</P>
-<P>
+<b> pcre16_jit_callback <i>callback</i>, void *<i>data</i>);</b>
+<br>
+<br>
<b>void pcre32_assign_jit_stack(pcre32_extra *<i>extra</i>,</b>
-<b>pcre32_jit_callback <i>callback</i>, void *<i>data</i>);</b>
+<b> pcre32_jit_callback <i>callback</i>, void *<i>data</i>);</b>
</P>
<br><b>
DESCRIPTION
diff --git a/pcre/doc/html/pcre_compile.html b/pcre/doc/html/pcre_compile.html
index 012147516cf..95b4bec63c6 100644
--- a/pcre/doc/html/pcre_compile.html
+++ b/pcre/doc/html/pcre_compile.html
@@ -20,18 +20,18 @@ SYNOPSIS
</P>
<P>
<b>pcre *pcre_compile(const char *<i>pattern</i>, int <i>options</i>,</b>
-<b>const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
-<b>const unsigned char *<i>tableptr</i>);</b>
-</P>
-<P>
+<b> const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
+<b> const unsigned char *<i>tableptr</i>);</b>
+<br>
+<br>
<b>pcre16 *pcre16_compile(PCRE_SPTR16 <i>pattern</i>, int <i>options</i>,</b>
-<b>const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
-<b>const unsigned char *<i>tableptr</i>);</b>
-</P>
-<P>
+<b> const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
+<b> const unsigned char *<i>tableptr</i>);</b>
+<br>
+<br>
<b>pcre32 *pcre32_compile(PCRE_SPTR32 <i>pattern</i>, int <i>options</i>,</b>
-<b>const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
-<b>const unsigned char *<i>tableptr</i>);</b>
+<b> const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
+<b> const unsigned char *<i>tableptr</i>);</b>
</P>
<br><b>
DESCRIPTION
@@ -65,6 +65,7 @@ The option bits are:
PCRE_FIRSTLINE Force matching to be before newline
PCRE_JAVASCRIPT_COMPAT JavaScript compatibility
PCRE_MULTILINE ^ and $ match newlines within data
+ PCRE_NEVER_UTF Lock out UTF, e.g. via (*UTF)
PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
PCRE_NEWLINE_ANYCRLF Recognize CR, LF, and CRLF as newline
sequences
@@ -73,6 +74,8 @@ The option bits are:
PCRE_NEWLINE_LF Set LF as the newline sequence
PCRE_NO_AUTO_CAPTURE Disable numbered capturing paren-
theses (named ones available)
+ PCRE_NO_AUTO_POSSESS Disable auto-possessification
+ PCRE_NO_START_OPTIMIZE Disable match-time start optimizations
PCRE_NO_UTF16_CHECK Do not check the pattern for UTF-16
validity (only relevant if
PCRE_UTF16 is set)
diff --git a/pcre/doc/html/pcre_compile2.html b/pcre/doc/html/pcre_compile2.html
index 7d76bd9cae0..9cd56a237ba 100644
--- a/pcre/doc/html/pcre_compile2.html
+++ b/pcre/doc/html/pcre_compile2.html
@@ -20,21 +20,21 @@ SYNOPSIS
</P>
<P>
<b>pcre *pcre_compile2(const char *<i>pattern</i>, int <i>options</i>,</b>
-<b>int *<i>errorcodeptr</i>,</b>
-<b>const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
-<b>const unsigned char *<i>tableptr</i>);</b>
-</P>
-<P>
+<b> int *<i>errorcodeptr</i>,</b>
+<b> const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
+<b> const unsigned char *<i>tableptr</i>);</b>
+<br>
+<br>
<b>pcre16 *pcre16_compile2(PCRE_SPTR16 <i>pattern</i>, int <i>options</i>,</b>
-<b>int *<i>errorcodeptr</i>,</b>
-<b>const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
-<b>const unsigned char *<i>tableptr</i>);</b>
-</P>
-<P>
+<b> int *<i>errorcodeptr</i>,</b>
+<b> const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
+<b> const unsigned char *<i>tableptr</i>);</b>
+<br>
+<br>
<b>pcre32 *pcre32_compile2(PCRE_SPTR32 <i>pattern</i>, int <i>options</i>,</b>
-<b>int *<i>errorcodeptr</i>,</b>
-<b>const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
-<b>const unsigned char *<i>tableptr</i>);</b>
+<b>" int *<i>errorcodeptr</i>,£</b>
+<b> const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
+<b> const unsigned char *<i>tableptr</i>);</b>
</P>
<br><b>
DESCRIPTION
@@ -69,6 +69,7 @@ The option bits are:
PCRE_FIRSTLINE Force matching to be before newline
PCRE_JAVASCRIPT_COMPAT JavaScript compatibility
PCRE_MULTILINE ^ and $ match newlines within data
+ PCRE_NEVER_UTF Lock out UTF, e.g. via (*UTF)
PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
PCRE_NEWLINE_ANYCRLF Recognize CR, LF, and CRLF as newline
sequences
@@ -77,6 +78,8 @@ The option bits are:
PCRE_NEWLINE_LF Set LF as the newline sequence
PCRE_NO_AUTO_CAPTURE Disable numbered capturing paren-
theses (named ones available)
+ PCRE_NO_AUTO_POSSESS Disable auto-possessification
+ PCRE_NO_START_OPTIMIZE Disable match-time start optimizations
PCRE_NO_UTF16_CHECK Do not check the pattern for UTF-16
validity (only relevant if
PCRE_UTF16 is set)
diff --git a/pcre/doc/html/pcre_config.html b/pcre/doc/html/pcre_config.html
index fc10d183933..bcdcdded708 100644
--- a/pcre/doc/html/pcre_config.html
+++ b/pcre/doc/html/pcre_config.html
@@ -48,6 +48,7 @@ point to an unsigned long integer. The available codes are:
target architecture for the JIT compiler,
or NULL if there is no JIT support
PCRE_CONFIG_LINK_SIZE Internal link size: 2, 3, or 4
+ PCRE_CONFIG_PARENS_LIMIT Parentheses nesting limit
PCRE_CONFIG_MATCH_LIMIT Internal resource limit
PCRE_CONFIG_MATCH_LIMIT_RECURSION
Internal recursion depth limit
diff --git a/pcre/doc/html/pcre_copy_named_substring.html b/pcre/doc/html/pcre_copy_named_substring.html
index ae4f6905ccc..77b48043cd2 100644
--- a/pcre/doc/html/pcre_copy_named_substring.html
+++ b/pcre/doc/html/pcre_copy_named_substring.html
@@ -20,21 +20,21 @@ SYNOPSIS
</P>
<P>
<b>int pcre_copy_named_substring(const pcre *<i>code</i>,</b>
-<b>const char *<i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, const char *<i>stringname</i>,</b>
-<b>char *<i>buffer</i>, int <i>buffersize</i>);</b>
-</P>
-<P>
+<b> const char *<i>subject</i>, int *<i>ovector</i>,</b>
+<b> int <i>stringcount</i>, const char *<i>stringname</i>,</b>
+<b> char *<i>buffer</i>, int <i>buffersize</i>);</b>
+<br>
+<br>
<b>int pcre16_copy_named_substring(const pcre16 *<i>code</i>,</b>
-<b>PCRE_SPTR16 <i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, PCRE_SPTR16 <i>stringname</i>,</b>
-<b>PCRE_UCHAR16 *<i>buffer</i>, int <i>buffersize</i>);</b>
-</P>
-<P>
+<b> PCRE_SPTR16 <i>subject</i>, int *<i>ovector</i>,</b>
+<b> int <i>stringcount</i>, PCRE_SPTR16 <i>stringname</i>,</b>
+<b> PCRE_UCHAR16 *<i>buffer</i>, int <i>buffersize</i>);</b>
+<br>
+<br>
<b>int pcre32_copy_named_substring(const pcre32 *<i>code</i>,</b>
-<b>PCRE_SPTR32 <i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, PCRE_SPTR32 <i>stringname</i>,</b>
-<b>PCRE_UCHAR32 *<i>buffer</i>, int <i>buffersize</i>);</b>
+<b> PCRE_SPTR32 <i>subject</i>, int *<i>ovector</i>,</b>
+<b> int <i>stringcount</i>, PCRE_SPTR32 <i>stringname</i>,</b>
+<b> PCRE_UCHAR32 *<i>buffer</i>, int <i>buffersize</i>);</b>
</P>
<br><b>
DESCRIPTION
diff --git a/pcre/doc/html/pcre_copy_substring.html b/pcre/doc/html/pcre_copy_substring.html
index 12bfb636a77..ecaebe85338 100644
--- a/pcre/doc/html/pcre_copy_substring.html
+++ b/pcre/doc/html/pcre_copy_substring.html
@@ -20,18 +20,18 @@ SYNOPSIS
</P>
<P>
<b>int pcre_copy_substring(const char *<i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, int <i>stringnumber</i>, char *<i>buffer</i>,</b>
-<b>int <i>buffersize</i>);</b>
-</P>
-<P>
+<b> int <i>stringcount</i>, int <i>stringnumber</i>, char *<i>buffer</i>,</b>
+<b> int <i>buffersize</i>);</b>
+<br>
+<br>
<b>int pcre16_copy_substring(PCRE_SPTR16 <i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, int <i>stringnumber</i>, PCRE_UCHAR16 *<i>buffer</i>,</b>
-<b>int <i>buffersize</i>);</b>
-</P>
-<P>
+<b> int <i>stringcount</i>, int <i>stringnumber</i>, PCRE_UCHAR16 *<i>buffer</i>,</b>
+<b> int <i>buffersize</i>);</b>
+<br>
+<br>
<b>int pcre32_copy_substring(PCRE_SPTR32 <i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, int <i>stringnumber</i>, PCRE_UCHAR32 *<i>buffer</i>,</b>
-<b>int <i>buffersize</i>);</b>
+<b> int <i>stringcount</i>, int <i>stringnumber</i>, PCRE_UCHAR32 *<i>buffer</i>,</b>
+<b> int <i>buffersize</i>);</b>
</P>
<br><b>
DESCRIPTION
diff --git a/pcre/doc/html/pcre_dfa_exec.html b/pcre/doc/html/pcre_dfa_exec.html
index e91b670eac6..5fff6a7e0a5 100644
--- a/pcre/doc/html/pcre_dfa_exec.html
+++ b/pcre/doc/html/pcre_dfa_exec.html
@@ -20,21 +20,21 @@ SYNOPSIS
</P>
<P>
<b>int pcre_dfa_exec(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b>
-<b>const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
-<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
-<b>int *<i>workspace</i>, int <i>wscount</i>);</b>
-</P>
-<P>
+<b> const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
+<b> int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
+<b> int *<i>workspace</i>, int <i>wscount</i>);</b>
+<br>
+<br>
<b>int pcre16_dfa_exec(const pcre16 *<i>code</i>, const pcre16_extra *<i>extra</i>,</b>
-<b>PCRE_SPTR16 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
-<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
-<b>int *<i>workspace</i>, int <i>wscount</i>);</b>
-</P>
-<P>
+<b> PCRE_SPTR16 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
+<b> int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
+<b> int *<i>workspace</i>, int <i>wscount</i>);</b>
+<br>
+<br>
<b>int pcre32_dfa_exec(const pcre32 *<i>code</i>, const pcre32_extra *<i>extra</i>,</b>
-<b>PCRE_SPTR32 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
-<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
-<b>int *<i>workspace</i>, int <i>wscount</i>);</b>
+<b> PCRE_SPTR32 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
+<b> int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
+<b> int *<i>workspace</i>, int <i>wscount</i>);</b>
</P>
<br><b>
DESCRIPTION
diff --git a/pcre/doc/html/pcre_exec.html b/pcre/doc/html/pcre_exec.html
index 0cc3bb7bb8b..18e1a13ff8d 100644
--- a/pcre/doc/html/pcre_exec.html
+++ b/pcre/doc/html/pcre_exec.html
@@ -20,18 +20,18 @@ SYNOPSIS
</P>
<P>
<b>int pcre_exec(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b>
-<b>const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
-<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>);</b>
-</P>
-<P>
+<b> const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
+<b> int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>);</b>
+<br>
+<br>
<b>int pcre16_exec(const pcre16 *<i>code</i>, const pcre16_extra *<i>extra</i>,</b>
-<b>PCRE_SPTR16 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
-<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>);</b>
-</P>
-<P>
+<b> PCRE_SPTR16 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
+<b> int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>);</b>
+<br>
+<br>
<b>int pcre32_exec(const pcre32 *<i>code</i>, const pcre32_extra *<i>extra</i>,</b>
-<b>PCRE_SPTR32 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
-<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>);</b>
+<b> PCRE_SPTR32 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
+<b> int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>);</b>
</P>
<br><b>
DESCRIPTION
diff --git a/pcre/doc/html/pcre_fullinfo.html b/pcre/doc/html/pcre_fullinfo.html
index d353432bc52..b88fc1155bd 100644
--- a/pcre/doc/html/pcre_fullinfo.html
+++ b/pcre/doc/html/pcre_fullinfo.html
@@ -20,15 +20,15 @@ SYNOPSIS
</P>
<P>
<b>int pcre_fullinfo(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b>
-<b>int <i>what</i>, void *<i>where</i>);</b>
-</P>
-<P>
+<b> int <i>what</i>, void *<i>where</i>);</b>
+<br>
+<br>
<b>int pcre16_fullinfo(const pcre16 *<i>code</i>, const pcre16_extra *<i>extra</i>,</b>
-<b>int <i>what</i>, void *<i>where</i>);</b>
-</P>
-<P>
+<b> int <i>what</i>, void *<i>where</i>);</b>
+<br>
+<br>
<b>int pcre32_fullinfo(const pcre32 *<i>code</i>, const pcre32_extra *<i>extra</i>,</b>
-<b>int <i>what</i>, void *<i>where</i>);</b>
+<b> int <i>what</i>, void *<i>where</i>);</b>
</P>
<br><b>
DESCRIPTION
diff --git a/pcre/doc/html/pcre_get_named_substring.html b/pcre/doc/html/pcre_get_named_substring.html
index 6150ad71424..72924d9b252 100644
--- a/pcre/doc/html/pcre_get_named_substring.html
+++ b/pcre/doc/html/pcre_get_named_substring.html
@@ -20,21 +20,21 @@ SYNOPSIS
</P>
<P>
<b>int pcre_get_named_substring(const pcre *<i>code</i>,</b>
-<b>const char *<i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, const char *<i>stringname</i>,</b>
-<b>const char **<i>stringptr</i>);</b>
-</P>
-<P>
+<b> const char *<i>subject</i>, int *<i>ovector</i>,</b>
+<b> int <i>stringcount</i>, const char *<i>stringname</i>,</b>
+<b> const char **<i>stringptr</i>);</b>
+<br>
+<br>
<b>int pcre16_get_named_substring(const pcre16 *<i>code</i>,</b>
-<b>PCRE_SPTR16 <i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, PCRE_SPTR16 <i>stringname</i>,</b>
-<b>PCRE_SPTR16 *<i>stringptr</i>);</b>
-</P>
-<P>
+<b> PCRE_SPTR16 <i>subject</i>, int *<i>ovector</i>,</b>
+<b> int <i>stringcount</i>, PCRE_SPTR16 <i>stringname</i>,</b>
+<b> PCRE_SPTR16 *<i>stringptr</i>);</b>
+<br>
+<br>
<b>int pcre32_get_named_substring(const pcre32 *<i>code</i>,</b>
-<b>PCRE_SPTR32 <i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, PCRE_SPTR32 <i>stringname</i>,</b>
-<b>PCRE_SPTR32 *<i>stringptr</i>);</b>
+<b> PCRE_SPTR32 <i>subject</i>, int *<i>ovector</i>,</b>
+<b> int <i>stringcount</i>, PCRE_SPTR32 <i>stringname</i>,</b>
+<b> PCRE_SPTR32 *<i>stringptr</i>);</b>
</P>
<br><b>
DESCRIPTION
diff --git a/pcre/doc/html/pcre_get_stringnumber.html b/pcre/doc/html/pcre_get_stringnumber.html
index 08967de3f7d..7324d782e72 100644
--- a/pcre/doc/html/pcre_get_stringnumber.html
+++ b/pcre/doc/html/pcre_get_stringnumber.html
@@ -20,15 +20,15 @@ SYNOPSIS
</P>
<P>
<b>int pcre_get_stringnumber(const pcre *<i>code</i>,</b>
-<b>const char *<i>name</i>);</b>
-</P>
-<P>
+<b> const char *<i>name</i>);</b>
+<br>
+<br>
<b>int pcre16_get_stringnumber(const pcre16 *<i>code</i>,</b>
-<b>PCRE_SPTR16 <i>name</i>);</b>
-</P>
-<P>
+<b> PCRE_SPTR16 <i>name</i>);</b>
+<br>
+<br>
<b>int pcre32_get_stringnumber(const pcre32 *<i>code</i>,</b>
-<b>PCRE_SPTR32 <i>name</i>);</b>
+<b> PCRE_SPTR32 <i>name</i>);</b>
</P>
<br><b>
DESCRIPTION
diff --git a/pcre/doc/html/pcre_get_stringtable_entries.html b/pcre/doc/html/pcre_get_stringtable_entries.html
index 38f9c0c902f..79906798e68 100644
--- a/pcre/doc/html/pcre_get_stringtable_entries.html
+++ b/pcre/doc/html/pcre_get_stringtable_entries.html
@@ -20,15 +20,15 @@ SYNOPSIS
</P>
<P>
<b>int pcre_get_stringtable_entries(const pcre *<i>code</i>,</b>
-<b>const char *<i>name</i>, char **<i>first</i>, char **<i>last</i>);</b>
-</P>
-<P>
+<b> const char *<i>name</i>, char **<i>first</i>, char **<i>last</i>);</b>
+<br>
+<br>
<b>int pcre16_get_stringtable_entries(const pcre16 *<i>code</i>,</b>
-<b>PCRE_SPTR16 <i>name</i>, PCRE_UCHAR16 **<i>first</i>, PCRE_UCHAR16 **<i>last</i>);</b>
-</P>
-<P>
+<b> PCRE_SPTR16 <i>name</i>, PCRE_UCHAR16 **<i>first</i>, PCRE_UCHAR16 **<i>last</i>);</b>
+<br>
+<br>
<b>int pcre32_get_stringtable_entries(const pcre32 *<i>code</i>,</b>
-<b>PCRE_SPTR32 <i>name</i>, PCRE_UCHAR32 **<i>first</i>, PCRE_UCHAR32 **<i>last</i>);</b>
+<b> PCRE_SPTR32 <i>name</i>, PCRE_UCHAR32 **<i>first</i>, PCRE_UCHAR32 **<i>last</i>);</b>
</P>
<br><b>
DESCRIPTION
diff --git a/pcre/doc/html/pcre_get_substring.html b/pcre/doc/html/pcre_get_substring.html
index 2a5a610f971..1a8e4f5a499 100644
--- a/pcre/doc/html/pcre_get_substring.html
+++ b/pcre/doc/html/pcre_get_substring.html
@@ -20,18 +20,18 @@ SYNOPSIS
</P>
<P>
<b>int pcre_get_substring(const char *<i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, int <i>stringnumber</i>,</b>
-<b>const char **<i>stringptr</i>);</b>
-</P>
-<P>
+<b> int <i>stringcount</i>, int <i>stringnumber</i>,</b>
+<b> const char **<i>stringptr</i>);</b>
+<br>
+<br>
<b>int pcre16_get_substring(PCRE_SPTR16 <i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, int <i>stringnumber</i>,</b>
-<b>PCRE_SPTR16 *<i>stringptr</i>);</b>
-</P>
-<P>
+<b> int <i>stringcount</i>, int <i>stringnumber</i>,</b>
+<b> PCRE_SPTR16 *<i>stringptr</i>);</b>
+<br>
+<br>
<b>int pcre32_get_substring(PCRE_SPTR32 <i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, int <i>stringnumber</i>,</b>
-<b>PCRE_SPTR32 *<i>stringptr</i>);</b>
+<b> int <i>stringcount</i>, int <i>stringnumber</i>,</b>
+<b> PCRE_SPTR32 *<i>stringptr</i>);</b>
</P>
<br><b>
DESCRIPTION
diff --git a/pcre/doc/html/pcre_get_substring_list.html b/pcre/doc/html/pcre_get_substring_list.html
index 85edef4b9f4..7e8c6bc8584 100644
--- a/pcre/doc/html/pcre_get_substring_list.html
+++ b/pcre/doc/html/pcre_get_substring_list.html
@@ -20,15 +20,15 @@ SYNOPSIS
</P>
<P>
<b>int pcre_get_substring_list(const char *<i>subject</i>,</b>
-<b>int *<i>ovector</i>, int <i>stringcount</i>, const char ***<i>listptr</i>);</b>
-</P>
-<P>
+<b> int *<i>ovector</i>, int <i>stringcount</i>, const char ***<i>listptr</i>);</b>
+<br>
+<br>
<b>int pcre16_get_substring_list(PCRE_SPTR16 <i>subject</i>,</b>
-<b>int *<i>ovector</i>, int <i>stringcount</i>, PCRE_SPTR16 **<i>listptr</i>);</b>
-</P>
-<P>
+<b> int *<i>ovector</i>, int <i>stringcount</i>, PCRE_SPTR16 **<i>listptr</i>);</b>
+<br>
+<br>
<b>int pcre32_get_substring_list(PCRE_SPTR32 <i>subject</i>,</b>
-<b>int *<i>ovector</i>, int <i>stringcount</i>, PCRE_SPTR32 **<i>listptr</i>);</b>
+<b> int *<i>ovector</i>, int <i>stringcount</i>, PCRE_SPTR32 **<i>listptr</i>);</b>
</P>
<br><b>
DESCRIPTION
diff --git a/pcre/doc/html/pcre_jit_exec.html b/pcre/doc/html/pcre_jit_exec.html
index 0c63503a997..4ebb0cbcac4 100644
--- a/pcre/doc/html/pcre_jit_exec.html
+++ b/pcre/doc/html/pcre_jit_exec.html
@@ -20,21 +20,21 @@ SYNOPSIS
</P>
<P>
<b>int pcre_jit_exec(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b>
-<b>const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
-<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
-<b>pcre_jit_stack *<i>jstack</i>);</b>
-</P>
-<P>
+<b> const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
+<b> int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
+<b> pcre_jit_stack *<i>jstack</i>);</b>
+<br>
+<br>
<b>int pcre16_jit_exec(const pcre16 *<i>code</i>, const pcre16_extra *<i>extra</i>,</b>
-<b>PCRE_SPTR16 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
-<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
-<b>pcre_jit_stack *<i>jstack</i>);</b>
-</P>
-<P>
+<b> PCRE_SPTR16 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
+<b> int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
+<b> pcre_jit_stack *<i>jstack</i>);</b>
+<br>
+<br>
<b>int pcre32_jit_exec(const pcre32 *<i>code</i>, const pcre32_extra *<i>extra</i>,</b>
-<b>PCRE_SPTR32 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
-<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
-<b>pcre_jit_stack *<i>jstack</i>);</b>
+<b> PCRE_SPTR32 <i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
+<b> int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
+<b> pcre_jit_stack *<i>jstack</i>);</b>
</P>
<br><b>
DESCRIPTION
diff --git a/pcre/doc/html/pcre_jit_stack_alloc.html b/pcre/doc/html/pcre_jit_stack_alloc.html
index 4153ee594ff..23ba450750c 100644
--- a/pcre/doc/html/pcre_jit_stack_alloc.html
+++ b/pcre/doc/html/pcre_jit_stack_alloc.html
@@ -20,15 +20,15 @@ SYNOPSIS
</P>
<P>
<b>pcre_jit_stack *pcre_jit_stack_alloc(int <i>startsize</i>,</b>
-<b>int <i>maxsize</i>);</b>
-</P>
-<P>
+<b> int <i>maxsize</i>);</b>
+<br>
+<br>
<b>pcre16_jit_stack *pcre16_jit_stack_alloc(int <i>startsize</i>,</b>
-<b>int <i>maxsize</i>);</b>
-</P>
-<P>
+<b> int <i>maxsize</i>);</b>
+<br>
+<br>
<b>pcre32_jit_stack *pcre32_jit_stack_alloc(int <i>startsize</i>,</b>
-<b>int <i>maxsize</i>);</b>
+<b> int <i>maxsize</i>);</b>
</P>
<br><b>
DESCRIPTION
diff --git a/pcre/doc/html/pcre_pattern_to_host_byte_order.html b/pcre/doc/html/pcre_pattern_to_host_byte_order.html
index 68d6f5a10a3..1b1c80372b8 100644
--- a/pcre/doc/html/pcre_pattern_to_host_byte_order.html
+++ b/pcre/doc/html/pcre_pattern_to_host_byte_order.html
@@ -20,15 +20,15 @@ SYNOPSIS
</P>
<P>
<b>int pcre_pattern_to_host_byte_order(pcre *<i>code</i>,</b>
-<b>pcre_extra *<i>extra</i>, const unsigned char *<i>tables</i>);</b>
-</P>
-<P>
+<b> pcre_extra *<i>extra</i>, const unsigned char *<i>tables</i>);</b>
+<br>
+<br>
<b>int pcre16_pattern_to_host_byte_order(pcre16 *<i>code</i>,</b>
-<b>pcre16_extra *<i>extra</i>, const unsigned char *<i>tables</i>);</b>
-</P>
-<P>
+<b> pcre16_extra *<i>extra</i>, const unsigned char *<i>tables</i>);</b>
+<br>
+<br>
<b>int pcre32_pattern_to_host_byte_order(pcre32 *<i>code</i>,</b>
-<b>pcre32_extra *<i>extra</i>, const unsigned char *<i>tables</i>);</b>
+<b> pcre32_extra *<i>extra</i>, const unsigned char *<i>tables</i>);</b>
</P>
<br><b>
DESCRIPTION
diff --git a/pcre/doc/html/pcre_study.html b/pcre/doc/html/pcre_study.html
index 2baf54c4689..af82f11409d 100644
--- a/pcre/doc/html/pcre_study.html
+++ b/pcre/doc/html/pcre_study.html
@@ -20,15 +20,15 @@ SYNOPSIS
</P>
<P>
<b>pcre_extra *pcre_study(const pcre *<i>code</i>, int <i>options</i>,</b>
-<b>const char **<i>errptr</i>);</b>
-</P>
-<P>
+<b> const char **<i>errptr</i>);</b>
+<br>
+<br>
<b>pcre16_extra *pcre16_study(const pcre16 *<i>code</i>, int <i>options</i>,</b>
-<b>const char **<i>errptr</i>);</b>
-</P>
-<P>
+<b> const char **<i>errptr</i>);</b>
+<br>
+<br>
<b>pcre32_extra *pcre32_study(const pcre32 *<i>code</i>, int <i>options</i>,</b>
-<b>const char **<i>errptr</i>);</b>
+<b> const char **<i>errptr</i>);</b>
</P>
<br><b>
DESCRIPTION
diff --git a/pcre/doc/html/pcre_utf16_to_host_byte_order.html b/pcre/doc/html/pcre_utf16_to_host_byte_order.html
index 164e2365a15..18e7788f682 100644
--- a/pcre/doc/html/pcre_utf16_to_host_byte_order.html
+++ b/pcre/doc/html/pcre_utf16_to_host_byte_order.html
@@ -20,8 +20,8 @@ SYNOPSIS
</P>
<P>
<b>int pcre16_utf16_to_host_byte_order(PCRE_UCHAR16 *<i>output</i>,</b>
-<b>PCRE_SPTR16 <i>input</i>, int <i>length</i>, int *<i>host_byte_order</i>,</b>
-<b>int <i>keep_boms</i>);</b>
+<b> PCRE_SPTR16 <i>input</i>, int <i>length</i>, int *<i>host_byte_order</i>,</b>
+<b> int <i>keep_boms</i>);</b>
</P>
<br><b>
DESCRIPTION
diff --git a/pcre/doc/html/pcre_utf32_to_host_byte_order.html b/pcre/doc/html/pcre_utf32_to_host_byte_order.html
index 967c00db802..772ae40cd92 100644
--- a/pcre/doc/html/pcre_utf32_to_host_byte_order.html
+++ b/pcre/doc/html/pcre_utf32_to_host_byte_order.html
@@ -20,8 +20,8 @@ SYNOPSIS
</P>
<P>
<b>int pcre32_utf32_to_host_byte_order(PCRE_UCHAR32 *<i>output</i>,</b>
-<b>PCRE_SPTR32 <i>input</i>, int <i>length</i>, int *<i>host_byte_order</i>,</b>
-<b>int <i>keep_boms</i>);</b>
+<b> PCRE_SPTR32 <i>input</i>, int <i>length</i>, int *<i>host_byte_order</i>,</b>
+<b> int <i>keep_boms</i>);</b>
</P>
<br><b>
DESCRIPTION
diff --git a/pcre/doc/html/pcreapi.html b/pcre/doc/html/pcreapi.html
index 2a00d9ba041..abc3d2663fc 100644
--- a/pcre/doc/html/pcreapi.html
+++ b/pcre/doc/html/pcreapi.html
@@ -46,125 +46,125 @@ man page, in case the conversion went wrong.
<br><a name="SEC1" href="#TOC1">PCRE NATIVE API BASIC FUNCTIONS</a><br>
<P>
<b>pcre *pcre_compile(const char *<i>pattern</i>, int <i>options</i>,</b>
-<b>const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
-<b>const unsigned char *<i>tableptr</i>);</b>
-</P>
-<P>
+<b> const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
+<b> const unsigned char *<i>tableptr</i>);</b>
+<br>
+<br>
<b>pcre *pcre_compile2(const char *<i>pattern</i>, int <i>options</i>,</b>
-<b>int *<i>errorcodeptr</i>,</b>
-<b>const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
-<b>const unsigned char *<i>tableptr</i>);</b>
-</P>
-<P>
+<b> int *<i>errorcodeptr</i>,</b>
+<b> const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
+<b> const unsigned char *<i>tableptr</i>);</b>
+<br>
+<br>
<b>pcre_extra *pcre_study(const pcre *<i>code</i>, int <i>options</i>,</b>
-<b>const char **<i>errptr</i>);</b>
-</P>
-<P>
+<b> const char **<i>errptr</i>);</b>
+<br>
+<br>
<b>void pcre_free_study(pcre_extra *<i>extra</i>);</b>
-</P>
-<P>
+<br>
+<br>
<b>int pcre_exec(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b>
-<b>const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
-<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>);</b>
-</P>
-<P>
+<b> const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
+<b> int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>);</b>
+<br>
+<br>
<b>int pcre_dfa_exec(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b>
-<b>const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
-<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
-<b>int *<i>workspace</i>, int <i>wscount</i>);</b>
+<b> const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
+<b> int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
+<b> int *<i>workspace</i>, int <i>wscount</i>);</b>
</P>
<br><a name="SEC2" href="#TOC1">PCRE NATIVE API STRING EXTRACTION FUNCTIONS</a><br>
<P>
<b>int pcre_copy_named_substring(const pcre *<i>code</i>,</b>
-<b>const char *<i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, const char *<i>stringname</i>,</b>
-<b>char *<i>buffer</i>, int <i>buffersize</i>);</b>
-</P>
-<P>
+<b> const char *<i>subject</i>, int *<i>ovector</i>,</b>
+<b> int <i>stringcount</i>, const char *<i>stringname</i>,</b>
+<b> char *<i>buffer</i>, int <i>buffersize</i>);</b>
+<br>
+<br>
<b>int pcre_copy_substring(const char *<i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, int <i>stringnumber</i>, char *<i>buffer</i>,</b>
-<b>int <i>buffersize</i>);</b>
-</P>
-<P>
+<b> int <i>stringcount</i>, int <i>stringnumber</i>, char *<i>buffer</i>,</b>
+<b> int <i>buffersize</i>);</b>
+<br>
+<br>
<b>int pcre_get_named_substring(const pcre *<i>code</i>,</b>
-<b>const char *<i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, const char *<i>stringname</i>,</b>
-<b>const char **<i>stringptr</i>);</b>
-</P>
-<P>
+<b> const char *<i>subject</i>, int *<i>ovector</i>,</b>
+<b> int <i>stringcount</i>, const char *<i>stringname</i>,</b>
+<b> const char **<i>stringptr</i>);</b>
+<br>
+<br>
<b>int pcre_get_stringnumber(const pcre *<i>code</i>,</b>
-<b>const char *<i>name</i>);</b>
-</P>
-<P>
+<b> const char *<i>name</i>);</b>
+<br>
+<br>
<b>int pcre_get_stringtable_entries(const pcre *<i>code</i>,</b>
-<b>const char *<i>name</i>, char **<i>first</i>, char **<i>last</i>);</b>
-</P>
-<P>
+<b> const char *<i>name</i>, char **<i>first</i>, char **<i>last</i>);</b>
+<br>
+<br>
<b>int pcre_get_substring(const char *<i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, int <i>stringnumber</i>,</b>
-<b>const char **<i>stringptr</i>);</b>
-</P>
-<P>
+<b> int <i>stringcount</i>, int <i>stringnumber</i>,</b>
+<b> const char **<i>stringptr</i>);</b>
+<br>
+<br>
<b>int pcre_get_substring_list(const char *<i>subject</i>,</b>
-<b>int *<i>ovector</i>, int <i>stringcount</i>, const char ***<i>listptr</i>);</b>
-</P>
-<P>
+<b> int *<i>ovector</i>, int <i>stringcount</i>, const char ***<i>listptr</i>);</b>
+<br>
+<br>
<b>void pcre_free_substring(const char *<i>stringptr</i>);</b>
-</P>
-<P>
+<br>
+<br>
<b>void pcre_free_substring_list(const char **<i>stringptr</i>);</b>
</P>
<br><a name="SEC3" href="#TOC1">PCRE NATIVE API AUXILIARY FUNCTIONS</a><br>
<P>
<b>int pcre_jit_exec(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b>
-<b>const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
-<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
-<b>pcre_jit_stack *<i>jstack</i>);</b>
-</P>
-<P>
+<b> const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
+<b> int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
+<b> pcre_jit_stack *<i>jstack</i>);</b>
+<br>
+<br>
<b>pcre_jit_stack *pcre_jit_stack_alloc(int <i>startsize</i>, int <i>maxsize</i>);</b>
-</P>
-<P>
+<br>
+<br>
<b>void pcre_jit_stack_free(pcre_jit_stack *<i>stack</i>);</b>
-</P>
-<P>
+<br>
+<br>
<b>void pcre_assign_jit_stack(pcre_extra *<i>extra</i>,</b>
-<b>pcre_jit_callback <i>callback</i>, void *<i>data</i>);</b>
-</P>
-<P>
+<b> pcre_jit_callback <i>callback</i>, void *<i>data</i>);</b>
+<br>
+<br>
<b>const unsigned char *pcre_maketables(void);</b>
-</P>
-<P>
+<br>
+<br>
<b>int pcre_fullinfo(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b>
-<b>int <i>what</i>, void *<i>where</i>);</b>
-</P>
-<P>
+<b> int <i>what</i>, void *<i>where</i>);</b>
+<br>
+<br>
<b>int pcre_refcount(pcre *<i>code</i>, int <i>adjust</i>);</b>
-</P>
-<P>
+<br>
+<br>
<b>int pcre_config(int <i>what</i>, void *<i>where</i>);</b>
-</P>
-<P>
+<br>
+<br>
<b>const char *pcre_version(void);</b>
-</P>
-<P>
+<br>
+<br>
<b>int pcre_pattern_to_host_byte_order(pcre *<i>code</i>,</b>
-<b>pcre_extra *<i>extra</i>, const unsigned char *<i>tables</i>);</b>
+<b> pcre_extra *<i>extra</i>, const unsigned char *<i>tables</i>);</b>
</P>
<br><a name="SEC4" href="#TOC1">PCRE NATIVE API INDIRECTED FUNCTIONS</a><br>
<P>
<b>void *(*pcre_malloc)(size_t);</b>
-</P>
-<P>
+<br>
+<br>
<b>void (*pcre_free)(void *);</b>
-</P>
-<P>
+<br>
+<br>
<b>void *(*pcre_stack_malloc)(size_t);</b>
-</P>
-<P>
+<br>
+<br>
<b>void (*pcre_stack_free)(void *);</b>
-</P>
-<P>
+<br>
+<br>
<b>int (*pcre_callout)(pcre_callout_block *);</b>
</P>
<br><a name="SEC5" href="#TOC1">PCRE 8-BIT, 16-BIT, AND 32-BIT LIBRARIES</a><br>
@@ -484,6 +484,13 @@ the
<a href="pcreposix.html"><b>pcreposix</b></a>
documentation.
<pre>
+ PCRE_CONFIG_PARENS_LIMIT
+</pre>
+The output is a long integer that gives the maximum depth of nesting of
+parentheses (of any kind) in a pattern. This limit is imposed to cap the amount
+of system stack used when a pattern is compiled. It is specified when PCRE is
+built; the default is 250.
+<pre>
PCRE_CONFIG_MATCH_LIMIT
</pre>
The output is a long integer that gives the default limit for the number of
@@ -509,12 +516,14 @@ avoiding the use of the stack.
<br><a name="SEC11" href="#TOC1">COMPILING A PATTERN</a><br>
<P>
<b>pcre *pcre_compile(const char *<i>pattern</i>, int <i>options</i>,</b>
-<b>const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
-<b>const unsigned char *<i>tableptr</i>);</b>
+<b> const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
+<b> const unsigned char *<i>tableptr</i>);</b>
+<br>
+<br>
<b>pcre *pcre_compile2(const char *<i>pattern</i>, int <i>options</i>,</b>
-<b>int *<i>errorcodeptr</i>,</b>
-<b>const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
-<b>const unsigned char *<i>tableptr</i>);</b>
+<b> int *<i>errorcodeptr</i>,</b>
+<b> const char **<i>errptr</i>, int *<i>erroffset</i>,</b>
+<b> const unsigned char *<i>tableptr</i>);</b>
</P>
<P>
Either of the functions <b>pcre_compile()</b> or <b>pcre_compile2()</b> can be
@@ -580,8 +589,9 @@ If the final argument, <i>tableptr</i>, is NULL, PCRE uses a default set of
character tables that are built when PCRE is compiled, using the default C
locale. Otherwise, <i>tableptr</i> must be an address that is the result of a
call to <b>pcre_maketables()</b>. This value is stored with the compiled
-pattern, and used again by <b>pcre_exec()</b>, unless another table pointer is
-passed to it. For more discussion, see the section on locale support below.
+pattern, and used again by <b>pcre_exec()</b> and <b>pcre_dfa_exec()</b> when the
+pattern is matched. For more discussion, see the section on locale support
+below.
</P>
<P>
This code fragment shows a typical straightforward call to <b>pcre_compile()</b>:
@@ -666,12 +676,24 @@ documentation.
<pre>
PCRE_EXTENDED
</pre>
-If this bit is set, white space data characters in the pattern are totally
-ignored except when escaped or inside a character class. White space does not
-include the VT character (code 11). In addition, characters between an
-unescaped # outside a character class and the next newline, inclusive, are also
-ignored. This is equivalent to Perl's /x option, and it can be changed within a
-pattern by a (?x) option setting.
+If this bit is set, most white space characters in the pattern are totally
+ignored except when escaped or inside a character class. However, white space
+is not allowed within sequences such as (?&#62; that introduce various
+parenthesized subpatterns, nor within a numerical quantifier such as {1,3}.
+However, ignorable white space is permitted between an item and a following
+quantifier and between a quantifier and a following + that indicates
+possessiveness.
+</P>
+<P>
+White space did not used to include the VT character (code 11), because Perl
+did not treat this character as white space. However, Perl changed at release
+5.18, so PCRE followed at release 8.34, and VT is now treated as white space.
+</P>
+<P>
+PCRE_EXTENDED also causes characters between an unescaped # outside a character
+class and the next newline, inclusive, to be ignored. PCRE_EXTENDED is
+equivalent to Perl's /x option, and it can be changed within a pattern by a
+(?x) option setting.
</P>
<P>
Which characters are interpreted as newlines is controlled by the options
@@ -825,6 +847,15 @@ were followed by ?: but named parentheses can still be used for capturing (and
they acquire numbers in the usual way). There is no equivalent of this option
in Perl.
<pre>
+ PCRE_NO_AUTO_POSSESS
+</pre>
+If this option is set, it disables "auto-possessification". This is an
+optimization that, for example, turns a+b into a++b in order to avoid
+backtracks into a+ that can never be successful. However, if callouts are in
+use, auto-possessification means that some of them are never taken. You can set
+this option if you want the matching functions to do a full unoptimized search
+and run all the callouts, but it is mainly provided for testing purposes.
+<pre>
PCRE_NO_START_OPTIMIZE
</pre>
This is an option that acts at matching time; that is, it is really an option
@@ -875,10 +906,10 @@ page. If an invalid UTF-8 sequence is found, <b>pcre_compile()</b> returns an
error. If you already know that your pattern is valid, and you want to skip
this check for performance reasons, you can set the PCRE_NO_UTF8_CHECK option.
When it is set, the effect of passing an invalid UTF-8 string as a pattern is
-undefined. It may cause your program to crash. Note that this option can also
-be passed to <b>pcre_exec()</b> and <b>pcre_dfa_exec()</b>, to suppress the
-validity checking of subject strings only. If the same string is being matched
-many times, the option can be safely set for the second and subsequent
+undefined. It may cause your program to crash or loop. Note that this option
+can also be passed to <b>pcre_exec()</b> and <b>pcre_dfa_exec()</b>, to suppress
+the validity checking of subject strings only. If the same string is being
+matched many times, the option can be safely set for the second and subsequent
matchings to improve performance.
</P>
<br><a name="SEC12" href="#TOC1">COMPILATION ERROR CODES</a><br>
@@ -923,7 +954,7 @@ have fallen out of use. To avoid confusion, they have not been re-used.
31 POSIX collating elements are not supported
32 this version of PCRE is compiled without UTF support
33 [this code is not in use]
- 34 character value in \x{...} sequence is too large
+ 34 character value in \x{} or \o{} is too large
35 invalid condition (?(0)
36 \C not allowed in lookbehind assertion
37 PCRE does not support \L, \l, \N{name}, \U, or \u
@@ -971,14 +1002,20 @@ have fallen out of use. To avoid confusion, they have not been re-used.
75 name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)
76 character value in \u.... sequence is too large
77 invalid UTF-32 string (specifically UTF-32)
+ 78 setting UTF is disabled by the application
+ 79 non-hex character in \x{} (closing brace missing?)
+ 80 non-octal character in \o{} (closing brace missing?)
+ 81 missing opening brace after \o
+ 82 parentheses are too deeply nested
+ 83 invalid range in character class
</pre>
The numbers 32 and 10000 in errors 48 and 49 are defaults; different values may
be used if the limits were changed when PCRE was built.
<a name="studyingapattern"></a></P>
<br><a name="SEC13" href="#TOC1">STUDYING A PATTERN</a><br>
<P>
-<b>pcre_extra *pcre_study(const pcre *<i>code</i>, int <i>options</i></b>
-<b>const char **<i>errptr</i>);</b>
+<b>pcre_extra *pcre_study(const pcre *<i>code</i>, int <i>options</i>,</b>
+<b> const char **<i>errptr</i>);</b>
</P>
<P>
If a compiled pattern is going to be used several times, it is worth spending
@@ -1101,15 +1138,18 @@ There is a longer discussion of PCRE_NO_START_OPTIMIZE
<P>
PCRE handles caseless matching, and determines whether characters are letters,
digits, or whatever, by reference to a set of tables, indexed by character
-value. When running in UTF-8 mode, this applies only to characters
-with codes less than 128. By default, higher-valued codes never match escapes
-such as \w or \d, but they can be tested with \p if PCRE is built with
-Unicode character property support. Alternatively, the PCRE_UCP option can be
-set at compile time; this causes \w and friends to use Unicode property
-support instead of built-in tables. The use of locales with Unicode is
-discouraged. If you are handling characters with codes greater than 128, you
-should either use UTF-8 and Unicode, or use locales, but not try to mix the
-two.
+code point. When running in UTF-8 mode, or in the 16- or 32-bit libraries, this
+applies only to characters with code points less than 256. By default,
+higher-valued code points never match escapes such as \w or \d. However, if
+PCRE is built with Unicode property support, all characters can be tested with
+\p and \P, or, alternatively, the PCRE_UCP option can be set when a pattern
+is compiled; this causes \w and friends to use Unicode property support
+instead of the built-in tables.
+</P>
+<P>
+The use of locales with Unicode is discouraged. If you are handling characters
+with code points greater than 128, you should either use Unicode support, or
+use locales, but not try to mix the two.
</P>
<P>
PCRE contains an internal set of tables that are used when the final argument
@@ -1127,10 +1167,10 @@ for this locale support is expected to die away.
<P>
External tables are built by calling the <b>pcre_maketables()</b> function,
which has no arguments, in the relevant locale. The result can then be passed
-to <b>pcre_compile()</b> or <b>pcre_exec()</b> as often as necessary. For
-example, to build and use tables that are appropriate for the French locale
-(where accented characters with values greater than 128 are treated as letters),
-the following code could be used:
+to <b>pcre_compile()</b> as often as necessary. For example, to build and use
+tables that are appropriate for the French locale (where accented characters
+with values greater than 128 are treated as letters), the following code could
+be used:
<pre>
setlocale(LC_CTYPE, "fr_FR");
tables = pcre_maketables();
@@ -1148,21 +1188,25 @@ needed.
<P>
The pointer that is passed to <b>pcre_compile()</b> is saved with the compiled
pattern, and the same tables are used via this pointer by <b>pcre_study()</b>
-and normally also by <b>pcre_exec()</b>. Thus, by default, for any single
+and also by <b>pcre_exec()</b> and <b>pcre_dfa_exec()</b>. Thus, for any single
pattern, compilation, studying and matching all happen in the same locale, but
-different patterns can be compiled in different locales.
+different patterns can be processed in different locales.
</P>
<P>
It is possible to pass a table pointer or NULL (indicating the use of the
-internal tables) to <b>pcre_exec()</b>. Although not intended for this purpose,
-this facility could be used to match a pattern in a different locale from the
-one in which it was compiled. Passing table pointers at run time is discussed
-below in the section on matching a pattern.
+internal tables) to <b>pcre_exec()</b> or <b>pcre_dfa_exec()</b> (see the
+discussion below in the section on matching a pattern). This facility is
+provided for use with pre-compiled patterns that have been saved and reloaded.
+Character tables are not saved with patterns, so if a non-standard table was
+used at compile time, it must be provided again when the reloaded pattern is
+matched. Attempting to use this facility to match a pattern in a different
+locale from the one in which it was compiled is likely to lead to anomalous
+(usually incorrect) results.
<a name="infoaboutpattern"></a></P>
<br><a name="SEC15" href="#TOC1">INFORMATION ABOUT A PATTERN</a><br>
<P>
<b>int pcre_fullinfo(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b>
-<b>int <i>what</i>, void *<i>where</i>);</b>
+<b> int <i>what</i>, void *<i>where</i>);</b>
</P>
<P>
The <b>pcre_fullinfo()</b> function returns information about a compiled
@@ -1303,10 +1347,15 @@ is -1.
</P>
<P>
Since for the 32-bit library using the non-UTF-32 mode, this function is unable
-to return the full 32-bit range of the character, this value is deprecated;
+to return the full 32-bit range of characters, this value is deprecated;
instead the PCRE_INFO_REQUIREDCHARFLAGS and PCRE_INFO_REQUIREDCHAR values should
be used.
<pre>
+ PCRE_INFO_MATCH_EMPTY
+</pre>
+Return 1 if the pattern can match an empty string, otherwise 0. The fourth
+argument should point to an <b>int</b> variable.
+<pre>
PCRE_INFO_MATCHLIMIT
</pre>
If the pattern set a match limit by including an item of the form
@@ -1364,16 +1413,18 @@ contains the parenthesis number. The rest of the entry is the corresponding
name, zero terminated.
</P>
<P>
-The names are in alphabetical order. Duplicate names may appear if (?| is used
-to create multiple groups with the same number, as described in the
+The names are in alphabetical order. If (?| is used to create multiple groups
+with the same number, as described in the
<a href="pcrepattern.html#dupsubpatternnumber">section on duplicate subpattern numbers</a>
in the
<a href="pcrepattern.html"><b>pcrepattern</b></a>
-page. Duplicate names for subpatterns with different numbers are permitted only
-if PCRE_DUPNAMES is set. In all cases of duplicate names, they appear in the
-table in the order in which they were found in the pattern. In the absence of
-(?| this is the order of increasing number; when (?| is used this is not
-necessarily the case because later subpatterns may have lower numbers.
+page, the groups may be given the same name, but there is only one entry in the
+table. Different names for groups of the same number are not permitted.
+Duplicate names for subpatterns with different numbers are permitted,
+but only if PCRE_DUPNAMES is set. They appear in the table in the order in
+which they were found in the pattern. In the absence of (?| this is the order
+of increasing number; when (?| is used this is not necessarily the case because
+later subpatterns may have lower numbers.
</P>
<P>
As a simple example of the name/number table, consider the following pattern
@@ -1487,30 +1538,14 @@ returned. For anchored patterns, 0 is returned.
<pre>
PCRE_INFO_FIRSTCHARACTER
</pre>
-Return the fixed first character value, if PCRE_INFO_FIRSTCHARACTERFLAGS
-returned 1; otherwise returns 0. The fourth argument should point to an
-<b>uint_t</b> variable.
+Return the fixed first character value in the situation where
+PCRE_INFO_FIRSTCHARACTERFLAGS returns 1; otherwise return 0. The fourth
+argument should point to an <b>uint_t</b> variable.
</P>
<P>
In the 8-bit library, the value is always less than 256. In the 16-bit library
the value can be up to 0xffff. In the 32-bit library in UTF-32 mode the value
can be up to 0x10ffff, and up to 0xffffffff when not using UTF-32 mode.
-</P>
-<P>
-If there is no fixed first value, and if either
-<br>
-<br>
-(a) the pattern was compiled with the PCRE_MULTILINE option, and every branch
-starts with "^", or
-<br>
-<br>
-(b) every branch of the pattern starts with ".*" and PCRE_DOTALL is not set
-(if it were set, the pattern would be anchored),
-<br>
-<br>
--1 is returned, indicating that the pattern matches only at the start of a
-subject string or after any newline within the string. Otherwise -2 is
-returned. For anchored patterns, -2 is returned.
<pre>
PCRE_INFO_REQUIREDCHARFLAGS
</pre>
@@ -1559,8 +1594,8 @@ is different. (This seems a highly unlikely scenario.)
<br><a name="SEC17" href="#TOC1">MATCHING A PATTERN: THE TRADITIONAL FUNCTION</a><br>
<P>
<b>int pcre_exec(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b>
-<b>const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
-<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>);</b>
+<b> const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
+<b> int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>);</b>
</P>
<P>
The function <b>pcre_exec()</b> is called to match a subject string against a
@@ -1723,17 +1758,22 @@ and is described in the
documentation.
</P>
<P>
-The <i>tables</i> field is used to pass a character tables pointer to
-<b>pcre_exec()</b>; this overrides the value that is stored with the compiled
-pattern. A non-NULL value is stored with the compiled pattern only if custom
-tables were supplied to <b>pcre_compile()</b> via its <i>tableptr</i> argument.
-If NULL is passed to <b>pcre_exec()</b> using this mechanism, it forces PCRE's
-internal tables to be used. This facility is helpful when re-using patterns
-that have been saved after compiling with an external set of tables, because
-the external tables might be at a different address when <b>pcre_exec()</b> is
-called. See the
+The <i>tables</i> field is provided for use with patterns that have been
+pre-compiled using custom character tables, saved to disc or elsewhere, and
+then reloaded, because the tables that were used to compile a pattern are not
+saved with it. See the
<a href="pcreprecompile.html"><b>pcreprecompile</b></a>
-documentation for a discussion of saving compiled patterns for later use.
+documentation for a discussion of saving compiled patterns for later use. If
+NULL is passed using this mechanism, it forces PCRE's internal tables to be
+used.
+</P>
+<P>
+<b>Warning:</b> The tables that <b>pcre_exec()</b> uses must be the same as those
+that were used when the pattern was compiled. If this is not the case, the
+behaviour of <b>pcre_exec()</b> is undefined. Therefore, when a pattern is
+compiled and matched in the same process, this field should never be set. In
+this (the most common) case, the correct table pointer is automatically passed
+with the compiled pattern from <b>pcre_compile()</b> to <b>pcre_exec()</b>.
</P>
<P>
If PCRE_EXTRA_MARK is set in the <i>flags</i> field, the <i>mark</i> field must
@@ -1951,7 +1991,7 @@ all the matches in a single subject string. However, you should be sure that
the value of <i>startoffset</i> points to the start of a character (or the end
of the subject). When PCRE_NO_UTF8_CHECK is set, the effect of passing an
invalid string as a subject or an invalid value of <i>startoffset</i> is
-undefined. Your program may crash.
+undefined. Your program may crash or loop.
<pre>
PCRE_PARTIAL_HARD
PCRE_PARTIAL_SOFT
@@ -2413,17 +2453,17 @@ no longer in use and is never returned.
<br><a name="SEC18" href="#TOC1">EXTRACTING CAPTURED SUBSTRINGS BY NUMBER</a><br>
<P>
<b>int pcre_copy_substring(const char *<i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, int <i>stringnumber</i>, char *<i>buffer</i>,</b>
-<b>int <i>buffersize</i>);</b>
-</P>
-<P>
+<b> int <i>stringcount</i>, int <i>stringnumber</i>, char *<i>buffer</i>,</b>
+<b> int <i>buffersize</i>);</b>
+<br>
+<br>
<b>int pcre_get_substring(const char *<i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, int <i>stringnumber</i>,</b>
-<b>const char **<i>stringptr</i>);</b>
-</P>
-<P>
+<b> int <i>stringcount</i>, int <i>stringnumber</i>,</b>
+<b> const char **<i>stringptr</i>);</b>
+<br>
+<br>
<b>int pcre_get_substring_list(const char *<i>subject</i>,</b>
-<b>int *<i>ovector</i>, int <i>stringcount</i>, const char ***<i>listptr</i>);</b>
+<b> int *<i>ovector</i>, int <i>stringcount</i>, const char ***<i>listptr</i>);</b>
</P>
<P>
Captured substrings can be accessed directly by using the offsets returned by
@@ -2508,19 +2548,19 @@ provided.
<br><a name="SEC19" href="#TOC1">EXTRACTING CAPTURED SUBSTRINGS BY NAME</a><br>
<P>
<b>int pcre_get_stringnumber(const pcre *<i>code</i>,</b>
-<b>const char *<i>name</i>);</b>
-</P>
-<P>
+<b> const char *<i>name</i>);</b>
+<br>
+<br>
<b>int pcre_copy_named_substring(const pcre *<i>code</i>,</b>
-<b>const char *<i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, const char *<i>stringname</i>,</b>
-<b>char *<i>buffer</i>, int <i>buffersize</i>);</b>
-</P>
-<P>
+<b> const char *<i>subject</i>, int *<i>ovector</i>,</b>
+<b> int <i>stringcount</i>, const char *<i>stringname</i>,</b>
+<b> char *<i>buffer</i>, int <i>buffersize</i>);</b>
+<br>
+<br>
<b>int pcre_get_named_substring(const pcre *<i>code</i>,</b>
-<b>const char *<i>subject</i>, int *<i>ovector</i>,</b>
-<b>int <i>stringcount</i>, const char *<i>stringname</i>,</b>
-<b>const char **<i>stringptr</i>);</b>
+<b> const char *<i>subject</i>, int *<i>ovector</i>,</b>
+<b> int <i>stringcount</i>, const char *<i>stringname</i>,</b>
+<b> const char **<i>stringptr</i>);</b>
</P>
<P>
To extract a substring by name, you first have to find associated number.
@@ -2572,7 +2612,7 @@ same number causes an error at compile time.
<br><a name="SEC20" href="#TOC1">DUPLICATE SUBPATTERN NAMES</a><br>
<P>
<b>int pcre_get_stringtable_entries(const pcre *<i>code</i>,</b>
-<b>const char *<i>name</i>, char **<i>first</i>, char **<i>last</i>);</b>
+<b> const char *<i>name</i>, char **<i>first</i>, char **<i>last</i>);</b>
</P>
<P>
When a pattern is compiled with the PCRE_DUPNAMES option, names for subpatterns
@@ -2653,9 +2693,9 @@ the value returned is the size of each block that is obtained from the heap.
<br><a name="SEC23" href="#TOC1">MATCHING A PATTERN: THE ALTERNATIVE FUNCTION</a><br>
<P>
<b>int pcre_dfa_exec(const pcre *<i>code</i>, const pcre_extra *<i>extra</i>,</b>
-<b>const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
-<b>int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
-<b>int *<i>workspace</i>, int <i>wscount</i>);</b>
+<b> const char *<i>subject</i>, int <i>length</i>, int <i>startoffset</i>,</b>
+<b> int <i>options</i>, int *<i>ovector</i>, int <i>ovecsize</i>,</b>
+<b> int *<i>workspace</i>, int <i>wscount</i>);</b>
</P>
<P>
The function <b>pcre_dfa_exec()</b> is called to match a subject string against
@@ -2784,6 +2824,15 @@ matching string is given first. If there were too many matches to fit into
the longest matches. Unlike <b>pcre_exec()</b>, <b>pcre_dfa_exec()</b> can use
the entire <i>ovector</i> for returning matched strings.
</P>
+<P>
+NOTE: PCRE's "auto-possessification" optimization usually applies to character
+repeats at the end of a pattern (as well as internally). For example, the
+pattern "a\d+" is compiled as if it were "a\d++" because there is no point
+even considering the possibility of backtracking into the repeated digits. For
+DFA matching, this means that only one possible match is found. If you really
+do want multiple matches in such cases, either use an ungreedy repeat
+("a\d+?") or set the PCRE_NO_AUTO_POSSESS option when compiling.
+</P>
<br><b>
Error returns from <b>pcre_dfa_exec()</b>
</b><br>
@@ -2850,7 +2899,7 @@ Cambridge CB2 3QH, England.
</P>
<br><a name="SEC26" href="#TOC1">REVISION</a><br>
<P>
-Last updated: 12 May 2013
+Last updated: 12 November 2013
<br>
Copyright &copy; 1997-2013 University of Cambridge.
<br>
diff --git a/pcre/doc/html/pcrecallout.html b/pcre/doc/html/pcrecallout.html
index 7233bb671e7..53a937f52dd 100644
--- a/pcre/doc/html/pcrecallout.html
+++ b/pcre/doc/html/pcrecallout.html
@@ -77,15 +77,50 @@ independent groups).
Automatic callouts can be used for tracking the progress of pattern matching.
The
<a href="pcretest.html"><b>pcretest</b></a>
-command has an option that sets automatic callouts; when it is used, the output
-indicates how the pattern is matched. This is useful information when you are
-trying to optimize the performance of a particular pattern.
+program has a pattern qualifier (/C) that sets automatic callouts; when it is
+used, the output indicates how the pattern is being matched. This is useful
+information when you are trying to optimize the performance of a particular
+pattern.
</P>
<br><a name="SEC3" href="#TOC1">MISSING CALLOUTS</a><br>
<P>
-You should be aware that, because of optimizations in the way PCRE matches
-patterns by default, callouts sometimes do not happen. For example, if the
-pattern is
+You should be aware that, because of optimizations in the way PCRE compiles and
+matches patterns, callouts sometimes do not happen exactly as you might expect.
+</P>
+<P>
+At compile time, PCRE "auto-possessifies" repeated items when it knows that
+what follows cannot be part of the repeat. For example, a+[bc] is compiled as
+if it were a++[bc]. The <b>pcretest</b> output when this pattern is anchored and
+then applied with automatic callouts to the string "aaaa" is:
+<pre>
+ ---&#62;aaaa
+ +0 ^ ^
+ +1 ^ a+
+ +3 ^ ^ [bc]
+ No match
+</pre>
+This indicates that when matching [bc] fails, there is no backtracking into a+
+and therefore the callouts that would be taken for the backtracks do not occur.
+You can disable the auto-possessify feature by passing PCRE_NO_AUTO_POSSESS
+to <b>pcre_compile()</b>, or starting the pattern with (*NO_AUTO_POSSESS). If
+this is done in <b>pcretest</b> (using the /O qualifier), the output changes to
+this:
+<pre>
+ ---&#62;aaaa
+ +0 ^ ^
+ +1 ^ a+
+ +3 ^ ^ [bc]
+ +3 ^ ^ [bc]
+ +3 ^ ^ [bc]
+ +3 ^^ [bc]
+ No match
+</pre>
+This time, when matching [bc] fails, the matcher backtracks into a+ and tries
+again, repeatedly, until a+ itself fails.
+</P>
+<P>
+Other optimizations that provide fast "no match" results also affect callouts.
+For example, if the pattern is
<pre>
ab(?C4)cd
</pre>
@@ -109,11 +144,11 @@ callouts such as the example above are obeyed.
<br><a name="SEC4" href="#TOC1">THE CALLOUT INTERFACE</a><br>
<P>
During matching, when PCRE reaches a callout point, the external function
-defined by <i>pcre_callout</i> or <i>pcre[16|32]_callout</i> is called
-(if it is set). This applies to both normal and DFA matching. The only
-argument to the callout function is a pointer to a <b>pcre_callout</b>
-or <b>pcre[16|32]_callout</b> block.
-These structures contains the following fields:
+defined by <i>pcre_callout</i> or <i>pcre[16|32]_callout</i> is called (if it is
+set). This applies to both normal and DFA matching. The only argument to the
+callout function is a pointer to a <b>pcre_callout</b> or
+<b>pcre[16|32]_callout</b> block. These structures contains the following
+fields:
<pre>
int <i>version</i>;
int <i>callout_number</i>;
@@ -242,7 +277,7 @@ Cambridge CB2 3QH, England.
</P>
<br><a name="SEC7" href="#TOC1">REVISION</a><br>
<P>
-Last updated: 03 March 2013
+Last updated: 12 November 2013
<br>
Copyright &copy; 1997-2013 University of Cambridge.
<br>
diff --git a/pcre/doc/html/pcrecompat.html b/pcre/doc/html/pcrecompat.html
index 14e20c5f4b4..3e6226692ee 100644
--- a/pcre/doc/html/pcrecompat.html
+++ b/pcre/doc/html/pcrecompat.html
@@ -138,18 +138,24 @@ an error is given at compile time.
<P>
15. Perl recognizes comments in some places that PCRE does not, for example,
between the ( and ? at the start of a subpattern. If the /x modifier is set,
-Perl allows white space between ( and ? but PCRE never does, even if the
-PCRE_EXTENDED option is set.
+Perl allows white space between ( and ? (though current Perls warn that this is
+deprecated) but PCRE never does, even if the PCRE_EXTENDED option is set.
</P>
<P>
-16. In PCRE, the upper/lower case character properties Lu and Ll are not
+16. Perl, when in warning mode, gives warnings for character classes such as
+[A-\d] or [a-[:digit:]]. It then treats the hyphens as literals. PCRE has no
+warning features, so it gives an error in these cases because they are almost
+certainly user mistakes.
+</P>
+<P>
+17. In PCRE, the upper/lower case character properties Lu and Ll are not
affected when case-independent matching is specified. For example, \p{Lu}
always matches an upper case letter. I think Perl has changed in this respect;
in the release at the time of writing (5.16), \p{Lu} and \p{Ll} match all
letters, regardless of case, when case independence is specified.
</P>
<P>
-17. PCRE provides some extensions to the Perl regular expression facilities.
+18. PCRE provides some extensions to the Perl regular expression facilities.
Perl 5.10 includes new features that are not in earlier versions of Perl, some
of which (such as named parentheses) have been in PCRE for some time. This list
is with respect to Perl 5.10:
@@ -220,7 +226,7 @@ Cambridge CB2 3QH, England.
REVISION
</b><br>
<P>
-Last updated: 19 March 2013
+Last updated: 10 November 2013
<br>
Copyright &copy; 1997-2013 University of Cambridge.
<br>
diff --git a/pcre/doc/html/pcrelimits.html b/pcre/doc/html/pcrelimits.html
index b83a801040a..ee5ebf033d9 100644
--- a/pcre/doc/html/pcrelimits.html
+++ b/pcre/doc/html/pcrelimits.html
@@ -21,9 +21,10 @@ practice be relevant.
</P>
<P>
The maximum length of a compiled pattern is approximately 64K data units (bytes
-for the 8-bit library, 32-bit units for the 32-bit library, and 32-bit units for
-the 32-bit library) if PCRE is compiled with the default internal linkage size
-of 2 bytes. If you want to process regular expressions that are truly enormous,
+for the 8-bit library, 16-bit units for the 16-bit library, and 32-bit units for
+the 32-bit library) if PCRE is compiled with the default internal linkage size,
+which is 2 bytes for the 8-bit and 16-bit libraries, and 4 bytes for the 32-bit
+library. If you want to process regular expressions that are truly enormous,
you can compile PCRE with an internal linkage size of 3 or 4 (when building the
16-bit or 32-bit library, 3 is rounded up to 4). See the <b>README</b> file in
the source distribution and the
@@ -36,7 +37,10 @@ All values in repeating quantifiers must be less than 65536.
</P>
<P>
There is no limit to the number of parenthesized subpatterns, but there can be
-no more than 65535 capturing subpatterns.
+no more than 65535 capturing subpatterns. There is, however, a limit to the
+depth of nesting of parenthesized subpatterns of all kinds. This is imposed in
+order to limit the amount of system stack used at compile time. The limit can
+be specified when PCRE is built; the default is 250.
</P>
<P>
There is a limit to the number of forward references to subsequent subpatterns
@@ -50,7 +54,7 @@ maximum number of named subpatterns is 10000.
</P>
<P>
The maximum length of a name in a (*MARK), (*PRUNE), (*SKIP), or (*THEN) verb
-is 255 for the 8-bit library and 65535 for the 16-bit and 32-bit library.
+is 255 for the 8-bit library and 65535 for the 16-bit and 32-bit libraries.
</P>
<P>
The maximum length of a subject string is the largest positive number that an
@@ -77,9 +81,9 @@ Cambridge CB2 3QH, England.
REVISION
</b><br>
<P>
-Last updated: 04 May 2012
+Last updated: 05 November 2013
<br>
-Copyright &copy; 1997-2012 University of Cambridge.
+Copyright &copy; 1997-2013 University of Cambridge.
<br>
<p>
Return to the <a href="index.html">PCRE index page</a>.
diff --git a/pcre/doc/html/pcrematching.html b/pcre/doc/html/pcrematching.html
index f1854314594..a1af39b68d3 100644
--- a/pcre/doc/html/pcrematching.html
+++ b/pcre/doc/html/pcrematching.html
@@ -126,6 +126,15 @@ character of the subject. The algorithm does not automatically move on to find
matches that start at later positions.
</P>
<P>
+PCRE's "auto-possessification" optimization usually applies to character
+repeats at the end of a pattern (as well as internally). For example, the
+pattern "a\d+" is compiled as if it were "a\d++" because there is no point
+even considering the possibility of backtracking into the repeated digits. For
+DFA matching, this means that only one possible match is found. If you really
+do want multiple matches in such cases, either use an ungreedy repeat
+("a\d+?") or set the PCRE_NO_AUTO_POSSESS option when compiling.
+</P>
+<P>
There are a number of features of PCRE regular expressions that are not
supported by the alternative matching algorithm. They are as follows:
</P>
@@ -224,7 +233,7 @@ Cambridge CB2 3QH, England.
</P>
<br><a name="SEC8" href="#TOC1">REVISION</a><br>
<P>
-Last updated: 08 January 2012
+Last updated: 12 November 2013
<br>
Copyright &copy; 1997-2012 University of Cambridge.
<br>
diff --git a/pcre/doc/html/pcrepartial.html b/pcre/doc/html/pcrepartial.html
index 98d34f0bcc2..4faeafcb688 100644
--- a/pcre/doc/html/pcrepartial.html
+++ b/pcre/doc/html/pcrepartial.html
@@ -306,6 +306,16 @@ not retain the previously partially-matched string. It is up to the calling
program to do that if it needs to.
</P>
<P>
+That means that, for an unanchored pattern, if a continued match fails, it is
+not possible to try again at a new starting point. All this facility is capable
+of doing is continuing with the previous match attempt. In the previous
+example, if the second set of data is "ug23" the result is no match, even
+though there would be a match for "aug23" if the entire string were given at
+once. Depending on the application, this may or may not be what you want.
+The only way to allow for starting again at the next character is to retain the
+matched part of the subject and try a new complete match.
+</P>
+<P>
You can set the PCRE_PARTIAL_SOFT or PCRE_PARTIAL_HARD options with
PCRE_DFA_RESTART to continue partial matching over multiple segments. This
facility can be used to pass very long subject strings to the DFA matching
@@ -490,7 +500,7 @@ Cambridge CB2 3QH, England.
</P>
<br><a name="SEC11" href="#TOC1">REVISION</a><br>
<P>
-Last updated: 20 February 2013
+Last updated: 02 July 2013
<br>
Copyright &copy; 1997-2013 University of Cambridge.
<br>
diff --git a/pcre/doc/html/pcrepattern.html b/pcre/doc/html/pcrepattern.html
index 7e837e5a87e..624cb447238 100644
--- a/pcre/doc/html/pcrepattern.html
+++ b/pcre/doc/html/pcrepattern.html
@@ -23,25 +23,26 @@ man page, in case the conversion went wrong.
<li><a name="TOC8" href="#SEC8">MATCHING A SINGLE DATA UNIT</a>
<li><a name="TOC9" href="#SEC9">SQUARE BRACKETS AND CHARACTER CLASSES</a>
<li><a name="TOC10" href="#SEC10">POSIX CHARACTER CLASSES</a>
-<li><a name="TOC11" href="#SEC11">VERTICAL BAR</a>
-<li><a name="TOC12" href="#SEC12">INTERNAL OPTION SETTING</a>
-<li><a name="TOC13" href="#SEC13">SUBPATTERNS</a>
-<li><a name="TOC14" href="#SEC14">DUPLICATE SUBPATTERN NUMBERS</a>
-<li><a name="TOC15" href="#SEC15">NAMED SUBPATTERNS</a>
-<li><a name="TOC16" href="#SEC16">REPETITION</a>
-<li><a name="TOC17" href="#SEC17">ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS</a>
-<li><a name="TOC18" href="#SEC18">BACK REFERENCES</a>
-<li><a name="TOC19" href="#SEC19">ASSERTIONS</a>
-<li><a name="TOC20" href="#SEC20">CONDITIONAL SUBPATTERNS</a>
-<li><a name="TOC21" href="#SEC21">COMMENTS</a>
-<li><a name="TOC22" href="#SEC22">RECURSIVE PATTERNS</a>
-<li><a name="TOC23" href="#SEC23">SUBPATTERNS AS SUBROUTINES</a>
-<li><a name="TOC24" href="#SEC24">ONIGURUMA SUBROUTINE SYNTAX</a>
-<li><a name="TOC25" href="#SEC25">CALLOUTS</a>
-<li><a name="TOC26" href="#SEC26">BACKTRACKING CONTROL</a>
-<li><a name="TOC27" href="#SEC27">SEE ALSO</a>
-<li><a name="TOC28" href="#SEC28">AUTHOR</a>
-<li><a name="TOC29" href="#SEC29">REVISION</a>
+<li><a name="TOC11" href="#SEC11">COMPATIBILITY FEATURE FOR WORD BOUNDARIES</a>
+<li><a name="TOC12" href="#SEC12">VERTICAL BAR</a>
+<li><a name="TOC13" href="#SEC13">INTERNAL OPTION SETTING</a>
+<li><a name="TOC14" href="#SEC14">SUBPATTERNS</a>
+<li><a name="TOC15" href="#SEC15">DUPLICATE SUBPATTERN NUMBERS</a>
+<li><a name="TOC16" href="#SEC16">NAMED SUBPATTERNS</a>
+<li><a name="TOC17" href="#SEC17">REPETITION</a>
+<li><a name="TOC18" href="#SEC18">ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS</a>
+<li><a name="TOC19" href="#SEC19">BACK REFERENCES</a>
+<li><a name="TOC20" href="#SEC20">ASSERTIONS</a>
+<li><a name="TOC21" href="#SEC21">CONDITIONAL SUBPATTERNS</a>
+<li><a name="TOC22" href="#SEC22">COMMENTS</a>
+<li><a name="TOC23" href="#SEC23">RECURSIVE PATTERNS</a>
+<li><a name="TOC24" href="#SEC24">SUBPATTERNS AS SUBROUTINES</a>
+<li><a name="TOC25" href="#SEC25">ONIGURUMA SUBROUTINE SYNTAX</a>
+<li><a name="TOC26" href="#SEC26">CALLOUTS</a>
+<li><a name="TOC27" href="#SEC27">BACKTRACKING CONTROL</a>
+<li><a name="TOC28" href="#SEC28">SEE ALSO</a>
+<li><a name="TOC29" href="#SEC29">AUTHOR</a>
+<li><a name="TOC30" href="#SEC30">REVISION</a>
</ul>
<br><a name="SEC1" href="#TOC1">PCRE REGULAR EXPRESSION DETAILS</a><br>
<P>
@@ -116,21 +117,33 @@ appearance causes an error.
Unicode property support
</b><br>
<P>
-Another special sequence that may appear at the start of a pattern is
-<pre>
- (*UCP)
-</pre>
+Another special sequence that may appear at the start of a pattern is (*UCP).
This has the same effect as setting the PCRE_UCP option: it causes sequences
such as \d and \w to use Unicode properties to determine character types,
instead of recognizing only characters with codes less than 128 via a lookup
table.
</P>
<br><b>
+Disabling auto-possessification
+</b><br>
+<P>
+If a pattern starts with (*NO_AUTO_POSSESS), it has the same effect as setting
+the PCRE_NO_AUTO_POSSESS option at compile time. This stops PCRE from making
+quantifiers possessive when what follows cannot match the repeated item. For
+example, by default a+b is treated as a++b. For more details, see the
+<a href="pcreapi.html"><b>pcreapi</b></a>
+documentation.
+</P>
+<br><b>
Disabling start-up optimizations
</b><br>
<P>
If a pattern starts with (*NO_START_OPT), it has the same effect as setting the
-PCRE_NO_START_OPTIMIZE option either at compile or matching time.
+PCRE_NO_START_OPTIMIZE option either at compile or matching time. This disables
+several optimizations for quickly reaching "no match" results. For more
+details, see the
+<a href="pcreapi.html"><b>pcreapi</b></a>
+documentation.
<a name="newlines"></a></P>
<br><b>
Newline conventions
@@ -193,10 +206,10 @@ pattern of the form
(*LIMIT_RECURSION=d)
</pre>
where d is any number of decimal digits. However, the value of the setting must
-be less than the value set by the caller of <b>pcre_exec()</b> for it to have
-any effect. In other words, the pattern writer can lower the limit set by the
-programmer, but not raise it. If there is more than one setting of one of these
-limits, the lower value is used.
+be less than the value set (or defaulted) by the caller of <b>pcre_exec()</b>
+for it to have any effect. In other words, the pattern writer can lower the
+limits set by the programmer, but not raise them. If there is more than one
+setting of one of these limits, the lower value is used.
</P>
<br><a name="SEC3" href="#TOC1">EBCDIC CHARACTER CODES</a><br>
<P>
@@ -283,10 +296,11 @@ backslash. All other characters (in particular, those whose codepoints are
greater than 127) are treated as literals.
</P>
<P>
-If a pattern is compiled with the PCRE_EXTENDED option, white space in the
-pattern (other than in a character class) and characters between a # outside
-a character class and the next newline are ignored. An escaping backslash can
-be used to include a white space or # character as part of the pattern.
+If a pattern is compiled with the PCRE_EXTENDED option, most white space in the
+pattern (other than in a character class), and characters between a # outside a
+character class and the next newline, inclusive, are ignored. An escaping
+backslash can be used to include a white space or # character as part of the
+pattern.
</P>
<P>
If you want to remove the special meaning from a sequence of characters, you
@@ -324,7 +338,9 @@ one of the following escape sequences than the binary character it represents:
\n linefeed (hex 0A)
\r carriage return (hex 0D)
\t tab (hex 09)
+ \0dd character with octal code 0dd
\ddd character with octal code ddd, or back reference
+ \o{ddd..} character with octal code ddd..
\xhh character with hex code hh
\x{hhh..} character with hex code hhh.. (non-JavaScript mode)
\uhhhh character with hex code hhhh (JavaScript mode only)
@@ -347,42 +363,6 @@ the EBCDIC letters are disjoint, \cZ becomes hex 29 (Z is E9), and other
characters also generate different values.
</P>
<P>
-By default, after \x, from zero to two hexadecimal digits are read (letters
-can be in upper or lower case). Any number of hexadecimal digits may appear
-between \x{ and }, but the character code is constrained as follows:
-<pre>
- 8-bit non-UTF mode less than 0x100
- 8-bit UTF-8 mode less than 0x10ffff and a valid codepoint
- 16-bit non-UTF mode less than 0x10000
- 16-bit UTF-16 mode less than 0x10ffff and a valid codepoint
- 32-bit non-UTF mode less than 0x80000000
- 32-bit UTF-32 mode less than 0x10ffff and a valid codepoint
-</pre>
-Invalid Unicode codepoints are the range 0xd800 to 0xdfff (the so-called
-"surrogate" codepoints), and 0xffef.
-</P>
-<P>
-If characters other than hexadecimal digits appear between \x{ and }, or if
-there is no terminating }, this form of escape is not recognized. Instead, the
-initial \x will be interpreted as a basic hexadecimal escape, with no
-following digits, giving a character whose value is zero.
-</P>
-<P>
-If the PCRE_JAVASCRIPT_COMPAT option is set, the interpretation of \x is
-as just described only when it is followed by two hexadecimal digits.
-Otherwise, it matches a literal "x" character. In JavaScript mode, support for
-code points greater than 256 is provided by \u, which must be followed by
-four hexadecimal digits; otherwise it matches a literal "u" character.
-Character codes specified by \u in JavaScript mode are constrained in the same
-was as those specified by \x in non-JavaScript mode.
-</P>
-<P>
-Characters whose value is less than 256 can be defined by either of the two
-syntaxes for \x (or by \u in JavaScript mode). There is no difference in the
-way they are handled. For example, \xdc is exactly the same as \x{dc} (or
-\u00dc in JavaScript mode).
-</P>
-<P>
After \0 up to two further octal digits are read. If there are fewer than two
digits, just those that are present are used. Thus the sequence \0\x\07
specifies two binary zeros followed by a BEL character (code value 7). Make
@@ -390,9 +370,23 @@ sure you supply two digits after the initial zero if the pattern character that
follows is itself an octal digit.
</P>
<P>
-The handling of a backslash followed by a digit other than 0 is complicated.
-Outside a character class, PCRE reads it and any following digits as a decimal
-number. If the number is less than 10, or if there have been at least that many
+The escape \o must be followed by a sequence of octal digits, enclosed in
+braces. An error occurs if this is not the case. This escape is a recent
+addition to Perl; it provides way of specifying character code points as octal
+numbers greater than 0777, and it also allows octal numbers and back references
+to be unambiguously specified.
+</P>
+<P>
+For greater clarity and unambiguity, it is best to avoid following \ by a
+digit greater than zero. Instead, use \o{} or \x{} to specify character
+numbers, and \g{} to specify back references. The following paragraphs
+describe the old, ambiguous syntax.
+</P>
+<P>
+The handling of a backslash followed by a digit other than 0 is complicated,
+and Perl has changed in recent releases, causing PCRE also to change. Outside a
+character class, PCRE reads the digit and any following digits as a decimal
+number. If the number is less than 8, or if there have been at least that many
previous capturing left parentheses in the expression, the entire sequence is
taken as a <i>back reference</i>. A description of how this works is given
<a href="#backreferences">later,</a>
@@ -400,12 +394,11 @@ following the discussion of
<a href="#subpattern">parenthesized subpatterns.</a>
</P>
<P>
-Inside a character class, or if the decimal number is greater than 9 and there
-have not been that many capturing subpatterns, PCRE re-reads up to three octal
-digits following the backslash, and uses them to generate a data character. Any
-subsequent digits stand for themselves. The value of the character is
-constrained in the same way as characters specified in hexadecimal.
-For example:
+Inside a character class, or if the decimal number following \ is greater than
+7 and there have not been that many capturing subpatterns, PCRE handles \8 and
+\9 as the literal characters "8" and "9", and otherwise re-reads up to three
+octal digits following the backslash, using them to generate a data character.
+Any subsequent digits stand for themselves. For example:
<pre>
\040 is another way of writing an ASCII space
\40 is the same, provided there are fewer than 40 previous capturing subpatterns
@@ -415,11 +408,52 @@ For example:
\0113 is a tab followed by the character "3"
\113 might be a back reference, otherwise the character with octal code 113
\377 might be a back reference, otherwise the value 255 (decimal)
- \81 is either a back reference, or a binary zero followed by the two characters "8" and "1"
+ \81 is either a back reference, or the two characters "8" and "1"
+</pre>
+Note that octal values of 100 or greater that are specified using this syntax
+must not be introduced by a leading zero, because no more than three octal
+digits are ever read.
+</P>
+<P>
+By default, after \x that is not followed by {, from zero to two hexadecimal
+digits are read (letters can be in upper or lower case). Any number of
+hexadecimal digits may appear between \x{ and }. If a character other than
+a hexadecimal digit appears between \x{ and }, or if there is no terminating
+}, an error occurs.
+</P>
+<P>
+If the PCRE_JAVASCRIPT_COMPAT option is set, the interpretation of \x is
+as just described only when it is followed by two hexadecimal digits.
+Otherwise, it matches a literal "x" character. In JavaScript mode, support for
+code points greater than 256 is provided by \u, which must be followed by
+four hexadecimal digits; otherwise it matches a literal "u" character.
+</P>
+<P>
+Characters whose value is less than 256 can be defined by either of the two
+syntaxes for \x (or by \u in JavaScript mode). There is no difference in the
+way they are handled. For example, \xdc is exactly the same as \x{dc} (or
+\u00dc in JavaScript mode).
+</P>
+<br><b>
+Constraints on character values
+</b><br>
+<P>
+Characters that are specified using octal or hexadecimal numbers are
+limited to certain values, as follows:
+<pre>
+ 8-bit non-UTF mode less than 0x100
+ 8-bit UTF-8 mode less than 0x10ffff and a valid codepoint
+ 16-bit non-UTF mode less than 0x10000
+ 16-bit UTF-16 mode less than 0x10ffff and a valid codepoint
+ 32-bit non-UTF mode less than 0x100000000
+ 32-bit UTF-32 mode less than 0x10ffff and a valid codepoint
</pre>
-Note that octal values of 100 or greater must not be introduced by a leading
-zero, because no more than three octal digits are ever read.
+Invalid Unicode codepoints are the range 0xd800 to 0xdfff (the so-called
+"surrogate" codepoints), and 0xffef.
</P>
+<br><b>
+Escape sequences in character classes
+</b><br>
<P>
All the sequences that define a single character value can be used both inside
and outside character classes. In addition, inside a character class, \b is
@@ -498,11 +532,14 @@ matching point is at the end of the subject string, all of them fail, because
there is no character to match.
</P>
<P>
-For compatibility with Perl, \s does not match the VT character (code 11).
-This makes it different from the the POSIX "space" class. The \s characters
-are HT (9), LF (10), FF (12), CR (13), and space (32). If "use locale;" is
-included in a Perl script, \s may match the VT character. In PCRE, it never
-does.
+For compatibility with Perl, \s did not used to match the VT character (code
+11), which made it different from the the POSIX "space" class. However, Perl
+added VT at release 5.18, and PCRE followed suit at release 8.34. The default
+\s characters are now HT (9), LF (10), VT (11), FF (12), CR (13), and space
+(32), which are defined as white space in the "C" locale. This list may vary if
+locale-specific matching is taking place. For example, in some locales the
+"non-breaking space" character (\xA0) is recognized as white space, and in
+others the VT character is not.
</P>
<P>
A "word" character is an underscore or any character that is a letter or digit.
@@ -513,21 +550,23 @@ place (see
in the
<a href="pcreapi.html"><b>pcreapi</b></a>
page). For example, in a French locale such as "fr_FR" in Unix-like systems,
-or "french" in Windows, some character codes greater than 128 are used for
+or "french" in Windows, some character codes greater than 127 are used for
accented letters, and these are then matched by \w. The use of locales with
Unicode is discouraged.
</P>
<P>
-By default, in a UTF mode, characters with values greater than 128 never match
-\d, \s, or \w, and always match \D, \S, and \W. These sequences retain
-their original meanings from before UTF support was available, mainly for
-efficiency reasons. However, if PCRE is compiled with Unicode property support,
-and the PCRE_UCP option is set, the behaviour is changed so that Unicode
-properties are used to determine character types, as follows:
+By default, characters whose code points are greater than 127 never match \d,
+\s, or \w, and always match \D, \S, and \W, although this may vary for
+characters in the range 128-255 when locale-specific matching is happening.
+These escape sequences retain their original meanings from before Unicode
+support was available, mainly for efficiency reasons. If PCRE is compiled with
+Unicode property support, and the PCRE_UCP option is set, the behaviour is
+changed so that Unicode properties are used to determine character types, as
+follows:
<pre>
- \d any character that \p{Nd} matches (decimal digit)
- \s any character that \p{Z} matches, plus HT, LF, FF, CR
- \w any character that \p{L} or \p{N} matches, plus underscore
+ \d any character that matches \p{Nd} (decimal digit)
+ \s any character that matches \p{Z} or \h or \v
+ \w any character that matches \p{L} or \p{N}, plus underscore
</pre>
The upper case escapes match the inverse sets of characters. Note that \d
matches only decimal digits, whereas \w matches any Unicode digit, as well as
@@ -538,7 +577,7 @@ is noticeably slower when PCRE_UCP is set.
<P>
The sequences \h, \H, \v, and \V are features that were added to Perl at
release 5.10. In contrast to the other sequences, which match only ASCII
-characters by default, these always match certain high-valued codepoints,
+characters by default, these always match certain high-valued code points,
whether or not PCRE_UCP is set. The horizontal space characters are:
<pre>
U+0009 Horizontal tab (HT)
@@ -913,9 +952,9 @@ PCRE's additional properties
<P>
As well as the standard Unicode properties described above, PCRE supports four
more that make it possible to convert traditional escape sequences such as \w
-and \s and POSIX character classes to use Unicode properties. PCRE uses these
-non-standard, non-Perl properties internally when PCRE_UCP is set. However,
-they may also be used explicitly. These properties are:
+and \s to use Unicode properties. PCRE uses these non-standard, non-Perl
+properties internally when PCRE_UCP is set. However, they may also be used
+explicitly. These properties are:
<pre>
Xan Any alphanumeric character
Xps Any POSIX space character
@@ -925,8 +964,9 @@ they may also be used explicitly. These properties are:
Xan matches characters that have either the L (letter) or the N (number)
property. Xps matches the characters tab, linefeed, vertical tab, form feed, or
carriage return, and any other character that has the Z (separator) property.
-Xsp is the same as Xps, except that vertical tab is excluded. Xwd matches the
-same characters as Xan, plus underscore.
+Xsp is the same as Xps; it used to exclude vertical tab, for Perl
+compatibility, but Perl changed, and so PCRE followed at release 8.34. Xwd
+matches the same characters as Xan, plus underscore.
</P>
<P>
There is another non-standard property, Xuc, which matches any character that
@@ -1218,7 +1258,9 @@ The minus (hyphen) character can be used to specify a range of characters in a
character class. For example, [d-m] matches any letter between d and m,
inclusive. If a minus character is required in a class, it must be escaped with
a backslash or appear in a position where it cannot be interpreted as
-indicating a range, typically as the first or last character in the class.
+indicating a range, typically as the first or last character in the class, or
+immediately after a range. For example, [b-d-z] matches letters in the range b
+to d, a hyphen character, or z.
</P>
<P>
It is not possible to have the literal character "]" as the end character of a
@@ -1230,6 +1272,12 @@ followed by two other characters. The octal or hexadecimal representation of
"]" can also be used to end a range.
</P>
<P>
+An error is generated if a POSIX character class (see below) or an escape
+sequence other than one that defines a single character appears at a point
+where a range ending character is expected. For example, [z-\xff] is valid,
+but [A-\d] and [A-[:digit:]] are not.
+</P>
+<P>
Ranges operate in the collating sequence of character values. They can also be
used for characters specified numerically, for example [\000-\037]. Ranges
can include any characters that are valid for the current mode.
@@ -1269,9 +1317,9 @@ something AND NOT ...".
The only metacharacters that are recognized in character classes are backslash,
hyphen (only where it can be interpreted as specifying a range), circumflex
(only at the start), opening square bracket (only when it can be interpreted as
-introducing a POSIX class name - see the next section), and the terminating
-closing square bracket. However, escaping other non-alphanumeric characters
-does no harm.
+introducing a POSIX class name, or for a special compatibility feature - see
+the next two sections), and the terminating closing square bracket. However,
+escaping other non-alphanumeric characters does no harm.
</P>
<br><a name="SEC10" href="#TOC1">POSIX CHARACTER CLASSES</a><br>
<P>
@@ -1294,15 +1342,17 @@ are:
lower lower case letters
print printing characters, including space
punct printing characters, excluding letters and digits and space
- space white space (not quite the same as \s)
+ space white space (the same as \s from PCRE 8.34)
upper upper case letters
word "word" characters (same as \w)
xdigit hexadecimal digits
</pre>
-The "space" characters are HT (9), LF (10), VT (11), FF (12), CR (13), and
-space (32). Notice that this list includes the VT character (code 11). This
-makes "space" different to \s, which does not include VT (for Perl
-compatibility).
+The default "space" characters are HT (9), LF (10), VT (11), FF (12), CR (13),
+and space (32). If locale-specific matching is taking place, the list of space
+characters may be different; there may be fewer or more of them. "Space" used
+to be different to \s, which did not include VT, for Perl compatibility.
+However, Perl changed at release 5.18, and PCRE followed at release 8.34.
+"Space" and \s now match the same set of characters.
</P>
<P>
The name "word" is a Perl extension, and "blank" is a GNU extension from Perl
@@ -1316,11 +1366,11 @@ syntax [.ch.] and [=ch=] where "ch" is a "collating element", but these are not
supported, and an error is given if they are encountered.
</P>
<P>
-By default, in UTF modes, characters with values greater than 128 do not match
-any of the POSIX character classes. However, if the PCRE_UCP option is passed
-to <b>pcre_compile()</b>, some of the classes are changed so that Unicode
-character properties are used. This is achieved by replacing the POSIX classes
-by other sequences, as follows:
+By default, characters with values greater than 128 do not match any of the
+POSIX character classes. However, if the PCRE_UCP option is passed to
+<b>pcre_compile()</b>, some of the classes are changed so that Unicode character
+properties are used. This is achieved by replacing certain POSIX classes by
+other sequences, as follows:
<pre>
[:alnum:] becomes \p{Xan}
[:alpha:] becomes \p{L}
@@ -1331,11 +1381,56 @@ by other sequences, as follows:
[:upper:] becomes \p{Lu}
[:word:] becomes \p{Xwd}
</pre>
-Negated versions, such as [:^alpha:] use \P instead of \p. The other POSIX
-classes are unchanged, and match only characters with code points less than
-128.
+Negated versions, such as [:^alpha:] use \P instead of \p. Three other POSIX
+classes are handled specially in UCP mode:
</P>
-<br><a name="SEC11" href="#TOC1">VERTICAL BAR</a><br>
+<P>
+[:graph:]
+This matches characters that have glyphs that mark the page when printed. In
+Unicode property terms, it matches all characters with the L, M, N, P, S, or Cf
+properties, except for:
+<pre>
+ U+061C Arabic Letter Mark
+ U+180E Mongolian Vowel Separator
+ U+2066 - U+2069 Various "isolate"s
+
+</PRE>
+</P>
+<P>
+[:print:]
+This matches the same characters as [:graph:] plus space characters that are
+not controls, that is, characters with the Zs property.
+</P>
+<P>
+[:punct:]
+This matches all characters that have the Unicode P (punctuation) property,
+plus those characters whose code points are less than 128 that have the S
+(Symbol) property.
+</P>
+<P>
+The other POSIX classes are unchanged, and match only characters with code
+points less than 128.
+</P>
+<br><a name="SEC11" href="#TOC1">COMPATIBILITY FEATURE FOR WORD BOUNDARIES</a><br>
+<P>
+In the POSIX.2 compliant library that was included in 4.4BSD Unix, the ugly
+syntax [[:&#60;:]] and [[:&#62;:]] is used for matching "start of word" and "end of
+word". PCRE treats these items as follows:
+<pre>
+ [[:&#60;:]] is converted to \b(?=\w)
+ [[:&#62;:]] is converted to \b(?&#60;=\w)
+</pre>
+Only these exact character sequences are recognized. A sequence such as
+[a[:&#60;:]b] provokes error for an unrecognized POSIX class name. This support is
+not compatible with Perl. It is provided to help migrations from other
+environments, and is best not used in any new patterns. Note that \b matches
+at the start and the end of a word (see
+<a href="#smallassertions">"Simple assertions"</a>
+above), and in a Perl-style pattern the preceding or following character
+normally shows which is wanted, without the need for the assertions that are
+used above in order to give exactly the POSIX behaviour.
+</P>
+<br><a name="SEC12" href="#TOC1">VERTICAL BAR</a><br>
<P>
Vertical bar characters are used to separate alternative patterns. For example,
the pattern
@@ -1350,7 +1445,7 @@ that succeeds is used. If the alternatives are within a subpattern
"succeeds" means matching the rest of the main pattern as well as the
alternative in the subpattern.
</P>
-<br><a name="SEC12" href="#TOC1">INTERNAL OPTION SETTING</a><br>
+<br><a name="SEC13" href="#TOC1">INTERNAL OPTION SETTING</a><br>
<P>
The settings of the PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and
PCRE_EXTENDED options (which are Perl-compatible) can be changed from within
@@ -1413,7 +1508,7 @@ options, respectively. The (*UTF) sequence is a generic version that can be
used with any of the libraries. However, the application can set the
PCRE_NEVER_UTF option, which locks out the use of the (*UTF) sequences.
<a name="subpattern"></a></P>
-<br><a name="SEC13" href="#TOC1">SUBPATTERNS</a><br>
+<br><a name="SEC14" href="#TOC1">SUBPATTERNS</a><br>
<P>
Subpatterns are delimited by parentheses (round brackets), which can be nested.
Turning part of a pattern into a subpattern does two things:
@@ -1469,7 +1564,7 @@ from left to right, and options are not reset until the end of the subpattern
is reached, an option setting in one branch does affect subsequent branches, so
the above patterns match "SUNDAY" as well as "Saturday".
<a name="dupsubpatternnumber"></a></P>
-<br><a name="SEC14" href="#TOC1">DUPLICATE SUBPATTERN NUMBERS</a><br>
+<br><a name="SEC15" href="#TOC1">DUPLICATE SUBPATTERN NUMBERS</a><br>
<P>
Perl 5.10 introduced a feature whereby each alternative in a subpattern uses
the same numbers for its capturing parentheses. Such a subpattern starts with
@@ -1513,7 +1608,7 @@ true if any of the subpatterns of that number have matched.
An alternative approach to using this "branch reset" feature is to use
duplicate named subpatterns, as described in the next section.
</P>
-<br><a name="SEC15" href="#TOC1">NAMED SUBPATTERNS</a><br>
+<br><a name="SEC16" href="#TOC1">NAMED SUBPATTERNS</a><br>
<P>
Identifying capturing parentheses by number is simple, but it can be very hard
to keep track of the numbers in complicated regular expressions. Furthermore,
@@ -1535,11 +1630,12 @@ and
can be made by name as well as by number.
</P>
<P>
-Names consist of up to 32 alphanumeric characters and underscores. Named
-capturing parentheses are still allocated numbers as well as names, exactly as
-if the names were not present. The PCRE API provides function calls for
-extracting the name-to-number translation table from a compiled pattern. There
-is also a convenience function for extracting a captured substring by name.
+Names consist of up to 32 alphanumeric characters and underscores, but must
+start with a non-digit. Named capturing parentheses are still allocated numbers
+as well as names, exactly as if the names were not present. The PCRE API
+provides function calls for extracting the name-to-number translation table
+from a compiled pattern. There is also a convenience function for extracting a
+captured substring by name.
</P>
<P>
By default, a name must be unique within a pattern, but it is possible to relax
@@ -1568,9 +1664,23 @@ matched. This saves searching to find which numbered subpattern it was.
</P>
<P>
If you make a back reference to a non-unique named subpattern from elsewhere in
-the pattern, the one that corresponds to the first occurrence of the name is
-used. In the absence of duplicate numbers (see the previous section) this is
-the one with the lowest number. If you use a named reference in a condition
+the pattern, the subpatterns to which the name refers are checked in the order
+in which they appear in the overall pattern. The first one that is set is used
+for the reference. For example, this pattern matches both "foofoo" and
+"barbar" but not "foobar" or "barfoo":
+<pre>
+ (?:(?&#60;n&#62;foo)|(?&#60;n&#62;bar))\k&#60;n&#62;
+
+</PRE>
+</P>
+<P>
+If you make a subroutine call to a non-unique named subpattern, the one that
+corresponds to the first occurrence of the name is used. In the absence of
+duplicate numbers (see the previous section) this is the one with the lowest
+number.
+</P>
+<P>
+If you use a named reference in a condition
test (see the
<a href="#conditions">section about conditions</a>
below), either to check whether a subpattern has matched, or to check for
@@ -1585,10 +1695,11 @@ documentation.
<b>Warning:</b> You cannot use different names to distinguish between two
subpatterns with the same number because PCRE uses only the numbers when
matching. For this reason, an error is given at compile time if different names
-are given to subpatterns with the same number. However, you can give the same
-name to subpatterns with the same number, even when PCRE_DUPNAMES is not set.
+are given to subpatterns with the same number. However, you can always give the
+same name to subpatterns with the same number, even when PCRE_DUPNAMES is not
+set.
</P>
-<br><a name="SEC16" href="#TOC1">REPETITION</a><br>
+<br><a name="SEC17" href="#TOC1">REPETITION</a><br>
<P>
Repetition is specified by quantifiers, which can follow any of the following
items:
@@ -1756,7 +1867,7 @@ example, after
</pre>
matches "aba" the value of the second captured substring is "b".
<a name="atomicgroup"></a></P>
-<br><a name="SEC17" href="#TOC1">ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS</a><br>
+<br><a name="SEC18" href="#TOC1">ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS</a><br>
<P>
With both maximizing ("greedy") and minimizing ("ungreedy" or "lazy")
repetition, failure of what follows normally causes the repeated item to be
@@ -1860,7 +1971,7 @@ an atomic group, like this:
</pre>
sequences of non-digits cannot be broken, and failure happens quickly.
<a name="backreferences"></a></P>
-<br><a name="SEC18" href="#TOC1">BACK REFERENCES</a><br>
+<br><a name="SEC19" href="#TOC1">BACK REFERENCES</a><br>
<P>
Outside a character class, a backslash followed by a digit greater than 0 (and
possibly further digits) is a back reference to a capturing subpattern earlier
@@ -1988,7 +2099,7 @@ as an
Once the whole group has been matched, a subsequent matching failure cannot
cause backtracking into the middle of the group.
<a name="bigassertions"></a></P>
-<br><a name="SEC19" href="#TOC1">ASSERTIONS</a><br>
+<br><a name="SEC20" href="#TOC1">ASSERTIONS</a><br>
<P>
An assertion is a test on the characters following or preceding the current
matching point that does not actually consume any characters. The simple
@@ -2178,7 +2289,7 @@ preceded by "foo", while
is another pattern that matches "foo" preceded by three digits and any three
characters that are not "999".
<a name="conditions"></a></P>
-<br><a name="SEC20" href="#TOC1">CONDITIONAL SUBPATTERNS</a><br>
+<br><a name="SEC21" href="#TOC1">CONDITIONAL SUBPATTERNS</a><br>
<P>
It is possible to cause the matching process to obey a subpattern
conditionally or to choose between two alternative subpatterns, depending on
@@ -2252,12 +2363,7 @@ Checking for a used subpattern by name
<P>
Perl uses the syntax (?(&#60;name&#62;)...) or (?('name')...) to test for a used
subpattern by name. For compatibility with earlier versions of PCRE, which had
-this facility before Perl, the syntax (?(name)...) is also recognized. However,
-there is a possible ambiguity with this syntax, because subpattern names may
-consist entirely of digits. PCRE looks first for a named subpattern; if it
-cannot find one and the name consists entirely of digits, PCRE looks for a
-subpattern of that number, which must be greater than zero. Using subpattern
-names that consist entirely of digits is not recommended.
+this facility before Perl, the syntax (?(name)...) is also recognized.
</P>
<P>
Rewriting the above example to use a named subpattern gives this:
@@ -2333,7 +2439,7 @@ subject is matched against the first alternative; otherwise it is matched
against the second. This pattern matches strings in one of the two forms
dd-aaa-dd or dd-dd-dd, where aaa are letters and dd are digits.
<a name="comments"></a></P>
-<br><a name="SEC21" href="#TOC1">COMMENTS</a><br>
+<br><a name="SEC22" href="#TOC1">COMMENTS</a><br>
<P>
There are two ways of including comments in patterns that are processed by
PCRE. In both cases, the start of the comment must not be in a character class,
@@ -2362,7 +2468,7 @@ a newline in the pattern. The sequence \n is still literal at this stage, so
it does not terminate the comment. Only an actual character with the code value
0x0a (the default newline) does so.
<a name="recursion"></a></P>
-<br><a name="SEC22" href="#TOC1">RECURSIVE PATTERNS</a><br>
+<br><a name="SEC23" href="#TOC1">RECURSIVE PATTERNS</a><br>
<P>
Consider the problem of matching a string in parentheses, allowing for
unlimited nested parentheses. Without the use of recursion, the best that can
@@ -2577,7 +2683,7 @@ now match "b" and so the whole match succeeds. In Perl, the pattern fails to
match because inside the recursive call \1 cannot access the externally set
value.
<a name="subpatternsassubroutines"></a></P>
-<br><a name="SEC23" href="#TOC1">SUBPATTERNS AS SUBROUTINES</a><br>
+<br><a name="SEC24" href="#TOC1">SUBPATTERNS AS SUBROUTINES</a><br>
<P>
If the syntax for a recursive subpattern call (either by number or by
name) is used outside the parentheses to which it refers, it operates like a
@@ -2618,7 +2724,7 @@ different calls. For example, consider this pattern:
It matches "abcabc". It does not match "abcABC" because the change of
processing option does not affect the called subpattern.
<a name="onigurumasubroutines"></a></P>
-<br><a name="SEC24" href="#TOC1">ONIGURUMA SUBROUTINE SYNTAX</a><br>
+<br><a name="SEC25" href="#TOC1">ONIGURUMA SUBROUTINE SYNTAX</a><br>
<P>
For compatibility with Oniguruma, the non-Perl syntax \g followed by a name or
a number enclosed either in angle brackets or single quotes, is an alternative
@@ -2636,7 +2742,7 @@ plus or a minus sign it is taken as a relative reference. For example:
Note that \g{...} (Perl syntax) and \g&#60;...&#62; (Oniguruma syntax) are <i>not</i>
synonymous. The former is a back reference; the latter is a subroutine call.
</P>
-<br><a name="SEC25" href="#TOC1">CALLOUTS</a><br>
+<br><a name="SEC26" href="#TOC1">CALLOUTS</a><br>
<P>
Perl has a feature whereby using the sequence (?{...}) causes arbitrary Perl
code to be obeyed in the middle of matching a regular expression. This makes it
@@ -2674,12 +2780,18 @@ During matching, when PCRE reaches a callout point, the external function is
called. It is provided with the number of the callout, the position in the
pattern, and, optionally, one item of data originally supplied by the caller of
the matching function. The callout function may cause matching to proceed, to
-backtrack, or to fail altogether. A complete description of the interface to
-the callout function is given in the
+backtrack, or to fail altogether.
+</P>
+<P>
+By default, PCRE implements a number of optimizations at compile time and
+matching time, and one side-effect is that sometimes callouts are skipped. If
+you need all possible callouts to happen, you need to set options that disable
+the relevant optimizations. More details, and a complete description of the
+interface to the callout function, are given in the
<a href="pcrecallout.html"><b>pcrecallout</b></a>
documentation.
<a name="backtrackcontrol"></a></P>
-<br><a name="SEC26" href="#TOC1">BACKTRACKING CONTROL</a><br>
+<br><a name="SEC27" href="#TOC1">BACKTRACKING CONTROL</a><br>
<P>
Perl 5.10 introduced a number of "Special Backtracking Control Verbs", which
are still described in the Perl documentation as "experimental and subject to
@@ -3026,7 +3138,7 @@ example:
<pre>
...(*COMMIT)(*PRUNE)...
</pre>
-If there is a matching failure to the right, backtracking onto (*PRUNE) cases
+If there is a matching failure to the right, backtracking onto (*PRUNE) causes
it to be triggered, and its action is taken. There can never be a backtrack
onto (*COMMIT).
<a name="btrepeat"></a></P>
@@ -3093,12 +3205,12 @@ the subroutine match to fail.
the subpattern that has alternatives. If there is no such group within the
subpattern, (*THEN) causes the subroutine match to fail.
</P>
-<br><a name="SEC27" href="#TOC1">SEE ALSO</a><br>
+<br><a name="SEC28" href="#TOC1">SEE ALSO</a><br>
<P>
<b>pcreapi</b>(3), <b>pcrecallout</b>(3), <b>pcrematching</b>(3),
<b>pcresyntax</b>(3), <b>pcre</b>(3), <b>pcre16(3)</b>, <b>pcre32(3)</b>.
</P>
-<br><a name="SEC28" href="#TOC1">AUTHOR</a><br>
+<br><a name="SEC29" href="#TOC1">AUTHOR</a><br>
<P>
Philip Hazel
<br>
@@ -3107,9 +3219,9 @@ University Computing Service
Cambridge CB2 3QH, England.
<br>
</P>
-<br><a name="SEC29" href="#TOC1">REVISION</a><br>
+<br><a name="SEC30" href="#TOC1">REVISION</a><br>
<P>
-Last updated: 26 April 2013
+Last updated: 03 December 2013
<br>
Copyright &copy; 1997-2013 University of Cambridge.
<br>
diff --git a/pcre/doc/html/pcreposix.html b/pcre/doc/html/pcreposix.html
index 0e5b296a086..18924cf7f94 100644
--- a/pcre/doc/html/pcreposix.html
+++ b/pcre/doc/html/pcreposix.html
@@ -13,7 +13,7 @@ from the original man page. If there is any nonsense in it, please consult the
man page, in case the conversion went wrong.
<br>
<ul>
-<li><a name="TOC1" href="#SEC1">SYNOPSIS OF POSIX API</a>
+<li><a name="TOC1" href="#SEC1">SYNOPSIS</a>
<li><a name="TOC2" href="#SEC2">DESCRIPTION</a>
<li><a name="TOC3" href="#SEC3">COMPILING A PATTERN</a>
<li><a name="TOC4" href="#SEC4">MATCHING NEWLINE CHARACTERS</a>
@@ -23,23 +23,21 @@ man page, in case the conversion went wrong.
<li><a name="TOC8" href="#SEC8">AUTHOR</a>
<li><a name="TOC9" href="#SEC9">REVISION</a>
</ul>
-<br><a name="SEC1" href="#TOC1">SYNOPSIS OF POSIX API</a><br>
+<br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br>
<P>
<b>#include &#60;pcreposix.h&#62;</b>
</P>
<P>
<b>int regcomp(regex_t *<i>preg</i>, const char *<i>pattern</i>,</b>
-<b>int <i>cflags</i>);</b>
-</P>
-<P>
+<b> int <i>cflags</i>);</b>
+<br>
+<br>
<b>int regexec(regex_t *<i>preg</i>, const char *<i>string</i>,</b>
-<b>size_t <i>nmatch</i>, regmatch_t <i>pmatch</i>[], int <i>eflags</i>);</b>
-</P>
-<P>
-<b>size_t regerror(int <i>errcode</i>, const regex_t *<i>preg</i>,</b>
-<b>char *<i>errbuf</i>, size_t <i>errbuf_size</i>);</b>
-</P>
-<P>
+<b> size_t <i>nmatch</i>, regmatch_t <i>pmatch</i>[], int <i>eflags</i>);</b>
+<b> size_t regerror(int <i>errcode</i>, const regex_t *<i>preg</i>,</b>
+<b> char *<i>errbuf</i>, size_t <i>errbuf_size</i>);</b>
+<br>
+<br>
<b>void regfree(regex_t *<i>preg</i>);</b>
</P>
<br><a name="SEC2" href="#TOC1">DESCRIPTION</a><br>
diff --git a/pcre/doc/html/pcreprecompile.html b/pcre/doc/html/pcreprecompile.html
index beb9e242451..decb1d6ce05 100644
--- a/pcre/doc/html/pcreprecompile.html
+++ b/pcre/doc/html/pcreprecompile.html
@@ -102,8 +102,8 @@ study data.
<br><a name="SEC3" href="#TOC1">RE-USING A PRECOMPILED PATTERN</a><br>
<P>
Re-using a precompiled pattern is straightforward. Having reloaded it into main
-memory, called <b>pcre[16|32]_pattern_to_host_byte_order()</b> if necessary,
-you pass its pointer to <b>pcre[16|32]_exec()</b> or <b>pcre[16|32]_dfa_exec()</b> in
+memory, called <b>pcre[16|32]_pattern_to_host_byte_order()</b> if necessary, you
+pass its pointer to <b>pcre[16|32]_exec()</b> or <b>pcre[16|32]_dfa_exec()</b> in
the usual way.
</P>
<P>
@@ -119,6 +119,11 @@ in the
documentation.
</P>
<P>
+<b>Warning:</b> The tables that <b>pcre_exec()</b> and <b>pcre_dfa_exec()</b> use
+must be the same as those that were used when the pattern was compiled. If this
+is not the case, the behaviour is undefined.
+</P>
+<P>
If you did not provide custom character tables when the pattern was compiled,
the pointer in the compiled pattern is NULL, which causes the matching
functions to use PCRE's internal tables. Thus, you do not need to take any
@@ -126,9 +131,9 @@ special action at run time in this case.
</P>
<P>
If you saved study data with the compiled pattern, you need to create your own
-<b>pcre[16|32]_extra</b> data block and set the <i>study_data</i> field to point to the
-reloaded study data. You must also set the PCRE_EXTRA_STUDY_DATA bit in the
-<i>flags</i> field to indicate that study data is present. Then pass the
+<b>pcre[16|32]_extra</b> data block and set the <i>study_data</i> field to point
+to the reloaded study data. You must also set the PCRE_EXTRA_STUDY_DATA bit in
+the <i>flags</i> field to indicate that study data is present. Then pass the
<b>pcre[16|32]_extra</b> block to the matching function in the usual way. If the
pattern was studied for just-in-time optimization, that data cannot be saved,
and so is lost by a save/restore cycle.
@@ -149,9 +154,9 @@ Cambridge CB2 3QH, England.
</P>
<br><a name="SEC6" href="#TOC1">REVISION</a><br>
<P>
-Last updated: 24 June 2012
+Last updated: 12 November 2013
<br>
-Copyright &copy; 1997-2012 University of Cambridge.
+Copyright &copy; 1997-2013 University of Cambridge.
<br>
<p>
Return to the <a href="index.html">PCRE index page</a>.
diff --git a/pcre/doc/html/pcresyntax.html b/pcre/doc/html/pcresyntax.html
index b32e8b1689f..0764a33a376 100644
--- a/pcre/doc/html/pcresyntax.html
+++ b/pcre/doc/html/pcresyntax.html
@@ -65,10 +65,14 @@ documentation. This document contains a quick-reference summary of the syntax.
\n newline (hex 0A)
\r carriage return (hex 0D)
\t tab (hex 09)
+ \0dd character with octal code 0dd
\ddd character with octal code ddd, or backreference
+ \o{ddd..} character with octal code ddd..
\xhh character with hex code hh
\x{hhh..} character with hex code hhh..
-</PRE>
+</pre>
+Note that \0dd is always an octal code, and that \8 and \9 are the literal
+characters "8" and "9".
</P>
<br><a name="SEC4" href="#TOC1">CHARACTER TYPES</a><br>
<P>
@@ -92,9 +96,11 @@ documentation. This document contains a quick-reference summary of the syntax.
\W a "non-word" character
\X a Unicode extended grapheme cluster
</pre>
-In PCRE, by default, \d, \D, \s, \S, \w, and \W recognize only ASCII
-characters, even in a UTF mode. However, this can be changed by setting the
-PCRE_UCP option.
+By default, \d, \s, and \w match only ASCII characters, even in UTF-8 mode
+or in the 16- bit and 32-bit libraries. However, if locale-specific matching is
+happening, \s and \w may also match characters with code points in the range
+128-255. If the PCRE_UCP option is set, the behaviour of these escape sequences
+is changed to use Unicode properties and they match many more characters.
</P>
<br><a name="SEC5" href="#TOC1">GENERAL CATEGORY PROPERTIES FOR \p and \P</a><br>
<P>
@@ -150,11 +156,13 @@ PCRE_UCP option.
<pre>
Xan Alphanumeric: union of properties L and N
Xps POSIX space: property Z or tab, NL, VT, FF, CR
- Xsp Perl space: property Z or tab, NL, FF, CR
+ Xsp Perl space: property Z or tab, NL, VT, FF, CR
Xuc Univerally-named character: one that can be
represented by a Universal Character Name
Xwd Perl word: property Xan or underscore
-</PRE>
+</pre>
+Perl and POSIX space are now the same. Perl added VT to its space character set
+at release 5.18 and PCRE changed at release 8.34.
</P>
<br><a name="SEC7" href="#TOC1">SCRIPT NAMES FOR \p AND \P</a><br>
<P>
@@ -385,7 +393,9 @@ newline-setting options with similar syntax:
(*UTF32) set UTF-32 mode: 32-bit library (PCRE_UTF32)
(*UTF) set appropriate UTF mode for the library in use
(*UCP) set PCRE_UCP (use Unicode properties for \d etc)
-</PRE>
+</pre>
+Note that LIMIT_MATCH and LIMIT_RECURSION can only reduce the value of the
+limits set by the caller of pcre_exec(), not increase them.
</P>
<br><a name="SEC17" href="#TOC1">LOOKAHEAD AND LOOKBEHIND ASSERTIONS</a><br>
<P>
@@ -516,7 +526,7 @@ Cambridge CB2 3QH, England.
</P>
<br><a name="SEC27" href="#TOC1">REVISION</a><br>
<P>
-Last updated: 26 April 2013
+Last updated: 12 November 2013
<br>
Copyright &copy; 1997-2013 University of Cambridge.
<br>
diff --git a/pcre/doc/html/pcretest.html b/pcre/doc/html/pcretest.html
index 17d1ade6246..4ed1dfd0c74 100644
--- a/pcre/doc/html/pcretest.html
+++ b/pcre/doc/html/pcretest.html
@@ -187,6 +187,11 @@ equivalent to adding <b>/M</b> to each regular expression. The size is given in
bytes for both libraries.
</P>
<P>
+<b>-O</b>
+Behave as if each pattern has the <b>/O</b> modifier, that is disable
+auto-possessification for all patterns.
+</P>
+<P>
<b>-o</b> <i>osize</i>
Set the number of elements in the output vector that is used when calling
<b>pcre[16|32]_exec()</b> or <b>pcre[16|32]_dfa_exec()</b> to be <i>osize</i>. The
@@ -256,19 +261,24 @@ should never be studied (see the <b>/S</b> pattern modifier below).
</P>
<P>
<b>-t</b>
-Run each compile, study, and match many times with a timer, and output
-resulting time per compile or match (in milliseconds). Do not set <b>-m</b> with
-<b>-t</b>, because you will then get the size output a zillion times, and the
-timing will be distorted. You can control the number of iterations that are
-used for timing by following <b>-t</b> with a number (as a separate item on the
-command line). For example, "-t 1000" would iterate 1000 times. The default is
-to iterate 500000 times.
+Run each compile, study, and match many times with a timer, and output the
+resulting times per compile, study, or match (in milliseconds). Do not set
+<b>-m</b> with <b>-t</b>, because you will then get the size output a zillion
+times, and the timing will be distorted. You can control the number of
+iterations that are used for timing by following <b>-t</b> with a number (as a
+separate item on the command line). For example, "-t 1000" iterates 1000 times.
+The default is to iterate 500000 times.
</P>
<P>
<b>-tm</b>
This is like <b>-t</b> except that it times only the matching phase, not the
compile or study phases.
</P>
+<P>
+<b>-T</b> <b>-TM</b>
+These behave like <b>-t</b> and <b>-tm</b>, but in addition, at the end of a run,
+the total times for all compiles, studies, and matches are output.
+</P>
<br><a name="SEC5" href="#TOC1">DESCRIPTION</a><br>
<P>
If <b>pcretest</b> is given two filename arguments, it reads from the first and
@@ -287,7 +297,7 @@ option states whether or not <b>readline()</b> will be used.
<P>
The program handles any number of sets of input on a single input file. Each
set starts with a regular expression, and continues with any number of data
-lines to be matched against the pattern.
+lines to be matched against that pattern.
</P>
<P>
Each data line is matched separately and independently. If you want to do
@@ -361,6 +371,7 @@ sections.
<b>/M</b> show compiled memory size
<b>/m</b> set PCRE_MULTILINE
<b>/N</b> set PCRE_NO_AUTO_CAPTURE
+ <b>/O</b> set PCRE_NO_AUTO_POSSESS
<b>/P</b> use the POSIX wrapper
<b>/S</b> study the pattern after compilation
<b>/s</b> set PCRE_DOTALL
@@ -419,6 +430,7 @@ options that do not correspond to anything in Perl:
<b>/f</b> PCRE_FIRSTLINE
<b>/J</b> PCRE_DUPNAMES
<b>/N</b> PCRE_NO_AUTO_CAPTURE
+ <b>/O</b> PCRE_NO_AUTO_POSSESS
<b>/U</b> PCRE_UNGREEDY
<b>/W</b> PCRE_UCP
<b>/X</b> PCRE_EXTRA
@@ -562,8 +574,8 @@ matched. There are a number of qualifying characters that may follow <b>/S</b>.
They may appear in any order.
</P>
<P>
-If <b>S</b> is followed by an exclamation mark, <b>pcre[16|32]_study()</b> is called
-with the PCRE_STUDY_EXTRA_NEEDED option, causing it always to return a
+If <b>/S</b> is followed by an exclamation mark, <b>pcre[16|32]_study()</b> is
+called with the PCRE_STUDY_EXTRA_NEEDED option, causing it always to return a
<b>pcre_extra</b> block, even when studying discovers no useful information.
</P>
<P>
@@ -642,6 +654,37 @@ function:
The <b>/+</b> modifier works as described above. All other modifiers are
ignored.
</P>
+<br><b>
+Locking out certain modifiers
+</b><br>
+<P>
+PCRE can be compiled with or without support for certain features such as
+UTF-8/16/32 or Unicode properties. Accordingly, the standard tests are split up
+into a number of different files that are selected for running depending on
+which features are available. When updating the tests, it is all too easy to
+put a new test into the wrong file by mistake; for example, to put a test that
+requires UTF support into a file that is used when it is not available. To help
+detect such mistakes as early as possible, there is a facility for locking out
+specific modifiers. If an input line for <b>pcretest</b> starts with the string
+"&#60; forbid " the following sequence of characters is taken as a list of
+forbidden modifiers. For example, in the test files that must not use UTF or
+Unicode property support, this line appears:
+<pre>
+ &#60; forbid 8W
+</pre>
+This locks out the /8 and /W modifiers. An immediate error is given if they are
+subsequently encountered. If the character string contains &#60; but not &#62;, all the
+multi-character modifiers that begin with &#60; are locked out. Otherwise, such
+modifiers must be explicitly listed, for example:
+<pre>
+ &#60; forbid &#60;JS&#62;&#60;cr&#62;
+</pre>
+There must be a single space between &#60; and "forbid" for this feature to be
+recognised. If there is not, the line is interpreted either as a request to
+re-load a pre-compiled pattern (see "SAVING AND RELOADING COMPILED PATTERNS"
+below) or, if there is a another &#60; character, as a pattern that uses &#60; as its
+delimiter.
+</P>
<br><a name="SEC7" href="#TOC1">DATA LINES</a><br>
<P>
Before each data line is passed to <b>pcre[16|32]_exec()</b>, leading and trailing
@@ -662,6 +705,7 @@ recognized:
\v vertical tab (\x0b)
\nnn octal character (up to 3 octal digits); always
a byte unless &#62; 255 in UTF-8 or 16-bit or 32-bit mode
+ \o{dd...} octal character (any number of octal digits}
\xhh hexadecimal byte (up to 2 hex digits)
\x{hh...} hexadecimal character (any number of hex digits)
\A pass the PCRE_ANCHORED option to <b>pcre[16|32]_exec()</b> or <b>pcre[16|32]_dfa_exec()</b>
@@ -1031,10 +1075,9 @@ writing the file, <b>pcretest</b> expects to read a new pattern.
</P>
<P>
A saved pattern can be reloaded into <b>pcretest</b> by specifying &#60; and a file
-name instead of a pattern. The name of the file must not contain a &#60; character,
-as otherwise <b>pcretest</b> will interpret the line as a pattern delimited by &#60;
-characters.
-For example:
+name instead of a pattern. There must be no space between &#60; and the file name,
+which must not contain a &#60; character, as otherwise <b>pcretest</b> will
+interpret the line as a pattern delimited by &#60; characters. For example:
<pre>
re&#62; &#60;/some/file
Compiled pattern loaded from /some/file
@@ -1091,7 +1134,7 @@ Cambridge CB2 3QH, England.
</P>
<br><a name="SEC17" href="#TOC1">REVISION</a><br>
<P>
-Last updated: 26 April 2013
+Last updated: 12 November 2013
<br>
Copyright &copy; 1997-2013 University of Cambridge.
<br>
diff --git a/pcre/doc/pcre-config.1 b/pcre/doc/pcre-config.1
index 92a4b58bc4a..52eb4fb2264 100644
--- a/pcre/doc/pcre-config.1
+++ b/pcre/doc/pcre-config.1
@@ -4,11 +4,11 @@ pcre-config - program to return PCRE configuration
.SH SYNOPSIS
.rs
.sp
+.nf
.B pcre-config [--prefix] [--exec-prefix] [--version] [--libs]
-.ti +5n
-.B [--libs16] [--libs32] [--libs-cpp] [--libs-posix]
-.ti +5n
-.B [--cflags] [--cflags-posix]
+.B " [--libs16] [--libs32] [--libs-cpp] [--libs-posix]"
+.B " [--cflags] [--cflags-posix]"
+.fi
.
.
.SH DESCRIPTION
diff --git a/pcre/doc/pcre-config.txt b/pcre/doc/pcre-config.txt
index 97a6abed62c..8503ab0ef0c 100644
--- a/pcre/doc/pcre-config.txt
+++ b/pcre/doc/pcre-config.txt
@@ -8,8 +8,8 @@ NAME
SYNOPSIS
pcre-config [--prefix] [--exec-prefix] [--version] [--libs]
- [--libs16] [--libs32] [--libs-cpp] [--libs-posix]
- [--cflags] [--cflags-posix]
+ [--libs16] [--libs32] [--libs-cpp] [--libs-posix]
+ [--cflags] [--cflags-posix]
DESCRIPTION
diff --git a/pcre/doc/pcre.3 b/pcre/doc/pcre.3
index c2f9164052c..d92f9ef08de 100644
--- a/pcre/doc/pcre.3
+++ b/pcre/doc/pcre.3
@@ -1,4 +1,4 @@
-.TH PCRE 3 "13 May 2013" "PCRE 8.33"
+.TH PCRE 3 "01 Oct 2013" "PCRE 8.33"
.SH NAME
PCRE - Perl-compatible regular expressions
.SH INTRODUCTION
@@ -44,7 +44,7 @@ The current implementation of PCRE corresponds approximately with Perl 5.12,
including support for UTF-8/16/32 encoded strings and Unicode general category
properties. However, UTF-8/16/32 and Unicode support has to be explicitly
enabled; it is not the default. The Unicode tables correspond to Unicode
-release 6.2.0.
+release 6.3.0.
.P
In addition to the Perl-compatible matching function, PCRE contains an
alternative function that matches the same compiled patterns in a different
diff --git a/pcre/doc/pcre.txt b/pcre/doc/pcre.txt
index 193203e8a32..9d69515c3b8 100644
--- a/pcre/doc/pcre.txt
+++ b/pcre/doc/pcre.txt
@@ -53,7 +53,7 @@ INTRODUCTION
5.12, including support for UTF-8/16/32 encoded strings and Unicode
general category properties. However, UTF-8/16/32 and Unicode support
has to be explicitly enabled; it is not the default. The Unicode tables
- correspond to Unicode release 6.2.0.
+ correspond to Unicode release 6.3.0.
In addition to the Perl-compatible matching function, PCRE contains an
alternative function that matches the same compiled patterns in a dif-
@@ -532,7 +532,6 @@ PCRE 32-BIT API BASIC FUNCTIONS
pcre32 *pcre32_compile2(PCRE_SPTR32 pattern, int options,
int *errorcodeptr,
- const char **errptr, int *erroffset,
const unsigned char *tableptr);
pcre32_extra *pcre32_study(const pcre32 *code, int options,
@@ -1458,72 +1457,81 @@ THE ALTERNATIVE MATCHING ALGORITHM
at the fifth character of the subject. The algorithm does not automati-
cally move on to find matches that start at later positions.
+ PCRE's "auto-possessification" optimization usually applies to charac-
+ ter repeats at the end of a pattern (as well as internally). For exam-
+ ple, the pattern "a\d+" is compiled as if it were "a\d++" because there
+ is no point even considering the possibility of backtracking into the
+ repeated digits. For DFA matching, this means that only one possible
+ match is found. If you really do want multiple matches in such cases,
+ either use an ungreedy repeat ("a\d+?") or set the PCRE_NO_AUTO_POSSESS
+ option when compiling.
+
There are a number of features of PCRE regular expressions that are not
supported by the alternative matching algorithm. They are as follows:
- 1. Because the algorithm finds all possible matches, the greedy or
- ungreedy nature of repetition quantifiers is not relevant. Greedy and
+ 1. Because the algorithm finds all possible matches, the greedy or
+ ungreedy nature of repetition quantifiers is not relevant. Greedy and
ungreedy quantifiers are treated in exactly the same way. However, pos-
- sessive quantifiers can make a difference when what follows could also
+ sessive quantifiers can make a difference when what follows could also
match what is quantified, for example in a pattern like this:
^a++\w!
- This pattern matches "aaab!" but not "aaa!", which would be matched by
- a non-possessive quantifier. Similarly, if an atomic group is present,
- it is matched as if it were a standalone pattern at the current point,
- and the longest match is then "locked in" for the rest of the overall
+ This pattern matches "aaab!" but not "aaa!", which would be matched by
+ a non-possessive quantifier. Similarly, if an atomic group is present,
+ it is matched as if it were a standalone pattern at the current point,
+ and the longest match is then "locked in" for the rest of the overall
pattern.
2. When dealing with multiple paths through the tree simultaneously, it
- is not straightforward to keep track of captured substrings for the
- different matching possibilities, and PCRE's implementation of this
+ is not straightforward to keep track of captured substrings for the
+ different matching possibilities, and PCRE's implementation of this
algorithm does not attempt to do this. This means that no captured sub-
strings are available.
- 3. Because no substrings are captured, back references within the pat-
+ 3. Because no substrings are captured, back references within the pat-
tern are not supported, and cause errors if encountered.
- 4. For the same reason, conditional expressions that use a backrefer-
- ence as the condition or test for a specific group recursion are not
+ 4. For the same reason, conditional expressions that use a backrefer-
+ ence as the condition or test for a specific group recursion are not
supported.
- 5. Because many paths through the tree may be active, the \K escape
+ 5. Because many paths through the tree may be active, the \K escape
sequence, which resets the start of the match when encountered (but may
- be on some paths and not on others), is not supported. It causes an
+ be on some paths and not on others), is not supported. It causes an
error if encountered.
- 6. Callouts are supported, but the value of the capture_top field is
+ 6. Callouts are supported, but the value of the capture_top field is
always 1, and the value of the capture_last field is always -1.
- 7. The \C escape sequence, which (in the standard algorithm) always
- matches a single data unit, even in UTF-8, UTF-16 or UTF-32 modes, is
- not supported in these modes, because the alternative algorithm moves
+ 7. The \C escape sequence, which (in the standard algorithm) always
+ matches a single data unit, even in UTF-8, UTF-16 or UTF-32 modes, is
+ not supported in these modes, because the alternative algorithm moves
through the subject string one character (not data unit) at a time, for
all active paths through the tree.
- 8. Except for (*FAIL), the backtracking control verbs such as (*PRUNE)
- are not supported. (*FAIL) is supported, and behaves like a failing
+ 8. Except for (*FAIL), the backtracking control verbs such as (*PRUNE)
+ are not supported. (*FAIL) is supported, and behaves like a failing
negative assertion.
ADVANTAGES OF THE ALTERNATIVE ALGORITHM
- Using the alternative matching algorithm provides the following advan-
+ Using the alternative matching algorithm provides the following advan-
tages:
1. All possible matches (at a single point in the subject) are automat-
- ically found, and in particular, the longest match is found. To find
+ ically found, and in particular, the longest match is found. To find
more than one match using the standard algorithm, you have to do kludgy
things with callouts.
- 2. Because the alternative algorithm scans the subject string just
+ 2. Because the alternative algorithm scans the subject string just
once, and never needs to backtrack (except for lookbehinds), it is pos-
- sible to pass very long subject strings to the matching function in
+ sible to pass very long subject strings to the matching function in
several pieces, checking for partial matching each time. Although it is
- possible to do multi-segment matching using the standard algorithm by
- retaining partially matched substrings, it is more complicated. The
- pcrepartial documentation gives details of partial matching and dis-
+ possible to do multi-segment matching using the standard algorithm by
+ retaining partially matched substrings, it is more complicated. The
+ pcrepartial documentation gives details of partial matching and dis-
cusses multi-segment matching.
@@ -1531,8 +1539,8 @@ DISADVANTAGES OF THE ALTERNATIVE ALGORITHM
The alternative algorithm suffers from a number of disadvantages:
- 1. It is substantially slower than the standard algorithm. This is
- partly because it has to search for all possible matches, but is also
+ 1. It is substantially slower than the standard algorithm. This is
+ partly because it has to search for all possible matches, but is also
because it is less susceptible to optimization.
2. Capturing parentheses and back references are not supported.
@@ -1550,7 +1558,7 @@ AUTHOR
REVISION
- Last updated: 08 January 2012
+ Last updated: 12 November 2013
Copyright (c) 1997-2012 University of Cambridge.
------------------------------------------------------------------------------
@@ -1958,27 +1966,34 @@ CHECKING BUILD-TIME OPTIONS
POSIX interface uses malloc() for output vectors. Further details are
given in the pcreposix documentation.
+ PCRE_CONFIG_PARENS_LIMIT
+
+ The output is a long integer that gives the maximum depth of nesting of
+ parentheses (of any kind) in a pattern. This limit is imposed to cap
+ the amount of system stack used when a pattern is compiled. It is spec-
+ ified when PCRE is built; the default is 250.
+
PCRE_CONFIG_MATCH_LIMIT
- The output is a long integer that gives the default limit for the num-
- ber of internal matching function calls in a pcre_exec() execution.
+ The output is a long integer that gives the default limit for the num-
+ ber of internal matching function calls in a pcre_exec() execution.
Further details are given with pcre_exec() below.
PCRE_CONFIG_MATCH_LIMIT_RECURSION
The output is a long integer that gives the default limit for the depth
- of recursion when calling the internal matching function in a
- pcre_exec() execution. Further details are given with pcre_exec()
+ of recursion when calling the internal matching function in a
+ pcre_exec() execution. Further details are given with pcre_exec()
below.
PCRE_CONFIG_STACKRECURSE
- The output is an integer that is set to one if internal recursion when
+ The output is an integer that is set to one if internal recursion when
running pcre_exec() is implemented by recursive function calls that use
- the stack to remember their state. This is the usual way that PCRE is
+ the stack to remember their state. This is the usual way that PCRE is
compiled. The output is zero if PCRE was compiled to use blocks of data
- on the heap instead of recursive function calls. In this case,
- pcre_stack_malloc and pcre_stack_free are called to manage memory
+ on the heap instead of recursive function calls. In this case,
+ pcre_stack_malloc and pcre_stack_free are called to manage memory
blocks on the heap, thus avoiding the use of the stack.
@@ -1995,67 +2010,67 @@ COMPILING A PATTERN
Either of the functions pcre_compile() or pcre_compile2() can be called
to compile a pattern into an internal form. The only difference between
- the two interfaces is that pcre_compile2() has an additional argument,
- errorcodeptr, via which a numerical error code can be returned. To
- avoid too much repetition, we refer just to pcre_compile() below, but
+ the two interfaces is that pcre_compile2() has an additional argument,
+ errorcodeptr, via which a numerical error code can be returned. To
+ avoid too much repetition, we refer just to pcre_compile() below, but
the information applies equally to pcre_compile2().
The pattern is a C string terminated by a binary zero, and is passed in
- the pattern argument. A pointer to a single block of memory that is
- obtained via pcre_malloc is returned. This contains the compiled code
+ the pattern argument. A pointer to a single block of memory that is
+ obtained via pcre_malloc is returned. This contains the compiled code
and related data. The pcre type is defined for the returned block; this
is a typedef for a structure whose contents are not externally defined.
It is up to the caller to free the memory (via pcre_free) when it is no
longer required.
- Although the compiled code of a PCRE regex is relocatable, that is, it
+ Although the compiled code of a PCRE regex is relocatable, that is, it
does not depend on memory location, the complete pcre data block is not
- fully relocatable, because it may contain a copy of the tableptr argu-
+ fully relocatable, because it may contain a copy of the tableptr argu-
ment, which is an address (see below).
The options argument contains various bit settings that affect the com-
- pilation. It should be zero if no options are required. The available
- options are described below. Some of them (in particular, those that
- are compatible with Perl, but some others as well) can also be set and
- unset from within the pattern (see the detailed description in the
- pcrepattern documentation). For those options that can be different in
- different parts of the pattern, the contents of the options argument
+ pilation. It should be zero if no options are required. The available
+ options are described below. Some of them (in particular, those that
+ are compatible with Perl, but some others as well) can also be set and
+ unset from within the pattern (see the detailed description in the
+ pcrepattern documentation). For those options that can be different in
+ different parts of the pattern, the contents of the options argument
specifies their settings at the start of compilation and execution. The
- PCRE_ANCHORED, PCRE_BSR_xxx, PCRE_NEWLINE_xxx, PCRE_NO_UTF8_CHECK, and
- PCRE_NO_START_OPTIMIZE options can be set at the time of matching as
+ PCRE_ANCHORED, PCRE_BSR_xxx, PCRE_NEWLINE_xxx, PCRE_NO_UTF8_CHECK, and
+ PCRE_NO_START_OPTIMIZE options can be set at the time of matching as
well as at compile time.
If errptr is NULL, pcre_compile() returns NULL immediately. Otherwise,
- if compilation of a pattern fails, pcre_compile() returns NULL, and
+ if compilation of a pattern fails, pcre_compile() returns NULL, and
sets the variable pointed to by errptr to point to a textual error mes-
sage. This is a static string that is part of the library. You must not
- try to free it. Normally, the offset from the start of the pattern to
+ try to free it. Normally, the offset from the start of the pattern to
the data unit that was being processed when the error was discovered is
- placed in the variable pointed to by erroffset, which must not be NULL
- (if it is, an immediate error is given). However, for an invalid UTF-8
- or UTF-16 string, the offset is that of the first data unit of the
+ placed in the variable pointed to by erroffset, which must not be NULL
+ (if it is, an immediate error is given). However, for an invalid UTF-8
+ or UTF-16 string, the offset is that of the first data unit of the
failing character.
- Some errors are not detected until the whole pattern has been scanned;
- in these cases, the offset passed back is the length of the pattern.
- Note that the offset is in data units, not characters, even in a UTF
+ Some errors are not detected until the whole pattern has been scanned;
+ in these cases, the offset passed back is the length of the pattern.
+ Note that the offset is in data units, not characters, even in a UTF
mode. It may sometimes point into the middle of a UTF-8 or UTF-16 char-
acter.
- If pcre_compile2() is used instead of pcre_compile(), and the error-
- codeptr argument is not NULL, a non-zero error code number is returned
- via this argument in the event of an error. This is in addition to the
+ If pcre_compile2() is used instead of pcre_compile(), and the error-
+ codeptr argument is not NULL, a non-zero error code number is returned
+ via this argument in the event of an error. This is in addition to the
textual error message. Error codes and messages are listed below.
- If the final argument, tableptr, is NULL, PCRE uses a default set of
- character tables that are built when PCRE is compiled, using the
- default C locale. Otherwise, tableptr must be an address that is the
- result of a call to pcre_maketables(). This value is stored with the
- compiled pattern, and used again by pcre_exec(), unless another table
- pointer is passed to it. For more discussion, see the section on locale
- support below.
+ If the final argument, tableptr, is NULL, PCRE uses a default set of
+ character tables that are built when PCRE is compiled, using the
+ default C locale. Otherwise, tableptr must be an address that is the
+ result of a call to pcre_maketables(). This value is stored with the
+ compiled pattern, and used again by pcre_exec() and pcre_dfa_exec()
+ when the pattern is matched. For more discussion, see the section on
+ locale support below.
- This code fragment shows a typical straightforward call to pcre_com-
+ This code fragment shows a typical straightforward call to pcre_com-
pile():
pcre *re;
@@ -2068,171 +2083,181 @@ COMPILING A PATTERN
&erroffset, /* for error offset */
NULL); /* use default character tables */
- The following names for option bits are defined in the pcre.h header
+ The following names for option bits are defined in the pcre.h header
file:
PCRE_ANCHORED
If this bit is set, the pattern is forced to be "anchored", that is, it
- is constrained to match only at the first matching point in the string
- that is being searched (the "subject string"). This effect can also be
- achieved by appropriate constructs in the pattern itself, which is the
+ is constrained to match only at the first matching point in the string
+ that is being searched (the "subject string"). This effect can also be
+ achieved by appropriate constructs in the pattern itself, which is the
only way to do it in Perl.
PCRE_AUTO_CALLOUT
If this bit is set, pcre_compile() automatically inserts callout items,
- all with number 255, before each pattern item. For discussion of the
+ all with number 255, before each pattern item. For discussion of the
callout facility, see the pcrecallout documentation.
PCRE_BSR_ANYCRLF
PCRE_BSR_UNICODE
These options (which are mutually exclusive) control what the \R escape
- sequence matches. The choice is either to match only CR, LF, or CRLF,
+ sequence matches. The choice is either to match only CR, LF, or CRLF,
or to match any Unicode newline sequence. The default is specified when
PCRE is built. It can be overridden from within the pattern, or by set-
ting an option when a compiled pattern is matched.
PCRE_CASELESS
- If this bit is set, letters in the pattern match both upper and lower
- case letters. It is equivalent to Perl's /i option, and it can be
- changed within a pattern by a (?i) option setting. In UTF-8 mode, PCRE
- always understands the concept of case for characters whose values are
- less than 128, so caseless matching is always possible. For characters
- with higher values, the concept of case is supported if PCRE is com-
- piled with Unicode property support, but not otherwise. If you want to
- use caseless matching for characters 128 and above, you must ensure
- that PCRE is compiled with Unicode property support as well as with
+ If this bit is set, letters in the pattern match both upper and lower
+ case letters. It is equivalent to Perl's /i option, and it can be
+ changed within a pattern by a (?i) option setting. In UTF-8 mode, PCRE
+ always understands the concept of case for characters whose values are
+ less than 128, so caseless matching is always possible. For characters
+ with higher values, the concept of case is supported if PCRE is com-
+ piled with Unicode property support, but not otherwise. If you want to
+ use caseless matching for characters 128 and above, you must ensure
+ that PCRE is compiled with Unicode property support as well as with
UTF-8 support.
PCRE_DOLLAR_ENDONLY
- If this bit is set, a dollar metacharacter in the pattern matches only
- at the end of the subject string. Without this option, a dollar also
- matches immediately before a newline at the end of the string (but not
- before any other newlines). The PCRE_DOLLAR_ENDONLY option is ignored
- if PCRE_MULTILINE is set. There is no equivalent to this option in
+ If this bit is set, a dollar metacharacter in the pattern matches only
+ at the end of the subject string. Without this option, a dollar also
+ matches immediately before a newline at the end of the string (but not
+ before any other newlines). The PCRE_DOLLAR_ENDONLY option is ignored
+ if PCRE_MULTILINE is set. There is no equivalent to this option in
Perl, and no way to set it within a pattern.
PCRE_DOTALL
- If this bit is set, a dot metacharacter in the pattern matches a char-
+ If this bit is set, a dot metacharacter in the pattern matches a char-
acter of any value, including one that indicates a newline. However, it
- only ever matches one character, even if newlines are coded as CRLF.
- Without this option, a dot does not match when the current position is
+ only ever matches one character, even if newlines are coded as CRLF.
+ Without this option, a dot does not match when the current position is
at a newline. This option is equivalent to Perl's /s option, and it can
- be changed within a pattern by a (?s) option setting. A negative class
+ be changed within a pattern by a (?s) option setting. A negative class
such as [^a] always matches newline characters, independent of the set-
ting of this option.
PCRE_DUPNAMES
- If this bit is set, names used to identify capturing subpatterns need
+ If this bit is set, names used to identify capturing subpatterns need
not be unique. This can be helpful for certain types of pattern when it
- is known that only one instance of the named subpattern can ever be
- matched. There are more details of named subpatterns below; see also
+ is known that only one instance of the named subpattern can ever be
+ matched. There are more details of named subpatterns below; see also
the pcrepattern documentation.
PCRE_EXTENDED
- If this bit is set, white space data characters in the pattern are
- totally ignored except when escaped or inside a character class. White
- space does not include the VT character (code 11). In addition, charac-
- ters between an unescaped # outside a character class and the next new-
- line, inclusive, are also ignored. This is equivalent to Perl's /x
- option, and it can be changed within a pattern by a (?x) option set-
- ting.
-
- Which characters are interpreted as newlines is controlled by the
- options passed to pcre_compile() or by a special sequence at the start
- of the pattern, as described in the section entitled "Newline conven-
+ If this bit is set, most white space characters in the pattern are
+ totally ignored except when escaped or inside a character class. How-
+ ever, white space is not allowed within sequences such as (?> that
+ introduce various parenthesized subpatterns, nor within a numerical
+ quantifier such as {1,3}. However, ignorable white space is permitted
+ between an item and a following quantifier and between a quantifier and
+ a following + that indicates possessiveness.
+
+ White space did not used to include the VT character (code 11), because
+ Perl did not treat this character as white space. However, Perl changed
+ at release 5.18, so PCRE followed at release 8.34, and VT is now
+ treated as white space.
+
+ PCRE_EXTENDED also causes characters between an unescaped # outside a
+ character class and the next newline, inclusive, to be ignored.
+ PCRE_EXTENDED is equivalent to Perl's /x option, and it can be changed
+ within a pattern by a (?x) option setting.
+
+ Which characters are interpreted as newlines is controlled by the
+ options passed to pcre_compile() or by a special sequence at the start
+ of the pattern, as described in the section entitled "Newline conven-
tions" in the pcrepattern documentation. Note that the end of this type
- of comment is a literal newline sequence in the pattern; escape
+ of comment is a literal newline sequence in the pattern; escape
sequences that happen to represent a newline do not count.
- This option makes it possible to include comments inside complicated
- patterns. Note, however, that this applies only to data characters.
- White space characters may never appear within special character
+ This option makes it possible to include comments inside complicated
+ patterns. Note, however, that this applies only to data characters.
+ White space characters may never appear within special character
sequences in a pattern, for example within the sequence (?( that intro-
duces a conditional subpattern.
PCRE_EXTRA
- This option was invented in order to turn on additional functionality
- of PCRE that is incompatible with Perl, but it is currently of very
- little use. When set, any backslash in a pattern that is followed by a
- letter that has no special meaning causes an error, thus reserving
- these combinations for future expansion. By default, as in Perl, a
- backslash followed by a letter with no special meaning is treated as a
+ This option was invented in order to turn on additional functionality
+ of PCRE that is incompatible with Perl, but it is currently of very
+ little use. When set, any backslash in a pattern that is followed by a
+ letter that has no special meaning causes an error, thus reserving
+ these combinations for future expansion. By default, as in Perl, a
+ backslash followed by a letter with no special meaning is treated as a
literal. (Perl can, however, be persuaded to give an error for this, by
- running it with the -w option.) There are at present no other features
- controlled by this option. It can also be set by a (?X) option setting
+ running it with the -w option.) There are at present no other features
+ controlled by this option. It can also be set by a (?X) option setting
within a pattern.
PCRE_FIRSTLINE
- If this option is set, an unanchored pattern is required to match
- before or at the first newline in the subject string, though the
+ If this option is set, an unanchored pattern is required to match
+ before or at the first newline in the subject string, though the
matched text may continue over the newline.
PCRE_JAVASCRIPT_COMPAT
If this option is set, PCRE's behaviour is changed in some ways so that
- it is compatible with JavaScript rather than Perl. The changes are as
+ it is compatible with JavaScript rather than Perl. The changes are as
follows:
- (1) A lone closing square bracket in a pattern causes a compile-time
- error, because this is illegal in JavaScript (by default it is treated
+ (1) A lone closing square bracket in a pattern causes a compile-time
+ error, because this is illegal in JavaScript (by default it is treated
as a data character). Thus, the pattern AB]CD becomes illegal when this
option is set.
- (2) At run time, a back reference to an unset subpattern group matches
- an empty string (by default this causes the current matching alterna-
- tive to fail). A pattern such as (\1)(a) succeeds when this option is
- set (assuming it can find an "a" in the subject), whereas it fails by
+ (2) At run time, a back reference to an unset subpattern group matches
+ an empty string (by default this causes the current matching alterna-
+ tive to fail). A pattern such as (\1)(a) succeeds when this option is
+ set (assuming it can find an "a" in the subject), whereas it fails by
default, for Perl compatibility.
(3) \U matches an upper case "U" character; by default \U causes a com-
pile time error (Perl uses \U to upper case subsequent characters).
(4) \u matches a lower case "u" character unless it is followed by four
- hexadecimal digits, in which case the hexadecimal number defines the
- code point to match. By default, \u causes a compile time error (Perl
+ hexadecimal digits, in which case the hexadecimal number defines the
+ code point to match. By default, \u causes a compile time error (Perl
uses it to upper case the following character).
- (5) \x matches a lower case "x" character unless it is followed by two
- hexadecimal digits, in which case the hexadecimal number defines the
- code point to match. By default, as in Perl, a hexadecimal number is
+ (5) \x matches a lower case "x" character unless it is followed by two
+ hexadecimal digits, in which case the hexadecimal number defines the
+ code point to match. By default, as in Perl, a hexadecimal number is
always expected after \x, but it may have zero, one, or two digits (so,
for example, \xz matches a binary zero character followed by z).
PCRE_MULTILINE
- By default, for the purposes of matching "start of line" and "end of
+ By default, for the purposes of matching "start of line" and "end of
line", PCRE treats the subject string as consisting of a single line of
- characters, even if it actually contains newlines. The "start of line"
+ characters, even if it actually contains newlines. The "start of line"
metacharacter (^) matches only at the start of the string, and the "end
- of line" metacharacter ($) matches only at the end of the string, or
- before a terminating newline (except when PCRE_DOLLAR_ENDONLY is set).
- Note, however, that unless PCRE_DOTALL is set, the "any character"
- metacharacter (.) does not match at a newline. This behaviour (for ^,
+ of line" metacharacter ($) matches only at the end of the string, or
+ before a terminating newline (except when PCRE_DOLLAR_ENDONLY is set).
+ Note, however, that unless PCRE_DOTALL is set, the "any character"
+ metacharacter (.) does not match at a newline. This behaviour (for ^,
$, and dot) is the same as Perl.
- When PCRE_MULTILINE it is set, the "start of line" and "end of line"
- constructs match immediately following or immediately before internal
- newlines in the subject string, respectively, as well as at the very
- start and end. This is equivalent to Perl's /m option, and it can be
+ When PCRE_MULTILINE it is set, the "start of line" and "end of line"
+ constructs match immediately following or immediately before internal
+ newlines in the subject string, respectively, as well as at the very
+ start and end. This is equivalent to Perl's /m option, and it can be
changed within a pattern by a (?m) option setting. If there are no new-
- lines in a subject string, or no occurrences of ^ or $ in a pattern,
+ lines in a subject string, or no occurrences of ^ or $ in a pattern,
setting PCRE_MULTILINE has no effect.
PCRE_NEVER_UTF
This option locks out interpretation of the pattern as UTF-8 (or UTF-16
- or UTF-32 in the 16-bit and 32-bit libraries). In particular, it pre-
- vents the creator of the pattern from switching to UTF interpretation
+ or UTF-32 in the 16-bit and 32-bit libraries). In particular, it pre-
+ vents the creator of the pattern from switching to UTF interpretation
by starting the pattern with (*UTF). This may be useful in applications
that process patterns from external sources. The combination of
PCRE_UTF8 and PCRE_NEVER_UTF also causes an error.
@@ -2243,41 +2268,41 @@ COMPILING A PATTERN
PCRE_NEWLINE_ANYCRLF
PCRE_NEWLINE_ANY
- These options override the default newline definition that was chosen
- when PCRE was built. Setting the first or the second specifies that a
- newline is indicated by a single character (CR or LF, respectively).
- Setting PCRE_NEWLINE_CRLF specifies that a newline is indicated by the
- two-character CRLF sequence. Setting PCRE_NEWLINE_ANYCRLF specifies
+ These options override the default newline definition that was chosen
+ when PCRE was built. Setting the first or the second specifies that a
+ newline is indicated by a single character (CR or LF, respectively).
+ Setting PCRE_NEWLINE_CRLF specifies that a newline is indicated by the
+ two-character CRLF sequence. Setting PCRE_NEWLINE_ANYCRLF specifies
that any of the three preceding sequences should be recognized. Setting
- PCRE_NEWLINE_ANY specifies that any Unicode newline sequence should be
+ PCRE_NEWLINE_ANY specifies that any Unicode newline sequence should be
recognized.
- In an ASCII/Unicode environment, the Unicode newline sequences are the
- three just mentioned, plus the single characters VT (vertical tab,
+ In an ASCII/Unicode environment, the Unicode newline sequences are the
+ three just mentioned, plus the single characters VT (vertical tab,
U+000B), FF (form feed, U+000C), NEL (next line, U+0085), LS (line sep-
- arator, U+2028), and PS (paragraph separator, U+2029). For the 8-bit
+ arator, U+2028), and PS (paragraph separator, U+2029). For the 8-bit
library, the last two are recognized only in UTF-8 mode.
- When PCRE is compiled to run in an EBCDIC (mainframe) environment, the
+ When PCRE is compiled to run in an EBCDIC (mainframe) environment, the
code for CR is 0x0d, the same as ASCII. However, the character code for
- LF is normally 0x15, though in some EBCDIC environments 0x25 is used.
- Whichever of these is not LF is made to correspond to Unicode's NEL
- character. EBCDIC codes are all less than 256. For more details, see
+ LF is normally 0x15, though in some EBCDIC environments 0x25 is used.
+ Whichever of these is not LF is made to correspond to Unicode's NEL
+ character. EBCDIC codes are all less than 256. For more details, see
the pcrebuild documentation.
- The newline setting in the options word uses three bits that are
+ The newline setting in the options word uses three bits that are
treated as a number, giving eight possibilities. Currently only six are
- used (default plus the five values above). This means that if you set
- more than one newline option, the combination may or may not be sensi-
+ used (default plus the five values above). This means that if you set
+ more than one newline option, the combination may or may not be sensi-
ble. For example, PCRE_NEWLINE_CR with PCRE_NEWLINE_LF is equivalent to
- PCRE_NEWLINE_CRLF, but other combinations may yield unused numbers and
+ PCRE_NEWLINE_CRLF, but other combinations may yield unused numbers and
cause an error.
- The only time that a line break in a pattern is specially recognized
- when compiling is when PCRE_EXTENDED is set. CR and LF are white space
- characters, and so are ignored in this mode. Also, an unescaped # out-
- side a character class indicates a comment that lasts until after the
- next line break sequence. In other circumstances, line break sequences
+ The only time that a line break in a pattern is specially recognized
+ when compiling is when PCRE_EXTENDED is set. CR and LF are white space
+ characters, and so are ignored in this mode. Also, an unescaped # out-
+ side a character class indicates a comment that lasts until after the
+ next line break sequence. In other circumstances, line break sequences
in patterns are treated as literal data.
The newline option that is set at compile time becomes the default that
@@ -2286,69 +2311,79 @@ COMPILING A PATTERN
PCRE_NO_AUTO_CAPTURE
If this option is set, it disables the use of numbered capturing paren-
- theses in the pattern. Any opening parenthesis that is not followed by
- ? behaves as if it were followed by ?: but named parentheses can still
- be used for capturing (and they acquire numbers in the usual way).
+ theses in the pattern. Any opening parenthesis that is not followed by
+ ? behaves as if it were followed by ?: but named parentheses can still
+ be used for capturing (and they acquire numbers in the usual way).
There is no equivalent of this option in Perl.
+ PCRE_NO_AUTO_POSSESS
+
+ If this option is set, it disables "auto-possessification". This is an
+ optimization that, for example, turns a+b into a++b in order to avoid
+ backtracks into a+ that can never be successful. However, if callouts
+ are in use, auto-possessification means that some of them are never
+ taken. You can set this option if you want the matching functions to do
+ a full unoptimized search and run all the callouts, but it is mainly
+ provided for testing purposes.
+
PCRE_NO_START_OPTIMIZE
- This is an option that acts at matching time; that is, it is really an
- option for pcre_exec() or pcre_dfa_exec(). If it is set at compile
- time, it is remembered with the compiled pattern and assumed at match-
- ing time. This is necessary if you want to use JIT execution, because
- the JIT compiler needs to know whether or not this option is set. For
+ This is an option that acts at matching time; that is, it is really an
+ option for pcre_exec() or pcre_dfa_exec(). If it is set at compile
+ time, it is remembered with the compiled pattern and assumed at match-
+ ing time. This is necessary if you want to use JIT execution, because
+ the JIT compiler needs to know whether or not this option is set. For
details see the discussion of PCRE_NO_START_OPTIMIZE below.
PCRE_UCP
- This option changes the way PCRE processes \B, \b, \D, \d, \S, \s, \W,
- \w, and some of the POSIX character classes. By default, only ASCII
- characters are recognized, but if PCRE_UCP is set, Unicode properties
- are used instead to classify characters. More details are given in the
- section on generic character types in the pcrepattern page. If you set
- PCRE_UCP, matching one of the items it affects takes much longer. The
- option is available only if PCRE has been compiled with Unicode prop-
+ This option changes the way PCRE processes \B, \b, \D, \d, \S, \s, \W,
+ \w, and some of the POSIX character classes. By default, only ASCII
+ characters are recognized, but if PCRE_UCP is set, Unicode properties
+ are used instead to classify characters. More details are given in the
+ section on generic character types in the pcrepattern page. If you set
+ PCRE_UCP, matching one of the items it affects takes much longer. The
+ option is available only if PCRE has been compiled with Unicode prop-
erty support.
PCRE_UNGREEDY
- This option inverts the "greediness" of the quantifiers so that they
- are not greedy by default, but become greedy if followed by "?". It is
- not compatible with Perl. It can also be set by a (?U) option setting
+ This option inverts the "greediness" of the quantifiers so that they
+ are not greedy by default, but become greedy if followed by "?". It is
+ not compatible with Perl. It can also be set by a (?U) option setting
within the pattern.
PCRE_UTF8
- This option causes PCRE to regard both the pattern and the subject as
+ This option causes PCRE to regard both the pattern and the subject as
strings of UTF-8 characters instead of single-byte strings. However, it
- is available only when PCRE is built to include UTF support. If not,
- the use of this option provokes an error. Details of how this option
+ is available only when PCRE is built to include UTF support. If not,
+ the use of this option provokes an error. Details of how this option
changes the behaviour of PCRE are given in the pcreunicode page.
PCRE_NO_UTF8_CHECK
When PCRE_UTF8 is set, the validity of the pattern as a UTF-8 string is
- automatically checked. There is a discussion about the validity of
- UTF-8 strings in the pcreunicode page. If an invalid UTF-8 sequence is
- found, pcre_compile() returns an error. If you already know that your
- pattern is valid, and you want to skip this check for performance rea-
- sons, you can set the PCRE_NO_UTF8_CHECK option. When it is set, the
+ automatically checked. There is a discussion about the validity of
+ UTF-8 strings in the pcreunicode page. If an invalid UTF-8 sequence is
+ found, pcre_compile() returns an error. If you already know that your
+ pattern is valid, and you want to skip this check for performance rea-
+ sons, you can set the PCRE_NO_UTF8_CHECK option. When it is set, the
effect of passing an invalid UTF-8 string as a pattern is undefined. It
- may cause your program to crash. Note that this option can also be
- passed to pcre_exec() and pcre_dfa_exec(), to suppress the validity
- checking of subject strings only. If the same string is being matched
- many times, the option can be safely set for the second and subsequent
+ may cause your program to crash or loop. Note that this option can also
+ be passed to pcre_exec() and pcre_dfa_exec(), to suppress the validity
+ checking of subject strings only. If the same string is being matched
+ many times, the option can be safely set for the second and subsequent
matchings to improve performance.
COMPILATION ERROR CODES
- The following table lists the error codes than may be returned by
- pcre_compile2(), along with the error messages that may be returned by
- both compiling functions. Note that error messages are always 8-bit
- ASCII strings, even in 16-bit or 32-bit mode. As PCRE has developed,
- some error codes have fallen out of use. To avoid confusion, they have
+ The following table lists the error codes than may be returned by
+ pcre_compile2(), along with the error messages that may be returned by
+ both compiling functions. Note that error messages are always 8-bit
+ ASCII strings, even in 16-bit or 32-bit mode. As PCRE has developed,
+ some error codes have fallen out of use. To avoid confusion, they have
not been re-used.
0 no error
@@ -2385,7 +2420,7 @@ COMPILATION ERROR CODES
31 POSIX collating elements are not supported
32 this version of PCRE is compiled without UTF support
33 [this code is not in use]
- 34 character value in \x{...} sequence is too large
+ 34 character value in \x{} or \o{} is too large
35 invalid condition (?(0)
36 \C not allowed in lookbehind assertion
37 PCRE does not support \L, \l, \N{name}, \U, or \u
@@ -2433,74 +2468,80 @@ COMPILATION ERROR CODES
75 name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)
76 character value in \u.... sequence is too large
77 invalid UTF-32 string (specifically UTF-32)
-
- The numbers 32 and 10000 in errors 48 and 49 are defaults; different
+ 78 setting UTF is disabled by the application
+ 79 non-hex character in \x{} (closing brace missing?)
+ 80 non-octal character in \o{} (closing brace missing?)
+ 81 missing opening brace after \o
+ 82 parentheses are too deeply nested
+ 83 invalid range in character class
+
+ The numbers 32 and 10000 in errors 48 and 49 are defaults; different
values may be used if the limits were changed when PCRE was built.
STUDYING A PATTERN
- pcre_extra *pcre_study(const pcre *code, int options
+ pcre_extra *pcre_study(const pcre *code, int options,
const char **errptr);
- If a compiled pattern is going to be used several times, it is worth
+ If a compiled pattern is going to be used several times, it is worth
spending more time analyzing it in order to speed up the time taken for
- matching. The function pcre_study() takes a pointer to a compiled pat-
+ matching. The function pcre_study() takes a pointer to a compiled pat-
tern as its first argument. If studying the pattern produces additional
- information that will help speed up matching, pcre_study() returns a
- pointer to a pcre_extra block, in which the study_data field points to
+ information that will help speed up matching, pcre_study() returns a
+ pointer to a pcre_extra block, in which the study_data field points to
the results of the study.
The returned value from pcre_study() can be passed directly to
- pcre_exec() or pcre_dfa_exec(). However, a pcre_extra block also con-
- tains other fields that can be set by the caller before the block is
+ pcre_exec() or pcre_dfa_exec(). However, a pcre_extra block also con-
+ tains other fields that can be set by the caller before the block is
passed; these are described below in the section on matching a pattern.
- If studying the pattern does not produce any useful information,
- pcre_study() returns NULL by default. In that circumstance, if the
+ If studying the pattern does not produce any useful information,
+ pcre_study() returns NULL by default. In that circumstance, if the
calling program wants to pass any of the other fields to pcre_exec() or
- pcre_dfa_exec(), it must set up its own pcre_extra block. However, if
- pcre_study() is called with the PCRE_STUDY_EXTRA_NEEDED option, it
+ pcre_dfa_exec(), it must set up its own pcre_extra block. However, if
+ pcre_study() is called with the PCRE_STUDY_EXTRA_NEEDED option, it
returns a pcre_extra block even if studying did not find any additional
- information. It may still return NULL, however, if an error occurs in
+ information. It may still return NULL, however, if an error occurs in
pcre_study().
- The second argument of pcre_study() contains option bits. There are
+ The second argument of pcre_study() contains option bits. There are
three further options in addition to PCRE_STUDY_EXTRA_NEEDED:
PCRE_STUDY_JIT_COMPILE
PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE
PCRE_STUDY_JIT_PARTIAL_SOFT_COMPILE
- If any of these are set, and the just-in-time compiler is available,
- the pattern is further compiled into machine code that executes much
- faster than the pcre_exec() interpretive matching function. If the
- just-in-time compiler is not available, these options are ignored. All
+ If any of these are set, and the just-in-time compiler is available,
+ the pattern is further compiled into machine code that executes much
+ faster than the pcre_exec() interpretive matching function. If the
+ just-in-time compiler is not available, these options are ignored. All
undefined bits in the options argument must be zero.
- JIT compilation is a heavyweight optimization. It can take some time
- for patterns to be analyzed, and for one-off matches and simple pat-
- terns the benefit of faster execution might be offset by a much slower
+ JIT compilation is a heavyweight optimization. It can take some time
+ for patterns to be analyzed, and for one-off matches and simple pat-
+ terns the benefit of faster execution might be offset by a much slower
study time. Not all patterns can be optimized by the JIT compiler. For
- those that cannot be handled, matching automatically falls back to the
- pcre_exec() interpreter. For more details, see the pcrejit documenta-
+ those that cannot be handled, matching automatically falls back to the
+ pcre_exec() interpreter. For more details, see the pcrejit documenta-
tion.
- The third argument for pcre_study() is a pointer for an error message.
- If studying succeeds (even if no data is returned), the variable it
- points to is set to NULL. Otherwise it is set to point to a textual
+ The third argument for pcre_study() is a pointer for an error message.
+ If studying succeeds (even if no data is returned), the variable it
+ points to is set to NULL. Otherwise it is set to point to a textual
error message. This is a static string that is part of the library. You
- must not try to free it. You should test the error pointer for NULL
+ must not try to free it. You should test the error pointer for NULL
after calling pcre_study(), to be sure that it has run successfully.
- When you are finished with a pattern, you can free the memory used for
+ When you are finished with a pattern, you can free the memory used for
the study data by calling pcre_free_study(). This function was added to
- the API for release 8.20. For earlier versions, the memory could be
- freed with pcre_free(), just like the pattern itself. This will still
- work in cases where JIT optimization is not used, but it is advisable
+ the API for release 8.20. For earlier versions, the memory could be
+ freed with pcre_free(), just like the pattern itself. This will still
+ work in cases where JIT optimization is not used, but it is advisable
to change to the new function when convenient.
- This is a typical way in which pcre_study() is used (except that in a
+ This is a typical way in which pcre_study() is used (except that in a
real application there should be tests for errors):
int rc;
@@ -2520,29 +2561,29 @@ STUDYING A PATTERN
Studying a pattern does two things: first, a lower bound for the length
of subject string that is needed to match the pattern is computed. This
does not mean that there are any strings of that length that match, but
- it does guarantee that no shorter strings match. The value is used to
+ it does guarantee that no shorter strings match. The value is used to
avoid wasting time by trying to match strings that are shorter than the
- lower bound. You can find out the value in a calling program via the
+ lower bound. You can find out the value in a calling program via the
pcre_fullinfo() function.
Studying a pattern is also useful for non-anchored patterns that do not
- have a single fixed starting character. A bitmap of possible starting
- bytes is created. This speeds up finding a position in the subject at
+ have a single fixed starting character. A bitmap of possible starting
+ bytes is created. This speeds up finding a position in the subject at
which to start matching. (In 16-bit mode, the bitmap is used for 16-bit
- values less than 256. In 32-bit mode, the bitmap is used for 32-bit
+ values less than 256. In 32-bit mode, the bitmap is used for 32-bit
values less than 256.)
- These two optimizations apply to both pcre_exec() and pcre_dfa_exec(),
- and the information is also used by the JIT compiler. The optimiza-
- tions can be disabled by setting the PCRE_NO_START_OPTIMIZE option.
- You might want to do this if your pattern contains callouts or (*MARK)
- and you want to make use of these facilities in cases where matching
+ These two optimizations apply to both pcre_exec() and pcre_dfa_exec(),
+ and the information is also used by the JIT compiler. The optimiza-
+ tions can be disabled by setting the PCRE_NO_START_OPTIMIZE option.
+ You might want to do this if your pattern contains callouts or (*MARK)
+ and you want to make use of these facilities in cases where matching
fails.
- PCRE_NO_START_OPTIMIZE can be specified at either compile time or exe-
- cution time. However, if PCRE_NO_START_OPTIMIZE is passed to
+ PCRE_NO_START_OPTIMIZE can be specified at either compile time or exe-
+ cution time. However, if PCRE_NO_START_OPTIMIZE is passed to
pcre_exec(), (that is, after any JIT compilation has happened) JIT exe-
- cution is disabled. For JIT execution to work with PCRE_NO_START_OPTI-
+ cution is disabled. For JIT execution to work with PCRE_NO_START_OPTI-
MIZE, the option must be set at compile time.
There is a longer discussion of PCRE_NO_START_OPTIMIZE below.
@@ -2550,17 +2591,20 @@ STUDYING A PATTERN
LOCALE SUPPORT
- PCRE handles caseless matching, and determines whether characters are
- letters, digits, or whatever, by reference to a set of tables, indexed
- by character value. When running in UTF-8 mode, this applies only to
- characters with codes less than 128. By default, higher-valued codes
- never match escapes such as \w or \d, but they can be tested with \p if
- PCRE is built with Unicode character property support. Alternatively,
- the PCRE_UCP option can be set at compile time; this causes \w and
- friends to use Unicode property support instead of built-in tables. The
- use of locales with Unicode is discouraged. If you are handling charac-
- ters with codes greater than 128, you should either use UTF-8 and Uni-
- code, or use locales, but not try to mix the two.
+ PCRE handles caseless matching, and determines whether characters are
+ letters, digits, or whatever, by reference to a set of tables, indexed
+ by character code point. When running in UTF-8 mode, or in the 16- or
+ 32-bit libraries, this applies only to characters with code points less
+ than 256. By default, higher-valued code points never match escapes
+ such as \w or \d. However, if PCRE is built with Unicode property sup-
+ port, all characters can be tested with \p and \P, or, alternatively,
+ the PCRE_UCP option can be set when a pattern is compiled; this causes
+ \w and friends to use Unicode property support instead of the built-in
+ tables.
+
+ The use of locales with Unicode is discouraged. If you are handling
+ characters with code points greater than 128, you should either use
+ Unicode support, or use locales, but not try to mix the two.
PCRE contains an internal set of tables that are used when the final
argument of pcre_compile() is NULL. These are sufficient for many
@@ -2576,10 +2620,10 @@ LOCALE SUPPORT
External tables are built by calling the pcre_maketables() function,
which has no arguments, in the relevant locale. The result can then be
- passed to pcre_compile() or pcre_exec() as often as necessary. For
- example, to build and use tables that are appropriate for the French
- locale (where accented characters with values greater than 128 are
- treated as letters), the following code could be used:
+ passed to pcre_compile() as often as necessary. For example, to build
+ and use tables that are appropriate for the French locale (where
+ accented characters with values greater than 128 are treated as let-
+ ters), the following code could be used:
setlocale(LC_CTYPE, "fr_FR");
tables = pcre_maketables();
@@ -2595,15 +2639,19 @@ LOCALE SUPPORT
The pointer that is passed to pcre_compile() is saved with the compiled
pattern, and the same tables are used via this pointer by pcre_study()
- and normally also by pcre_exec(). Thus, by default, for any single pat-
+ and also by pcre_exec() and pcre_dfa_exec(). Thus, for any single pat-
tern, compilation, studying and matching all happen in the same locale,
- but different patterns can be compiled in different locales.
+ but different patterns can be processed in different locales.
It is possible to pass a table pointer or NULL (indicating the use of
- the internal tables) to pcre_exec(). Although not intended for this
- purpose, this facility could be used to match a pattern in a different
- locale from the one in which it was compiled. Passing table pointers at
- run time is discussed below in the section on matching a pattern.
+ the internal tables) to pcre_exec() or pcre_dfa_exec() (see the discus-
+ sion below in the section on matching a pattern). This facility is pro-
+ vided for use with pre-compiled patterns that have been saved and
+ reloaded. Character tables are not saved with patterns, so if a non-
+ standard table was used at compile time, it must be provided again when
+ the reloaded pattern is matched. Attempting to use this facility to
+ match a pattern in a different locale from the one in which it was com-
+ piled is likely to lead to anomalous (usually incorrect) results.
INFORMATION ABOUT A PATTERN
@@ -2744,77 +2792,83 @@ INFORMATION ABOUT A PATTERN
/^a\dz\d/ the returned value is -1.
Since for the 32-bit library using the non-UTF-32 mode, this function
- is unable to return the full 32-bit range of the character, this value
- is deprecated; instead the PCRE_INFO_REQUIREDCHARFLAGS and
+ is unable to return the full 32-bit range of characters, this value is
+ deprecated; instead the PCRE_INFO_REQUIREDCHARFLAGS and
PCRE_INFO_REQUIREDCHAR values should be used.
+ PCRE_INFO_MATCH_EMPTY
+
+ Return 1 if the pattern can match an empty string, otherwise 0. The
+ fourth argument should point to an int variable.
+
PCRE_INFO_MATCHLIMIT
- If the pattern set a match limit by including an item of the form
- (*LIMIT_MATCH=nnnn) at the start, the value is returned. The fourth
- argument should point to an unsigned 32-bit integer. If no such value
- has been set, the call to pcre_fullinfo() returns the error
+ If the pattern set a match limit by including an item of the form
+ (*LIMIT_MATCH=nnnn) at the start, the value is returned. The fourth
+ argument should point to an unsigned 32-bit integer. If no such value
+ has been set, the call to pcre_fullinfo() returns the error
PCRE_ERROR_UNSET.
PCRE_INFO_MAXLOOKBEHIND
- Return the number of characters (NB not data units) in the longest
- lookbehind assertion in the pattern. This information is useful when
- doing multi-segment matching using the partial matching facilities.
+ Return the number of characters (NB not data units) in the longest
+ lookbehind assertion in the pattern. This information is useful when
+ doing multi-segment matching using the partial matching facilities.
Note that the simple assertions \b and \B require a one-character look-
- behind. \A also registers a one-character lookbehind, though it does
- not actually inspect the previous character. This is to ensure that at
+ behind. \A also registers a one-character lookbehind, though it does
+ not actually inspect the previous character. This is to ensure that at
least one character from the old segment is retained when a new segment
is processed. Otherwise, if there are no lookbehinds in the pattern, \A
might match incorrectly at the start of a new segment.
PCRE_INFO_MINLENGTH
- If the pattern was studied and a minimum length for matching subject
- strings was computed, its value is returned. Otherwise the returned
+ If the pattern was studied and a minimum length for matching subject
+ strings was computed, its value is returned. Otherwise the returned
value is -1. The value is a number of characters, which in UTF mode may
- be different from the number of data units. The fourth argument should
- point to an int variable. A non-negative value is a lower bound to the
- length of any matching string. There may not be any strings of that
- length that do actually match, but every string that does match is at
+ be different from the number of data units. The fourth argument should
+ point to an int variable. A non-negative value is a lower bound to the
+ length of any matching string. There may not be any strings of that
+ length that do actually match, but every string that does match is at
least that long.
PCRE_INFO_NAMECOUNT
PCRE_INFO_NAMEENTRYSIZE
PCRE_INFO_NAMETABLE
- PCRE supports the use of named as well as numbered capturing parenthe-
- ses. The names are just an additional way of identifying the parenthe-
+ PCRE supports the use of named as well as numbered capturing parenthe-
+ ses. The names are just an additional way of identifying the parenthe-
ses, which still acquire numbers. Several convenience functions such as
- pcre_get_named_substring() are provided for extracting captured sub-
- strings by name. It is also possible to extract the data directly, by
- first converting the name to a number in order to access the correct
+ pcre_get_named_substring() are provided for extracting captured sub-
+ strings by name. It is also possible to extract the data directly, by
+ first converting the name to a number in order to access the correct
pointers in the output vector (described with pcre_exec() below). To do
- the conversion, you need to use the name-to-number map, which is
+ the conversion, you need to use the name-to-number map, which is
described by these three values.
The map consists of a number of fixed-size entries. PCRE_INFO_NAMECOUNT
gives the number of entries, and PCRE_INFO_NAMEENTRYSIZE gives the size
- of each entry; both of these return an int value. The entry size
- depends on the length of the longest name. PCRE_INFO_NAMETABLE returns
+ of each entry; both of these return an int value. The entry size
+ depends on the length of the longest name. PCRE_INFO_NAMETABLE returns
a pointer to the first entry of the table. This is a pointer to char in
the 8-bit library, where the first two bytes of each entry are the num-
- ber of the capturing parenthesis, most significant byte first. In the
- 16-bit library, the pointer points to 16-bit data units, the first of
- which contains the parenthesis number. In the 32-bit library, the
- pointer points to 32-bit data units, the first of which contains the
- parenthesis number. The rest of the entry is the corresponding name,
+ ber of the capturing parenthesis, most significant byte first. In the
+ 16-bit library, the pointer points to 16-bit data units, the first of
+ which contains the parenthesis number. In the 32-bit library, the
+ pointer points to 32-bit data units, the first of which contains the
+ parenthesis number. The rest of the entry is the corresponding name,
zero terminated.
- The names are in alphabetical order. Duplicate names may appear if (?|
- is used to create multiple groups with the same number, as described in
- the section on duplicate subpattern numbers in the pcrepattern page.
- Duplicate names for subpatterns with different numbers are permitted
- only if PCRE_DUPNAMES is set. In all cases of duplicate names, they
- appear in the table in the order in which they were found in the pat-
- tern. In the absence of (?| this is the order of increasing number;
- when (?| is used this is not necessarily the case because later subpat-
- terns may have lower numbers.
+ The names are in alphabetical order. If (?| is used to create multiple
+ groups with the same number, as described in the section on duplicate
+ subpattern numbers in the pcrepattern page, the groups may be given the
+ same name, but there is only one entry in the table. Different names
+ for groups of the same number are not permitted. Duplicate names for
+ subpatterns with different numbers are permitted, but only if PCRE_DUP-
+ NAMES is set. They appear in the table in the order in which they were
+ found in the pattern. In the absence of (?| this is the order of
+ increasing number; when (?| is used this is not necessarily the case
+ because later subpatterns may have lower numbers.
As a simple example of the name/number table, consider the following
pattern after compilation by the 8-bit library (assume PCRE_EXTENDED is
@@ -2924,27 +2978,15 @@ INFORMATION ABOUT A PATTERN
PCRE_INFO_FIRSTCHARACTER
- Return the fixed first character value, if PCRE_INFO_FIRSTCHARACTER-
- FLAGS returned 1; otherwise returns 0. The fourth argument should point
- to an uint_t variable.
+ Return the fixed first character value in the situation where
+ PCRE_INFO_FIRSTCHARACTERFLAGS returns 1; otherwise return 0. The fourth
+ argument should point to an uint_t variable.
In the 8-bit library, the value is always less than 256. In the 16-bit
library the value can be up to 0xffff. In the 32-bit library in UTF-32
mode the value can be up to 0x10ffff, and up to 0xffffffff when not
using UTF-32 mode.
- If there is no fixed first value, and if either
-
- (a) the pattern was compiled with the PCRE_MULTILINE option, and every
- branch starts with "^", or
-
- (b) every branch of the pattern starts with ".*" and PCRE_DOTALL is not
- set (if it were set, the pattern would be anchored),
-
- -1 is returned, indicating that the pattern matches only at the start
- of a subject string or after any newline within the string. Otherwise
- -2 is returned. For anchored patterns, -2 is returned.
-
PCRE_INFO_REQUIREDCHARFLAGS
Returns 1 if there is a rightmost literal data unit that must exist in
@@ -3133,16 +3175,20 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
The callout_data field is used in conjunction with the "callout" fea-
ture, and is described in the pcrecallout documentation.
- The tables field is used to pass a character tables pointer to
- pcre_exec(); this overrides the value that is stored with the compiled
- pattern. A non-NULL value is stored with the compiled pattern only if
- custom tables were supplied to pcre_compile() via its tableptr argu-
- ment. If NULL is passed to pcre_exec() using this mechanism, it forces
- PCRE's internal tables to be used. This facility is helpful when re-
- using patterns that have been saved after compiling with an external
- set of tables, because the external tables might be at a different
- address when pcre_exec() is called. See the pcreprecompile documenta-
- tion for a discussion of saving compiled patterns for later use.
+ The tables field is provided for use with patterns that have been pre-
+ compiled using custom character tables, saved to disc or elsewhere, and
+ then reloaded, because the tables that were used to compile a pattern
+ are not saved with it. See the pcreprecompile documentation for a dis-
+ cussion of saving compiled patterns for later use. If NULL is passed
+ using this mechanism, it forces PCRE's internal tables to be used.
+
+ Warning: The tables that pcre_exec() uses must be the same as those
+ that were used when the pattern was compiled. If this is not the case,
+ the behaviour of pcre_exec() is undefined. Therefore, when a pattern is
+ compiled and matched in the same process, this field should never be
+ set. In this (the most common) case, the correct table pointer is auto-
+ matically passed with the compiled pattern from pcre_compile() to
+ pcre_exec().
If PCRE_EXTRA_MARK is set in the flags field, the mark field must be
set to point to a suitable variable. If the pattern contains any back-
@@ -3351,7 +3397,7 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
points to the start of a character (or the end of the subject). When
PCRE_NO_UTF8_CHECK is set, the effect of passing an invalid string as a
subject or an invalid value of startoffset is undefined. Your program
- may crash.
+ may crash or loop.
PCRE_PARTIAL_HARD
PCRE_PARTIAL_SOFT
@@ -4131,55 +4177,64 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
filled with the longest matches. Unlike pcre_exec(), pcre_dfa_exec()
can use the entire ovector for returning matched strings.
+ NOTE: PCRE's "auto-possessification" optimization usually applies to
+ character repeats at the end of a pattern (as well as internally). For
+ example, the pattern "a\d+" is compiled as if it were "a\d++" because
+ there is no point even considering the possibility of backtracking into
+ the repeated digits. For DFA matching, this means that only one possi-
+ ble match is found. If you really do want multiple matches in such
+ cases, either use an ungreedy repeat ("a\d+?") or set the
+ PCRE_NO_AUTO_POSSESS option when compiling.
+
Error returns from pcre_dfa_exec()
- The pcre_dfa_exec() function returns a negative number when it fails.
- Many of the errors are the same as for pcre_exec(), and these are
- described above. There are in addition the following errors that are
+ The pcre_dfa_exec() function returns a negative number when it fails.
+ Many of the errors are the same as for pcre_exec(), and these are
+ described above. There are in addition the following errors that are
specific to pcre_dfa_exec():
PCRE_ERROR_DFA_UITEM (-16)
- This return is given if pcre_dfa_exec() encounters an item in the pat-
- tern that it does not support, for instance, the use of \C or a back
+ This return is given if pcre_dfa_exec() encounters an item in the pat-
+ tern that it does not support, for instance, the use of \C or a back
reference.
PCRE_ERROR_DFA_UCOND (-17)
- This return is given if pcre_dfa_exec() encounters a condition item
- that uses a back reference for the condition, or a test for recursion
+ This return is given if pcre_dfa_exec() encounters a condition item
+ that uses a back reference for the condition, or a test for recursion
in a specific group. These are not supported.
PCRE_ERROR_DFA_UMLIMIT (-18)
- This return is given if pcre_dfa_exec() is called with an extra block
- that contains a setting of the match_limit or match_limit_recursion
- fields. This is not supported (these fields are meaningless for DFA
+ This return is given if pcre_dfa_exec() is called with an extra block
+ that contains a setting of the match_limit or match_limit_recursion
+ fields. This is not supported (these fields are meaningless for DFA
matching).
PCRE_ERROR_DFA_WSSIZE (-19)
- This return is given if pcre_dfa_exec() runs out of space in the
+ This return is given if pcre_dfa_exec() runs out of space in the
workspace vector.
PCRE_ERROR_DFA_RECURSE (-20)
- When a recursive subpattern is processed, the matching function calls
- itself recursively, using private vectors for ovector and workspace.
- This error is given if the output vector is not large enough. This
+ When a recursive subpattern is processed, the matching function calls
+ itself recursively, using private vectors for ovector and workspace.
+ This error is given if the output vector is not large enough. This
should be extremely rare, as a vector of size 1000 is used.
PCRE_ERROR_DFA_BADRESTART (-30)
- When pcre_dfa_exec() is called with the PCRE_DFA_RESTART option, some
- plausibility checks are made on the contents of the workspace, which
- should contain data about the previous partial match. If any of these
+ When pcre_dfa_exec() is called with the PCRE_DFA_RESTART option, some
+ plausibility checks are made on the contents of the workspace, which
+ should contain data about the previous partial match. If any of these
checks fail, this error is given.
SEE ALSO
- pcre16(3), pcre32(3), pcrebuild(3), pcrecallout(3), pcrecpp(3)(3),
+ pcre16(3), pcre32(3), pcrebuild(3), pcrecallout(3), pcrecpp(3)(3),
pcrematching(3), pcrepartial(3), pcreposix(3), pcreprecompile(3), pcre-
sample(3), pcrestack(3).
@@ -4193,7 +4248,7 @@ AUTHOR
REVISION
- Last updated: 12 May 2013
+ Last updated: 12 November 2013
Copyright (c) 1997-2013 University of Cambridge.
------------------------------------------------------------------------------
@@ -4256,43 +4311,77 @@ DESCRIPTION
independent groups).
Automatic callouts can be used for tracking the progress of pattern
- matching. The pcretest command has an option that sets automatic call-
- outs; when it is used, the output indicates how the pattern is matched.
- This is useful information when you are trying to optimize the perfor-
- mance of a particular pattern.
+ matching. The pcretest program has a pattern qualifier (/C) that sets
+ automatic callouts; when it is used, the output indicates how the pat-
+ tern is being matched. This is useful information when you are trying
+ to optimize the performance of a particular pattern.
MISSING CALLOUTS
- You should be aware that, because of optimizations in the way PCRE
- matches patterns by default, callouts sometimes do not happen. For
- example, if the pattern is
+ You should be aware that, because of optimizations in the way PCRE com-
+ piles and matches patterns, callouts sometimes do not happen exactly as
+ you might expect.
+
+ At compile time, PCRE "auto-possessifies" repeated items when it knows
+ that what follows cannot be part of the repeat. For example, a+[bc] is
+ compiled as if it were a++[bc]. The pcretest output when this pattern
+ is anchored and then applied with automatic callouts to the string
+ "aaaa" is:
+
+ --->aaaa
+ +0 ^ ^
+ +1 ^ a+
+ +3 ^ ^ [bc]
+ No match
+
+ This indicates that when matching [bc] fails, there is no backtracking
+ into a+ and therefore the callouts that would be taken for the back-
+ tracks do not occur. You can disable the auto-possessify feature by
+ passing PCRE_NO_AUTO_POSSESS to pcre_compile(), or starting the pattern
+ with (*NO_AUTO_POSSESS). If this is done in pcretest (using the /O
+ qualifier), the output changes to this:
+
+ --->aaaa
+ +0 ^ ^
+ +1 ^ a+
+ +3 ^ ^ [bc]
+ +3 ^ ^ [bc]
+ +3 ^ ^ [bc]
+ +3 ^^ [bc]
+ No match
+
+ This time, when matching [bc] fails, the matcher backtracks into a+ and
+ tries again, repeatedly, until a+ itself fails.
+
+ Other optimizations that provide fast "no match" results also affect
+ callouts. For example, if the pattern is
ab(?C4)cd
PCRE knows that any matching string must contain the letter "d". If the
- subject string is "abyz", the lack of "d" means that matching doesn't
- ever start, and the callout is never reached. However, with "abyd",
+ subject string is "abyz", the lack of "d" means that matching doesn't
+ ever start, and the callout is never reached. However, with "abyd",
though the result is still no match, the callout is obeyed.
- If the pattern is studied, PCRE knows the minimum length of a matching
- string, and will immediately give a "no match" return without actually
- running a match if the subject is not long enough, or, for unanchored
+ If the pattern is studied, PCRE knows the minimum length of a matching
+ string, and will immediately give a "no match" return without actually
+ running a match if the subject is not long enough, or, for unanchored
patterns, if it has been scanned far enough.
- You can disable these optimizations by passing the PCRE_NO_START_OPTI-
- MIZE option to the matching function, or by starting the pattern with
- (*NO_START_OPT). This slows down the matching process, but does ensure
+ You can disable these optimizations by passing the PCRE_NO_START_OPTI-
+ MIZE option to the matching function, or by starting the pattern with
+ (*NO_START_OPT). This slows down the matching process, but does ensure
that callouts such as the example above are obeyed.
THE CALLOUT INTERFACE
- During matching, when PCRE reaches a callout point, the external func-
+ During matching, when PCRE reaches a callout point, the external func-
tion defined by pcre_callout or pcre[16|32]_callout is called (if it is
- set). This applies to both normal and DFA matching. The only argument
- to the callout function is a pointer to a pcre_callout or
- pcre[16|32]_callout block. These structures contains the following
+ set). This applies to both normal and DFA matching. The only argument
+ to the callout function is a pointer to a pcre_callout or
+ pcre[16|32]_callout block. These structures contains the following
fields:
int version;
@@ -4313,92 +4402,92 @@ THE CALLOUT INTERFACE
const PCRE_UCHAR16 *mark; (16-bit version)
const PCRE_UCHAR32 *mark; (32-bit version)
- The version field is an integer containing the version number of the
- block format. The initial version was 0; the current version is 2. The
- version number will change again in future if additional fields are
+ The version field is an integer containing the version number of the
+ block format. The initial version was 0; the current version is 2. The
+ version number will change again in future if additional fields are
added, but the intention is never to remove any of the existing fields.
- The callout_number field contains the number of the callout, as com-
- piled into the pattern (that is, the number after ?C for manual call-
+ The callout_number field contains the number of the callout, as com-
+ piled into the pattern (that is, the number after ?C for manual call-
outs, and 255 for automatically generated callouts).
- The offset_vector field is a pointer to the vector of offsets that was
- passed by the caller to the matching function. When pcre_exec() or
- pcre[16|32]_exec() is used, the contents can be inspected, in order to
- extract substrings that have been matched so far, in the same way as
- for extracting substrings after a match has completed. For the DFA
+ The offset_vector field is a pointer to the vector of offsets that was
+ passed by the caller to the matching function. When pcre_exec() or
+ pcre[16|32]_exec() is used, the contents can be inspected, in order to
+ extract substrings that have been matched so far, in the same way as
+ for extracting substrings after a match has completed. For the DFA
matching functions, this field is not useful.
The subject and subject_length fields contain copies of the values that
were passed to the matching function.
- The start_match field normally contains the offset within the subject
- at which the current match attempt started. However, if the escape
- sequence \K has been encountered, this value is changed to reflect the
- modified starting point. If the pattern is not anchored, the callout
+ The start_match field normally contains the offset within the subject
+ at which the current match attempt started. However, if the escape
+ sequence \K has been encountered, this value is changed to reflect the
+ modified starting point. If the pattern is not anchored, the callout
function may be called several times from the same point in the pattern
for different starting points in the subject.
- The current_position field contains the offset within the subject of
+ The current_position field contains the offset within the subject of
the current match pointer.
- When the pcre_exec() or pcre[16|32]_exec() is used, the capture_top
- field contains one more than the number of the highest numbered cap-
- tured substring so far. If no substrings have been captured, the value
- of capture_top is one. This is always the case when the DFA functions
+ When the pcre_exec() or pcre[16|32]_exec() is used, the capture_top
+ field contains one more than the number of the highest numbered cap-
+ tured substring so far. If no substrings have been captured, the value
+ of capture_top is one. This is always the case when the DFA functions
are used, because they do not support captured substrings.
- The capture_last field contains the number of the most recently cap-
- tured substring. However, when a recursion exits, the value reverts to
- what it was outside the recursion, as do the values of all captured
- substrings. If no substrings have been captured, the value of cap-
- ture_last is -1. This is always the case for the DFA matching func-
+ The capture_last field contains the number of the most recently cap-
+ tured substring. However, when a recursion exits, the value reverts to
+ what it was outside the recursion, as do the values of all captured
+ substrings. If no substrings have been captured, the value of cap-
+ ture_last is -1. This is always the case for the DFA matching func-
tions.
- The callout_data field contains a value that is passed to a matching
- function specifically so that it can be passed back in callouts. It is
- passed in the callout_data field of a pcre_extra or pcre[16|32]_extra
- data structure. If no such data was passed, the value of callout_data
- in a callout block is NULL. There is a description of the pcre_extra
+ The callout_data field contains a value that is passed to a matching
+ function specifically so that it can be passed back in callouts. It is
+ passed in the callout_data field of a pcre_extra or pcre[16|32]_extra
+ data structure. If no such data was passed, the value of callout_data
+ in a callout block is NULL. There is a description of the pcre_extra
structure in the pcreapi documentation.
- The pattern_position field is present from version 1 of the callout
+ The pattern_position field is present from version 1 of the callout
structure. It contains the offset to the next item to be matched in the
pattern string.
- The next_item_length field is present from version 1 of the callout
+ The next_item_length field is present from version 1 of the callout
structure. It contains the length of the next item to be matched in the
- pattern string. When the callout immediately precedes an alternation
- bar, a closing parenthesis, or the end of the pattern, the length is
- zero. When the callout precedes an opening parenthesis, the length is
+ pattern string. When the callout immediately precedes an alternation
+ bar, a closing parenthesis, or the end of the pattern, the length is
+ zero. When the callout precedes an opening parenthesis, the length is
that of the entire subpattern.
- The pattern_position and next_item_length fields are intended to help
- in distinguishing between different automatic callouts, which all have
+ The pattern_position and next_item_length fields are intended to help
+ in distinguishing between different automatic callouts, which all have
the same callout number. However, they are set for all callouts.
- The mark field is present from version 2 of the callout structure. In
- callouts from pcre_exec() or pcre[16|32]_exec() it contains a pointer
- to the zero-terminated name of the most recently passed (*MARK),
- (*PRUNE), or (*THEN) item in the match, or NULL if no such items have
- been passed. Instances of (*PRUNE) or (*THEN) without a name do not
- obliterate a previous (*MARK). In callouts from the DFA matching func-
+ The mark field is present from version 2 of the callout structure. In
+ callouts from pcre_exec() or pcre[16|32]_exec() it contains a pointer
+ to the zero-terminated name of the most recently passed (*MARK),
+ (*PRUNE), or (*THEN) item in the match, or NULL if no such items have
+ been passed. Instances of (*PRUNE) or (*THEN) without a name do not
+ obliterate a previous (*MARK). In callouts from the DFA matching func-
tions this field always contains NULL.
RETURN VALUES
- The external callout function returns an integer to PCRE. If the value
- is zero, matching proceeds as normal. If the value is greater than
- zero, matching fails at the current point, but the testing of other
+ The external callout function returns an integer to PCRE. If the value
+ is zero, matching proceeds as normal. If the value is greater than
+ zero, matching fails at the current point, but the testing of other
matching possibilities goes ahead, just as if a lookahead assertion had
- failed. If the value is less than zero, the match is abandoned, the
+ failed. If the value is less than zero, the match is abandoned, the
matching function returns the negative value.
- Negative values should normally be chosen from the set of
+ Negative values should normally be chosen from the set of
PCRE_ERROR_xxx values. In particular, PCRE_ERROR_NOMATCH forces a stan-
- dard "no match" failure. The error number PCRE_ERROR_CALLOUT is
- reserved for use by callout functions; it will never be used by PCRE
+ dard "no match" failure. The error number PCRE_ERROR_CALLOUT is
+ reserved for use by callout functions; it will never be used by PCRE
itself.
@@ -4411,7 +4500,7 @@ AUTHOR
REVISION
- Last updated: 03 March 2013
+ Last updated: 12 November 2013
Copyright (c) 1997-2013 University of Cambridge.
------------------------------------------------------------------------------
@@ -4533,17 +4622,23 @@ DIFFERENCES BETWEEN PCRE AND PERL
15. Perl recognizes comments in some places that PCRE does not, for
example, between the ( and ? at the start of a subpattern. If the /x
- modifier is set, Perl allows white space between ( and ? but PCRE never
- does, even if the PCRE_EXTENDED option is set.
+ modifier is set, Perl allows white space between ( and ? (though cur-
+ rent Perls warn that this is deprecated) but PCRE never does, even if
+ the PCRE_EXTENDED option is set.
+
+ 16. Perl, when in warning mode, gives warnings for character classes
+ such as [A-\d] or [a-[:digit:]]. It then treats the hyphens as liter-
+ als. PCRE has no warning features, so it gives an error in these cases
+ because they are almost certainly user mistakes.
- 16. In PCRE, the upper/lower case character properties Lu and Ll are
+ 17. In PCRE, the upper/lower case character properties Lu and Ll are
not affected when case-independent matching is specified. For example,
\p{Lu} always matches an upper case letter. I think Perl has changed in
this respect; in the release at the time of writing (5.16), \p{Lu} and
\p{Ll} match all letters, regardless of case, when case independence is
specified.
- 17. PCRE provides some extensions to the Perl regular expression facil-
+ 18. PCRE provides some extensions to the Perl regular expression facil-
ities. Perl 5.10 includes new features that are not in earlier ver-
sions of Perl, some of which (such as named parentheses) have been in
PCRE for some time. This list is with respect to Perl 5.10:
@@ -4600,7 +4695,7 @@ AUTHOR
REVISION
- Last updated: 19 March 2013
+ Last updated: 10 November 2013
Copyright (c) 1997-2013 University of Cambridge.
------------------------------------------------------------------------------
@@ -4679,20 +4774,26 @@ SPECIAL START-OF-PATTERN ITEMS
Unicode property support
- Another special sequence that may appear at the start of a pattern is
+ Another special sequence that may appear at the start of a pattern is
+ (*UCP). This has the same effect as setting the PCRE_UCP option: it
+ causes sequences such as \d and \w to use Unicode properties to deter-
+ mine character types, instead of recognizing only characters with codes
+ less than 128 via a lookup table.
- (*UCP)
+ Disabling auto-possessification
- This has the same effect as setting the PCRE_UCP option: it causes
- sequences such as \d and \w to use Unicode properties to determine
- character types, instead of recognizing only characters with codes less
- than 128 via a lookup table.
+ If a pattern starts with (*NO_AUTO_POSSESS), it has the same effect as
+ setting the PCRE_NO_AUTO_POSSESS option at compile time. This stops
+ PCRE from making quantifiers possessive when what follows cannot match
+ the repeated item. For example, by default a+b is treated as a++b. For
+ more details, see the pcreapi documentation.
Disabling start-up optimizations
- If a pattern starts with (*NO_START_OPT), it has the same effect as
+ If a pattern starts with (*NO_START_OPT), it has the same effect as
setting the PCRE_NO_START_OPTIMIZE option either at compile or matching
- time.
+ time. This disables several optimizations for quickly reaching "no
+ match" results. For more details, see the pcreapi documentation.
Newline conventions
@@ -4746,48 +4847,49 @@ SPECIAL START-OF-PATTERN ITEMS
(*LIMIT_RECURSION=d)
where d is any number of decimal digits. However, the value of the set-
- ting must be less than the value set by the caller of pcre_exec() for
- it to have any effect. In other words, the pattern writer can lower the
- limit set by the programmer, but not raise it. If there is more than
- one setting of one of these limits, the lower value is used.
+ ting must be less than the value set (or defaulted) by the caller of
+ pcre_exec() for it to have any effect. In other words, the pattern
+ writer can lower the limits set by the programmer, but not raise them.
+ If there is more than one setting of one of these limits, the lower
+ value is used.
EBCDIC CHARACTER CODES
- PCRE can be compiled to run in an environment that uses EBCDIC as its
+ PCRE can be compiled to run in an environment that uses EBCDIC as its
character code rather than ASCII or Unicode (typically a mainframe sys-
- tem). In the sections below, character code values are ASCII or Uni-
+ tem). In the sections below, character code values are ASCII or Uni-
code; in an EBCDIC environment these characters may have different code
values, and there are no code points greater than 255.
CHARACTERS AND METACHARACTERS
- A regular expression is a pattern that is matched against a subject
- string from left to right. Most characters stand for themselves in a
- pattern, and match the corresponding characters in the subject. As a
+ A regular expression is a pattern that is matched against a subject
+ string from left to right. Most characters stand for themselves in a
+ pattern, and match the corresponding characters in the subject. As a
trivial example, the pattern
The quick brown fox
matches a portion of a subject string that is identical to itself. When
- caseless matching is specified (the PCRE_CASELESS option), letters are
- matched independently of case. In a UTF mode, PCRE always understands
- the concept of case for characters whose values are less than 128, so
- caseless matching is always possible. For characters with higher val-
- ues, the concept of case is supported if PCRE is compiled with Unicode
- property support, but not otherwise. If you want to use caseless
- matching for characters 128 and above, you must ensure that PCRE is
+ caseless matching is specified (the PCRE_CASELESS option), letters are
+ matched independently of case. In a UTF mode, PCRE always understands
+ the concept of case for characters whose values are less than 128, so
+ caseless matching is always possible. For characters with higher val-
+ ues, the concept of case is supported if PCRE is compiled with Unicode
+ property support, but not otherwise. If you want to use caseless
+ matching for characters 128 and above, you must ensure that PCRE is
compiled with Unicode property support as well as with UTF support.
- The power of regular expressions comes from the ability to include
- alternatives and repetitions in the pattern. These are encoded in the
+ The power of regular expressions comes from the ability to include
+ alternatives and repetitions in the pattern. These are encoded in the
pattern by the use of metacharacters, which do not stand for themselves
but instead are interpreted in some special way.
- There are two different sets of metacharacters: those that are recog-
- nized anywhere in the pattern except within square brackets, and those
- that are recognized within square brackets. Outside square brackets,
+ There are two different sets of metacharacters: those that are recog-
+ nized anywhere in the pattern except within square brackets, and those
+ that are recognized within square brackets. Outside square brackets,
the metacharacters are as follows:
\ general escape character with several uses
@@ -4806,7 +4908,7 @@ CHARACTERS AND METACHARACTERS
also "possessive quantifier"
{ start min/max quantifier
- Part of a pattern that is in square brackets is called a "character
+ Part of a pattern that is in square brackets is called a "character
class". In a character class the only metacharacters are:
\ general escape character
@@ -4823,30 +4925,30 @@ BACKSLASH
The backslash character has several uses. Firstly, if it is followed by
a character that is not a number or a letter, it takes away any special
- meaning that character may have. This use of backslash as an escape
+ meaning that character may have. This use of backslash as an escape
character applies both inside and outside character classes.
- For example, if you want to match a * character, you write \* in the
- pattern. This escaping action applies whether or not the following
- character would otherwise be interpreted as a metacharacter, so it is
- always safe to precede a non-alphanumeric with backslash to specify
- that it stands for itself. In particular, if you want to match a back-
+ For example, if you want to match a * character, you write \* in the
+ pattern. This escaping action applies whether or not the following
+ character would otherwise be interpreted as a metacharacter, so it is
+ always safe to precede a non-alphanumeric with backslash to specify
+ that it stands for itself. In particular, if you want to match a back-
slash, you write \\.
- In a UTF mode, only ASCII numbers and letters have any special meaning
- after a backslash. All other characters (in particular, those whose
+ In a UTF mode, only ASCII numbers and letters have any special meaning
+ after a backslash. All other characters (in particular, those whose
codepoints are greater than 127) are treated as literals.
- If a pattern is compiled with the PCRE_EXTENDED option, white space in
- the pattern (other than in a character class) and characters between a
- # outside a character class and the next newline are ignored. An escap-
- ing backslash can be used to include a white space or # character as
- part of the pattern.
+ If a pattern is compiled with the PCRE_EXTENDED option, most white
+ space in the pattern (other than in a character class), and characters
+ between a # outside a character class and the next newline, inclusive,
+ are ignored. An escaping backslash can be used to include a white space
+ or # character as part of the pattern.
- If you want to remove the special meaning from a sequence of charac-
- ters, you can do so by putting them between \Q and \E. This is differ-
- ent from Perl in that $ and @ are handled as literals in \Q...\E
- sequences in PCRE, whereas in Perl, $ and @ cause variable interpola-
+ If you want to remove the special meaning from a sequence of charac-
+ ters, you can do so by putting them between \Q and \E. This is differ-
+ ent from Perl in that $ and @ are handled as literals in \Q...\E
+ sequences in PCRE, whereas in Perl, $ and @ cause variable interpola-
tion. Note the following examples:
Pattern PCRE matches Perl matches
@@ -4856,20 +4958,20 @@ BACKSLASH
\Qabc\$xyz\E abc\$xyz abc\$xyz
\Qabc\E\$\Qxyz\E abc$xyz abc$xyz
- The \Q...\E sequence is recognized both inside and outside character
- classes. An isolated \E that is not preceded by \Q is ignored. If \Q
- is not followed by \E later in the pattern, the literal interpretation
- continues to the end of the pattern (that is, \E is assumed at the
- end). If the isolated \Q is inside a character class, this causes an
+ The \Q...\E sequence is recognized both inside and outside character
+ classes. An isolated \E that is not preceded by \Q is ignored. If \Q
+ is not followed by \E later in the pattern, the literal interpretation
+ continues to the end of the pattern (that is, \E is assumed at the
+ end). If the isolated \Q is inside a character class, this causes an
error, because the character class is not terminated.
Non-printing characters
A second use of backslash provides a way of encoding non-printing char-
- acters in patterns in a visible manner. There is no restriction on the
- appearance of non-printing characters, apart from the binary zero that
- terminates a pattern, but when a pattern is being prepared by text
- editing, it is often easier to use one of the following escape
+ acters in patterns in a visible manner. There is no restriction on the
+ appearance of non-printing characters, apart from the binary zero that
+ terminates a pattern, but when a pattern is being prepared by text
+ editing, it is often easier to use one of the following escape
sequences than the binary character it represents:
\a alarm, that is, the BEL character (hex 07)
@@ -4879,84 +4981,63 @@ BACKSLASH
\n linefeed (hex 0A)
\r carriage return (hex 0D)
\t tab (hex 09)
+ \0dd character with octal code 0dd
\ddd character with octal code ddd, or back reference
+ \o{ddd..} character with octal code ddd..
\xhh character with hex code hh
\x{hhh..} character with hex code hhh.. (non-JavaScript mode)
\uhhhh character with hex code hhhh (JavaScript mode only)
- The precise effect of \cx on ASCII characters is as follows: if x is a
- lower case letter, it is converted to upper case. Then bit 6 of the
+ The precise effect of \cx on ASCII characters is as follows: if x is a
+ lower case letter, it is converted to upper case. Then bit 6 of the
character (hex 40) is inverted. Thus \cA to \cZ become hex 01 to hex 1A
- (A is 41, Z is 5A), but \c{ becomes hex 3B ({ is 7B), and \c; becomes
- hex 7B (; is 3B). If the data item (byte or 16-bit value) following \c
- has a value greater than 127, a compile-time error occurs. This locks
+ (A is 41, Z is 5A), but \c{ becomes hex 3B ({ is 7B), and \c; becomes
+ hex 7B (; is 3B). If the data item (byte or 16-bit value) following \c
+ has a value greater than 127, a compile-time error occurs. This locks
out non-ASCII characters in all modes.
- The \c facility was designed for use with ASCII characters, but with
- the extension to Unicode it is even less useful than it once was. It
- is, however, recognized when PCRE is compiled in EBCDIC mode, where
- data items are always bytes. In this mode, all values are valid after
- \c. If the next character is a lower case letter, it is converted to
- upper case. Then the 0xc0 bits of the byte are inverted. Thus \cA
- becomes hex 01, as in ASCII (A is C1), but because the EBCDIC letters
- are disjoint, \cZ becomes hex 29 (Z is E9), and other characters also
+ The \c facility was designed for use with ASCII characters, but with
+ the extension to Unicode it is even less useful than it once was. It
+ is, however, recognized when PCRE is compiled in EBCDIC mode, where
+ data items are always bytes. In this mode, all values are valid after
+ \c. If the next character is a lower case letter, it is converted to
+ upper case. Then the 0xc0 bits of the byte are inverted. Thus \cA
+ becomes hex 01, as in ASCII (A is C1), but because the EBCDIC letters
+ are disjoint, \cZ becomes hex 29 (Z is E9), and other characters also
generate different values.
- By default, after \x, from zero to two hexadecimal digits are read
- (letters can be in upper or lower case). Any number of hexadecimal dig-
- its may appear between \x{ and }, but the character code is constrained
- as follows:
-
- 8-bit non-UTF mode less than 0x100
- 8-bit UTF-8 mode less than 0x10ffff and a valid codepoint
- 16-bit non-UTF mode less than 0x10000
- 16-bit UTF-16 mode less than 0x10ffff and a valid codepoint
- 32-bit non-UTF mode less than 0x80000000
- 32-bit UTF-32 mode less than 0x10ffff and a valid codepoint
-
- Invalid Unicode codepoints are the range 0xd800 to 0xdfff (the so-
- called "surrogate" codepoints), and 0xffef.
-
- If characters other than hexadecimal digits appear between \x{ and },
- or if there is no terminating }, this form of escape is not recognized.
- Instead, the initial \x will be interpreted as a basic hexadecimal
- escape, with no following digits, giving a character whose value is
- zero.
-
- If the PCRE_JAVASCRIPT_COMPAT option is set, the interpretation of \x
- is as just described only when it is followed by two hexadecimal dig-
- its. Otherwise, it matches a literal "x" character. In JavaScript
- mode, support for code points greater than 256 is provided by \u, which
- must be followed by four hexadecimal digits; otherwise it matches a
- literal "u" character. Character codes specified by \u in JavaScript
- mode are constrained in the same was as those specified by \x in non-
- JavaScript mode.
-
- Characters whose value is less than 256 can be defined by either of the
- two syntaxes for \x (or by \u in JavaScript mode). There is no differ-
- ence in the way they are handled. For example, \xdc is exactly the same
- as \x{dc} (or \u00dc in JavaScript mode).
-
- After \0 up to two further octal digits are read. If there are fewer
- than two digits, just those that are present are used. Thus the
+ After \0 up to two further octal digits are read. If there are fewer
+ than two digits, just those that are present are used. Thus the
sequence \0\x\07 specifies two binary zeros followed by a BEL character
- (code value 7). Make sure you supply two digits after the initial zero
+ (code value 7). Make sure you supply two digits after the initial zero
if the pattern character that follows is itself an octal digit.
+ The escape \o must be followed by a sequence of octal digits, enclosed
+ in braces. An error occurs if this is not the case. This escape is a
+ recent addition to Perl; it provides way of specifying character code
+ points as octal numbers greater than 0777, and it also allows octal
+ numbers and back references to be unambiguously specified.
+
+ For greater clarity and unambiguity, it is best to avoid following \ by
+ a digit greater than zero. Instead, use \o{} or \x{} to specify charac-
+ ter numbers, and \g{} to specify back references. The following para-
+ graphs describe the old, ambiguous syntax.
+
The handling of a backslash followed by a digit other than 0 is compli-
- cated. Outside a character class, PCRE reads it and any following dig-
- its as a decimal number. If the number is less than 10, or if there
- have been at least that many previous capturing left parentheses in the
- expression, the entire sequence is taken as a back reference. A
- description of how this works is given later, following the discussion
+ cated, and Perl has changed in recent releases, causing PCRE also to
+ change. Outside a character class, PCRE reads the digit and any follow-
+ ing digits as a decimal number. If the number is less than 8, or if
+ there have been at least that many previous capturing left parentheses
+ in the expression, the entire sequence is taken as a back reference. A
+ description of how this works is given later, following the discussion
of parenthesized subpatterns.
- Inside a character class, or if the decimal number is greater than 9
- and there have not been that many capturing subpatterns, PCRE re-reads
- up to three octal digits following the backslash, and uses them to gen-
- erate a data character. Any subsequent digits stand for themselves. The
- value of the character is constrained in the same way as characters
- specified in hexadecimal. For example:
+ Inside a character class, or if the decimal number following \ is
+ greater than 7 and there have not been that many capturing subpatterns,
+ PCRE handles \8 and \9 as the literal characters "8" and "9", and oth-
+ erwise re-reads up to three octal digits following the backslash, using
+ them to generate a data character. Any subsequent digits stand for
+ themselves. For example:
\040 is another way of writing an ASCII space
\40 is the same, provided there are fewer than 40
@@ -4970,11 +5051,47 @@ BACKSLASH
character with octal code 113
\377 might be a back reference, otherwise
the value 255 (decimal)
- \81 is either a back reference, or a binary zero
- followed by the two characters "8" and "1"
+ \81 is either a back reference, or the two
+ characters "8" and "1"
+
+ Note that octal values of 100 or greater that are specified using this
+ syntax must not be introduced by a leading zero, because no more than
+ three octal digits are ever read.
- Note that octal values of 100 or greater must not be introduced by a
- leading zero, because no more than three octal digits are ever read.
+ By default, after \x that is not followed by {, from zero to two hexa-
+ decimal digits are read (letters can be in upper or lower case). Any
+ number of hexadecimal digits may appear between \x{ and }. If a charac-
+ ter other than a hexadecimal digit appears between \x{ and }, or if
+ there is no terminating }, an error occurs.
+
+ If the PCRE_JAVASCRIPT_COMPAT option is set, the interpretation of \x
+ is as just described only when it is followed by two hexadecimal dig-
+ its. Otherwise, it matches a literal "x" character. In JavaScript
+ mode, support for code points greater than 256 is provided by \u, which
+ must be followed by four hexadecimal digits; otherwise it matches a
+ literal "u" character.
+
+ Characters whose value is less than 256 can be defined by either of the
+ two syntaxes for \x (or by \u in JavaScript mode). There is no differ-
+ ence in the way they are handled. For example, \xdc is exactly the same
+ as \x{dc} (or \u00dc in JavaScript mode).
+
+ Constraints on character values
+
+ Characters that are specified using octal or hexadecimal numbers are
+ limited to certain values, as follows:
+
+ 8-bit non-UTF mode less than 0x100
+ 8-bit UTF-8 mode less than 0x10ffff and a valid codepoint
+ 16-bit non-UTF mode less than 0x10000
+ 16-bit UTF-16 mode less than 0x10ffff and a valid codepoint
+ 32-bit non-UTF mode less than 0x100000000
+ 32-bit UTF-32 mode less than 0x10ffff and a valid codepoint
+
+ Invalid Unicode codepoints are the range 0xd800 to 0xdfff (the so-
+ called "surrogate" codepoints), and 0xffef.
+
+ Escape sequences in character classes
All the sequences that define a single character value can be used both
inside and outside character classes. In addition, inside a character
@@ -5039,43 +5156,48 @@ BACKSLASH
the subject string, all of them fail, because there is no character to
match.
- For compatibility with Perl, \s does not match the VT character (code
- 11). This makes it different from the the POSIX "space" class. The \s
- characters are HT (9), LF (10), FF (12), CR (13), and space (32). If
- "use locale;" is included in a Perl script, \s may match the VT charac-
- ter. In PCRE, it never does.
+ For compatibility with Perl, \s did not used to match the VT character
+ (code 11), which made it different from the the POSIX "space" class.
+ However, Perl added VT at release 5.18, and PCRE followed suit at
+ release 8.34. The default \s characters are now HT (9), LF (10), VT
+ (11), FF (12), CR (13), and space (32), which are defined as white
+ space in the "C" locale. This list may vary if locale-specific matching
+ is taking place. For example, in some locales the "non-breaking space"
+ character (\xA0) is recognized as white space, and in others the VT
+ character is not.
A "word" character is an underscore or any character that is a letter
or digit. By default, the definition of letters and digits is con-
trolled by PCRE's low-valued character tables, and may vary if locale-
specific matching is taking place (see "Locale support" in the pcreapi
page). For example, in a French locale such as "fr_FR" in Unix-like
- systems, or "french" in Windows, some character codes greater than 128
+ systems, or "french" in Windows, some character codes greater than 127
are used for accented letters, and these are then matched by \w. The
use of locales with Unicode is discouraged.
- By default, in a UTF mode, characters with values greater than 128
- never match \d, \s, or \w, and always match \D, \S, and \W. These
- sequences retain their original meanings from before UTF support was
- available, mainly for efficiency reasons. However, if PCRE is compiled
- with Unicode property support, and the PCRE_UCP option is set, the be-
- haviour is changed so that Unicode properties are used to determine
- character types, as follows:
-
- \d any character that \p{Nd} matches (decimal digit)
- \s any character that \p{Z} matches, plus HT, LF, FF, CR
- \w any character that \p{L} or \p{N} matches, plus underscore
-
- The upper case escapes match the inverse sets of characters. Note that
- \d matches only decimal digits, whereas \w matches any Unicode digit,
- as well as any Unicode letter, and underscore. Note also that PCRE_UCP
- affects \b, and \B because they are defined in terms of \w and \W.
+ By default, characters whose code points are greater than 127 never
+ match \d, \s, or \w, and always match \D, \S, and \W, although this may
+ vary for characters in the range 128-255 when locale-specific matching
+ is happening. These escape sequences retain their original meanings
+ from before Unicode support was available, mainly for efficiency rea-
+ sons. If PCRE is compiled with Unicode property support, and the
+ PCRE_UCP option is set, the behaviour is changed so that Unicode prop-
+ erties are used to determine character types, as follows:
+
+ \d any character that matches \p{Nd} (decimal digit)
+ \s any character that matches \p{Z} or \h or \v
+ \w any character that matches \p{L} or \p{N}, plus underscore
+
+ The upper case escapes match the inverse sets of characters. Note that
+ \d matches only decimal digits, whereas \w matches any Unicode digit,
+ as well as any Unicode letter, and underscore. Note also that PCRE_UCP
+ affects \b, and \B because they are defined in terms of \w and \W.
Matching these sequences is noticeably slower when PCRE_UCP is set.
- The sequences \h, \H, \v, and \V are features that were added to Perl
- at release 5.10. In contrast to the other sequences, which match only
- ASCII characters by default, these always match certain high-valued
- codepoints, whether or not PCRE_UCP is set. The horizontal space char-
+ The sequences \h, \H, \v, and \V are features that were added to Perl
+ at release 5.10. In contrast to the other sequences, which match only
+ ASCII characters by default, these always match certain high-valued
+ code points, whether or not PCRE_UCP is set. The horizontal space char-
acters are:
U+0009 Horizontal tab (HT)
@@ -5113,106 +5235,106 @@ BACKSLASH
Newline sequences
- Outside a character class, by default, the escape sequence \R matches
- any Unicode newline sequence. In 8-bit non-UTF-8 mode \R is equivalent
+ Outside a character class, by default, the escape sequence \R matches
+ any Unicode newline sequence. In 8-bit non-UTF-8 mode \R is equivalent
to the following:
(?>\r\n|\n|\x0b|\f|\r|\x85)
- This is an example of an "atomic group", details of which are given
+ This is an example of an "atomic group", details of which are given
below. This particular group matches either the two-character sequence
- CR followed by LF, or one of the single characters LF (linefeed,
- U+000A), VT (vertical tab, U+000B), FF (form feed, U+000C), CR (car-
- riage return, U+000D), or NEL (next line, U+0085). The two-character
+ CR followed by LF, or one of the single characters LF (linefeed,
+ U+000A), VT (vertical tab, U+000B), FF (form feed, U+000C), CR (car-
+ riage return, U+000D), or NEL (next line, U+0085). The two-character
sequence is treated as a single unit that cannot be split.
- In other modes, two additional characters whose codepoints are greater
+ In other modes, two additional characters whose codepoints are greater
than 255 are added: LS (line separator, U+2028) and PS (paragraph sepa-
- rator, U+2029). Unicode character property support is not needed for
+ rator, U+2029). Unicode character property support is not needed for
these characters to be recognized.
It is possible to restrict \R to match only CR, LF, or CRLF (instead of
- the complete set of Unicode line endings) by setting the option
+ the complete set of Unicode line endings) by setting the option
PCRE_BSR_ANYCRLF either at compile time or when the pattern is matched.
(BSR is an abbrevation for "backslash R".) This can be made the default
- when PCRE is built; if this is the case, the other behaviour can be
- requested via the PCRE_BSR_UNICODE option. It is also possible to
- specify these settings by starting a pattern string with one of the
+ when PCRE is built; if this is the case, the other behaviour can be
+ requested via the PCRE_BSR_UNICODE option. It is also possible to
+ specify these settings by starting a pattern string with one of the
following sequences:
(*BSR_ANYCRLF) CR, LF, or CRLF only
(*BSR_UNICODE) any Unicode newline sequence
These override the default and the options given to the compiling func-
- tion, but they can themselves be overridden by options given to a
- matching function. Note that these special settings, which are not
- Perl-compatible, are recognized only at the very start of a pattern,
- and that they must be in upper case. If more than one of them is
- present, the last one is used. They can be combined with a change of
+ tion, but they can themselves be overridden by options given to a
+ matching function. Note that these special settings, which are not
+ Perl-compatible, are recognized only at the very start of a pattern,
+ and that they must be in upper case. If more than one of them is
+ present, the last one is used. They can be combined with a change of
newline convention; for example, a pattern can start with:
(*ANY)(*BSR_ANYCRLF)
- They can also be combined with the (*UTF8), (*UTF16), (*UTF32), (*UTF)
+ They can also be combined with the (*UTF8), (*UTF16), (*UTF32), (*UTF)
or (*UCP) special sequences. Inside a character class, \R is treated as
- an unrecognized escape sequence, and so matches the letter "R" by
+ an unrecognized escape sequence, and so matches the letter "R" by
default, but causes an error if PCRE_EXTRA is set.
Unicode character properties
When PCRE is built with Unicode character property support, three addi-
- tional escape sequences that match characters with specific properties
- are available. When in 8-bit non-UTF-8 mode, these sequences are of
- course limited to testing characters whose codepoints are less than
+ tional escape sequences that match characters with specific properties
+ are available. When in 8-bit non-UTF-8 mode, these sequences are of
+ course limited to testing characters whose codepoints are less than
256, but they do work in this mode. The extra escape sequences are:
\p{xx} a character with the xx property
\P{xx} a character without the xx property
\X a Unicode extended grapheme cluster
- The property names represented by xx above are limited to the Unicode
+ The property names represented by xx above are limited to the Unicode
script names, the general category properties, "Any", which matches any
- character (including newline), and some special PCRE properties
- (described in the next section). Other Perl properties such as "InMu-
- sicalSymbols" are not currently supported by PCRE. Note that \P{Any}
+ character (including newline), and some special PCRE properties
+ (described in the next section). Other Perl properties such as "InMu-
+ sicalSymbols" are not currently supported by PCRE. Note that \P{Any}
does not match any characters, so always causes a match failure.
Sets of Unicode characters are defined as belonging to certain scripts.
- A character from one of these sets can be matched using a script name.
+ A character from one of these sets can be matched using a script name.
For example:
\p{Greek}
\P{Han}
- Those that are not part of an identified script are lumped together as
+ Those that are not part of an identified script are lumped together as
"Common". The current list of scripts is:
- Arabic, Armenian, Avestan, Balinese, Bamum, Batak, Bengali, Bopomofo,
- Brahmi, Braille, Buginese, Buhid, Canadian_Aboriginal, Carian, Chakma,
- Cham, Cherokee, Common, Coptic, Cuneiform, Cypriot, Cyrillic, Deseret,
- Devanagari, Egyptian_Hieroglyphs, Ethiopic, Georgian, Glagolitic,
- Gothic, Greek, Gujarati, Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hira-
- gana, Imperial_Aramaic, Inherited, Inscriptional_Pahlavi, Inscrip-
- tional_Parthian, Javanese, Kaithi, Kannada, Katakana, Kayah_Li,
- Kharoshthi, Khmer, Lao, Latin, Lepcha, Limbu, Linear_B, Lisu, Lycian,
+ Arabic, Armenian, Avestan, Balinese, Bamum, Batak, Bengali, Bopomofo,
+ Brahmi, Braille, Buginese, Buhid, Canadian_Aboriginal, Carian, Chakma,
+ Cham, Cherokee, Common, Coptic, Cuneiform, Cypriot, Cyrillic, Deseret,
+ Devanagari, Egyptian_Hieroglyphs, Ethiopic, Georgian, Glagolitic,
+ Gothic, Greek, Gujarati, Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hira-
+ gana, Imperial_Aramaic, Inherited, Inscriptional_Pahlavi, Inscrip-
+ tional_Parthian, Javanese, Kaithi, Kannada, Katakana, Kayah_Li,
+ Kharoshthi, Khmer, Lao, Latin, Lepcha, Limbu, Linear_B, Lisu, Lycian,
Lydian, Malayalam, Mandaic, Meetei_Mayek, Meroitic_Cursive,
- Meroitic_Hieroglyphs, Miao, Mongolian, Myanmar, New_Tai_Lue, Nko,
- Ogham, Old_Italic, Old_Persian, Old_South_Arabian, Old_Turkic,
- Ol_Chiki, Oriya, Osmanya, Phags_Pa, Phoenician, Rejang, Runic, Samari-
- tan, Saurashtra, Sharada, Shavian, Sinhala, Sora_Sompeng, Sundanese,
- Syloti_Nagri, Syriac, Tagalog, Tagbanwa, Tai_Le, Tai_Tham, Tai_Viet,
- Takri, Tamil, Telugu, Thaana, Thai, Tibetan, Tifinagh, Ugaritic, Vai,
+ Meroitic_Hieroglyphs, Miao, Mongolian, Myanmar, New_Tai_Lue, Nko,
+ Ogham, Old_Italic, Old_Persian, Old_South_Arabian, Old_Turkic,
+ Ol_Chiki, Oriya, Osmanya, Phags_Pa, Phoenician, Rejang, Runic, Samari-
+ tan, Saurashtra, Sharada, Shavian, Sinhala, Sora_Sompeng, Sundanese,
+ Syloti_Nagri, Syriac, Tagalog, Tagbanwa, Tai_Le, Tai_Tham, Tai_Viet,
+ Takri, Tamil, Telugu, Thaana, Thai, Tibetan, Tifinagh, Ugaritic, Vai,
Yi.
Each character has exactly one Unicode general category property, spec-
- ified by a two-letter abbreviation. For compatibility with Perl, nega-
- tion can be specified by including a circumflex between the opening
- brace and the property name. For example, \p{^Lu} is the same as
+ ified by a two-letter abbreviation. For compatibility with Perl, nega-
+ tion can be specified by including a circumflex between the opening
+ brace and the property name. For example, \p{^Lu} is the same as
\P{Lu}.
If only one letter is specified with \p or \P, it includes all the gen-
- eral category properties that start with that letter. In this case, in
- the absence of negation, the curly brackets in the escape sequence are
+ eral category properties that start with that letter. In this case, in
+ the absence of negation, the curly brackets in the escape sequence are
optional; these two examples have the same effect:
\p{L}
@@ -5264,73 +5386,73 @@ BACKSLASH
Zp Paragraph separator
Zs Space separator
- The special property L& is also supported: it matches a character that
- has the Lu, Ll, or Lt property, in other words, a letter that is not
+ The special property L& is also supported: it matches a character that
+ has the Lu, Ll, or Lt property, in other words, a letter that is not
classified as a modifier or "other".
- The Cs (Surrogate) property applies only to characters in the range
- U+D800 to U+DFFF. Such characters are not valid in Unicode strings and
- so cannot be tested by PCRE, unless UTF validity checking has been
+ The Cs (Surrogate) property applies only to characters in the range
+ U+D800 to U+DFFF. Such characters are not valid in Unicode strings and
+ so cannot be tested by PCRE, unless UTF validity checking has been
turned off (see the discussion of PCRE_NO_UTF8_CHECK,
- PCRE_NO_UTF16_CHECK and PCRE_NO_UTF32_CHECK in the pcreapi page). Perl
+ PCRE_NO_UTF16_CHECK and PCRE_NO_UTF32_CHECK in the pcreapi page). Perl
does not support the Cs property.
- The long synonyms for property names that Perl supports (such as
- \p{Letter}) are not supported by PCRE, nor is it permitted to prefix
+ The long synonyms for property names that Perl supports (such as
+ \p{Letter}) are not supported by PCRE, nor is it permitted to prefix
any of these properties with "Is".
No character that is in the Unicode table has the Cn (unassigned) prop-
erty. Instead, this property is assumed for any code point that is not
in the Unicode table.
- Specifying caseless matching does not affect these escape sequences.
- For example, \p{Lu} always matches only upper case letters. This is
+ Specifying caseless matching does not affect these escape sequences.
+ For example, \p{Lu} always matches only upper case letters. This is
different from the behaviour of current versions of Perl.
- Matching characters by Unicode property is not fast, because PCRE has
- to do a multistage table lookup in order to find a character's prop-
+ Matching characters by Unicode property is not fast, because PCRE has
+ to do a multistage table lookup in order to find a character's prop-
erty. That is why the traditional escape sequences such as \d and \w do
not use Unicode properties in PCRE by default, though you can make them
- do so by setting the PCRE_UCP option or by starting the pattern with
+ do so by setting the PCRE_UCP option or by starting the pattern with
(*UCP).
Extended grapheme clusters
- The \X escape matches any number of Unicode characters that form an
+ The \X escape matches any number of Unicode characters that form an
"extended grapheme cluster", and treats the sequence as an atomic group
- (see below). Up to and including release 8.31, PCRE matched an ear-
+ (see below). Up to and including release 8.31, PCRE matched an ear-
lier, simpler definition that was equivalent to
(?>\PM\pM*)
- That is, it matched a character without the "mark" property, followed
- by zero or more characters with the "mark" property. Characters with
- the "mark" property are typically non-spacing accents that affect the
+ That is, it matched a character without the "mark" property, followed
+ by zero or more characters with the "mark" property. Characters with
+ the "mark" property are typically non-spacing accents that affect the
preceding character.
- This simple definition was extended in Unicode to include more compli-
- cated kinds of composite character by giving each character a grapheme
- breaking property, and creating rules that use these properties to
- define the boundaries of extended grapheme clusters. In releases of
+ This simple definition was extended in Unicode to include more compli-
+ cated kinds of composite character by giving each character a grapheme
+ breaking property, and creating rules that use these properties to
+ define the boundaries of extended grapheme clusters. In releases of
PCRE later than 8.31, \X matches one of these clusters.
- \X always matches at least one character. Then it decides whether to
+ \X always matches at least one character. Then it decides whether to
add additional characters according to the following rules for ending a
cluster:
1. End at the end of the subject string.
- 2. Do not end between CR and LF; otherwise end after any control char-
+ 2. Do not end between CR and LF; otherwise end after any control char-
acter.
- 3. Do not break Hangul (a Korean script) syllable sequences. Hangul
- characters are of five types: L, V, T, LV, and LVT. An L character may
- be followed by an L, V, LV, or LVT character; an LV or V character may
+ 3. Do not break Hangul (a Korean script) syllable sequences. Hangul
+ characters are of five types: L, V, T, LV, and LVT. An L character may
+ be followed by an L, V, LV, or LVT character; an LV or V character may
be followed by a V or T character; an LVT or T character may be follwed
only by a T character.
- 4. Do not end before extending characters or spacing marks. Characters
- with the "mark" property always have the "extend" grapheme breaking
+ 4. Do not end before extending characters or spacing marks. Characters
+ with the "mark" property always have the "extend" grapheme breaking
property.
5. Do not end after prepend characters.
@@ -5339,12 +5461,11 @@ BACKSLASH
PCRE's additional properties
- As well as the standard Unicode properties described above, PCRE sup-
- ports four more that make it possible to convert traditional escape
- sequences such as \w and \s and POSIX character classes to use Unicode
- properties. PCRE uses these non-standard, non-Perl properties inter-
- nally when PCRE_UCP is set. However, they may also be used explicitly.
- These properties are:
+ As well as the standard Unicode properties described above, PCRE sup-
+ ports four more that make it possible to convert traditional escape
+ sequences such as \w and \s to use Unicode properties. PCRE uses these
+ non-standard, non-Perl properties internally when PCRE_UCP is set. How-
+ ever, they may also be used explicitly. These properties are:
Xan Any alphanumeric character
Xps Any POSIX space character
@@ -5354,8 +5475,10 @@ BACKSLASH
Xan matches characters that have either the L (letter) or the N (num-
ber) property. Xps matches the characters tab, linefeed, vertical tab,
form feed, or carriage return, and any other character that has the Z
- (separator) property. Xsp is the same as Xps, except that vertical tab
- is excluded. Xwd matches the same characters as Xan, plus underscore.
+ (separator) property. Xsp is the same as Xps; it used to exclude ver-
+ tical tab, for Perl compatibility, but Perl changed, and so PCRE fol-
+ lowed at release 8.34. Xwd matches the same characters as Xan, plus
+ underscore.
There is another non-standard property, Xuc, which matches any charac-
ter that can be represented by a Universal Character Name in C++ and
@@ -5628,7 +5751,9 @@ SQUARE BRACKETS AND CHARACTER CLASSES
between d and m, inclusive. If a minus character is required in a
class, it must be escaped with a backslash or appear in a position
where it cannot be interpreted as indicating a range, typically as the
- first or last character in the class.
+ first or last character in the class, or immediately after a range. For
+ example, [b-d-z] matches letters in the range b to d, a hyphen charac-
+ ter, or z.
It is not possible to have the literal character "]" as the end charac-
ter of a range. A pattern such as [W-]46] is interpreted as a class of
@@ -5639,45 +5764,51 @@ SQUARE BRACKETS AND CHARACTER CLASSES
The octal or hexadecimal representation of "]" can also be used to end
a range.
- Ranges operate in the collating sequence of character values. They can
- also be used for characters specified numerically, for example
- [\000-\037]. Ranges can include any characters that are valid for the
+ An error is generated if a POSIX character class (see below) or an
+ escape sequence other than one that defines a single character appears
+ at a point where a range ending character is expected. For example,
+ [z-\xff] is valid, but [A-\d] and [A-[:digit:]] are not.
+
+ Ranges operate in the collating sequence of character values. They can
+ also be used for characters specified numerically, for example
+ [\000-\037]. Ranges can include any characters that are valid for the
current mode.
If a range that includes letters is used when caseless matching is set,
it matches the letters in either case. For example, [W-c] is equivalent
- to [][\\^_`wxyzabc], matched caselessly, and in a non-UTF mode, if
- character tables for a French locale are in use, [\xc8-\xcb] matches
- accented E characters in both cases. In UTF modes, PCRE supports the
- concept of case for characters with values greater than 128 only when
+ to [][\\^_`wxyzabc], matched caselessly, and in a non-UTF mode, if
+ character tables for a French locale are in use, [\xc8-\xcb] matches
+ accented E characters in both cases. In UTF modes, PCRE supports the
+ concept of case for characters with values greater than 128 only when
it is compiled with Unicode property support.
- The character escape sequences \d, \D, \h, \H, \p, \P, \s, \S, \v, \V,
+ The character escape sequences \d, \D, \h, \H, \p, \P, \s, \S, \v, \V,
\w, and \W may appear in a character class, and add the characters that
- they match to the class. For example, [\dABCDEF] matches any hexadeci-
- mal digit. In UTF modes, the PCRE_UCP option affects the meanings of
- \d, \s, \w and their upper case partners, just as it does when they
- appear outside a character class, as described in the section entitled
+ they match to the class. For example, [\dABCDEF] matches any hexadeci-
+ mal digit. In UTF modes, the PCRE_UCP option affects the meanings of
+ \d, \s, \w and their upper case partners, just as it does when they
+ appear outside a character class, as described in the section entitled
"Generic character types" above. The escape sequence \b has a different
- meaning inside a character class; it matches the backspace character.
- The sequences \B, \N, \R, and \X are not special inside a character
- class. Like any other unrecognized escape sequences, they are treated
- as the literal characters "B", "N", "R", and "X" by default, but cause
+ meaning inside a character class; it matches the backspace character.
+ The sequences \B, \N, \R, and \X are not special inside a character
+ class. Like any other unrecognized escape sequences, they are treated
+ as the literal characters "B", "N", "R", and "X" by default, but cause
an error if the PCRE_EXTRA option is set.
- A circumflex can conveniently be used with the upper case character
- types to specify a more restricted set of characters than the matching
- lower case type. For example, the class [^\W_] matches any letter or
+ A circumflex can conveniently be used with the upper case character
+ types to specify a more restricted set of characters than the matching
+ lower case type. For example, the class [^\W_] matches any letter or
digit, but not underscore, whereas [\w] includes underscore. A positive
character class should be read as "something OR something OR ..." and a
negative class as "NOT something AND NOT something AND NOT ...".
- The only metacharacters that are recognized in character classes are
- backslash, hyphen (only where it can be interpreted as specifying a
- range), circumflex (only at the start), opening square bracket (only
- when it can be interpreted as introducing a POSIX class name - see the
- next section), and the terminating closing square bracket. However,
- escaping other non-alphanumeric characters does no harm.
+ The only metacharacters that are recognized in character classes are
+ backslash, hyphen (only where it can be interpreted as specifying a
+ range), circumflex (only at the start), opening square bracket (only
+ when it can be interpreted as introducing a POSIX class name, or for a
+ special compatibility feature - see the next two sections), and the
+ terminating closing square bracket. However, escaping other non-
+ alphanumeric characters does no harm.
POSIX CHARACTER CLASSES
@@ -5701,31 +5832,34 @@ POSIX CHARACTER CLASSES
lower lower case letters
print printing characters, including space
punct printing characters, excluding letters and digits and space
- space white space (not quite the same as \s)
+ space white space (the same as \s from PCRE 8.34)
upper upper case letters
word "word" characters (same as \w)
xdigit hexadecimal digits
- The "space" characters are HT (9), LF (10), VT (11), FF (12), CR (13),
- and space (32). Notice that this list includes the VT character (code
- 11). This makes "space" different to \s, which does not include VT (for
- Perl compatibility).
+ The default "space" characters are HT (9), LF (10), VT (11), FF (12),
+ CR (13), and space (32). If locale-specific matching is taking place,
+ the list of space characters may be different; there may be fewer or
+ more of them. "Space" used to be different to \s, which did not include
+ VT, for Perl compatibility. However, Perl changed at release 5.18, and
+ PCRE followed at release 8.34. "Space" and \s now match the same set
+ of characters.
- The name "word" is a Perl extension, and "blank" is a GNU extension
- from Perl 5.8. Another Perl extension is negation, which is indicated
+ The name "word" is a Perl extension, and "blank" is a GNU extension
+ from Perl 5.8. Another Perl extension is negation, which is indicated
by a ^ character after the colon. For example,
[12[:^digit:]]
- matches "1", "2", or any non-digit. PCRE (and Perl) also recognize the
+ matches "1", "2", or any non-digit. PCRE (and Perl) also recognize the
POSIX syntax [.ch.] and [=ch=] where "ch" is a "collating element", but
these are not supported, and an error is given if they are encountered.
- By default, in UTF modes, characters with values greater than 128 do
- not match any of the POSIX character classes. However, if the PCRE_UCP
- option is passed to pcre_compile(), some of the classes are changed so
- that Unicode character properties are used. This is achieved by replac-
- ing the POSIX classes by other sequences, as follows:
+ By default, characters with values greater than 128 do not match any of
+ the POSIX character classes. However, if the PCRE_UCP option is passed
+ to pcre_compile(), some of the classes are changed so that Unicode
+ character properties are used. This is achieved by replacing certain
+ POSIX classes by other sequences, as follows:
[:alnum:] becomes \p{Xan}
[:alpha:] becomes \p{L}
@@ -5736,31 +5870,70 @@ POSIX CHARACTER CLASSES
[:upper:] becomes \p{Lu}
[:word:] becomes \p{Xwd}
- Negated versions, such as [:^alpha:] use \P instead of \p. The other
- POSIX classes are unchanged, and match only characters with code points
- less than 128.
+ Negated versions, such as [:^alpha:] use \P instead of \p. Three other
+ POSIX classes are handled specially in UCP mode:
+
+ [:graph:] This matches characters that have glyphs that mark the page
+ when printed. In Unicode property terms, it matches all char-
+ acters with the L, M, N, P, S, or Cf properties, except for:
+
+ U+061C Arabic Letter Mark
+ U+180E Mongolian Vowel Separator
+ U+2066 - U+2069 Various "isolate"s
+
+
+ [:print:] This matches the same characters as [:graph:] plus space
+ characters that are not controls, that is, characters with
+ the Zs property.
+
+ [:punct:] This matches all characters that have the Unicode P (punctua-
+ tion) property, plus those characters whose code points are
+ less than 128 that have the S (Symbol) property.
+
+ The other POSIX classes are unchanged, and match only characters with
+ code points less than 128.
+
+
+COMPATIBILITY FEATURE FOR WORD BOUNDARIES
+
+ In the POSIX.2 compliant library that was included in 4.4BSD Unix, the
+ ugly syntax [[:<:]] and [[:>:]] is used for matching "start of word"
+ and "end of word". PCRE treats these items as follows:
+
+ [[:<:]] is converted to \b(?=\w)
+ [[:>:]] is converted to \b(?<=\w)
+
+ Only these exact character sequences are recognized. A sequence such as
+ [a[:<:]b] provokes error for an unrecognized POSIX class name. This
+ support is not compatible with Perl. It is provided to help migrations
+ from other environments, and is best not used in any new patterns. Note
+ that \b matches at the start and the end of a word (see "Simple asser-
+ tions" above), and in a Perl-style pattern the preceding or following
+ character normally shows which is wanted, without the need for the
+ assertions that are used above in order to give exactly the POSIX be-
+ haviour.
VERTICAL BAR
- Vertical bar characters are used to separate alternative patterns. For
+ Vertical bar characters are used to separate alternative patterns. For
example, the pattern
gilbert|sullivan
- matches either "gilbert" or "sullivan". Any number of alternatives may
- appear, and an empty alternative is permitted (matching the empty
+ matches either "gilbert" or "sullivan". Any number of alternatives may
+ appear, and an empty alternative is permitted (matching the empty
string). The matching process tries each alternative in turn, from left
- to right, and the first one that succeeds is used. If the alternatives
- are within a subpattern (defined below), "succeeds" means matching the
+ to right, and the first one that succeeds is used. If the alternatives
+ are within a subpattern (defined below), "succeeds" means matching the
rest of the main pattern as well as the alternative in the subpattern.
INTERNAL OPTION SETTING
- The settings of the PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and
- PCRE_EXTENDED options (which are Perl-compatible) can be changed from
- within the pattern by a sequence of Perl option letters enclosed
+ The settings of the PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and
+ PCRE_EXTENDED options (which are Perl-compatible) can be changed from
+ within the pattern by a sequence of Perl option letters enclosed
between "(?" and ")". The option letters are
i for PCRE_CASELESS
@@ -5770,51 +5943,51 @@ INTERNAL OPTION SETTING
For example, (?im) sets caseless, multiline matching. It is also possi-
ble to unset these options by preceding the letter with a hyphen, and a
- combined setting and unsetting such as (?im-sx), which sets PCRE_CASE-
- LESS and PCRE_MULTILINE while unsetting PCRE_DOTALL and PCRE_EXTENDED,
- is also permitted. If a letter appears both before and after the
+ combined setting and unsetting such as (?im-sx), which sets PCRE_CASE-
+ LESS and PCRE_MULTILINE while unsetting PCRE_DOTALL and PCRE_EXTENDED,
+ is also permitted. If a letter appears both before and after the
hyphen, the option is unset.
- The PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and PCRE_EXTRA
- can be changed in the same way as the Perl-compatible options by using
+ The PCRE-specific options PCRE_DUPNAMES, PCRE_UNGREEDY, and PCRE_EXTRA
+ can be changed in the same way as the Perl-compatible options by using
the characters J, U and X respectively.
- When one of these option changes occurs at top level (that is, not
- inside subpattern parentheses), the change applies to the remainder of
+ When one of these option changes occurs at top level (that is, not
+ inside subpattern parentheses), the change applies to the remainder of
the pattern that follows. If the change is placed right at the start of
a pattern, PCRE extracts it into the global options (and it will there-
fore show up in data extracted by the pcre_fullinfo() function).
- An option change within a subpattern (see below for a description of
- subpatterns) affects only that part of the subpattern that follows it,
+ An option change within a subpattern (see below for a description of
+ subpatterns) affects only that part of the subpattern that follows it,
so
(a(?i)b)c
matches abc and aBc and no other strings (assuming PCRE_CASELESS is not
- used). By this means, options can be made to have different settings
- in different parts of the pattern. Any changes made in one alternative
- do carry on into subsequent branches within the same subpattern. For
+ used). By this means, options can be made to have different settings
+ in different parts of the pattern. Any changes made in one alternative
+ do carry on into subsequent branches within the same subpattern. For
example,
(a(?i)b|c)
- matches "ab", "aB", "c", and "C", even though when matching "C" the
- first branch is abandoned before the option setting. This is because
- the effects of option settings happen at compile time. There would be
+ matches "ab", "aB", "c", and "C", even though when matching "C" the
+ first branch is abandoned before the option setting. This is because
+ the effects of option settings happen at compile time. There would be
some very weird behaviour otherwise.
- Note: There are other PCRE-specific options that can be set by the
- application when the compiling or matching functions are called. In
- some cases the pattern can contain special leading sequences such as
- (*CRLF) to override what the application has set or what has been
- defaulted. Details are given in the section entitled "Newline
- sequences" above. There are also the (*UTF8), (*UTF16),(*UTF32), and
- (*UCP) leading sequences that can be used to set UTF and Unicode prop-
- erty modes; they are equivalent to setting the PCRE_UTF8, PCRE_UTF16,
- PCRE_UTF32 and the PCRE_UCP options, respectively. The (*UTF) sequence
- is a generic version that can be used with any of the libraries. How-
- ever, the application can set the PCRE_NEVER_UTF option, which locks
+ Note: There are other PCRE-specific options that can be set by the
+ application when the compiling or matching functions are called. In
+ some cases the pattern can contain special leading sequences such as
+ (*CRLF) to override what the application has set or what has been
+ defaulted. Details are given in the section entitled "Newline
+ sequences" above. There are also the (*UTF8), (*UTF16),(*UTF32), and
+ (*UCP) leading sequences that can be used to set UTF and Unicode prop-
+ erty modes; they are equivalent to setting the PCRE_UTF8, PCRE_UTF16,
+ PCRE_UTF32 and the PCRE_UCP options, respectively. The (*UTF) sequence
+ is a generic version that can be used with any of the libraries. How-
+ ever, the application can set the PCRE_NEVER_UTF option, which locks
out the use of the (*UTF) sequences.
@@ -5827,18 +6000,18 @@ SUBPATTERNS
cat(aract|erpillar|)
- matches "cataract", "caterpillar", or "cat". Without the parentheses,
+ matches "cataract", "caterpillar", or "cat". Without the parentheses,
it would match "cataract", "erpillar" or an empty string.
- 2. It sets up the subpattern as a capturing subpattern. This means
- that, when the whole pattern matches, that portion of the subject
+ 2. It sets up the subpattern as a capturing subpattern. This means
+ that, when the whole pattern matches, that portion of the subject
string that matched the subpattern is passed back to the caller via the
- ovector argument of the matching function. (This applies only to the
- traditional matching functions; the DFA matching functions do not sup-
+ ovector argument of the matching function. (This applies only to the
+ traditional matching functions; the DFA matching functions do not sup-
port capturing.)
Opening parentheses are counted from left to right (starting from 1) to
- obtain numbers for the capturing subpatterns. For example, if the
+ obtain numbers for the capturing subpatterns. For example, if the
string "the red king" is matched against the pattern
the ((red|white) (king|queen))
@@ -5846,12 +6019,12 @@ SUBPATTERNS
the captured substrings are "red king", "red", and "king", and are num-
bered 1, 2, and 3, respectively.
- The fact that plain parentheses fulfil two functions is not always
- helpful. There are often times when a grouping subpattern is required
- without a capturing requirement. If an opening parenthesis is followed
- by a question mark and a colon, the subpattern does not do any captur-
- ing, and is not counted when computing the number of any subsequent
- capturing subpatterns. For example, if the string "the white queen" is
+ The fact that plain parentheses fulfil two functions is not always
+ helpful. There are often times when a grouping subpattern is required
+ without a capturing requirement. If an opening parenthesis is followed
+ by a question mark and a colon, the subpattern does not do any captur-
+ ing, and is not counted when computing the number of any subsequent
+ capturing subpatterns. For example, if the string "the white queen" is
matched against the pattern
the ((?:red|white) (king|queen))
@@ -5859,37 +6032,37 @@ SUBPATTERNS
the captured substrings are "white queen" and "queen", and are numbered
1 and 2. The maximum number of capturing subpatterns is 65535.
- As a convenient shorthand, if any option settings are required at the
- start of a non-capturing subpattern, the option letters may appear
+ As a convenient shorthand, if any option settings are required at the
+ start of a non-capturing subpattern, the option letters may appear
between the "?" and the ":". Thus the two patterns
(?i:saturday|sunday)
(?:(?i)saturday|sunday)
match exactly the same set of strings. Because alternative branches are
- tried from left to right, and options are not reset until the end of
- the subpattern is reached, an option setting in one branch does affect
- subsequent branches, so the above patterns match "SUNDAY" as well as
+ tried from left to right, and options are not reset until the end of
+ the subpattern is reached, an option setting in one branch does affect
+ subsequent branches, so the above patterns match "SUNDAY" as well as
"Saturday".
DUPLICATE SUBPATTERN NUMBERS
Perl 5.10 introduced a feature whereby each alternative in a subpattern
- uses the same numbers for its capturing parentheses. Such a subpattern
- starts with (?| and is itself a non-capturing subpattern. For example,
+ uses the same numbers for its capturing parentheses. Such a subpattern
+ starts with (?| and is itself a non-capturing subpattern. For example,
consider this pattern:
(?|(Sat)ur|(Sun))day
- Because the two alternatives are inside a (?| group, both sets of cap-
- turing parentheses are numbered one. Thus, when the pattern matches,
- you can look at captured substring number one, whichever alternative
- matched. This construct is useful when you want to capture part, but
+ Because the two alternatives are inside a (?| group, both sets of cap-
+ turing parentheses are numbered one. Thus, when the pattern matches,
+ you can look at captured substring number one, whichever alternative
+ matched. This construct is useful when you want to capture part, but
not all, of one of a number of alternatives. Inside a (?| group, paren-
- theses are numbered as usual, but the number is reset at the start of
- each branch. The numbers of any capturing parentheses that follow the
- subpattern start after the highest number used in any branch. The fol-
+ theses are numbered as usual, but the number is reset at the start of
+ each branch. The numbers of any capturing parentheses that follow the
+ subpattern start after the highest number used in any branch. The fol-
lowing example is taken from the Perl documentation. The numbers under-
neath show in which buffer the captured content will be stored.
@@ -5897,58 +6070,58 @@ DUPLICATE SUBPATTERN NUMBERS
/ ( a ) (?| x ( y ) z | (p (q) r) | (t) u (v) ) ( z ) /x
# 1 2 2 3 2 3 4
- A back reference to a numbered subpattern uses the most recent value
- that is set for that number by any subpattern. The following pattern
+ A back reference to a numbered subpattern uses the most recent value
+ that is set for that number by any subpattern. The following pattern
matches "abcabc" or "defdef":
/(?|(abc)|(def))\1/
- In contrast, a subroutine call to a numbered subpattern always refers
- to the first one in the pattern with the given number. The following
+ In contrast, a subroutine call to a numbered subpattern always refers
+ to the first one in the pattern with the given number. The following
pattern matches "abcabc" or "defabc":
/(?|(abc)|(def))(?1)/
- If a condition test for a subpattern's having matched refers to a non-
- unique number, the test is true if any of the subpatterns of that num-
+ If a condition test for a subpattern's having matched refers to a non-
+ unique number, the test is true if any of the subpatterns of that num-
ber have matched.
- An alternative approach to using this "branch reset" feature is to use
+ An alternative approach to using this "branch reset" feature is to use
duplicate named subpatterns, as described in the next section.
NAMED SUBPATTERNS
- Identifying capturing parentheses by number is simple, but it can be
- very hard to keep track of the numbers in complicated regular expres-
- sions. Furthermore, if an expression is modified, the numbers may
- change. To help with this difficulty, PCRE supports the naming of sub-
+ Identifying capturing parentheses by number is simple, but it can be
+ very hard to keep track of the numbers in complicated regular expres-
+ sions. Furthermore, if an expression is modified, the numbers may
+ change. To help with this difficulty, PCRE supports the naming of sub-
patterns. This feature was not added to Perl until release 5.10. Python
- had the feature earlier, and PCRE introduced it at release 4.0, using
- the Python syntax. PCRE now supports both the Perl and the Python syn-
- tax. Perl allows identically numbered subpatterns to have different
+ had the feature earlier, and PCRE introduced it at release 4.0, using
+ the Python syntax. PCRE now supports both the Perl and the Python syn-
+ tax. Perl allows identically numbered subpatterns to have different
names, but PCRE does not.
- In PCRE, a subpattern can be named in one of three ways: (?<name>...)
- or (?'name'...) as in Perl, or (?P<name>...) as in Python. References
- to capturing parentheses from other parts of the pattern, such as back
- references, recursion, and conditions, can be made by name as well as
+ In PCRE, a subpattern can be named in one of three ways: (?<name>...)
+ or (?'name'...) as in Perl, or (?P<name>...) as in Python. References
+ to capturing parentheses from other parts of the pattern, such as back
+ references, recursion, and conditions, can be made by name as well as
by number.
- Names consist of up to 32 alphanumeric characters and underscores.
- Named capturing parentheses are still allocated numbers as well as
- names, exactly as if the names were not present. The PCRE API provides
- function calls for extracting the name-to-number translation table from
- a compiled pattern. There is also a convenience function for extracting
- a captured substring by name.
+ Names consist of up to 32 alphanumeric characters and underscores, but
+ must start with a non-digit. Named capturing parentheses are still
+ allocated numbers as well as names, exactly as if the names were not
+ present. The PCRE API provides function calls for extracting the name-
+ to-number translation table from a compiled pattern. There is also a
+ convenience function for extracting a captured substring by name.
- By default, a name must be unique within a pattern, but it is possible
+ By default, a name must be unique within a pattern, but it is possible
to relax this constraint by setting the PCRE_DUPNAMES option at compile
- time. (Duplicate names are also always permitted for subpatterns with
- the same number, set up as described in the previous section.) Dupli-
- cate names can be useful for patterns where only one instance of the
- named parentheses can match. Suppose you want to match the name of a
- weekday, either as a 3-letter abbreviation or as the full name, and in
+ time. (Duplicate names are also always permitted for subpatterns with
+ the same number, set up as described in the previous section.) Dupli-
+ cate names can be useful for patterns where only one instance of the
+ named parentheses can match. Suppose you want to match the name of a
+ weekday, either as a 3-letter abbreviation or as the full name, and in
both cases you want to extract the abbreviation. This pattern (ignoring
the line breaks) does the job:
@@ -5958,33 +6131,43 @@ NAMED SUBPATTERNS
(?<DN>Thu)(?:rsday)?|
(?<DN>Sat)(?:urday)?
- There are five capturing substrings, but only one is ever set after a
+ There are five capturing substrings, but only one is ever set after a
match. (An alternative way of solving this problem is to use a "branch
reset" subpattern, as described in the previous section.)
- The convenience function for extracting the data by name returns the
- substring for the first (and in this example, the only) subpattern of
- that name that matched. This saves searching to find which numbered
+ The convenience function for extracting the data by name returns the
+ substring for the first (and in this example, the only) subpattern of
+ that name that matched. This saves searching to find which numbered
subpattern it was.
- If you make a back reference to a non-unique named subpattern from
- elsewhere in the pattern, the one that corresponds to the first occur-
- rence of the name is used. In the absence of duplicate numbers (see the
- previous section) this is the one with the lowest number. If you use a
- named reference in a condition test (see the section about conditions
- below), either to check whether a subpattern has matched, or to check
- for recursion, all subpatterns with the same name are tested. If the
- condition is true for any one of them, the overall condition is true.
- This is the same behaviour as testing by number. For further details of
- the interfaces for handling named subpatterns, see the pcreapi documen-
- tation.
+ If you make a back reference to a non-unique named subpattern from
+ elsewhere in the pattern, the subpatterns to which the name refers are
+ checked in the order in which they appear in the overall pattern. The
+ first one that is set is used for the reference. For example, this pat-
+ tern matches both "foofoo" and "barbar" but not "foobar" or "barfoo":
+
+ (?:(?<n>foo)|(?<n>bar))\k<n>
+
+
+ If you make a subroutine call to a non-unique named subpattern, the one
+ that corresponds to the first occurrence of the name is used. In the
+ absence of duplicate numbers (see the previous section) this is the one
+ with the lowest number.
+
+ If you use a named reference in a condition test (see the section about
+ conditions below), either to check whether a subpattern has matched, or
+ to check for recursion, all subpatterns with the same name are tested.
+ If the condition is true for any one of them, the overall condition is
+ true. This is the same behaviour as testing by number. For further
+ details of the interfaces for handling named subpatterns, see the
+ pcreapi documentation.
Warning: You cannot use different names to distinguish between two sub-
patterns with the same number because PCRE uses only the numbers when
matching. For this reason, an error is given at compile time if differ-
ent names are given to subpatterns with the same number. However, you
- can give the same name to subpatterns with the same number, even when
- PCRE_DUPNAMES is not set.
+ can always give the same name to subpatterns with the same number, even
+ when PCRE_DUPNAMES is not set.
REPETITION
@@ -6619,25 +6802,20 @@ CONDITIONAL SUBPATTERNS
Perl uses the syntax (?(<name>)...) or (?('name')...) to test for a
used subpattern by name. For compatibility with earlier versions of
PCRE, which had this facility before Perl, the syntax (?(name)...) is
- also recognized. However, there is a possible ambiguity with this syn-
- tax, because subpattern names may consist entirely of digits. PCRE
- looks first for a named subpattern; if it cannot find one and the name
- consists entirely of digits, PCRE looks for a subpattern of that num-
- ber, which must be greater than zero. Using subpattern names that con-
- sist entirely of digits is not recommended.
+ also recognized.
Rewriting the above example to use a named subpattern gives this:
(?<OPEN> \( )? [^()]+ (?(<OPEN>) \) )
- If the name used in a condition of this kind is a duplicate, the test
- is applied to all subpatterns of the same name, and is true if any one
+ If the name used in a condition of this kind is a duplicate, the test
+ is applied to all subpatterns of the same name, and is true if any one
of them has matched.
Checking for pattern recursion
If the condition is the string (R), and there is no subpattern with the
- name R, the condition is true if a recursive call to the whole pattern
+ name R, the condition is true if a recursive call to the whole pattern
or any subpattern has been made. If digits or a name preceded by amper-
sand follow the letter R, for example:
@@ -6645,51 +6823,51 @@ CONDITIONAL SUBPATTERNS
the condition is true if the most recent recursion is into a subpattern
whose number or name is given. This condition does not check the entire
- recursion stack. If the name used in a condition of this kind is a
+ recursion stack. If the name used in a condition of this kind is a
duplicate, the test is applied to all subpatterns of the same name, and
is true if any one of them is the most recent recursion.
- At "top level", all these recursion test conditions are false. The
+ At "top level", all these recursion test conditions are false. The
syntax for recursive patterns is described below.
Defining subpatterns for use by reference only
- If the condition is the string (DEFINE), and there is no subpattern
- with the name DEFINE, the condition is always false. In this case,
- there may be only one alternative in the subpattern. It is always
- skipped if control reaches this point in the pattern; the idea of
- DEFINE is that it can be used to define subroutines that can be refer-
- enced from elsewhere. (The use of subroutines is described below.) For
- example, a pattern to match an IPv4 address such as "192.168.23.245"
+ If the condition is the string (DEFINE), and there is no subpattern
+ with the name DEFINE, the condition is always false. In this case,
+ there may be only one alternative in the subpattern. It is always
+ skipped if control reaches this point in the pattern; the idea of
+ DEFINE is that it can be used to define subroutines that can be refer-
+ enced from elsewhere. (The use of subroutines is described below.) For
+ example, a pattern to match an IPv4 address such as "192.168.23.245"
could be written like this (ignore white space and line breaks):
(?(DEFINE) (?<byte> 2[0-4]\d | 25[0-5] | 1\d\d | [1-9]?\d) )
\b (?&byte) (\.(?&byte)){3} \b
- The first part of the pattern is a DEFINE group inside which a another
- group named "byte" is defined. This matches an individual component of
- an IPv4 address (a number less than 256). When matching takes place,
- this part of the pattern is skipped because DEFINE acts like a false
- condition. The rest of the pattern uses references to the named group
- to match the four dot-separated components of an IPv4 address, insist-
+ The first part of the pattern is a DEFINE group inside which a another
+ group named "byte" is defined. This matches an individual component of
+ an IPv4 address (a number less than 256). When matching takes place,
+ this part of the pattern is skipped because DEFINE acts like a false
+ condition. The rest of the pattern uses references to the named group
+ to match the four dot-separated components of an IPv4 address, insist-
ing on a word boundary at each end.
Assertion conditions
- If the condition is not in any of the above formats, it must be an
- assertion. This may be a positive or negative lookahead or lookbehind
- assertion. Consider this pattern, again containing non-significant
+ If the condition is not in any of the above formats, it must be an
+ assertion. This may be a positive or negative lookahead or lookbehind
+ assertion. Consider this pattern, again containing non-significant
white space, and with the two alternatives on the second line:
(?(?=[^a-z]*[a-z])
\d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} )
- The condition is a positive lookahead assertion that matches an
- optional sequence of non-letters followed by a letter. In other words,
- it tests for the presence of at least one letter in the subject. If a
- letter is found, the subject is matched against the first alternative;
- otherwise it is matched against the second. This pattern matches
- strings in one of the two forms dd-aaa-dd or dd-dd-dd, where aaa are
+ The condition is a positive lookahead assertion that matches an
+ optional sequence of non-letters followed by a letter. In other words,
+ it tests for the presence of at least one letter in the subject. If a
+ letter is found, the subject is matched against the first alternative;
+ otherwise it is matched against the second. This pattern matches
+ strings in one of the two forms dd-aaa-dd or dd-dd-dd, where aaa are
letters and dd are digits.
@@ -6698,41 +6876,41 @@ COMMENTS
There are two ways of including comments in patterns that are processed
by PCRE. In both cases, the start of the comment must not be in a char-
acter class, nor in the middle of any other sequence of related charac-
- ters such as (?: or a subpattern name or number. The characters that
+ ters such as (?: or a subpattern name or number. The characters that
make up a comment play no part in the pattern matching.
- The sequence (?# marks the start of a comment that continues up to the
- next closing parenthesis. Nested parentheses are not permitted. If the
+ The sequence (?# marks the start of a comment that continues up to the
+ next closing parenthesis. Nested parentheses are not permitted. If the
PCRE_EXTENDED option is set, an unescaped # character also introduces a
- comment, which in this case continues to immediately after the next
- newline character or character sequence in the pattern. Which charac-
+ comment, which in this case continues to immediately after the next
+ newline character or character sequence in the pattern. Which charac-
ters are interpreted as newlines is controlled by the options passed to
- a compiling function or by a special sequence at the start of the pat-
+ a compiling function or by a special sequence at the start of the pat-
tern, as described in the section entitled "Newline conventions" above.
Note that the end of this type of comment is a literal newline sequence
- in the pattern; escape sequences that happen to represent a newline do
- not count. For example, consider this pattern when PCRE_EXTENDED is
+ in the pattern; escape sequences that happen to represent a newline do
+ not count. For example, consider this pattern when PCRE_EXTENDED is
set, and the default newline convention is in force:
abc #comment \n still comment
- On encountering the # character, pcre_compile() skips along, looking
- for a newline in the pattern. The sequence \n is still literal at this
- stage, so it does not terminate the comment. Only an actual character
+ On encountering the # character, pcre_compile() skips along, looking
+ for a newline in the pattern. The sequence \n is still literal at this
+ stage, so it does not terminate the comment. Only an actual character
with the code value 0x0a (the default newline) does so.
RECURSIVE PATTERNS
- Consider the problem of matching a string in parentheses, allowing for
- unlimited nested parentheses. Without the use of recursion, the best
- that can be done is to use a pattern that matches up to some fixed
- depth of nesting. It is not possible to handle an arbitrary nesting
+ Consider the problem of matching a string in parentheses, allowing for
+ unlimited nested parentheses. Without the use of recursion, the best
+ that can be done is to use a pattern that matches up to some fixed
+ depth of nesting. It is not possible to handle an arbitrary nesting
depth.
For some time, Perl has provided a facility that allows regular expres-
- sions to recurse (amongst other things). It does this by interpolating
- Perl code in the expression at run time, and the code can refer to the
+ sions to recurse (amongst other things). It does this by interpolating
+ Perl code in the expression at run time, and the code can refer to the
expression itself. A Perl pattern using code interpolation to solve the
parentheses problem can be created like this:
@@ -6742,201 +6920,201 @@ RECURSIVE PATTERNS
refers recursively to the pattern in which it appears.
Obviously, PCRE cannot support the interpolation of Perl code. Instead,
- it supports special syntax for recursion of the entire pattern, and
- also for individual subpattern recursion. After its introduction in
- PCRE and Python, this kind of recursion was subsequently introduced
+ it supports special syntax for recursion of the entire pattern, and
+ also for individual subpattern recursion. After its introduction in
+ PCRE and Python, this kind of recursion was subsequently introduced
into Perl at release 5.10.
- A special item that consists of (? followed by a number greater than
- zero and a closing parenthesis is a recursive subroutine call of the
- subpattern of the given number, provided that it occurs inside that
- subpattern. (If not, it is a non-recursive subroutine call, which is
- described in the next section.) The special item (?R) or (?0) is a
+ A special item that consists of (? followed by a number greater than
+ zero and a closing parenthesis is a recursive subroutine call of the
+ subpattern of the given number, provided that it occurs inside that
+ subpattern. (If not, it is a non-recursive subroutine call, which is
+ described in the next section.) The special item (?R) or (?0) is a
recursive call of the entire regular expression.
- This PCRE pattern solves the nested parentheses problem (assume the
+ This PCRE pattern solves the nested parentheses problem (assume the
PCRE_EXTENDED option is set so that white space is ignored):
\( ( [^()]++ | (?R) )* \)
- First it matches an opening parenthesis. Then it matches any number of
- substrings which can either be a sequence of non-parentheses, or a
- recursive match of the pattern itself (that is, a correctly parenthe-
+ First it matches an opening parenthesis. Then it matches any number of
+ substrings which can either be a sequence of non-parentheses, or a
+ recursive match of the pattern itself (that is, a correctly parenthe-
sized substring). Finally there is a closing parenthesis. Note the use
of a possessive quantifier to avoid backtracking into sequences of non-
parentheses.
- If this were part of a larger pattern, you would not want to recurse
+ If this were part of a larger pattern, you would not want to recurse
the entire pattern, so instead you could use this:
( \( ( [^()]++ | (?1) )* \) )
- We have put the pattern into parentheses, and caused the recursion to
+ We have put the pattern into parentheses, and caused the recursion to
refer to them instead of the whole pattern.
- In a larger pattern, keeping track of parenthesis numbers can be
- tricky. This is made easier by the use of relative references. Instead
+ In a larger pattern, keeping track of parenthesis numbers can be
+ tricky. This is made easier by the use of relative references. Instead
of (?1) in the pattern above you can write (?-2) to refer to the second
- most recently opened parentheses preceding the recursion. In other
- words, a negative number counts capturing parentheses leftwards from
+ most recently opened parentheses preceding the recursion. In other
+ words, a negative number counts capturing parentheses leftwards from
the point at which it is encountered.
- It is also possible to refer to subsequently opened parentheses, by
- writing references such as (?+2). However, these cannot be recursive
- because the reference is not inside the parentheses that are refer-
- enced. They are always non-recursive subroutine calls, as described in
+ It is also possible to refer to subsequently opened parentheses, by
+ writing references such as (?+2). However, these cannot be recursive
+ because the reference is not inside the parentheses that are refer-
+ enced. They are always non-recursive subroutine calls, as described in
the next section.
- An alternative approach is to use named parentheses instead. The Perl
- syntax for this is (?&name); PCRE's earlier syntax (?P>name) is also
+ An alternative approach is to use named parentheses instead. The Perl
+ syntax for this is (?&name); PCRE's earlier syntax (?P>name) is also
supported. We could rewrite the above example as follows:
(?<pn> \( ( [^()]++ | (?&pn) )* \) )
- If there is more than one subpattern with the same name, the earliest
+ If there is more than one subpattern with the same name, the earliest
one is used.
- This particular example pattern that we have been looking at contains
+ This particular example pattern that we have been looking at contains
nested unlimited repeats, and so the use of a possessive quantifier for
matching strings of non-parentheses is important when applying the pat-
- tern to strings that do not match. For example, when this pattern is
+ tern to strings that do not match. For example, when this pattern is
applied to
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa()
- it yields "no match" quickly. However, if a possessive quantifier is
- not used, the match runs for a very long time indeed because there are
- so many different ways the + and * repeats can carve up the subject,
+ it yields "no match" quickly. However, if a possessive quantifier is
+ not used, the match runs for a very long time indeed because there are
+ so many different ways the + and * repeats can carve up the subject,
and all have to be tested before failure can be reported.
- At the end of a match, the values of capturing parentheses are those
- from the outermost level. If you want to obtain intermediate values, a
- callout function can be used (see below and the pcrecallout documenta-
+ At the end of a match, the values of capturing parentheses are those
+ from the outermost level. If you want to obtain intermediate values, a
+ callout function can be used (see below and the pcrecallout documenta-
tion). If the pattern above is matched against
(ab(cd)ef)
- the value for the inner capturing parentheses (numbered 2) is "ef",
- which is the last value taken on at the top level. If a capturing sub-
- pattern is not matched at the top level, its final captured value is
- unset, even if it was (temporarily) set at a deeper level during the
+ the value for the inner capturing parentheses (numbered 2) is "ef",
+ which is the last value taken on at the top level. If a capturing sub-
+ pattern is not matched at the top level, its final captured value is
+ unset, even if it was (temporarily) set at a deeper level during the
matching process.
- If there are more than 15 capturing parentheses in a pattern, PCRE has
- to obtain extra memory to store data during a recursion, which it does
+ If there are more than 15 capturing parentheses in a pattern, PCRE has
+ to obtain extra memory to store data during a recursion, which it does
by using pcre_malloc, freeing it via pcre_free afterwards. If no memory
can be obtained, the match fails with the PCRE_ERROR_NOMEMORY error.
- Do not confuse the (?R) item with the condition (R), which tests for
- recursion. Consider this pattern, which matches text in angle brack-
- ets, allowing for arbitrary nesting. Only digits are allowed in nested
- brackets (that is, when recursing), whereas any characters are permit-
+ Do not confuse the (?R) item with the condition (R), which tests for
+ recursion. Consider this pattern, which matches text in angle brack-
+ ets, allowing for arbitrary nesting. Only digits are allowed in nested
+ brackets (that is, when recursing), whereas any characters are permit-
ted at the outer level.
< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >
- In this pattern, (?(R) is the start of a conditional subpattern, with
- two different alternatives for the recursive and non-recursive cases.
+ In this pattern, (?(R) is the start of a conditional subpattern, with
+ two different alternatives for the recursive and non-recursive cases.
The (?R) item is the actual recursive call.
Differences in recursion processing between PCRE and Perl
- Recursion processing in PCRE differs from Perl in two important ways.
- In PCRE (like Python, but unlike Perl), a recursive subpattern call is
+ Recursion processing in PCRE differs from Perl in two important ways.
+ In PCRE (like Python, but unlike Perl), a recursive subpattern call is
always treated as an atomic group. That is, once it has matched some of
the subject string, it is never re-entered, even if it contains untried
- alternatives and there is a subsequent matching failure. This can be
- illustrated by the following pattern, which purports to match a palin-
- dromic string that contains an odd number of characters (for example,
+ alternatives and there is a subsequent matching failure. This can be
+ illustrated by the following pattern, which purports to match a palin-
+ dromic string that contains an odd number of characters (for example,
"a", "aba", "abcba", "abcdcba"):
^(.|(.)(?1)\2)$
The idea is that it either matches a single character, or two identical
- characters surrounding a sub-palindrome. In Perl, this pattern works;
- in PCRE it does not if the pattern is longer than three characters.
+ characters surrounding a sub-palindrome. In Perl, this pattern works;
+ in PCRE it does not if the pattern is longer than three characters.
Consider the subject string "abcba":
- At the top level, the first character is matched, but as it is not at
+ At the top level, the first character is matched, but as it is not at
the end of the string, the first alternative fails; the second alterna-
tive is taken and the recursion kicks in. The recursive call to subpat-
- tern 1 successfully matches the next character ("b"). (Note that the
+ tern 1 successfully matches the next character ("b"). (Note that the
beginning and end of line tests are not part of the recursion).
- Back at the top level, the next character ("c") is compared with what
- subpattern 2 matched, which was "a". This fails. Because the recursion
- is treated as an atomic group, there are now no backtracking points,
- and so the entire match fails. (Perl is able, at this point, to re-
- enter the recursion and try the second alternative.) However, if the
+ Back at the top level, the next character ("c") is compared with what
+ subpattern 2 matched, which was "a". This fails. Because the recursion
+ is treated as an atomic group, there are now no backtracking points,
+ and so the entire match fails. (Perl is able, at this point, to re-
+ enter the recursion and try the second alternative.) However, if the
pattern is written with the alternatives in the other order, things are
different:
^((.)(?1)\2|.)$
- This time, the recursing alternative is tried first, and continues to
- recurse until it runs out of characters, at which point the recursion
- fails. But this time we do have another alternative to try at the
- higher level. That is the big difference: in the previous case the
+ This time, the recursing alternative is tried first, and continues to
+ recurse until it runs out of characters, at which point the recursion
+ fails. But this time we do have another alternative to try at the
+ higher level. That is the big difference: in the previous case the
remaining alternative is at a deeper recursion level, which PCRE cannot
use.
- To change the pattern so that it matches all palindromic strings, not
- just those with an odd number of characters, it is tempting to change
+ To change the pattern so that it matches all palindromic strings, not
+ just those with an odd number of characters, it is tempting to change
the pattern to this:
^((.)(?1)\2|.?)$
- Again, this works in Perl, but not in PCRE, and for the same reason.
- When a deeper recursion has matched a single character, it cannot be
- entered again in order to match an empty string. The solution is to
- separate the two cases, and write out the odd and even cases as alter-
+ Again, this works in Perl, but not in PCRE, and for the same reason.
+ When a deeper recursion has matched a single character, it cannot be
+ entered again in order to match an empty string. The solution is to
+ separate the two cases, and write out the odd and even cases as alter-
natives at the higher level:
^(?:((.)(?1)\2|)|((.)(?3)\4|.))
- If you want to match typical palindromic phrases, the pattern has to
+ If you want to match typical palindromic phrases, the pattern has to
ignore all non-word characters, which can be done like this:
^\W*+(?:((.)\W*+(?1)\W*+\2|)|((.)\W*+(?3)\W*+\4|\W*+.\W*+))\W*+$
If run with the PCRE_CASELESS option, this pattern matches phrases such
as "A man, a plan, a canal: Panama!" and it works well in both PCRE and
- Perl. Note the use of the possessive quantifier *+ to avoid backtrack-
- ing into sequences of non-word characters. Without this, PCRE takes a
- great deal longer (ten times or more) to match typical phrases, and
+ Perl. Note the use of the possessive quantifier *+ to avoid backtrack-
+ ing into sequences of non-word characters. Without this, PCRE takes a
+ great deal longer (ten times or more) to match typical phrases, and
Perl takes so long that you think it has gone into a loop.
- WARNING: The palindrome-matching patterns above work only if the sub-
- ject string does not start with a palindrome that is shorter than the
- entire string. For example, although "abcba" is correctly matched, if
- the subject is "ababa", PCRE finds the palindrome "aba" at the start,
- then fails at top level because the end of the string does not follow.
- Once again, it cannot jump back into the recursion to try other alter-
+ WARNING: The palindrome-matching patterns above work only if the sub-
+ ject string does not start with a palindrome that is shorter than the
+ entire string. For example, although "abcba" is correctly matched, if
+ the subject is "ababa", PCRE finds the palindrome "aba" at the start,
+ then fails at top level because the end of the string does not follow.
+ Once again, it cannot jump back into the recursion to try other alter-
natives, so the entire match fails.
- The second way in which PCRE and Perl differ in their recursion pro-
- cessing is in the handling of captured values. In Perl, when a subpat-
- tern is called recursively or as a subpattern (see the next section),
- it has no access to any values that were captured outside the recur-
- sion, whereas in PCRE these values can be referenced. Consider this
+ The second way in which PCRE and Perl differ in their recursion pro-
+ cessing is in the handling of captured values. In Perl, when a subpat-
+ tern is called recursively or as a subpattern (see the next section),
+ it has no access to any values that were captured outside the recur-
+ sion, whereas in PCRE these values can be referenced. Consider this
pattern:
^(.)(\1|a(?2))
- In PCRE, this pattern matches "bab". The first capturing parentheses
- match "b", then in the second group, when the back reference \1 fails
- to match "b", the second alternative matches "a" and then recurses. In
- the recursion, \1 does now match "b" and so the whole match succeeds.
- In Perl, the pattern fails to match because inside the recursive call
+ In PCRE, this pattern matches "bab". The first capturing parentheses
+ match "b", then in the second group, when the back reference \1 fails
+ to match "b", the second alternative matches "a" and then recurses. In
+ the recursion, \1 does now match "b" and so the whole match succeeds.
+ In Perl, the pattern fails to match because inside the recursive call
\1 cannot access the externally set value.
SUBPATTERNS AS SUBROUTINES
- If the syntax for a recursive subpattern call (either by number or by
- name) is used outside the parentheses to which it refers, it operates
- like a subroutine in a programming language. The called subpattern may
- be defined before or after the reference. A numbered reference can be
+ If the syntax for a recursive subpattern call (either by number or by
+ name) is used outside the parentheses to which it refers, it operates
+ like a subroutine in a programming language. The called subpattern may
+ be defined before or after the reference. A numbered reference can be
absolute or relative, as in these examples:
(...(absolute)...)...(?2)...
@@ -6947,79 +7125,79 @@ SUBPATTERNS AS SUBROUTINES
(sens|respons)e and \1ibility
- matches "sense and sensibility" and "response and responsibility", but
+ matches "sense and sensibility" and "response and responsibility", but
not "sense and responsibility". If instead the pattern
(sens|respons)e and (?1)ibility
- is used, it does match "sense and responsibility" as well as the other
- two strings. Another example is given in the discussion of DEFINE
+ is used, it does match "sense and responsibility" as well as the other
+ two strings. Another example is given in the discussion of DEFINE
above.
- All subroutine calls, whether recursive or not, are always treated as
- atomic groups. That is, once a subroutine has matched some of the sub-
+ All subroutine calls, whether recursive or not, are always treated as
+ atomic groups. That is, once a subroutine has matched some of the sub-
ject string, it is never re-entered, even if it contains untried alter-
- natives and there is a subsequent matching failure. Any capturing
- parentheses that are set during the subroutine call revert to their
+ natives and there is a subsequent matching failure. Any capturing
+ parentheses that are set during the subroutine call revert to their
previous values afterwards.
- Processing options such as case-independence are fixed when a subpat-
- tern is defined, so if it is used as a subroutine, such options cannot
+ Processing options such as case-independence are fixed when a subpat-
+ tern is defined, so if it is used as a subroutine, such options cannot
be changed for different calls. For example, consider this pattern:
(abc)(?i:(?-1))
- It matches "abcabc". It does not match "abcABC" because the change of
+ It matches "abcabc". It does not match "abcABC" because the change of
processing option does not affect the called subpattern.
ONIGURUMA SUBROUTINE SYNTAX
- For compatibility with Oniguruma, the non-Perl syntax \g followed by a
+ For compatibility with Oniguruma, the non-Perl syntax \g followed by a
name or a number enclosed either in angle brackets or single quotes, is
- an alternative syntax for referencing a subpattern as a subroutine,
- possibly recursively. Here are two of the examples used above, rewrit-
+ an alternative syntax for referencing a subpattern as a subroutine,
+ possibly recursively. Here are two of the examples used above, rewrit-
ten using this syntax:
(?<pn> \( ( (?>[^()]+) | \g<pn> )* \) )
(sens|respons)e and \g'1'ibility
- PCRE supports an extension to Oniguruma: if a number is preceded by a
+ PCRE supports an extension to Oniguruma: if a number is preceded by a
plus or a minus sign it is taken as a relative reference. For example:
(abc)(?i:\g<-1>)
- Note that \g{...} (Perl syntax) and \g<...> (Oniguruma syntax) are not
- synonymous. The former is a back reference; the latter is a subroutine
+ Note that \g{...} (Perl syntax) and \g<...> (Oniguruma syntax) are not
+ synonymous. The former is a back reference; the latter is a subroutine
call.
CALLOUTS
Perl has a feature whereby using the sequence (?{...}) causes arbitrary
- Perl code to be obeyed in the middle of matching a regular expression.
+ Perl code to be obeyed in the middle of matching a regular expression.
This makes it possible, amongst other things, to extract different sub-
strings that match the same pair of parentheses when there is a repeti-
tion.
PCRE provides a similar feature, but of course it cannot obey arbitrary
Perl code. The feature is called "callout". The caller of PCRE provides
- an external function by putting its entry point in the global variable
- pcre_callout (8-bit library) or pcre[16|32]_callout (16-bit or 32-bit
- library). By default, this variable contains NULL, which disables all
+ an external function by putting its entry point in the global variable
+ pcre_callout (8-bit library) or pcre[16|32]_callout (16-bit or 32-bit
+ library). By default, this variable contains NULL, which disables all
calling out.
- Within a regular expression, (?C) indicates the points at which the
- external function is to be called. If you want to identify different
- callout points, you can put a number less than 256 after the letter C.
- The default value is zero. For example, this pattern has two callout
+ Within a regular expression, (?C) indicates the points at which the
+ external function is to be called. If you want to identify different
+ callout points, you can put a number less than 256 after the letter C.
+ The default value is zero. For example, this pattern has two callout
points:
(?C1)abc(?C2)def
- If the PCRE_AUTO_CALLOUT flag is passed to a compiling function, call-
- outs are automatically installed before each item in the pattern. They
- are all numbered 255. If there is a conditional group in the pattern
+ If the PCRE_AUTO_CALLOUT flag is passed to a compiling function, call-
+ outs are automatically installed before each item in the pattern. They
+ are all numbered 255. If there is a conditional group in the pattern
whose condition is an assertion, an additional callout is inserted just
before the condition. An explicit callout may also be set at this posi-
tion, as in this example:
@@ -7029,13 +7207,18 @@ CALLOUTS
Note that this applies only to assertion conditions, not to other types
of condition.
- During matching, when PCRE reaches a callout point, the external func-
- tion is called. It is provided with the number of the callout, the
- position in the pattern, and, optionally, one item of data originally
- supplied by the caller of the matching function. The callout function
- may cause matching to proceed, to backtrack, or to fail altogether. A
- complete description of the interface to the callout function is given
- in the pcrecallout documentation.
+ During matching, when PCRE reaches a callout point, the external func-
+ tion is called. It is provided with the number of the callout, the
+ position in the pattern, and, optionally, one item of data originally
+ supplied by the caller of the matching function. The callout function
+ may cause matching to proceed, to backtrack, or to fail altogether.
+
+ By default, PCRE implements a number of optimizations at compile time
+ and matching time, and one side-effect is that sometimes callouts are
+ skipped. If you need all possible callouts to happen, you need to set
+ options that disable the relevant optimizations. More details, and a
+ complete description of the interface to the callout function, are
+ given in the pcrecallout documentation.
BACKTRACKING CONTROL
@@ -7364,8 +7547,8 @@ BACKTRACKING CONTROL
...(*COMMIT)(*PRUNE)...
If there is a matching failure to the right, backtracking onto (*PRUNE)
- cases it to be triggered, and its action is taken. There can never be a
- backtrack onto (*COMMIT).
+ causes it to be triggered, and its action is taken. There can never be
+ a backtrack onto (*COMMIT).
Backtracking verbs in repeated groups
@@ -7435,7 +7618,7 @@ AUTHOR
REVISION
- Last updated: 26 April 2013
+ Last updated: 03 December 2013
Copyright (c) 1997-2013 University of Cambridge.
------------------------------------------------------------------------------
@@ -7469,10 +7652,15 @@ CHARACTERS
\n newline (hex 0A)
\r carriage return (hex 0D)
\t tab (hex 09)
+ \0dd character with octal code 0dd
\ddd character with octal code ddd, or backreference
+ \o{ddd..} character with octal code ddd..
\xhh character with hex code hh
\x{hhh..} character with hex code hhh..
+ Note that \0dd is always an octal code, and that \8 and \9 are the lit-
+ eral characters "8" and "9".
+
CHARACTER TYPES
@@ -7495,9 +7683,12 @@ CHARACTER TYPES
\W a "non-word" character
\X a Unicode extended grapheme cluster
- In PCRE, by default, \d, \D, \s, \S, \w, and \W recognize only ASCII
- characters, even in a UTF mode. However, this can be changed by setting
- the PCRE_UCP option.
+ By default, \d, \s, and \w match only ASCII characters, even in UTF-8
+ mode or in the 16- bit and 32-bit libraries. However, if locale-spe-
+ cific matching is happening, \s and \w may also match characters with
+ code points in the range 128-255. If the PCRE_UCP option is set, the
+ behaviour of these escape sequences is changed to use Unicode proper-
+ ties and they match many more characters.
GENERAL CATEGORY PROPERTIES FOR \p and \P
@@ -7552,29 +7743,32 @@ PCRE SPECIAL CATEGORY PROPERTIES FOR \p and \P
Xan Alphanumeric: union of properties L and N
Xps POSIX space: property Z or tab, NL, VT, FF, CR
- Xsp Perl space: property Z or tab, NL, FF, CR
+ Xsp Perl space: property Z or tab, NL, VT, FF, CR
Xuc Univerally-named character: one that can be
represented by a Universal Character Name
Xwd Perl word: property Xan or underscore
+ Perl and POSIX space are now the same. Perl added VT to its space char-
+ acter set at release 5.18 and PCRE changed at release 8.34.
+
SCRIPT NAMES FOR \p AND \P
- Arabic, Armenian, Avestan, Balinese, Bamum, Batak, Bengali, Bopomofo,
- Brahmi, Braille, Buginese, Buhid, Canadian_Aboriginal, Carian, Chakma,
- Cham, Cherokee, Common, Coptic, Cuneiform, Cypriot, Cyrillic, Deseret,
- Devanagari, Egyptian_Hieroglyphs, Ethiopic, Georgian, Glagolitic,
- Gothic, Greek, Gujarati, Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hira-
- gana, Imperial_Aramaic, Inherited, Inscriptional_Pahlavi, Inscrip-
- tional_Parthian, Javanese, Kaithi, Kannada, Katakana, Kayah_Li,
- Kharoshthi, Khmer, Lao, Latin, Lepcha, Limbu, Linear_B, Lisu, Lycian,
+ Arabic, Armenian, Avestan, Balinese, Bamum, Batak, Bengali, Bopomofo,
+ Brahmi, Braille, Buginese, Buhid, Canadian_Aboriginal, Carian, Chakma,
+ Cham, Cherokee, Common, Coptic, Cuneiform, Cypriot, Cyrillic, Deseret,
+ Devanagari, Egyptian_Hieroglyphs, Ethiopic, Georgian, Glagolitic,
+ Gothic, Greek, Gujarati, Gurmukhi, Han, Hangul, Hanunoo, Hebrew, Hira-
+ gana, Imperial_Aramaic, Inherited, Inscriptional_Pahlavi, Inscrip-
+ tional_Parthian, Javanese, Kaithi, Kannada, Katakana, Kayah_Li,
+ Kharoshthi, Khmer, Lao, Latin, Lepcha, Limbu, Linear_B, Lisu, Lycian,
Lydian, Malayalam, Mandaic, Meetei_Mayek, Meroitic_Cursive,
- Meroitic_Hieroglyphs, Miao, Mongolian, Myanmar, New_Tai_Lue, Nko,
- Ogham, Old_Italic, Old_Persian, Old_South_Arabian, Old_Turkic,
- Ol_Chiki, Oriya, Osmanya, Phags_Pa, Phoenician, Rejang, Runic, Samari-
- tan, Saurashtra, Sharada, Shavian, Sinhala, Sora_Sompeng, Sundanese,
- Syloti_Nagri, Syriac, Tagalog, Tagbanwa, Tai_Le, Tai_Tham, Tai_Viet,
- Takri, Tamil, Telugu, Thaana, Thai, Tibetan, Tifinagh, Ugaritic, Vai,
+ Meroitic_Hieroglyphs, Miao, Mongolian, Myanmar, New_Tai_Lue, Nko,
+ Ogham, Old_Italic, Old_Persian, Old_South_Arabian, Old_Turkic,
+ Ol_Chiki, Oriya, Osmanya, Phags_Pa, Phoenician, Rejang, Runic, Samari-
+ tan, Saurashtra, Sharada, Shavian, Sinhala, Sora_Sompeng, Sundanese,
+ Syloti_Nagri, Syriac, Tagalog, Tagbanwa, Tai_Le, Tai_Tham, Tai_Viet,
+ Takri, Tamil, Telugu, Thaana, Thai, Tibetan, Tifinagh, Ugaritic, Vai,
Yi.
@@ -7601,8 +7795,8 @@ CHARACTER CLASSES
word same as \w
xdigit hexadecimal digit
- In PCRE, POSIX character set names recognize only ASCII characters by
- default, but some of them use Unicode properties if PCRE_UCP is set.
+ In PCRE, POSIX character set names recognize only ASCII characters by
+ default, but some of them use Unicode properties if PCRE_UCP is set.
You can use \Q...\E inside a character class.
@@ -7683,7 +7877,7 @@ OPTION SETTING
(?x) extended (ignore white space)
(?-...) unset option(s)
- The following are recognized only at the start of a pattern or after
+ The following are recognized only at the start of a pattern or after
one of the newline-setting options with similar syntax:
(*LIMIT_MATCH=d) set the match limit to d (decimal number)
@@ -7695,6 +7889,9 @@ OPTION SETTING
(*UTF) set appropriate UTF mode for the library in use
(*UCP) set PCRE_UCP (use Unicode properties for \d etc)
+ Note that LIMIT_MATCH and LIMIT_RECURSION can only reduce the value of
+ the limits set by the caller of pcre_exec(), not increase them.
+
LOOKAHEAD AND LOOKBEHIND ASSERTIONS
@@ -7819,7 +8016,7 @@ AUTHOR
REVISION
- Last updated: 26 April 2013
+ Last updated: 12 November 2013
Copyright (c) 1997-2013 University of Cambridge.
------------------------------------------------------------------------------
@@ -8743,6 +8940,16 @@ MULTI-SEGMENT MATCHING WITH pcre_dfa_exec() OR pcre[16|32]_dfa_exec()
matched string. It is up to the calling program to do that if it needs
to.
+ That means that, for an unanchored pattern, if a continued match fails,
+ it is not possible to try again at a new starting point. All this
+ facility is capable of doing is continuing with the previous match
+ attempt. In the previous example, if the second set of data is "ug23"
+ the result is no match, even though there would be a match for "aug23"
+ if the entire string were given at once. Depending on the application,
+ this may or may not be what you want. The only way to allow for start-
+ ing again at the next character is to retain the matched part of the
+ subject and try a new complete match.
+
You can set the PCRE_PARTIAL_SOFT or PCRE_PARTIAL_HARD options with
PCRE_DFA_RESTART to continue partial matching over multiple segments.
This facility can be used to pass very long subject strings to the DFA
@@ -8926,7 +9133,7 @@ AUTHOR
REVISION
- Last updated: 20 February 2013
+ Last updated: 02 July 2013
Copyright (c) 1997-2013 University of Cambridge.
------------------------------------------------------------------------------
@@ -9030,6 +9237,10 @@ RE-USING A PRECOMPILED PATTERN
is used to pass this data, as described in the section on matching a
pattern in the pcreapi documentation.
+ Warning: The tables that pcre_exec() and pcre_dfa_exec() use must be
+ the same as those that were used when the pattern was compiled. If this
+ is not the case, the behaviour is undefined.
+
If you did not provide custom character tables when the pattern was
compiled, the pointer in the compiled pattern is NULL, which causes the
matching functions to use PCRE's internal tables. Thus, you do not need
@@ -9061,8 +9272,8 @@ AUTHOR
REVISION
- Last updated: 24 June 2012
- Copyright (c) 1997-2012 University of Cambridge.
+ Last updated: 12 November 2013
+ Copyright (c) 1997-2013 University of Cambridge.
------------------------------------------------------------------------------
@@ -9243,7 +9454,7 @@ PCREPOSIX(3) Library Functions Manual PCREPOSIX(3)
NAME
PCRE - Perl-compatible regular expressions.
-SYNOPSIS OF POSIX API
+SYNOPSIS
#include <pcreposix.h>
@@ -9252,8 +9463,7 @@ SYNOPSIS OF POSIX API
int regexec(regex_t *preg, const char *string,
size_t nmatch, regmatch_t pmatch[], int eflags);
-
- size_t regerror(int errcode, const regex_t *preg,
+ size_t regerror(int errcode, const regex_t *preg,
char *errbuf, size_t errbuf_size);
void regfree(regex_t *preg);
@@ -9943,38 +10153,43 @@ SIZE AND OTHER LIMITATIONS
never in practice be relevant.
The maximum length of a compiled pattern is approximately 64K data
- units (bytes for the 8-bit library, 32-bit units for the 32-bit
+ units (bytes for the 8-bit library, 16-bit units for the 16-bit
library, and 32-bit units for the 32-bit library) if PCRE is compiled
- with the default internal linkage size of 2 bytes. If you want to
- process regular expressions that are truly enormous, you can compile
- PCRE with an internal linkage size of 3 or 4 (when building the 16-bit
- or 32-bit library, 3 is rounded up to 4). See the README file in the
- source distribution and the pcrebuild documentation for details. In
- these cases the limit is substantially larger. However, the speed of
+ with the default internal linkage size, which is 2 bytes for the 8-bit
+ and 16-bit libraries, and 4 bytes for the 32-bit library. If you want
+ to process regular expressions that are truly enormous, you can compile
+ PCRE with an internal linkage size of 3 or 4 (when building the 16-bit
+ or 32-bit library, 3 is rounded up to 4). See the README file in the
+ source distribution and the pcrebuild documentation for details. In
+ these cases the limit is substantially larger. However, the speed of
execution is slower.
All values in repeating quantifiers must be less than 65536.
There is no limit to the number of parenthesized subpatterns, but there
- can be no more than 65535 capturing subpatterns.
+ can be no more than 65535 capturing subpatterns. There is, however, a
+ limit to the depth of nesting of parenthesized subpatterns of all
+ kinds. This is imposed in order to limit the amount of system stack
+ used at compile time. The limit can be specified when PCRE is built;
+ the default is 250.
There is a limit to the number of forward references to subsequent sub-
- patterns of around 200,000. Repeated forward references with fixed
- upper limits, for example, (?2){0,100} when subpattern number 2 is to
- the right, are included in the count. There is no limit to the number
+ patterns of around 200,000. Repeated forward references with fixed
+ upper limits, for example, (?2){0,100} when subpattern number 2 is to
+ the right, are included in the count. There is no limit to the number
of backward references.
The maximum length of name for a named subpattern is 32 characters, and
the maximum number of named subpatterns is 10000.
- The maximum length of a name in a (*MARK), (*PRUNE), (*SKIP), or
- (*THEN) verb is 255 for the 8-bit library and 65535 for the 16-bit and
- 32-bit library.
+ The maximum length of a name in a (*MARK), (*PRUNE), (*SKIP), or
+ (*THEN) verb is 255 for the 8-bit library and 65535 for the 16-bit and
+ 32-bit libraries.
- The maximum length of a subject string is the largest positive number
- that an integer variable can hold. However, when using the traditional
+ The maximum length of a subject string is the largest positive number
+ that an integer variable can hold. However, when using the traditional
matching function, PCRE uses recursion to handle subpatterns and indef-
- inite repetition. This means that the available stack space may limit
+ inite repetition. This means that the available stack space may limit
the size of a subject string that can be processed by certain patterns.
For a discussion of stack issues, see the pcrestack documentation.
@@ -9988,8 +10203,8 @@ AUTHOR
REVISION
- Last updated: 04 May 2012
- Copyright (c) 1997-2012 University of Cambridge.
+ Last updated: 05 November 2013
+ Copyright (c) 1997-2013 University of Cambridge.
------------------------------------------------------------------------------
diff --git a/pcre/doc/pcre16.3 b/pcre/doc/pcre16.3
index 234ae96412f..85126a67923 100644
--- a/pcre/doc/pcre16.3
+++ b/pcre/doc/pcre16.3
@@ -8,140 +8,120 @@ PCRE - Perl-compatible regular expressions
.SH "PCRE 16-BIT API BASIC FUNCTIONS"
.rs
.sp
-.SM
+.nf
.B pcre16 *pcre16_compile(PCRE_SPTR16 \fIpattern\fP, int \fIoptions\fP,
-.ti +5n
-.B const char **\fIerrptr\fP, int *\fIerroffset\fP,
-.ti +5n
-.B const unsigned char *\fItableptr\fP);
-.PP
+.B " const char **\fIerrptr\fP, int *\fIerroffset\fP,"
+.B " const unsigned char *\fItableptr\fP);"
+.sp
.B pcre16 *pcre16_compile2(PCRE_SPTR16 \fIpattern\fP, int \fIoptions\fP,
-.ti +5n
-.B int *\fIerrorcodeptr\fP,
-.ti +5n
-.B const char **\fIerrptr\fP, int *\fIerroffset\fP,
-.ti +5n
-.B const unsigned char *\fItableptr\fP);
-.PP
+.B " int *\fIerrorcodeptr\fP,"
+.B " const char **\fIerrptr\fP, int *\fIerroffset\fP,"
+.B " const unsigned char *\fItableptr\fP);"
+.sp
.B pcre16_extra *pcre16_study(const pcre16 *\fIcode\fP, int \fIoptions\fP,
-.ti +5n
-.B const char **\fIerrptr\fP);
-.PP
+.B " const char **\fIerrptr\fP);"
+.sp
.B void pcre16_free_study(pcre16_extra *\fIextra\fP);
-.PP
+.sp
.B int pcre16_exec(const pcre16 *\fIcode\fP, "const pcre16_extra *\fIextra\fP,"
-.ti +5n
-.B "PCRE_SPTR16 \fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
-.ti +5n
-.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);
-.PP
+.B " PCRE_SPTR16 \fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
+.B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);"
+.sp
.B int pcre16_dfa_exec(const pcre16 *\fIcode\fP, "const pcre16_extra *\fIextra\fP,"
-.ti +5n
-.B "PCRE_SPTR16 \fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
-.ti +5n
-.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,
-.ti +5n
-.B int *\fIworkspace\fP, int \fIwscount\fP);
+.B " PCRE_SPTR16 \fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
+.B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,"
+.B " int *\fIworkspace\fP, int \fIwscount\fP);"
+.fi
.
.
.SH "PCRE 16-BIT API STRING EXTRACTION FUNCTIONS"
.rs
.sp
+.nf
.B int pcre16_copy_named_substring(const pcre16 *\fIcode\fP,
-.ti +5n
-.B PCRE_SPTR16 \fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, PCRE_SPTR16 \fIstringname\fP,
-.ti +5n
-.B PCRE_UCHAR16 *\fIbuffer\fP, int \fIbuffersize\fP);
-.PP
+.B " PCRE_SPTR16 \fIsubject\fP, int *\fIovector\fP,"
+.B " int \fIstringcount\fP, PCRE_SPTR16 \fIstringname\fP,"
+.B " PCRE_UCHAR16 *\fIbuffer\fP, int \fIbuffersize\fP);"
+.sp
.B int pcre16_copy_substring(PCRE_SPTR16 \fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, int \fIstringnumber\fP, PCRE_UCHAR16 *\fIbuffer\fP,
-.ti +5n
-.B int \fIbuffersize\fP);
-.PP
+.B " int \fIstringcount\fP, int \fIstringnumber\fP, PCRE_UCHAR16 *\fIbuffer\fP,"
+.B " int \fIbuffersize\fP);"
+.sp
.B int pcre16_get_named_substring(const pcre16 *\fIcode\fP,
-.ti +5n
-.B PCRE_SPTR16 \fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, PCRE_SPTR16 \fIstringname\fP,
-.ti +5n
-.B PCRE_SPTR16 *\fIstringptr\fP);
-.PP
+.B " PCRE_SPTR16 \fIsubject\fP, int *\fIovector\fP,"
+.B " int \fIstringcount\fP, PCRE_SPTR16 \fIstringname\fP,"
+.B " PCRE_SPTR16 *\fIstringptr\fP);"
+.sp
.B int pcre16_get_stringnumber(const pcre16 *\fIcode\fP,
-.ti +5n
-.B PCRE_SPTR16 \fIname\fP);
-.PP
+.B " PCRE_SPTR16 \fIname\fP);
+.sp
.B int pcre16_get_stringtable_entries(const pcre16 *\fIcode\fP,
-.ti +5n
-.B PCRE_SPTR16 \fIname\fP, PCRE_UCHAR16 **\fIfirst\fP, PCRE_UCHAR16 **\fIlast\fP);
-.PP
+.B " PCRE_SPTR16 \fIname\fP, PCRE_UCHAR16 **\fIfirst\fP, PCRE_UCHAR16 **\fIlast\fP);"
+.sp
.B int pcre16_get_substring(PCRE_SPTR16 \fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, int \fIstringnumber\fP,
-.ti +5n
-.B PCRE_SPTR16 *\fIstringptr\fP);
-.PP
+.B " int \fIstringcount\fP, int \fIstringnumber\fP,"
+.B " PCRE_SPTR16 *\fIstringptr\fP);"
+.sp
.B int pcre16_get_substring_list(PCRE_SPTR16 \fIsubject\fP,
-.ti +5n
-.B int *\fIovector\fP, int \fIstringcount\fP, "PCRE_SPTR16 **\fIlistptr\fP);"
-.PP
+.B " int *\fIovector\fP, int \fIstringcount\fP, PCRE_SPTR16 **\fIlistptr\fP);"
+.sp
.B void pcre16_free_substring(PCRE_SPTR16 \fIstringptr\fP);
-.PP
+.sp
.B void pcre16_free_substring_list(PCRE_SPTR16 *\fIstringptr\fP);
+.fi
.
.
.SH "PCRE 16-BIT API AUXILIARY FUNCTIONS"
.rs
.sp
+.nf
.B pcre16_jit_stack *pcre16_jit_stack_alloc(int \fIstartsize\fP, int \fImaxsize\fP);
-.PP
+.sp
.B void pcre16_jit_stack_free(pcre16_jit_stack *\fIstack\fP);
-.PP
+.sp
.B void pcre16_assign_jit_stack(pcre16_extra *\fIextra\fP,
-.ti +5n
-.B pcre16_jit_callback \fIcallback\fP, void *\fIdata\fP);
-.PP
+.B " pcre16_jit_callback \fIcallback\fP, void *\fIdata\fP);"
+.sp
.B const unsigned char *pcre16_maketables(void);
-.PP
+.sp
.B int pcre16_fullinfo(const pcre16 *\fIcode\fP, "const pcre16_extra *\fIextra\fP,"
-.ti +5n
-.B int \fIwhat\fP, void *\fIwhere\fP);
-.PP
+.B " int \fIwhat\fP, void *\fIwhere\fP);"
+.sp
.B int pcre16_refcount(pcre16 *\fIcode\fP, int \fIadjust\fP);
-.PP
+.sp
.B int pcre16_config(int \fIwhat\fP, void *\fIwhere\fP);
-.PP
+.sp
.B const char *pcre16_version(void);
-.PP
+.sp
.B int pcre16_pattern_to_host_byte_order(pcre16 *\fIcode\fP,
-.ti +5n
-.B pcre16_extra *\fIextra\fP, const unsigned char *\fItables\fP);
+.B " pcre16_extra *\fIextra\fP, const unsigned char *\fItables\fP);"
+.fi
.
.
.SH "PCRE 16-BIT API INDIRECTED FUNCTIONS"
.rs
.sp
+.nf
.B void *(*pcre16_malloc)(size_t);
-.PP
+.sp
.B void (*pcre16_free)(void *);
-.PP
+.sp
.B void *(*pcre16_stack_malloc)(size_t);
-.PP
+.sp
.B void (*pcre16_stack_free)(void *);
-.PP
+.sp
.B int (*pcre16_callout)(pcre16_callout_block *);
+.fi
.
.
.SH "PCRE 16-BIT API 16-BIT-ONLY FUNCTION"
.rs
.sp
+.nf
.B int pcre16_utf16_to_host_byte_order(PCRE_UCHAR16 *\fIoutput\fP,
-.ti +5n
-.B PCRE_SPTR16 \fIinput\fP, int \fIlength\fP, int *\fIbyte_order\fP,
-.ti +5n
-.B int \fIkeep_boms\fP);
+.B " PCRE_SPTR16 \fIinput\fP, int \fIlength\fP, int *\fIbyte_order\fP,"
+.B " int \fIkeep_boms\fP);"
+.fi
.
.
.SH "THE PCRE 16-BIT LIBRARY"
diff --git a/pcre/doc/pcre32.3 b/pcre/doc/pcre32.3
index 516c8ee570c..7cde8c08772 100644
--- a/pcre/doc/pcre32.3
+++ b/pcre/doc/pcre32.3
@@ -8,140 +8,119 @@ PCRE - Perl-compatible regular expressions
.SH "PCRE 32-BIT API BASIC FUNCTIONS"
.rs
.sp
-.SM
+.nf
.B pcre32 *pcre32_compile(PCRE_SPTR32 \fIpattern\fP, int \fIoptions\fP,
-.ti +5n
-.B const char **\fIerrptr\fP, int *\fIerroffset\fP,
-.ti +5n
-.B const unsigned char *\fItableptr\fP);
-.PP
+.B " const char **\fIerrptr\fP, int *\fIerroffset\fP,"
+.B " const unsigned char *\fItableptr\fP);"
+.sp
.B pcre32 *pcre32_compile2(PCRE_SPTR32 \fIpattern\fP, int \fIoptions\fP,
-.ti +5n
-.B int *\fIerrorcodeptr\fP,
-.ti +5n
-.B const char **\fIerrptr\fP, int *\fIerroffset\fP,
-.ti +5n
-.B const unsigned char *\fItableptr\fP);
-.PP
+.B " int *\fIerrorcodeptr\fP,"
+.B " const unsigned char *\fItableptr\fP);"
+.sp
.B pcre32_extra *pcre32_study(const pcre32 *\fIcode\fP, int \fIoptions\fP,
-.ti +5n
-.B const char **\fIerrptr\fP);
-.PP
+.B " const char **\fIerrptr\fP);"
+.sp
.B void pcre32_free_study(pcre32_extra *\fIextra\fP);
-.PP
+.sp
.B int pcre32_exec(const pcre32 *\fIcode\fP, "const pcre32_extra *\fIextra\fP,"
-.ti +5n
-.B "PCRE_SPTR32 \fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
-.ti +5n
-.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);
-.PP
+.B " PCRE_SPTR32 \fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
+.B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);"
+.sp
.B int pcre32_dfa_exec(const pcre32 *\fIcode\fP, "const pcre32_extra *\fIextra\fP,"
-.ti +5n
-.B "PCRE_SPTR32 \fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
-.ti +5n
-.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,
-.ti +5n
-.B int *\fIworkspace\fP, int \fIwscount\fP);
+.B " PCRE_SPTR32 \fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
+.B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,"
+.B " int *\fIworkspace\fP, int \fIwscount\fP);"
+.fi
.
.
.SH "PCRE 32-BIT API STRING EXTRACTION FUNCTIONS"
.rs
.sp
+.nf
.B int pcre32_copy_named_substring(const pcre32 *\fIcode\fP,
-.ti +5n
-.B PCRE_SPTR32 \fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, PCRE_SPTR32 \fIstringname\fP,
-.ti +5n
-.B PCRE_UCHAR32 *\fIbuffer\fP, int \fIbuffersize\fP);
-.PP
+.B " PCRE_SPTR32 \fIsubject\fP, int *\fIovector\fP,"
+.B " int \fIstringcount\fP, PCRE_SPTR32 \fIstringname\fP,"
+.B " PCRE_UCHAR32 *\fIbuffer\fP, int \fIbuffersize\fP);"
+.sp
.B int pcre32_copy_substring(PCRE_SPTR32 \fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, int \fIstringnumber\fP, PCRE_UCHAR32 *\fIbuffer\fP,
-.ti +5n
-.B int \fIbuffersize\fP);
-.PP
+.B " int \fIstringcount\fP, int \fIstringnumber\fP, PCRE_UCHAR32 *\fIbuffer\fP,"
+.B " int \fIbuffersize\fP);"
+.sp
.B int pcre32_get_named_substring(const pcre32 *\fIcode\fP,
-.ti +5n
-.B PCRE_SPTR32 \fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, PCRE_SPTR32 \fIstringname\fP,
-.ti +5n
-.B PCRE_SPTR32 *\fIstringptr\fP);
-.PP
+.B " PCRE_SPTR32 \fIsubject\fP, int *\fIovector\fP,"
+.B " int \fIstringcount\fP, PCRE_SPTR32 \fIstringname\fP,"
+.B " PCRE_SPTR32 *\fIstringptr\fP);"
+.sp
.B int pcre32_get_stringnumber(const pcre32 *\fIcode\fP,
-.ti +5n
-.B PCRE_SPTR32 \fIname\fP);
-.PP
+.B " PCRE_SPTR32 \fIname\fP);"
+.sp
.B int pcre32_get_stringtable_entries(const pcre32 *\fIcode\fP,
-.ti +5n
-.B PCRE_SPTR32 \fIname\fP, PCRE_UCHAR32 **\fIfirst\fP, PCRE_UCHAR32 **\fIlast\fP);
-.PP
+.B " PCRE_SPTR32 \fIname\fP, PCRE_UCHAR32 **\fIfirst\fP, PCRE_UCHAR32 **\fIlast\fP);"
+.sp
.B int pcre32_get_substring(PCRE_SPTR32 \fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, int \fIstringnumber\fP,
-.ti +5n
-.B PCRE_SPTR32 *\fIstringptr\fP);
-.PP
+.B " int \fIstringcount\fP, int \fIstringnumber\fP,"
+.B " PCRE_SPTR32 *\fIstringptr\fP);"
+.sp
.B int pcre32_get_substring_list(PCRE_SPTR32 \fIsubject\fP,
-.ti +5n
-.B int *\fIovector\fP, int \fIstringcount\fP, "PCRE_SPTR32 **\fIlistptr\fP);"
-.PP
+.B " int *\fIovector\fP, int \fIstringcount\fP, PCRE_SPTR32 **\fIlistptr\fP);"
+.sp
.B void pcre32_free_substring(PCRE_SPTR32 \fIstringptr\fP);
-.PP
+.sp
.B void pcre32_free_substring_list(PCRE_SPTR32 *\fIstringptr\fP);
+.fi
.
.
.SH "PCRE 32-BIT API AUXILIARY FUNCTIONS"
.rs
.sp
+.nf
.B pcre32_jit_stack *pcre32_jit_stack_alloc(int \fIstartsize\fP, int \fImaxsize\fP);
-.PP
+.sp
.B void pcre32_jit_stack_free(pcre32_jit_stack *\fIstack\fP);
-.PP
+.sp
.B void pcre32_assign_jit_stack(pcre32_extra *\fIextra\fP,
-.ti +5n
-.B pcre32_jit_callback \fIcallback\fP, void *\fIdata\fP);
-.PP
+.B " pcre32_jit_callback \fIcallback\fP, void *\fIdata\fP);"
+.sp
.B const unsigned char *pcre32_maketables(void);
-.PP
+.sp
.B int pcre32_fullinfo(const pcre32 *\fIcode\fP, "const pcre32_extra *\fIextra\fP,"
-.ti +5n
-.B int \fIwhat\fP, void *\fIwhere\fP);
-.PP
+.B " int \fIwhat\fP, void *\fIwhere\fP);"
+.sp
.B int pcre32_refcount(pcre32 *\fIcode\fP, int \fIadjust\fP);
-.PP
+.sp
.B int pcre32_config(int \fIwhat\fP, void *\fIwhere\fP);
-.PP
+.sp
.B const char *pcre32_version(void);
-.PP
+.sp
.B int pcre32_pattern_to_host_byte_order(pcre32 *\fIcode\fP,
-.ti +5n
-.B pcre32_extra *\fIextra\fP, const unsigned char *\fItables\fP);
+.B " pcre32_extra *\fIextra\fP, const unsigned char *\fItables\fP);"
+.fi
.
.
.SH "PCRE 32-BIT API INDIRECTED FUNCTIONS"
.rs
.sp
+.nf
.B void *(*pcre32_malloc)(size_t);
-.PP
+.sp
.B void (*pcre32_free)(void *);
-.PP
+.sp
.B void *(*pcre32_stack_malloc)(size_t);
-.PP
+.sp
.B void (*pcre32_stack_free)(void *);
-.PP
+.sp
.B int (*pcre32_callout)(pcre32_callout_block *);
+.fi
.
.
.SH "PCRE 32-BIT API 32-BIT-ONLY FUNCTION"
.rs
.sp
+.nf
.B int pcre32_utf32_to_host_byte_order(PCRE_UCHAR32 *\fIoutput\fP,
-.ti +5n
-.B PCRE_SPTR32 \fIinput\fP, int \fIlength\fP, int *\fIbyte_order\fP,
-.ti +5n
-.B int \fIkeep_boms\fP);
+.B " PCRE_SPTR32 \fIinput\fP, int \fIlength\fP, int *\fIbyte_order\fP,"
+.B " int \fIkeep_boms\fP);"
+.fi
.
.
.SH "THE PCRE 32-BIT LIBRARY"
diff --git a/pcre/doc/pcre_assign_jit_stack.3 b/pcre/doc/pcre_assign_jit_stack.3
index e1563b6e06d..0ecf6f2c60f 100644
--- a/pcre/doc/pcre_assign_jit_stack.3
+++ b/pcre/doc/pcre_assign_jit_stack.3
@@ -6,18 +6,16 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B void pcre_assign_jit_stack(pcre_extra *\fIextra\fP,
-.ti +5n
-.B pcre_jit_callback \fIcallback\fP, void *\fIdata\fP);
-.PP
+.B " pcre_jit_callback \fIcallback\fP, void *\fIdata\fP);"
+.sp
.B void pcre16_assign_jit_stack(pcre16_extra *\fIextra\fP,
-.ti +5n
-.B pcre16_jit_callback \fIcallback\fP, void *\fIdata\fP);
-.PP
+.B " pcre16_jit_callback \fIcallback\fP, void *\fIdata\fP);"
+.sp
.B void pcre32_assign_jit_stack(pcre32_extra *\fIextra\fP,
-.ti +5n
-.B pcre32_jit_callback \fIcallback\fP, void *\fIdata\fP);
+.B " pcre32_jit_callback \fIcallback\fP, void *\fIdata\fP);"
+.fi
.
.SH DESCRIPTION
.rs
diff --git a/pcre/doc/pcre_compile.3 b/pcre/doc/pcre_compile.3
index d09768d8021..5c16ebe26d5 100644
--- a/pcre/doc/pcre_compile.3
+++ b/pcre/doc/pcre_compile.3
@@ -1,4 +1,4 @@
-.TH PCRE_COMPILE 3 "24 June 2012" "PCRE 8.30"
+.TH PCRE_COMPILE 3 "01 October 2013" "PCRE 8.34"
.SH NAME
PCRE - Perl-compatible regular expressions
.SH SYNOPSIS
@@ -6,24 +6,19 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B pcre *pcre_compile(const char *\fIpattern\fP, int \fIoptions\fP,
-.ti +5n
-.B const char **\fIerrptr\fP, int *\fIerroffset\fP,
-.ti +5n
-.B const unsigned char *\fItableptr\fP);
-.PP
+.B " const char **\fIerrptr\fP, int *\fIerroffset\fP,"
+.B " const unsigned char *\fItableptr\fP);"
+.sp
.B pcre16 *pcre16_compile(PCRE_SPTR16 \fIpattern\fP, int \fIoptions\fP,
-.ti +5n
-.B const char **\fIerrptr\fP, int *\fIerroffset\fP,
-.ti +5n
-.B const unsigned char *\fItableptr\fP);
-.PP
+.B " const char **\fIerrptr\fP, int *\fIerroffset\fP,"
+.B " const unsigned char *\fItableptr\fP);"
+.sp
.B pcre32 *pcre32_compile(PCRE_SPTR32 \fIpattern\fP, int \fIoptions\fP,
-.ti +5n
-.B const char **\fIerrptr\fP, int *\fIerroffset\fP,
-.ti +5n
-.B const unsigned char *\fItableptr\fP);
+.B " const char **\fIerrptr\fP, int *\fIerroffset\fP,"
+.B " const unsigned char *\fItableptr\fP);"
+.fi
.
.SH DESCRIPTION
.rs
@@ -56,6 +51,7 @@ The option bits are:
PCRE_FIRSTLINE Force matching to be before newline
PCRE_JAVASCRIPT_COMPAT JavaScript compatibility
PCRE_MULTILINE ^ and $ match newlines within data
+ PCRE_NEVER_UTF Lock out UTF, e.g. via (*UTF)
PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
PCRE_NEWLINE_ANYCRLF Recognize CR, LF, and CRLF as newline
sequences
@@ -64,6 +60,8 @@ The option bits are:
PCRE_NEWLINE_LF Set LF as the newline sequence
PCRE_NO_AUTO_CAPTURE Disable numbered capturing paren-
theses (named ones available)
+ PCRE_NO_AUTO_POSSESS Disable auto-possessification
+ PCRE_NO_START_OPTIMIZE Disable match-time start optimizations
PCRE_NO_UTF16_CHECK Do not check the pattern for UTF-16
validity (only relevant if
PCRE_UTF16 is set)
diff --git a/pcre/doc/pcre_compile2.3 b/pcre/doc/pcre_compile2.3
index 1fcae433b43..377420180e9 100644
--- a/pcre/doc/pcre_compile2.3
+++ b/pcre/doc/pcre_compile2.3
@@ -1,4 +1,4 @@
-.TH PCRE_COMPILE2 3 "24 June 2012" "PCRE 8.30"
+.TH PCRE_COMPILE2 3 "01 October 2013" "PCRE 8.34"
.SH NAME
PCRE - Perl-compatible regular expressions
.SH SYNOPSIS
@@ -6,30 +6,22 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B pcre *pcre_compile2(const char *\fIpattern\fP, int \fIoptions\fP,
-.ti +5n
-.B int *\fIerrorcodeptr\fP,
-.ti +5n
-.B const char **\fIerrptr\fP, int *\fIerroffset\fP,
-.ti +5n
-.B const unsigned char *\fItableptr\fP);
-.PP
+.B " int *\fIerrorcodeptr\fP,"
+.B " const char **\fIerrptr\fP, int *\fIerroffset\fP,"
+.B " const unsigned char *\fItableptr\fP);"
+.sp
.B pcre16 *pcre16_compile2(PCRE_SPTR16 \fIpattern\fP, int \fIoptions\fP,
-.ti +5n
-.B int *\fIerrorcodeptr\fP,
-.ti +5n
-.B const char **\fIerrptr\fP, int *\fIerroffset\fP,
-.ti +5n
-.B const unsigned char *\fItableptr\fP);
-.PP
+.B " int *\fIerrorcodeptr\fP,"
+.B " const char **\fIerrptr\fP, int *\fIerroffset\fP,"
+.B " const unsigned char *\fItableptr\fP);"
+.sp
.B pcre32 *pcre32_compile2(PCRE_SPTR32 \fIpattern\fP, int \fIoptions\fP,
-.ti +5n
-.B int *\fIerrorcodeptr\fP,
-.ti +5n
-.B const char **\fIerrptr\fP, int *\fIerroffset\fP,
-.ti +5n
-.B const unsigned char *\fItableptr\fP);
+.B " int *\fIerrorcodeptr\fP,£
+.B " const char **\fIerrptr\fP, int *\fIerroffset\fP,"
+.B " const unsigned char *\fItableptr\fP);"
+.fi
.
.SH DESCRIPTION
.rs
@@ -64,6 +56,7 @@ The option bits are:
PCRE_FIRSTLINE Force matching to be before newline
PCRE_JAVASCRIPT_COMPAT JavaScript compatibility
PCRE_MULTILINE ^ and $ match newlines within data
+ PCRE_NEVER_UTF Lock out UTF, e.g. via (*UTF)
PCRE_NEWLINE_ANY Recognize any Unicode newline sequence
PCRE_NEWLINE_ANYCRLF Recognize CR, LF, and CRLF as newline
sequences
@@ -72,6 +65,8 @@ The option bits are:
PCRE_NEWLINE_LF Set LF as the newline sequence
PCRE_NO_AUTO_CAPTURE Disable numbered capturing paren-
theses (named ones available)
+ PCRE_NO_AUTO_POSSESS Disable auto-possessification
+ PCRE_NO_START_OPTIMIZE Disable match-time start optimizations
PCRE_NO_UTF16_CHECK Do not check the pattern for UTF-16
validity (only relevant if
PCRE_UTF16 is set)
diff --git a/pcre/doc/pcre_config.3 b/pcre/doc/pcre_config.3
index 5a6e6be7a47..d3de14bb73c 100644
--- a/pcre/doc/pcre_config.3
+++ b/pcre/doc/pcre_config.3
@@ -1,4 +1,4 @@
-.TH PCRE_CONFIG 3 "24 June 2012" "PCRE 8.30"
+.TH PCRE_CONFIG 3 "05 November 2013" "PCRE 8.34"
.SH NAME
PCRE - Perl-compatible regular expressions
.SH SYNOPSIS
@@ -33,6 +33,7 @@ point to an unsigned long integer. The available codes are:
target architecture for the JIT compiler,
or NULL if there is no JIT support
PCRE_CONFIG_LINK_SIZE Internal link size: 2, 3, or 4
+ PCRE_CONFIG_PARENS_LIMIT Parentheses nesting limit
PCRE_CONFIG_MATCH_LIMIT Internal resource limit
PCRE_CONFIG_MATCH_LIMIT_RECURSION
Internal recursion depth limit
diff --git a/pcre/doc/pcre_copy_named_substring.3 b/pcre/doc/pcre_copy_named_substring.3
index e3281d8feae..52582aecb2b 100644
--- a/pcre/doc/pcre_copy_named_substring.3
+++ b/pcre/doc/pcre_copy_named_substring.3
@@ -6,30 +6,22 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B int pcre_copy_named_substring(const pcre *\fIcode\fP,
-.ti +5n
-.B const char *\fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, const char *\fIstringname\fP,
-.ti +5n
-.B char *\fIbuffer\fP, int \fIbuffersize\fP);
-.PP
+.B " const char *\fIsubject\fP, int *\fIovector\fP,"
+.B " int \fIstringcount\fP, const char *\fIstringname\fP,"
+.B " char *\fIbuffer\fP, int \fIbuffersize\fP);"
+.sp
.B int pcre16_copy_named_substring(const pcre16 *\fIcode\fP,
-.ti +5n
-.B PCRE_SPTR16 \fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, PCRE_SPTR16 \fIstringname\fP,
-.ti +5n
-.B PCRE_UCHAR16 *\fIbuffer\fP, int \fIbuffersize\fP);
-.PP
+.B " PCRE_SPTR16 \fIsubject\fP, int *\fIovector\fP,"
+.B " int \fIstringcount\fP, PCRE_SPTR16 \fIstringname\fP,"
+.B " PCRE_UCHAR16 *\fIbuffer\fP, int \fIbuffersize\fP);"
+.sp
.B int pcre32_copy_named_substring(const pcre32 *\fIcode\fP,
-.ti +5n
-.B PCRE_SPTR32 \fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, PCRE_SPTR32 \fIstringname\fP,
-.ti +5n
-.B PCRE_UCHAR32 *\fIbuffer\fP, int \fIbuffersize\fP);
+.B " PCRE_SPTR32 \fIsubject\fP, int *\fIovector\fP,"
+.B " int \fIstringcount\fP, PCRE_SPTR32 \fIstringname\fP,"
+.B " PCRE_UCHAR32 *\fIbuffer\fP, int \fIbuffersize\fP);"
+.fi
.
.SH DESCRIPTION
.rs
diff --git a/pcre/doc/pcre_copy_substring.3 b/pcre/doc/pcre_copy_substring.3
index 96bff3a2c66..83af6e800af 100644
--- a/pcre/doc/pcre_copy_substring.3
+++ b/pcre/doc/pcre_copy_substring.3
@@ -6,24 +6,19 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B int pcre_copy_substring(const char *\fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, int \fIstringnumber\fP, char *\fIbuffer\fP,
-.ti +5n
-.B int \fIbuffersize\fP);
-.PP
+.B " int \fIstringcount\fP, int \fIstringnumber\fP, char *\fIbuffer\fP,"
+.B " int \fIbuffersize\fP);"
+.sp
.B int pcre16_copy_substring(PCRE_SPTR16 \fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, int \fIstringnumber\fP, PCRE_UCHAR16 *\fIbuffer\fP,
-.ti +5n
-.B int \fIbuffersize\fP);
-.PP
+.B " int \fIstringcount\fP, int \fIstringnumber\fP, PCRE_UCHAR16 *\fIbuffer\fP,"
+.B " int \fIbuffersize\fP);"
+.sp
.B int pcre32_copy_substring(PCRE_SPTR32 \fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, int \fIstringnumber\fP, PCRE_UCHAR32 *\fIbuffer\fP,
-.ti +5n
-.B int \fIbuffersize\fP);
+.B " int \fIstringcount\fP, int \fIstringnumber\fP, PCRE_UCHAR32 *\fIbuffer\fP,"
+.B " int \fIbuffersize\fP);"
+.fi
.
.SH DESCRIPTION
.rs
diff --git a/pcre/doc/pcre_dfa_exec.3 b/pcre/doc/pcre_dfa_exec.3
index 9bc7448b6a3..39c2e836dac 100644
--- a/pcre/doc/pcre_dfa_exec.3
+++ b/pcre/doc/pcre_dfa_exec.3
@@ -6,30 +6,22 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B int pcre_dfa_exec(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
-.ti +5n
-.B "const char *\fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
-.ti +5n
-.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,
-.ti +5n
-.B int *\fIworkspace\fP, int \fIwscount\fP);
-.PP
+.B " const char *\fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
+.B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,"
+.B " int *\fIworkspace\fP, int \fIwscount\fP);"
+.sp
.B int pcre16_dfa_exec(const pcre16 *\fIcode\fP, "const pcre16_extra *\fIextra\fP,"
-.ti +5n
-.B "PCRE_SPTR16 \fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
-.ti +5n
-.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,
-.ti +5n
-.B int *\fIworkspace\fP, int \fIwscount\fP);
-.PP
+.B " PCRE_SPTR16 \fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
+.B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,"
+.B " int *\fIworkspace\fP, int \fIwscount\fP);"
+.sp
.B int pcre32_dfa_exec(const pcre32 *\fIcode\fP, "const pcre32_extra *\fIextra\fP,"
-.ti +5n
-.B "PCRE_SPTR32 \fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
-.ti +5n
-.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,
-.ti +5n
-.B int *\fIworkspace\fP, int \fIwscount\fP);
+.B " PCRE_SPTR32 \fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
+.B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,"
+.B " int *\fIworkspace\fP, int \fIwscount\fP);"
+.fi
.
.SH DESCRIPTION
.rs
diff --git a/pcre/doc/pcre_exec.3 b/pcre/doc/pcre_exec.3
index c92c2a57a69..4686bd6de06 100644
--- a/pcre/doc/pcre_exec.3
+++ b/pcre/doc/pcre_exec.3
@@ -6,24 +6,19 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B int pcre_exec(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
-.ti +5n
-.B "const char *\fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
-.ti +5n
-.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);
-.PP
+.B " const char *\fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
+.B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);"
+.sp
.B int pcre16_exec(const pcre16 *\fIcode\fP, "const pcre16_extra *\fIextra\fP,"
-.ti +5n
-.B "PCRE_SPTR16 \fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
-.ti +5n
-.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);
-.PP
+.B " PCRE_SPTR16 \fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
+.B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);"
+.sp
.B int pcre32_exec(const pcre32 *\fIcode\fP, "const pcre32_extra *\fIextra\fP,"
-.ti +5n
-.B "PCRE_SPTR32 \fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
-.ti +5n
-.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);
+.B " PCRE_SPTR32 \fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
+.B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);"
+.fi
.
.SH DESCRIPTION
.rs
diff --git a/pcre/doc/pcre_fullinfo.3 b/pcre/doc/pcre_fullinfo.3
index ad640fc66fc..01e2e928740 100644
--- a/pcre/doc/pcre_fullinfo.3
+++ b/pcre/doc/pcre_fullinfo.3
@@ -6,18 +6,16 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B int pcre_fullinfo(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
-.ti +5n
-.B int \fIwhat\fP, void *\fIwhere\fP);
-.PP
+.B " int \fIwhat\fP, void *\fIwhere\fP);"
+.sp
.B int pcre16_fullinfo(const pcre16 *\fIcode\fP, "const pcre16_extra *\fIextra\fP,"
-.ti +5n
-.B int \fIwhat\fP, void *\fIwhere\fP);
-.PP
+.B " int \fIwhat\fP, void *\fIwhere\fP);"
+.sp
.B int pcre32_fullinfo(const pcre32 *\fIcode\fP, "const pcre32_extra *\fIextra\fP,"
-.ti +5n
-.B int \fIwhat\fP, void *\fIwhere\fP);
+.B " int \fIwhat\fP, void *\fIwhere\fP);"
+.fi
.
.SH DESCRIPTION
.rs
diff --git a/pcre/doc/pcre_get_named_substring.3 b/pcre/doc/pcre_get_named_substring.3
index f81a243c6bf..84d4ee7dbbf 100644
--- a/pcre/doc/pcre_get_named_substring.3
+++ b/pcre/doc/pcre_get_named_substring.3
@@ -6,30 +6,22 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B int pcre_get_named_substring(const pcre *\fIcode\fP,
-.ti +5n
-.B const char *\fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, const char *\fIstringname\fP,
-.ti +5n
-.B const char **\fIstringptr\fP);
-.PP
+.B " const char *\fIsubject\fP, int *\fIovector\fP,"
+.B " int \fIstringcount\fP, const char *\fIstringname\fP,"
+.B " const char **\fIstringptr\fP);"
+.sp
.B int pcre16_get_named_substring(const pcre16 *\fIcode\fP,
-.ti +5n
-.B PCRE_SPTR16 \fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, PCRE_SPTR16 \fIstringname\fP,
-.ti +5n
-.B PCRE_SPTR16 *\fIstringptr\fP);
-.PP
+.B " PCRE_SPTR16 \fIsubject\fP, int *\fIovector\fP,"
+.B " int \fIstringcount\fP, PCRE_SPTR16 \fIstringname\fP,"
+.B " PCRE_SPTR16 *\fIstringptr\fP);"
+.sp
.B int pcre32_get_named_substring(const pcre32 *\fIcode\fP,
-.ti +5n
-.B PCRE_SPTR32 \fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, PCRE_SPTR32 \fIstringname\fP,
-.ti +5n
-.B PCRE_SPTR32 *\fIstringptr\fP);
+.B " PCRE_SPTR32 \fIsubject\fP, int *\fIovector\fP,"
+.B " int \fIstringcount\fP, PCRE_SPTR32 \fIstringname\fP,"
+.B " PCRE_SPTR32 *\fIstringptr\fP);"
+.fi
.
.SH DESCRIPTION
.rs
diff --git a/pcre/doc/pcre_get_stringnumber.3 b/pcre/doc/pcre_get_stringnumber.3
index 7def00bafd1..9fc5291dc88 100644
--- a/pcre/doc/pcre_get_stringnumber.3
+++ b/pcre/doc/pcre_get_stringnumber.3
@@ -6,18 +6,16 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B int pcre_get_stringnumber(const pcre *\fIcode\fP,
-.ti +5n
-.B const char *\fIname\fP);
-.PP
+.B " const char *\fIname\fP);"
+.sp
.B int pcre16_get_stringnumber(const pcre16 *\fIcode\fP,
-.ti +5n
-.B PCRE_SPTR16 \fIname\fP);
-.PP
+.B " PCRE_SPTR16 \fIname\fP);"
+.sp
.B int pcre32_get_stringnumber(const pcre32 *\fIcode\fP,
-.ti +5n
-.B PCRE_SPTR32 \fIname\fP);
+.B " PCRE_SPTR32 \fIname\fP);"
+.fi
.
.SH DESCRIPTION
.rs
diff --git a/pcre/doc/pcre_get_stringtable_entries.3 b/pcre/doc/pcre_get_stringtable_entries.3
index 39178165c59..5c58c90c0e4 100644
--- a/pcre/doc/pcre_get_stringtable_entries.3
+++ b/pcre/doc/pcre_get_stringtable_entries.3
@@ -6,18 +6,16 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B int pcre_get_stringtable_entries(const pcre *\fIcode\fP,
-.ti +5n
-.B const char *\fIname\fP, char **\fIfirst\fP, char **\fIlast\fP);
-.PP
+.B " const char *\fIname\fP, char **\fIfirst\fP, char **\fIlast\fP);"
+.sp
.B int pcre16_get_stringtable_entries(const pcre16 *\fIcode\fP,
-.ti +5n
-.B PCRE_SPTR16 \fIname\fP, PCRE_UCHAR16 **\fIfirst\fP, PCRE_UCHAR16 **\fIlast\fP);
-.PP
+.B " PCRE_SPTR16 \fIname\fP, PCRE_UCHAR16 **\fIfirst\fP, PCRE_UCHAR16 **\fIlast\fP);"
+.sp
.B int pcre32_get_stringtable_entries(const pcre32 *\fIcode\fP,
-.ti +5n
-.B PCRE_SPTR32 \fIname\fP, PCRE_UCHAR32 **\fIfirst\fP, PCRE_UCHAR32 **\fIlast\fP);
+.B " PCRE_SPTR32 \fIname\fP, PCRE_UCHAR32 **\fIfirst\fP, PCRE_UCHAR32 **\fIlast\fP);"
+.fi
.
.SH DESCRIPTION
.rs
diff --git a/pcre/doc/pcre_get_substring.3 b/pcre/doc/pcre_get_substring.3
index d5bc60c45d1..1e62b2c0c61 100644
--- a/pcre/doc/pcre_get_substring.3
+++ b/pcre/doc/pcre_get_substring.3
@@ -6,24 +6,19 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B int pcre_get_substring(const char *\fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, int \fIstringnumber\fP,
-.ti +5n
-.B const char **\fIstringptr\fP);
-.PP
+.B " int \fIstringcount\fP, int \fIstringnumber\fP,"
+.B " const char **\fIstringptr\fP);"
+.sp
.B int pcre16_get_substring(PCRE_SPTR16 \fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, int \fIstringnumber\fP,
-.ti +5n
-.B PCRE_SPTR16 *\fIstringptr\fP);
-.PP
+.B " int \fIstringcount\fP, int \fIstringnumber\fP,"
+.B " PCRE_SPTR16 *\fIstringptr\fP);"
+.sp
.B int pcre32_get_substring(PCRE_SPTR32 \fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, int \fIstringnumber\fP,
-.ti +5n
-.B PCRE_SPTR32 *\fIstringptr\fP);
+.B " int \fIstringcount\fP, int \fIstringnumber\fP,"
+.B " PCRE_SPTR32 *\fIstringptr\fP);"
+.fi
.
.SH DESCRIPTION
.rs
diff --git a/pcre/doc/pcre_get_substring_list.3 b/pcre/doc/pcre_get_substring_list.3
index a1a57496b19..511a4a39d67 100644
--- a/pcre/doc/pcre_get_substring_list.3
+++ b/pcre/doc/pcre_get_substring_list.3
@@ -6,18 +6,16 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B int pcre_get_substring_list(const char *\fIsubject\fP,
-.ti +5n
-.B int *\fIovector\fP, int \fIstringcount\fP, "const char ***\fIlistptr\fP);"
-.PP
+.B " int *\fIovector\fP, int \fIstringcount\fP, const char ***\fIlistptr\fP);"
+.sp
.B int pcre16_get_substring_list(PCRE_SPTR16 \fIsubject\fP,
-.ti +5n
-.B int *\fIovector\fP, int \fIstringcount\fP, "PCRE_SPTR16 **\fIlistptr\fP);"
-.PP
+.B " int *\fIovector\fP, int \fIstringcount\fP, PCRE_SPTR16 **\fIlistptr\fP);"
+.sp
.B int pcre32_get_substring_list(PCRE_SPTR32 \fIsubject\fP,
-.ti +5n
-.B int *\fIovector\fP, int \fIstringcount\fP, "PCRE_SPTR32 **\fIlistptr\fP);"
+.B " int *\fIovector\fP, int \fIstringcount\fP, PCRE_SPTR32 **\fIlistptr\fP);"
+.fi
.
.SH DESCRIPTION
.rs
diff --git a/pcre/doc/pcre_jit_exec.3 b/pcre/doc/pcre_jit_exec.3
index 8b9d05bf1ee..ba85168178a 100644
--- a/pcre/doc/pcre_jit_exec.3
+++ b/pcre/doc/pcre_jit_exec.3
@@ -6,30 +6,22 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B int pcre_jit_exec(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
-.ti +5n
-.B "const char *\fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
-.ti +5n
-.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,
-.ti +5n
-.B pcre_jit_stack *\fIjstack\fP);
-.PP
+.B " const char *\fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
+.B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,"
+.B " pcre_jit_stack *\fIjstack\fP);"
+.sp
.B int pcre16_jit_exec(const pcre16 *\fIcode\fP, "const pcre16_extra *\fIextra\fP,"
-.ti +5n
-.B "PCRE_SPTR16 \fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
-.ti +5n
-.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,
-.ti +5n
-.B pcre_jit_stack *\fIjstack\fP);
-.PP
+.B " PCRE_SPTR16 \fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
+.B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,"
+.B " pcre_jit_stack *\fIjstack\fP);"
+.sp
.B int pcre32_jit_exec(const pcre32 *\fIcode\fP, "const pcre32_extra *\fIextra\fP,"
-.ti +5n
-.B "PCRE_SPTR32 \fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
-.ti +5n
-.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,
-.ti +5n
-.B pcre_jit_stack *\fIjstack\fP);
+.B " PCRE_SPTR32 \fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
+.B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,"
+.B " pcre_jit_stack *\fIjstack\fP);"
+.fi
.
.SH DESCRIPTION
.rs
diff --git a/pcre/doc/pcre_jit_stack_alloc.3 b/pcre/doc/pcre_jit_stack_alloc.3
index 5d2a117882a..11c97a0fc8a 100644
--- a/pcre/doc/pcre_jit_stack_alloc.3
+++ b/pcre/doc/pcre_jit_stack_alloc.3
@@ -6,18 +6,16 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B pcre_jit_stack *pcre_jit_stack_alloc(int \fIstartsize\fP,
-.ti +5n
-.B int \fImaxsize\fP);
-.PP
+.B " int \fImaxsize\fP);"
+.sp
.B pcre16_jit_stack *pcre16_jit_stack_alloc(int \fIstartsize\fP,
-.ti +5n
-.B int \fImaxsize\fP);
-.PP
+.B " int \fImaxsize\fP);"
+.sp
.B pcre32_jit_stack *pcre32_jit_stack_alloc(int \fIstartsize\fP,
-.ti +5n
-.B int \fImaxsize\fP);
+.B " int \fImaxsize\fP);"
+.fi
.
.SH DESCRIPTION
.rs
diff --git a/pcre/doc/pcre_pattern_to_host_byte_order.3 b/pcre/doc/pcre_pattern_to_host_byte_order.3
index 4c306eef178..b0c41c38e89 100644
--- a/pcre/doc/pcre_pattern_to_host_byte_order.3
+++ b/pcre/doc/pcre_pattern_to_host_byte_order.3
@@ -6,18 +6,16 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B int pcre_pattern_to_host_byte_order(pcre *\fIcode\fP,
-.ti +5n
-.B pcre_extra *\fIextra\fP, const unsigned char *\fItables\fP);
-.PP
+.B " pcre_extra *\fIextra\fP, const unsigned char *\fItables\fP);"
+.sp
.B int pcre16_pattern_to_host_byte_order(pcre16 *\fIcode\fP,
-.ti +5n
-.B pcre16_extra *\fIextra\fP, const unsigned char *\fItables\fP);
-.PP
+.B " pcre16_extra *\fIextra\fP, const unsigned char *\fItables\fP);"
+.sp
.B int pcre32_pattern_to_host_byte_order(pcre32 *\fIcode\fP,
-.ti +5n
-.B pcre32_extra *\fIextra\fP, const unsigned char *\fItables\fP);
+.B " pcre32_extra *\fIextra\fP, const unsigned char *\fItables\fP);"
+.fi
.
.SH DESCRIPTION
.rs
diff --git a/pcre/doc/pcre_study.3 b/pcre/doc/pcre_study.3
index 1f2b465afff..1200e0a6683 100644
--- a/pcre/doc/pcre_study.3
+++ b/pcre/doc/pcre_study.3
@@ -6,18 +6,16 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B pcre_extra *pcre_study(const pcre *\fIcode\fP, int \fIoptions\fP,
-.ti +5n
-.B const char **\fIerrptr\fP);
-.PP
+.B " const char **\fIerrptr\fP);"
+.sp
.B pcre16_extra *pcre16_study(const pcre16 *\fIcode\fP, int \fIoptions\fP,
-.ti +5n
-.B const char **\fIerrptr\fP);
-.PP
+.B " const char **\fIerrptr\fP);"
+.sp
.B pcre32_extra *pcre32_study(const pcre32 *\fIcode\fP, int \fIoptions\fP,
-.ti +5n
-.B const char **\fIerrptr\fP);
+.B " const char **\fIerrptr\fP);"
+.fi
.
.SH DESCRIPTION
.rs
diff --git a/pcre/doc/pcre_utf16_to_host_byte_order.3 b/pcre/doc/pcre_utf16_to_host_byte_order.3
index 8f0d2d4e8a9..1851b619dad 100644
--- a/pcre/doc/pcre_utf16_to_host_byte_order.3
+++ b/pcre/doc/pcre_utf16_to_host_byte_order.3
@@ -6,12 +6,11 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B int pcre16_utf16_to_host_byte_order(PCRE_UCHAR16 *\fIoutput\fP,
-.ti +5n
-.B PCRE_SPTR16 \fIinput\fP, int \fIlength\fP, int *\fIhost_byte_order\fP,
-.ti +5n
-.B int \fIkeep_boms\fP);
+.B " PCRE_SPTR16 \fIinput\fP, int \fIlength\fP, int *\fIhost_byte_order\fP,"
+.B " int \fIkeep_boms\fP);"
+.fi
.
.
.SH DESCRIPTION
diff --git a/pcre/doc/pcre_utf32_to_host_byte_order.3 b/pcre/doc/pcre_utf32_to_host_byte_order.3
index fa4c1796b81..a415dcf5fad 100644
--- a/pcre/doc/pcre_utf32_to_host_byte_order.3
+++ b/pcre/doc/pcre_utf32_to_host_byte_order.3
@@ -6,12 +6,11 @@ PCRE - Perl-compatible regular expressions
.sp
.B #include <pcre.h>
.PP
-.SM
+.nf
.B int pcre32_utf32_to_host_byte_order(PCRE_UCHAR32 *\fIoutput\fP,
-.ti +5n
-.B PCRE_SPTR32 \fIinput\fP, int \fIlength\fP, int *\fIhost_byte_order\fP,
-.ti +5n
-.B int \fIkeep_boms\fP);
+.B " PCRE_SPTR32 \fIinput\fP, int \fIlength\fP, int *\fIhost_byte_order\fP,"
+.B " int \fIkeep_boms\fP);"
+.fi
.
.
.SH DESCRIPTION
diff --git a/pcre/doc/pcreapi.3 b/pcre/doc/pcreapi.3
index 4718c7fd71b..ebbd20fc4d5 100644
--- a/pcre/doc/pcreapi.3
+++ b/pcre/doc/pcreapi.3
@@ -1,4 +1,4 @@
-.TH PCREAPI 3 "12 May 2013" "PCRE 8.33"
+.TH PCREAPI 3 "12 November 2013" "PCRE 8.34"
.SH NAME
PCRE - Perl-compatible regular expressions
.sp
@@ -8,138 +8,115 @@ PCRE - Perl-compatible regular expressions
.SH "PCRE NATIVE API BASIC FUNCTIONS"
.rs
.sp
-.SM
+.nf
.B pcre *pcre_compile(const char *\fIpattern\fP, int \fIoptions\fP,
-.ti +5n
-.B const char **\fIerrptr\fP, int *\fIerroffset\fP,
-.ti +5n
-.B const unsigned char *\fItableptr\fP);
-.PP
+.B " const char **\fIerrptr\fP, int *\fIerroffset\fP,"
+.B " const unsigned char *\fItableptr\fP);"
+.sp
.B pcre *pcre_compile2(const char *\fIpattern\fP, int \fIoptions\fP,
-.ti +5n
-.B int *\fIerrorcodeptr\fP,
-.ti +5n
-.B const char **\fIerrptr\fP, int *\fIerroffset\fP,
-.ti +5n
-.B const unsigned char *\fItableptr\fP);
-.PP
+.B " int *\fIerrorcodeptr\fP,"
+.B " const char **\fIerrptr\fP, int *\fIerroffset\fP,"
+.B " const unsigned char *\fItableptr\fP);"
+.sp
.B pcre_extra *pcre_study(const pcre *\fIcode\fP, int \fIoptions\fP,
-.ti +5n
-.B const char **\fIerrptr\fP);
-.PP
+.B " const char **\fIerrptr\fP);"
+.sp
.B void pcre_free_study(pcre_extra *\fIextra\fP);
-.PP
+.sp
.B int pcre_exec(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
-.ti +5n
-.B "const char *\fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
-.ti +5n
-.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);
-.PP
+.B " const char *\fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
+.B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);"
+.sp
.B int pcre_dfa_exec(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
-.ti +5n
-.B "const char *\fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
-.ti +5n
-.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,
-.ti +5n
-.B int *\fIworkspace\fP, int \fIwscount\fP);
+.B " const char *\fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
+.B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,"
+.B " int *\fIworkspace\fP, int \fIwscount\fP);"
+.fi
.
.
.SH "PCRE NATIVE API STRING EXTRACTION FUNCTIONS"
.rs
.sp
+.nf
.B int pcre_copy_named_substring(const pcre *\fIcode\fP,
-.ti +5n
-.B const char *\fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, const char *\fIstringname\fP,
-.ti +5n
-.B char *\fIbuffer\fP, int \fIbuffersize\fP);
-.PP
+.B " const char *\fIsubject\fP, int *\fIovector\fP,"
+.B " int \fIstringcount\fP, const char *\fIstringname\fP,"
+.B " char *\fIbuffer\fP, int \fIbuffersize\fP);"
+.sp
.B int pcre_copy_substring(const char *\fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, int \fIstringnumber\fP, char *\fIbuffer\fP,
-.ti +5n
-.B int \fIbuffersize\fP);
-.PP
+.B " int \fIstringcount\fP, int \fIstringnumber\fP, char *\fIbuffer\fP,"
+.B " int \fIbuffersize\fP);"
+.sp
.B int pcre_get_named_substring(const pcre *\fIcode\fP,
-.ti +5n
-.B const char *\fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, const char *\fIstringname\fP,
-.ti +5n
-.B const char **\fIstringptr\fP);
-.PP
+.B " const char *\fIsubject\fP, int *\fIovector\fP,"
+.B " int \fIstringcount\fP, const char *\fIstringname\fP,"
+.B " const char **\fIstringptr\fP);"
+.sp
.B int pcre_get_stringnumber(const pcre *\fIcode\fP,
-.ti +5n
-.B const char *\fIname\fP);
-.PP
+.B " const char *\fIname\fP);"
+.sp
.B int pcre_get_stringtable_entries(const pcre *\fIcode\fP,
-.ti +5n
-.B const char *\fIname\fP, char **\fIfirst\fP, char **\fIlast\fP);
-.PP
+.B " const char *\fIname\fP, char **\fIfirst\fP, char **\fIlast\fP);"
+.sp
.B int pcre_get_substring(const char *\fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, int \fIstringnumber\fP,
-.ti +5n
-.B const char **\fIstringptr\fP);
-.PP
+.B " int \fIstringcount\fP, int \fIstringnumber\fP,"
+.B " const char **\fIstringptr\fP);"
+.sp
.B int pcre_get_substring_list(const char *\fIsubject\fP,
-.ti +5n
-.B int *\fIovector\fP, int \fIstringcount\fP, "const char ***\fIlistptr\fP);"
-.PP
+.B " int *\fIovector\fP, int \fIstringcount\fP, const char ***\fIlistptr\fP);"
+.sp
.B void pcre_free_substring(const char *\fIstringptr\fP);
-.PP
+.sp
.B void pcre_free_substring_list(const char **\fIstringptr\fP);
+.fi
.
.
.SH "PCRE NATIVE API AUXILIARY FUNCTIONS"
.rs
.sp
+.nf
.B int pcre_jit_exec(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
-.ti +5n
-.B "const char *\fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
-.ti +5n
-.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,
-.ti +5n
-.B pcre_jit_stack *\fIjstack\fP);
-.PP
+.B " const char *\fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
+.B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,"
+.B " pcre_jit_stack *\fIjstack\fP);"
+.sp
.B pcre_jit_stack *pcre_jit_stack_alloc(int \fIstartsize\fP, int \fImaxsize\fP);
-.PP
+.sp
.B void pcre_jit_stack_free(pcre_jit_stack *\fIstack\fP);
-.PP
+.sp
.B void pcre_assign_jit_stack(pcre_extra *\fIextra\fP,
-.ti +5n
-.B pcre_jit_callback \fIcallback\fP, void *\fIdata\fP);
-.PP
+.B " pcre_jit_callback \fIcallback\fP, void *\fIdata\fP);"
+.sp
.B const unsigned char *pcre_maketables(void);
-.PP
+.sp
.B int pcre_fullinfo(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
-.ti +5n
-.B int \fIwhat\fP, void *\fIwhere\fP);
-.PP
+.B " int \fIwhat\fP, void *\fIwhere\fP);"
+.sp
.B int pcre_refcount(pcre *\fIcode\fP, int \fIadjust\fP);
-.PP
+.sp
.B int pcre_config(int \fIwhat\fP, void *\fIwhere\fP);
-.PP
+.sp
.B const char *pcre_version(void);
-.PP
+.sp
.B int pcre_pattern_to_host_byte_order(pcre *\fIcode\fP,
-.ti +5n
-.B pcre_extra *\fIextra\fP, const unsigned char *\fItables\fP);
+.B " pcre_extra *\fIextra\fP, const unsigned char *\fItables\fP);"
+.fi
.
.
.SH "PCRE NATIVE API INDIRECTED FUNCTIONS"
.rs
.sp
+.nf
.B void *(*pcre_malloc)(size_t);
-.PP
+.sp
.B void (*pcre_free)(void *);
-.PP
+.sp
.B void *(*pcre_stack_malloc)(size_t);
-.PP
+.sp
.B void (*pcre_stack_free)(void *);
-.PP
+.sp
.B int (*pcre_callout)(pcre_callout_block *);
+.fi
.
.
.SH "PCRE 8-BIT, 16-BIT, AND 32-BIT LIBRARIES"
@@ -483,6 +460,13 @@ the
.\"
documentation.
.sp
+ PCRE_CONFIG_PARENS_LIMIT
+.sp
+The output is a long integer that gives the maximum depth of nesting of
+parentheses (of any kind) in a pattern. This limit is imposed to cap the amount
+of system stack used when a pattern is compiled. It is specified when PCRE is
+built; the default is 250.
+.sp
PCRE_CONFIG_MATCH_LIMIT
.sp
The output is a long integer that gives the default limit for the number of
@@ -509,19 +493,16 @@ avoiding the use of the stack.
.SH "COMPILING A PATTERN"
.rs
.sp
+.nf
.B pcre *pcre_compile(const char *\fIpattern\fP, int \fIoptions\fP,
-.ti +5n
-.B const char **\fIerrptr\fP, int *\fIerroffset\fP,
-.ti +5n
-.B const unsigned char *\fItableptr\fP);
+.B " const char **\fIerrptr\fP, int *\fIerroffset\fP,"
+.B " const unsigned char *\fItableptr\fP);"
.sp
.B pcre *pcre_compile2(const char *\fIpattern\fP, int \fIoptions\fP,
-.ti +5n
-.B int *\fIerrorcodeptr\fP,
-.ti +5n
-.B const char **\fIerrptr\fP, int *\fIerroffset\fP,
-.ti +5n
-.B const unsigned char *\fItableptr\fP);
+.B " int *\fIerrorcodeptr\fP,"
+.B " const char **\fIerrptr\fP, int *\fIerroffset\fP,"
+.B " const unsigned char *\fItableptr\fP);"
+.fi
.P
Either of the functions \fBpcre_compile()\fP or \fBpcre_compile2()\fP can be
called to compile a pattern into an internal form. The only difference between
@@ -581,8 +562,9 @@ If the final argument, \fItableptr\fP, is NULL, PCRE uses a default set of
character tables that are built when PCRE is compiled, using the default C
locale. Otherwise, \fItableptr\fP must be an address that is the result of a
call to \fBpcre_maketables()\fP. This value is stored with the compiled
-pattern, and used again by \fBpcre_exec()\fP, unless another table pointer is
-passed to it. For more discussion, see the section on locale support below.
+pattern, and used again by \fBpcre_exec()\fP and \fBpcre_dfa_exec()\fP when the
+pattern is matched. For more discussion, see the section on locale support
+below.
.P
This code fragment shows a typical straightforward call to \fBpcre_compile()\fP:
.sp
@@ -670,12 +652,22 @@ documentation.
.sp
PCRE_EXTENDED
.sp
-If this bit is set, white space data characters in the pattern are totally
-ignored except when escaped or inside a character class. White space does not
-include the VT character (code 11). In addition, characters between an
-unescaped # outside a character class and the next newline, inclusive, are also
-ignored. This is equivalent to Perl's /x option, and it can be changed within a
-pattern by a (?x) option setting.
+If this bit is set, most white space characters in the pattern are totally
+ignored except when escaped or inside a character class. However, white space
+is not allowed within sequences such as (?> that introduce various
+parenthesized subpatterns, nor within a numerical quantifier such as {1,3}.
+However, ignorable white space is permitted between an item and a following
+quantifier and between a quantifier and a following + that indicates
+possessiveness.
+.P
+White space did not used to include the VT character (code 11), because Perl
+did not treat this character as white space. However, Perl changed at release
+5.18, so PCRE followed at release 8.34, and VT is now treated as white space.
+.P
+PCRE_EXTENDED also causes characters between an unescaped # outside a character
+class and the next newline, inclusive, to be ignored. PCRE_EXTENDED is
+equivalent to Perl's /x option, and it can be changed within a pattern by a
+(?x) option setting.
.P
Which characters are interpreted as newlines is controlled by the options
passed to \fBpcre_compile()\fP or by a special sequence at the start of the
@@ -821,6 +813,15 @@ were followed by ?: but named parentheses can still be used for capturing (and
they acquire numbers in the usual way). There is no equivalent of this option
in Perl.
.sp
+ PCRE_NO_AUTO_POSSESS
+.sp
+If this option is set, it disables "auto-possessification". This is an
+optimization that, for example, turns a+b into a++b in order to avoid
+backtracks into a+ that can never be successful. However, if callouts are in
+use, auto-possessification means that some of them are never taken. You can set
+this option if you want the matching functions to do a full unoptimized search
+and run all the callouts, but it is mainly provided for testing purposes.
+.sp
PCRE_NO_START_OPTIMIZE
.sp
This is an option that acts at matching time; that is, it is really an option
@@ -886,10 +887,10 @@ page. If an invalid UTF-8 sequence is found, \fBpcre_compile()\fP returns an
error. If you already know that your pattern is valid, and you want to skip
this check for performance reasons, you can set the PCRE_NO_UTF8_CHECK option.
When it is set, the effect of passing an invalid UTF-8 string as a pattern is
-undefined. It may cause your program to crash. Note that this option can also
-be passed to \fBpcre_exec()\fP and \fBpcre_dfa_exec()\fP, to suppress the
-validity checking of subject strings only. If the same string is being matched
-many times, the option can be safely set for the second and subsequent
+undefined. It may cause your program to crash or loop. Note that this option
+can also be passed to \fBpcre_exec()\fP and \fBpcre_dfa_exec()\fP, to suppress
+the validity checking of subject strings only. If the same string is being
+matched many times, the option can be safely set for the second and subsequent
matchings to improve performance.
.
.
@@ -936,7 +937,7 @@ have fallen out of use. To avoid confusion, they have not been re-used.
31 POSIX collating elements are not supported
32 this version of PCRE is compiled without UTF support
33 [this code is not in use]
- 34 character value in \ex{...} sequence is too large
+ 34 character value in \ex{} or \eo{} is too large
35 invalid condition (?(0)
36 \eC not allowed in lookbehind assertion
37 PCRE does not support \eL, \el, \eN{name}, \eU, or \eu
@@ -984,6 +985,12 @@ have fallen out of use. To avoid confusion, they have not been re-used.
75 name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)
76 character value in \eu.... sequence is too large
77 invalid UTF-32 string (specifically UTF-32)
+ 78 setting UTF is disabled by the application
+ 79 non-hex character in \ex{} (closing brace missing?)
+ 80 non-octal character in \eo{} (closing brace missing?)
+ 81 missing opening brace after \eo
+ 82 parentheses are too deeply nested
+ 83 invalid range in character class
.sp
The numbers 32 and 10000 in errors 48 and 49 are defaults; different values may
be used if the limits were changed when PCRE was built.
@@ -993,9 +1000,10 @@ be used if the limits were changed when PCRE was built.
.SH "STUDYING A PATTERN"
.rs
.sp
-.B pcre_extra *pcre_study(const pcre *\fIcode\fP, int \fIoptions\fP
-.ti +5n
-.B const char **\fIerrptr\fP);
+.nf
+.B pcre_extra *pcre_study(const pcre *\fIcode\fP, int \fIoptions\fP,
+.B " const char **\fIerrptr\fP);"
+.fi
.PP
If a compiled pattern is going to be used several times, it is worth spending
more time analyzing it in order to speed up the time taken for matching. The
@@ -1117,15 +1125,17 @@ below.
.sp
PCRE handles caseless matching, and determines whether characters are letters,
digits, or whatever, by reference to a set of tables, indexed by character
-value. When running in UTF-8 mode, this applies only to characters
-with codes less than 128. By default, higher-valued codes never match escapes
-such as \ew or \ed, but they can be tested with \ep if PCRE is built with
-Unicode character property support. Alternatively, the PCRE_UCP option can be
-set at compile time; this causes \ew and friends to use Unicode property
-support instead of built-in tables. The use of locales with Unicode is
-discouraged. If you are handling characters with codes greater than 128, you
-should either use UTF-8 and Unicode, or use locales, but not try to mix the
-two.
+code point. When running in UTF-8 mode, or in the 16- or 32-bit libraries, this
+applies only to characters with code points less than 256. By default,
+higher-valued code points never match escapes such as \ew or \ed. However, if
+PCRE is built with Unicode property support, all characters can be tested with
+\ep and \eP, or, alternatively, the PCRE_UCP option can be set when a pattern
+is compiled; this causes \ew and friends to use Unicode property support
+instead of the built-in tables.
+.P
+The use of locales with Unicode is discouraged. If you are handling characters
+with code points greater than 128, you should either use Unicode support, or
+use locales, but not try to mix the two.
.P
PCRE contains an internal set of tables that are used when the final argument
of \fBpcre_compile()\fP is NULL. These are sufficient for many applications.
@@ -1140,10 +1150,10 @@ for this locale support is expected to die away.
.P
External tables are built by calling the \fBpcre_maketables()\fP function,
which has no arguments, in the relevant locale. The result can then be passed
-to \fBpcre_compile()\fP or \fBpcre_exec()\fP as often as necessary. For
-example, to build and use tables that are appropriate for the French locale
-(where accented characters with values greater than 128 are treated as letters),
-the following code could be used:
+to \fBpcre_compile()\fP as often as necessary. For example, to build and use
+tables that are appropriate for the French locale (where accented characters
+with values greater than 128 are treated as letters), the following code could
+be used:
.sp
setlocale(LC_CTYPE, "fr_FR");
tables = pcre_maketables();
@@ -1159,24 +1169,29 @@ needed.
.P
The pointer that is passed to \fBpcre_compile()\fP is saved with the compiled
pattern, and the same tables are used via this pointer by \fBpcre_study()\fP
-and normally also by \fBpcre_exec()\fP. Thus, by default, for any single
+and also by \fBpcre_exec()\fP and \fBpcre_dfa_exec()\fP. Thus, for any single
pattern, compilation, studying and matching all happen in the same locale, but
-different patterns can be compiled in different locales.
+different patterns can be processed in different locales.
.P
It is possible to pass a table pointer or NULL (indicating the use of the
-internal tables) to \fBpcre_exec()\fP. Although not intended for this purpose,
-this facility could be used to match a pattern in a different locale from the
-one in which it was compiled. Passing table pointers at run time is discussed
-below in the section on matching a pattern.
+internal tables) to \fBpcre_exec()\fP or \fBpcre_dfa_exec()\fP (see the
+discussion below in the section on matching a pattern). This facility is
+provided for use with pre-compiled patterns that have been saved and reloaded.
+Character tables are not saved with patterns, so if a non-standard table was
+used at compile time, it must be provided again when the reloaded pattern is
+matched. Attempting to use this facility to match a pattern in a different
+locale from the one in which it was compiled is likely to lead to anomalous
+(usually incorrect) results.
.
.
.\" HTML <a name="infoaboutpattern"></a>
.SH "INFORMATION ABOUT A PATTERN"
.rs
.sp
+.nf
.B int pcre_fullinfo(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
-.ti +5n
-.B int \fIwhat\fP, void *\fIwhere\fP);
+.B " int \fIwhat\fP, void *\fIwhere\fP);"
+.fi
.PP
The \fBpcre_fullinfo()\fP function returns information about a compiled
pattern. It replaces the \fBpcre_info()\fP function, which was removed from the
@@ -1310,10 +1325,15 @@ only if it follows something of variable length. For example, for the pattern
is -1.
.P
Since for the 32-bit library using the non-UTF-32 mode, this function is unable
-to return the full 32-bit range of the character, this value is deprecated;
+to return the full 32-bit range of characters, this value is deprecated;
instead the PCRE_INFO_REQUIREDCHARFLAGS and PCRE_INFO_REQUIREDCHAR values should
be used.
.sp
+ PCRE_INFO_MATCH_EMPTY
+.sp
+Return 1 if the pattern can match an empty string, otherwise 0. The fourth
+argument should point to an \fBint\fP variable.
+.sp
PCRE_INFO_MATCHLIMIT
.sp
If the pattern set a match limit by including an item of the form
@@ -1369,8 +1389,8 @@ most significant byte first. In the 16-bit library, the pointer points to
contains the parenthesis number. The rest of the entry is the corresponding
name, zero terminated.
.P
-The names are in alphabetical order. Duplicate names may appear if (?| is used
-to create multiple groups with the same number, as described in the
+The names are in alphabetical order. If (?| is used to create multiple groups
+with the same number, as described in the
.\" HTML <a href="pcrepattern.html#dupsubpatternnumber">
.\" </a>
section on duplicate subpattern numbers
@@ -1379,11 +1399,13 @@ in the
.\" HREF
\fBpcrepattern\fP
.\"
-page. Duplicate names for subpatterns with different numbers are permitted only
-if PCRE_DUPNAMES is set. In all cases of duplicate names, they appear in the
-table in the order in which they were found in the pattern. In the absence of
-(?| this is the order of increasing number; when (?| is used this is not
-necessarily the case because later subpatterns may have lower numbers.
+page, the groups may be given the same name, but there is only one entry in the
+table. Different names for groups of the same number are not permitted.
+Duplicate names for subpatterns with different numbers are permitted,
+but only if PCRE_DUPNAMES is set. They appear in the table in the order in
+which they were found in the pattern. In the absence of (?| this is the order
+of increasing number; when (?| is used this is not necessarily the case because
+later subpatterns may have lower numbers.
.P
As a simple example of the name/number table, consider the following pattern
after compilation by the 8-bit library (assume PCRE_EXTENDED is set, so white
@@ -1501,25 +1523,13 @@ returned. For anchored patterns, 0 is returned.
.sp
PCRE_INFO_FIRSTCHARACTER
.sp
-Return the fixed first character value, if PCRE_INFO_FIRSTCHARACTERFLAGS
-returned 1; otherwise returns 0. The fourth argument should point to an
-\fBuint_t\fP variable.
+Return the fixed first character value in the situation where
+PCRE_INFO_FIRSTCHARACTERFLAGS returns 1; otherwise return 0. The fourth
+argument should point to an \fBuint_t\fP variable.
.P
In the 8-bit library, the value is always less than 256. In the 16-bit library
the value can be up to 0xffff. In the 32-bit library in UTF-32 mode the value
can be up to 0x10ffff, and up to 0xffffffff when not using UTF-32 mode.
-.P
-If there is no fixed first value, and if either
-.sp
-(a) the pattern was compiled with the PCRE_MULTILINE option, and every branch
-starts with "^", or
-.sp
-(b) every branch of the pattern starts with ".*" and PCRE_DOTALL is not set
-(if it were set, the pattern would be anchored),
-.sp
--1 is returned, indicating that the pattern matches only at the start of a
-subject string or after any newline within the string. Otherwise -2 is
-returned. For anchored patterns, -2 is returned.
.sp
PCRE_INFO_REQUIREDCHARFLAGS
.sp
@@ -1567,11 +1577,11 @@ is different. (This seems a highly unlikely scenario.)
.SH "MATCHING A PATTERN: THE TRADITIONAL FUNCTION"
.rs
.sp
+.nf
.B int pcre_exec(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
-.ti +5n
-.B "const char *\fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
-.ti +5n
-.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);
+.B " const char *\fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
+.B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP);"
+.fi
.P
The function \fBpcre_exec()\fP is called to match a subject string against a
compiled pattern, which is passed in the \fIcode\fP argument. If the
@@ -1724,19 +1734,23 @@ and is described in the
.\"
documentation.
.P
-The \fItables\fP field is used to pass a character tables pointer to
-\fBpcre_exec()\fP; this overrides the value that is stored with the compiled
-pattern. A non-NULL value is stored with the compiled pattern only if custom
-tables were supplied to \fBpcre_compile()\fP via its \fItableptr\fP argument.
-If NULL is passed to \fBpcre_exec()\fP using this mechanism, it forces PCRE's
-internal tables to be used. This facility is helpful when re-using patterns
-that have been saved after compiling with an external set of tables, because
-the external tables might be at a different address when \fBpcre_exec()\fP is
-called. See the
+The \fItables\fP field is provided for use with patterns that have been
+pre-compiled using custom character tables, saved to disc or elsewhere, and
+then reloaded, because the tables that were used to compile a pattern are not
+saved with it. See the
.\" HREF
\fBpcreprecompile\fP
.\"
-documentation for a discussion of saving compiled patterns for later use.
+documentation for a discussion of saving compiled patterns for later use. If
+NULL is passed using this mechanism, it forces PCRE's internal tables to be
+used.
+.P
+\fBWarning:\fP The tables that \fBpcre_exec()\fP uses must be the same as those
+that were used when the pattern was compiled. If this is not the case, the
+behaviour of \fBpcre_exec()\fP is undefined. Therefore, when a pattern is
+compiled and matched in the same process, this field should never be set. In
+this (the most common) case, the correct table pointer is automatically passed
+with the compiled pattern from \fBpcre_compile()\fP to \fBpcre_exec()\fP.
.P
If PCRE_EXTRA_MARK is set in the \fIflags\fP field, the \fImark\fP field must
be set to point to a suitable variable. If the pattern contains any
@@ -1960,7 +1974,7 @@ all the matches in a single subject string. However, you should be sure that
the value of \fIstartoffset\fP points to the start of a character (or the end
of the subject). When PCRE_NO_UTF8_CHECK is set, the effect of passing an
invalid string as a subject or an invalid value of \fIstartoffset\fP is
-undefined. Your program may crash.
+undefined. Your program may crash or loop.
.sp
PCRE_PARTIAL_HARD
PCRE_PARTIAL_SOFT
@@ -2423,21 +2437,18 @@ no longer in use and is never returned.
.SH "EXTRACTING CAPTURED SUBSTRINGS BY NUMBER"
.rs
.sp
+.nf
.B int pcre_copy_substring(const char *\fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, int \fIstringnumber\fP, char *\fIbuffer\fP,
-.ti +5n
-.B int \fIbuffersize\fP);
-.PP
+.B " int \fIstringcount\fP, int \fIstringnumber\fP, char *\fIbuffer\fP,"
+.B " int \fIbuffersize\fP);"
+.sp
.B int pcre_get_substring(const char *\fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, int \fIstringnumber\fP,
-.ti +5n
-.B const char **\fIstringptr\fP);
-.PP
+.B " int \fIstringcount\fP, int \fIstringnumber\fP,"
+.B " const char **\fIstringptr\fP);"
+.sp
.B int pcre_get_substring_list(const char *\fIsubject\fP,
-.ti +5n
-.B int *\fIovector\fP, int \fIstringcount\fP, "const char ***\fIlistptr\fP);"
+.B " int *\fIovector\fP, int \fIstringcount\fP, const char ***\fIlistptr\fP);"
+.fi
.PP
Captured substrings can be accessed directly by using the offsets returned by
\fBpcre_exec()\fP in \fIovector\fP. For convenience, the functions
@@ -2516,25 +2527,20 @@ provided.
.SH "EXTRACTING CAPTURED SUBSTRINGS BY NAME"
.rs
.sp
+.nf
.B int pcre_get_stringnumber(const pcre *\fIcode\fP,
-.ti +5n
-.B const char *\fIname\fP);
-.PP
+.B " const char *\fIname\fP);"
+.sp
.B int pcre_copy_named_substring(const pcre *\fIcode\fP,
-.ti +5n
-.B const char *\fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, const char *\fIstringname\fP,
-.ti +5n
-.B char *\fIbuffer\fP, int \fIbuffersize\fP);
-.PP
+.B " const char *\fIsubject\fP, int *\fIovector\fP,"
+.B " int \fIstringcount\fP, const char *\fIstringname\fP,"
+.B " char *\fIbuffer\fP, int \fIbuffersize\fP);"
+.sp
.B int pcre_get_named_substring(const pcre *\fIcode\fP,
-.ti +5n
-.B const char *\fIsubject\fP, int *\fIovector\fP,
-.ti +5n
-.B int \fIstringcount\fP, const char *\fIstringname\fP,
-.ti +5n
-.B const char **\fIstringptr\fP);
+.B " const char *\fIsubject\fP, int *\fIovector\fP,"
+.B " int \fIstringcount\fP, const char *\fIstringname\fP,"
+.B " const char **\fIstringptr\fP);"
+.fi
.PP
To extract a substring by name, you first have to find associated number.
For example, for this pattern
@@ -2586,9 +2592,10 @@ same number causes an error at compile time.
.SH "DUPLICATE SUBPATTERN NAMES"
.rs
.sp
+.nf
.B int pcre_get_stringtable_entries(const pcre *\fIcode\fP,
-.ti +5n
-.B const char *\fIname\fP, char **\fIfirst\fP, char **\fIlast\fP);
+.B " const char *\fIname\fP, char **\fIfirst\fP, char **\fIlast\fP);"
+.fi
.PP
When a pattern is compiled with the PCRE_DUPNAMES option, names for subpatterns
are not required to be unique. (Duplicate names are always allowed for
@@ -2677,13 +2684,12 @@ the value returned is the size of each block that is obtained from the heap.
.SH "MATCHING A PATTERN: THE ALTERNATIVE FUNCTION"
.rs
.sp
+.nf
.B int pcre_dfa_exec(const pcre *\fIcode\fP, "const pcre_extra *\fIextra\fP,"
-.ti +5n
-.B "const char *\fIsubject\fP," int \fIlength\fP, int \fIstartoffset\fP,
-.ti +5n
-.B int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,
-.ti +5n
-.B int *\fIworkspace\fP, int \fIwscount\fP);
+.B " const char *\fIsubject\fP, int \fIlength\fP, int \fIstartoffset\fP,"
+.B " int \fIoptions\fP, int *\fIovector\fP, int \fIovecsize\fP,"
+.B " int *\fIworkspace\fP, int \fIwscount\fP);"
+.fi
.P
The function \fBpcre_dfa_exec()\fP is called to match a subject string against
a compiled pattern, using a matching algorithm that scans the subject string
@@ -2810,6 +2816,14 @@ matching string is given first. If there were too many matches to fit into
\fIovector\fP, the yield of the function is zero, and the vector is filled with
the longest matches. Unlike \fBpcre_exec()\fP, \fBpcre_dfa_exec()\fP can use
the entire \fIovector\fP for returning matched strings.
+.P
+NOTE: PCRE's "auto-possessification" optimization usually applies to character
+repeats at the end of a pattern (as well as internally). For example, the
+pattern "a\ed+" is compiled as if it were "a\ed++" because there is no point
+even considering the possibility of backtracking into the repeated digits. For
+DFA matching, this means that only one possible match is found. If you really
+do want multiple matches in such cases, either use an ungreedy repeat
+("a\ed+?") or set the PCRE_NO_AUTO_POSSESS option when compiling.
.
.
.SS "Error returns from \fBpcre_dfa_exec()\fP"
@@ -2886,6 +2900,6 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 12 May 2013
+Last updated: 12 November 2013
Copyright (c) 1997-2013 University of Cambridge.
.fi
diff --git a/pcre/doc/pcrecallout.3 b/pcre/doc/pcrecallout.3
index 79e2bb931aa..8ebc9959520 100644
--- a/pcre/doc/pcrecallout.3
+++ b/pcre/doc/pcrecallout.3
@@ -1,4 +1,4 @@
-.TH PCRECALLOUT 3 "03 March 2013" "PCRE 8.33"
+.TH PCRECALLOUT 3 "12 November 2013" "PCRE 8.34"
.SH NAME
PCRE - Perl-compatible regular expressions
.SH SYNOPSIS
@@ -55,17 +55,50 @@ The
.\" HREF
\fBpcretest\fP
.\"
-command has an option that sets automatic callouts; when it is used, the output
-indicates how the pattern is matched. This is useful information when you are
-trying to optimize the performance of a particular pattern.
+program has a pattern qualifier (/C) that sets automatic callouts; when it is
+used, the output indicates how the pattern is being matched. This is useful
+information when you are trying to optimize the performance of a particular
+pattern.
.
.
.SH "MISSING CALLOUTS"
.rs
.sp
-You should be aware that, because of optimizations in the way PCRE matches
-patterns by default, callouts sometimes do not happen. For example, if the
-pattern is
+You should be aware that, because of optimizations in the way PCRE compiles and
+matches patterns, callouts sometimes do not happen exactly as you might expect.
+.P
+At compile time, PCRE "auto-possessifies" repeated items when it knows that
+what follows cannot be part of the repeat. For example, a+[bc] is compiled as
+if it were a++[bc]. The \fBpcretest\fP output when this pattern is anchored and
+then applied with automatic callouts to the string "aaaa" is:
+.sp
+ --->aaaa
+ +0 ^ ^
+ +1 ^ a+
+ +3 ^ ^ [bc]
+ No match
+.sp
+This indicates that when matching [bc] fails, there is no backtracking into a+
+and therefore the callouts that would be taken for the backtracks do not occur.
+You can disable the auto-possessify feature by passing PCRE_NO_AUTO_POSSESS
+to \fBpcre_compile()\fP, or starting the pattern with (*NO_AUTO_POSSESS). If
+this is done in \fBpcretest\fP (using the /O qualifier), the output changes to
+this:
+.sp
+ --->aaaa
+ +0 ^ ^
+ +1 ^ a+
+ +3 ^ ^ [bc]
+ +3 ^ ^ [bc]
+ +3 ^ ^ [bc]
+ +3 ^^ [bc]
+ No match
+.sp
+This time, when matching [bc] fails, the matcher backtracks into a+ and tries
+again, repeatedly, until a+ itself fails.
+.P
+Other optimizations that provide fast "no match" results also affect callouts.
+For example, if the pattern is
.sp
ab(?C4)cd
.sp
@@ -89,11 +122,11 @@ callouts such as the example above are obeyed.
.rs
.sp
During matching, when PCRE reaches a callout point, the external function
-defined by \fIpcre_callout\fP or \fIpcre[16|32]_callout\fP is called
-(if it is set). This applies to both normal and DFA matching. The only
-argument to the callout function is a pointer to a \fBpcre_callout\fP
-or \fBpcre[16|32]_callout\fP block.
-These structures contains the following fields:
+defined by \fIpcre_callout\fP or \fIpcre[16|32]_callout\fP is called (if it is
+set). This applies to both normal and DFA matching. The only argument to the
+callout function is a pointer to a \fBpcre_callout\fP or
+\fBpcre[16|32]_callout\fP block. These structures contains the following
+fields:
.sp
int \fIversion\fP;
int \fIcallout_number\fP;
@@ -217,6 +250,6 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 03 March 2013
+Last updated: 12 November 2013
Copyright (c) 1997-2013 University of Cambridge.
.fi
diff --git a/pcre/doc/pcrecompat.3 b/pcre/doc/pcrecompat.3
index 2c109ea9999..0cc40198235 100644
--- a/pcre/doc/pcrecompat.3
+++ b/pcre/doc/pcrecompat.3
@@ -1,4 +1,4 @@
-.TH PCRECOMPAT 3 "19 March 2013" "PCRE 8.33"
+.TH PCRECOMPAT 3 "10 November 2013" "PCRE 8.34"
.SH NAME
PCRE - Perl-compatible regular expressions
.SH "DIFFERENCES BETWEEN PCRE AND PERL"
@@ -122,16 +122,21 @@ an error is given at compile time.
.P
15. Perl recognizes comments in some places that PCRE does not, for example,
between the ( and ? at the start of a subpattern. If the /x modifier is set,
-Perl allows white space between ( and ? but PCRE never does, even if the
-PCRE_EXTENDED option is set.
+Perl allows white space between ( and ? (though current Perls warn that this is
+deprecated) but PCRE never does, even if the PCRE_EXTENDED option is set.
.P
-16. In PCRE, the upper/lower case character properties Lu and Ll are not
+16. Perl, when in warning mode, gives warnings for character classes such as
+[A-\ed] or [a-[:digit:]]. It then treats the hyphens as literals. PCRE has no
+warning features, so it gives an error in these cases because they are almost
+certainly user mistakes.
+.P
+17. In PCRE, the upper/lower case character properties Lu and Ll are not
affected when case-independent matching is specified. For example, \ep{Lu}
always matches an upper case letter. I think Perl has changed in this respect;
in the release at the time of writing (5.16), \ep{Lu} and \ep{Ll} match all
letters, regardless of case, when case independence is specified.
.P
-17. PCRE provides some extensions to the Perl regular expression facilities.
+18. PCRE provides some extensions to the Perl regular expression facilities.
Perl 5.10 includes new features that are not in earlier versions of Perl, some
of which (such as named parentheses) have been in PCRE for some time. This list
is with respect to Perl 5.10:
@@ -190,6 +195,6 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 19 March 2013
+Last updated: 10 November 2013
Copyright (c) 1997-2013 University of Cambridge.
.fi
diff --git a/pcre/doc/pcrelimits.3 b/pcre/doc/pcrelimits.3
index 14ffbc466ed..423d6a27684 100644
--- a/pcre/doc/pcrelimits.3
+++ b/pcre/doc/pcrelimits.3
@@ -1,4 +1,4 @@
-.TH PCRELIMITS 3 "24 June 2012" "PCRE 8.30"
+.TH PCRELIMITS 3 "05 November 2013" "PCRE 8.34"
.SH NAME
PCRE - Perl-compatible regular expressions
.SH "SIZE AND OTHER LIMITATIONS"
@@ -8,9 +8,10 @@ There are some size limitations in PCRE but it is hoped that they will never in
practice be relevant.
.P
The maximum length of a compiled pattern is approximately 64K data units (bytes
-for the 8-bit library, 32-bit units for the 32-bit library, and 32-bit units for
-the 32-bit library) if PCRE is compiled with the default internal linkage size
-of 2 bytes. If you want to process regular expressions that are truly enormous,
+for the 8-bit library, 16-bit units for the 16-bit library, and 32-bit units for
+the 32-bit library) if PCRE is compiled with the default internal linkage size,
+which is 2 bytes for the 8-bit and 16-bit libraries, and 4 bytes for the 32-bit
+library. If you want to process regular expressions that are truly enormous,
you can compile PCRE with an internal linkage size of 3 or 4 (when building the
16-bit or 32-bit library, 3 is rounded up to 4). See the \fBREADME\fP file in
the source distribution and the
@@ -23,7 +24,10 @@ However, the speed of execution is slower.
All values in repeating quantifiers must be less than 65536.
.P
There is no limit to the number of parenthesized subpatterns, but there can be
-no more than 65535 capturing subpatterns.
+no more than 65535 capturing subpatterns. There is, however, a limit to the
+depth of nesting of parenthesized subpatterns of all kinds. This is imposed in
+order to limit the amount of system stack used at compile time. The limit can
+be specified when PCRE is built; the default is 250.
.P
There is a limit to the number of forward references to subsequent subpatterns
of around 200,000. Repeated forward references with fixed upper limits, for
@@ -34,7 +38,7 @@ The maximum length of name for a named subpattern is 32 characters, and the
maximum number of named subpatterns is 10000.
.P
The maximum length of a name in a (*MARK), (*PRUNE), (*SKIP), or (*THEN) verb
-is 255 for the 8-bit library and 65535 for the 16-bit and 32-bit library.
+is 255 for the 8-bit library and 65535 for the 16-bit and 32-bit libraries.
.P
The maximum length of a subject string is the largest positive number that an
integer variable can hold. However, when using the traditional matching
@@ -62,6 +66,6 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 04 May 2012
-Copyright (c) 1997-2012 University of Cambridge.
+Last updated: 05 November 2013
+Copyright (c) 1997-2013 University of Cambridge.
.fi
diff --git a/pcre/doc/pcrematching.3 b/pcre/doc/pcrematching.3
index a9977d5e05a..268baf9b8c6 100644
--- a/pcre/doc/pcrematching.3
+++ b/pcre/doc/pcrematching.3
@@ -1,4 +1,4 @@
-.TH PCREMATCHING 3 "08 January 2012" "PCRE 8.30"
+.TH PCREMATCHING 3 "12 November 2013" "PCRE 8.34"
.SH NAME
PCRE - Perl-compatible regular expressions
.SH "PCRE MATCHING ALGORITHMS"
@@ -106,6 +106,14 @@ the three strings "caterpillar", "cater", and "cat" that start at the fifth
character of the subject. The algorithm does not automatically move on to find
matches that start at later positions.
.P
+PCRE's "auto-possessification" optimization usually applies to character
+repeats at the end of a pattern (as well as internally). For example, the
+pattern "a\ed+" is compiled as if it were "a\ed++" because there is no point
+even considering the possibility of backtracking into the repeated digits. For
+DFA matching, this means that only one possible match is found. If you really
+do want multiple matches in such cases, either use an ungreedy repeat
+("a\ed+?") or set the PCRE_NO_AUTO_POSSESS option when compiling.
+.P
There are a number of features of PCRE regular expressions that are not
supported by the alternative matching algorithm. They are as follows:
.P
@@ -201,6 +209,6 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 08 January 2012
+Last updated: 12 November 2013
Copyright (c) 1997-2012 University of Cambridge.
.fi
diff --git a/pcre/doc/pcrepartial.3 b/pcre/doc/pcrepartial.3
index 4041838c3e9..14d0124f1c2 100644
--- a/pcre/doc/pcrepartial.3
+++ b/pcre/doc/pcrepartial.3
@@ -1,4 +1,4 @@
-.TH PCREPARTIAL 3 "20 February 2013" "PCRE 8.33"
+.TH PCREPARTIAL 3 "02 July 2013" "PCRE 8.34"
.SH NAME
PCRE - Perl-compatible regular expressions
.SH "PARTIAL MATCHING IN PCRE"
@@ -280,6 +280,15 @@ Notice that when the match is complete, only the last part is shown; PCRE does
not retain the previously partially-matched string. It is up to the calling
program to do that if it needs to.
.P
+That means that, for an unanchored pattern, if a continued match fails, it is
+not possible to try again at a new starting point. All this facility is capable
+of doing is continuing with the previous match attempt. In the previous
+example, if the second set of data is "ug23" the result is no match, even
+though there would be a match for "aug23" if the entire string were given at
+once. Depending on the application, this may or may not be what you want.
+The only way to allow for starting again at the next character is to retain the
+matched part of the subject and try a new complete match.
+.P
You can set the PCRE_PARTIAL_SOFT or PCRE_PARTIAL_HARD options with
PCRE_DFA_RESTART to continue partial matching over multiple segments. This
facility can be used to pass very long subject strings to the DFA matching
@@ -462,6 +471,6 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 20 February 2013
+Last updated: 02 July 2013
Copyright (c) 1997-2013 University of Cambridge.
.fi
diff --git a/pcre/doc/pcrepattern.3 b/pcre/doc/pcrepattern.3
index 39711014996..4c515f83adc 100644
--- a/pcre/doc/pcrepattern.3
+++ b/pcre/doc/pcrepattern.3
@@ -1,4 +1,4 @@
-.TH PCREPATTERN 3 "26 April 2013" "PCRE 8.33"
+.TH PCREPATTERN 3 "03 December 2013" "PCRE 8.34"
.SH NAME
PCRE - Perl-compatible regular expressions
.SH "PCRE REGULAR EXPRESSION DETAILS"
@@ -80,21 +80,37 @@ appearance causes an error.
.SS "Unicode property support"
.rs
.sp
-Another special sequence that may appear at the start of a pattern is
-.sp
- (*UCP)
-.sp
+Another special sequence that may appear at the start of a pattern is (*UCP).
This has the same effect as setting the PCRE_UCP option: it causes sequences
such as \ed and \ew to use Unicode properties to determine character types,
instead of recognizing only characters with codes less than 128 via a lookup
table.
.
.
+.SS "Disabling auto-possessification"
+.rs
+.sp
+If a pattern starts with (*NO_AUTO_POSSESS), it has the same effect as setting
+the PCRE_NO_AUTO_POSSESS option at compile time. This stops PCRE from making
+quantifiers possessive when what follows cannot match the repeated item. For
+example, by default a+b is treated as a++b. For more details, see the
+.\" HREF
+\fBpcreapi\fP
+.\"
+documentation.
+.
+.
.SS "Disabling start-up optimizations"
.rs
.sp
If a pattern starts with (*NO_START_OPT), it has the same effect as setting the
-PCRE_NO_START_OPTIMIZE option either at compile or matching time.
+PCRE_NO_START_OPTIMIZE option either at compile or matching time. This disables
+several optimizations for quickly reaching "no match" results. For more
+details, see the
+.\" HREF
+\fBpcreapi\fP
+.\"
+documentation.
.
.
.\" HTML <a name="newlines"></a>
@@ -164,10 +180,10 @@ pattern of the form
(*LIMIT_RECURSION=d)
.sp
where d is any number of decimal digits. However, the value of the setting must
-be less than the value set by the caller of \fBpcre_exec()\fP for it to have
-any effect. In other words, the pattern writer can lower the limit set by the
-programmer, but not raise it. If there is more than one setting of one of these
-limits, the lower value is used.
+be less than the value set (or defaulted) by the caller of \fBpcre_exec()\fP
+for it to have any effect. In other words, the pattern writer can lower the
+limits set by the programmer, but not raise them. If there is more than one
+setting of one of these limits, the lower value is used.
.
.
.SH "EBCDIC CHARACTER CODES"
@@ -257,10 +273,11 @@ In a UTF mode, only ASCII numbers and letters have any special meaning after a
backslash. All other characters (in particular, those whose codepoints are
greater than 127) are treated as literals.
.P
-If a pattern is compiled with the PCRE_EXTENDED option, white space in the
-pattern (other than in a character class) and characters between a # outside
-a character class and the next newline are ignored. An escaping backslash can
-be used to include a white space or # character as part of the pattern.
+If a pattern is compiled with the PCRE_EXTENDED option, most white space in the
+pattern (other than in a character class), and characters between a # outside a
+character class and the next newline, inclusive, are ignored. An escaping
+backslash can be used to include a white space or # character as part of the
+pattern.
.P
If you want to remove the special meaning from a sequence of characters, you
can do so by putting them between \eQ and \eE. This is different from Perl in
@@ -300,7 +317,9 @@ one of the following escape sequences than the binary character it represents:
\en linefeed (hex 0A)
\er carriage return (hex 0D)
\et tab (hex 09)
+ \e0dd character with octal code 0dd
\eddd character with octal code ddd, or back reference
+ \eo{ddd..} character with octal code ddd..
\exhh character with hex code hh
\ex{hhh..} character with hex code hhh.. (non-JavaScript mode)
\euhhhh character with hex code hhhh (JavaScript mode only)
@@ -321,47 +340,27 @@ byte are inverted. Thus \ecA becomes hex 01, as in ASCII (A is C1), but because
the EBCDIC letters are disjoint, \ecZ becomes hex 29 (Z is E9), and other
characters also generate different values.
.P
-By default, after \ex, from zero to two hexadecimal digits are read (letters
-can be in upper or lower case). Any number of hexadecimal digits may appear
-between \ex{ and }, but the character code is constrained as follows:
-.sp
- 8-bit non-UTF mode less than 0x100
- 8-bit UTF-8 mode less than 0x10ffff and a valid codepoint
- 16-bit non-UTF mode less than 0x10000
- 16-bit UTF-16 mode less than 0x10ffff and a valid codepoint
- 32-bit non-UTF mode less than 0x80000000
- 32-bit UTF-32 mode less than 0x10ffff and a valid codepoint
-.sp
-Invalid Unicode codepoints are the range 0xd800 to 0xdfff (the so-called
-"surrogate" codepoints), and 0xffef.
-.P
-If characters other than hexadecimal digits appear between \ex{ and }, or if
-there is no terminating }, this form of escape is not recognized. Instead, the
-initial \ex will be interpreted as a basic hexadecimal escape, with no
-following digits, giving a character whose value is zero.
-.P
-If the PCRE_JAVASCRIPT_COMPAT option is set, the interpretation of \ex is
-as just described only when it is followed by two hexadecimal digits.
-Otherwise, it matches a literal "x" character. In JavaScript mode, support for
-code points greater than 256 is provided by \eu, which must be followed by
-four hexadecimal digits; otherwise it matches a literal "u" character.
-Character codes specified by \eu in JavaScript mode are constrained in the same
-was as those specified by \ex in non-JavaScript mode.
-.P
-Characters whose value is less than 256 can be defined by either of the two
-syntaxes for \ex (or by \eu in JavaScript mode). There is no difference in the
-way they are handled. For example, \exdc is exactly the same as \ex{dc} (or
-\eu00dc in JavaScript mode).
-.P
After \e0 up to two further octal digits are read. If there are fewer than two
digits, just those that are present are used. Thus the sequence \e0\ex\e07
specifies two binary zeros followed by a BEL character (code value 7). Make
sure you supply two digits after the initial zero if the pattern character that
follows is itself an octal digit.
.P
-The handling of a backslash followed by a digit other than 0 is complicated.
-Outside a character class, PCRE reads it and any following digits as a decimal
-number. If the number is less than 10, or if there have been at least that many
+The escape \eo must be followed by a sequence of octal digits, enclosed in
+braces. An error occurs if this is not the case. This escape is a recent
+addition to Perl; it provides way of specifying character code points as octal
+numbers greater than 0777, and it also allows octal numbers and back references
+to be unambiguously specified.
+.P
+For greater clarity and unambiguity, it is best to avoid following \e by a
+digit greater than zero. Instead, use \eo{} or \ex{} to specify character
+numbers, and \eg{} to specify back references. The following paragraphs
+describe the old, ambiguous syntax.
+.P
+The handling of a backslash followed by a digit other than 0 is complicated,
+and Perl has changed in recent releases, causing PCRE also to change. Outside a
+character class, PCRE reads the digit and any following digits as a decimal
+number. If the number is less than 8, or if there have been at least that many
previous capturing left parentheses in the expression, the entire sequence is
taken as a \fIback reference\fP. A description of how this works is given
.\" HTML <a href="#backreferences">
@@ -374,12 +373,11 @@ following the discussion of
parenthesized subpatterns.
.\"
.P
-Inside a character class, or if the decimal number is greater than 9 and there
-have not been that many capturing subpatterns, PCRE re-reads up to three octal
-digits following the backslash, and uses them to generate a data character. Any
-subsequent digits stand for themselves. The value of the character is
-constrained in the same way as characters specified in hexadecimal.
-For example:
+Inside a character class, or if the decimal number following \e is greater than
+7 and there have not been that many capturing subpatterns, PCRE handles \e8 and
+\e9 as the literal characters "8" and "9", and otherwise re-reads up to three
+octal digits following the backslash, using them to generate a data character.
+Any subsequent digits stand for themselves. For example:
.sp
\e040 is another way of writing an ASCII space
.\" JOIN
@@ -398,12 +396,51 @@ For example:
\e377 might be a back reference, otherwise
the value 255 (decimal)
.\" JOIN
- \e81 is either a back reference, or a binary zero
- followed by the two characters "8" and "1"
+ \e81 is either a back reference, or the two
+ characters "8" and "1"
.sp
-Note that octal values of 100 or greater must not be introduced by a leading
-zero, because no more than three octal digits are ever read.
+Note that octal values of 100 or greater that are specified using this syntax
+must not be introduced by a leading zero, because no more than three octal
+digits are ever read.
+.P
+By default, after \ex that is not followed by {, from zero to two hexadecimal
+digits are read (letters can be in upper or lower case). Any number of
+hexadecimal digits may appear between \ex{ and }. If a character other than
+a hexadecimal digit appears between \ex{ and }, or if there is no terminating
+}, an error occurs.
.P
+If the PCRE_JAVASCRIPT_COMPAT option is set, the interpretation of \ex is
+as just described only when it is followed by two hexadecimal digits.
+Otherwise, it matches a literal "x" character. In JavaScript mode, support for
+code points greater than 256 is provided by \eu, which must be followed by
+four hexadecimal digits; otherwise it matches a literal "u" character.
+.P
+Characters whose value is less than 256 can be defined by either of the two
+syntaxes for \ex (or by \eu in JavaScript mode). There is no difference in the
+way they are handled. For example, \exdc is exactly the same as \ex{dc} (or
+\eu00dc in JavaScript mode).
+.
+.
+.SS "Constraints on character values"
+.rs
+.sp
+Characters that are specified using octal or hexadecimal numbers are
+limited to certain values, as follows:
+.sp
+ 8-bit non-UTF mode less than 0x100
+ 8-bit UTF-8 mode less than 0x10ffff and a valid codepoint
+ 16-bit non-UTF mode less than 0x10000
+ 16-bit UTF-16 mode less than 0x10ffff and a valid codepoint
+ 32-bit non-UTF mode less than 0x100000000
+ 32-bit UTF-32 mode less than 0x10ffff and a valid codepoint
+.sp
+Invalid Unicode codepoints are the range 0xd800 to 0xdfff (the so-called
+"surrogate" codepoints), and 0xffef.
+.
+.
+.SS "Escape sequences in character classes"
+.rs
+.sp
All the sequences that define a single character value can be used both inside
and outside character classes. In addition, inside a character class, \eb is
interpreted as the backspace character (hex 08).
@@ -494,11 +531,14 @@ classes. They each match one character of the appropriate type. If the current
matching point is at the end of the subject string, all of them fail, because
there is no character to match.
.P
-For compatibility with Perl, \es does not match the VT character (code 11).
-This makes it different from the the POSIX "space" class. The \es characters
-are HT (9), LF (10), FF (12), CR (13), and space (32). If "use locale;" is
-included in a Perl script, \es may match the VT character. In PCRE, it never
-does.
+For compatibility with Perl, \es did not used to match the VT character (code
+11), which made it different from the the POSIX "space" class. However, Perl
+added VT at release 5.18, and PCRE followed suit at release 8.34. The default
+\es characters are now HT (9), LF (10), VT (11), FF (12), CR (13), and space
+(32), which are defined as white space in the "C" locale. This list may vary if
+locale-specific matching is taking place. For example, in some locales the
+"non-breaking space" character (\exA0) is recognized as white space, and in
+others the VT character is not.
.P
A "word" character is an underscore or any character that is a letter or digit.
By default, the definition of letters and digits is controlled by PCRE's
@@ -513,20 +553,22 @@ in the
\fBpcreapi\fP
.\"
page). For example, in a French locale such as "fr_FR" in Unix-like systems,
-or "french" in Windows, some character codes greater than 128 are used for
+or "french" in Windows, some character codes greater than 127 are used for
accented letters, and these are then matched by \ew. The use of locales with
Unicode is discouraged.
.P
-By default, in a UTF mode, characters with values greater than 128 never match
-\ed, \es, or \ew, and always match \eD, \eS, and \eW. These sequences retain
-their original meanings from before UTF support was available, mainly for
-efficiency reasons. However, if PCRE is compiled with Unicode property support,
-and the PCRE_UCP option is set, the behaviour is changed so that Unicode
-properties are used to determine character types, as follows:
+By default, characters whose code points are greater than 127 never match \ed,
+\es, or \ew, and always match \eD, \eS, and \eW, although this may vary for
+characters in the range 128-255 when locale-specific matching is happening.
+These escape sequences retain their original meanings from before Unicode
+support was available, mainly for efficiency reasons. If PCRE is compiled with
+Unicode property support, and the PCRE_UCP option is set, the behaviour is
+changed so that Unicode properties are used to determine character types, as
+follows:
.sp
- \ed any character that \ep{Nd} matches (decimal digit)
- \es any character that \ep{Z} matches, plus HT, LF, FF, CR
- \ew any character that \ep{L} or \ep{N} matches, plus underscore
+ \ed any character that matches \ep{Nd} (decimal digit)
+ \es any character that matches \ep{Z} or \eh or \ev
+ \ew any character that matches \ep{L} or \ep{N}, plus underscore
.sp
The upper case escapes match the inverse sets of characters. Note that \ed
matches only decimal digits, whereas \ew matches any Unicode digit, as well as
@@ -536,7 +578,7 @@ is noticeably slower when PCRE_UCP is set.
.P
The sequences \eh, \eH, \ev, and \eV are features that were added to Perl at
release 5.10. In contrast to the other sequences, which match only ASCII
-characters by default, these always match certain high-valued codepoints,
+characters by default, these always match certain high-valued code points,
whether or not PCRE_UCP is set. The horizontal space characters are:
.sp
U+0009 Horizontal tab (HT)
@@ -906,9 +948,9 @@ the "mark" property always have the "extend" grapheme breaking property.
.sp
As well as the standard Unicode properties described above, PCRE supports four
more that make it possible to convert traditional escape sequences such as \ew
-and \es and POSIX character classes to use Unicode properties. PCRE uses these
-non-standard, non-Perl properties internally when PCRE_UCP is set. However,
-they may also be used explicitly. These properties are:
+and \es to use Unicode properties. PCRE uses these non-standard, non-Perl
+properties internally when PCRE_UCP is set. However, they may also be used
+explicitly. These properties are:
.sp
Xan Any alphanumeric character
Xps Any POSIX space character
@@ -918,8 +960,9 @@ they may also be used explicitly. These properties are:
Xan matches characters that have either the L (letter) or the N (number)
property. Xps matches the characters tab, linefeed, vertical tab, form feed, or
carriage return, and any other character that has the Z (separator) property.
-Xsp is the same as Xps, except that vertical tab is excluded. Xwd matches the
-same characters as Xan, plus underscore.
+Xsp is the same as Xps; it used to exclude vertical tab, for Perl
+compatibility, but Perl changed, and so PCRE followed at release 8.34. Xwd
+matches the same characters as Xan, plus underscore.
.P
There is another non-standard property, Xuc, which matches any character that
can be represented by a Universal Character Name in C++ and other programming
@@ -1215,7 +1258,9 @@ The minus (hyphen) character can be used to specify a range of characters in a
character class. For example, [d-m] matches any letter between d and m,
inclusive. If a minus character is required in a class, it must be escaped with
a backslash or appear in a position where it cannot be interpreted as
-indicating a range, typically as the first or last character in the class.
+indicating a range, typically as the first or last character in the class, or
+immediately after a range. For example, [b-d-z] matches letters in the range b
+to d, a hyphen character, or z.
.P
It is not possible to have the literal character "]" as the end character of a
range. A pattern such as [W-]46] is interpreted as a class of two characters
@@ -1225,6 +1270,11 @@ the end of range, so [W-\e]46] is interpreted as a class containing a range
followed by two other characters. The octal or hexadecimal representation of
"]" can also be used to end a range.
.P
+An error is generated if a POSIX character class (see below) or an escape
+sequence other than one that defines a single character appears at a point
+where a range ending character is expected. For example, [z-\exff] is valid,
+but [A-\ed] and [A-[:digit:]] are not.
+.P
Ranges operate in the collating sequence of character values. They can also be
used for characters specified numerically, for example [\e000-\e037]. Ranges
can include any characters that are valid for the current mode.
@@ -1263,9 +1313,9 @@ something AND NOT ...".
The only metacharacters that are recognized in character classes are backslash,
hyphen (only where it can be interpreted as specifying a range), circumflex
(only at the start), opening square bracket (only when it can be interpreted as
-introducing a POSIX class name - see the next section), and the terminating
-closing square bracket. However, escaping other non-alphanumeric characters
-does no harm.
+introducing a POSIX class name, or for a special compatibility feature - see
+the next two sections), and the terminating closing square bracket. However,
+escaping other non-alphanumeric characters does no harm.
.
.
.SH "POSIX CHARACTER CLASSES"
@@ -1290,15 +1340,17 @@ are:
lower lower case letters
print printing characters, including space
punct printing characters, excluding letters and digits and space
- space white space (not quite the same as \es)
+ space white space (the same as \es from PCRE 8.34)
upper upper case letters
word "word" characters (same as \ew)
xdigit hexadecimal digits
.sp
-The "space" characters are HT (9), LF (10), VT (11), FF (12), CR (13), and
-space (32). Notice that this list includes the VT character (code 11). This
-makes "space" different to \es, which does not include VT (for Perl
-compatibility).
+The default "space" characters are HT (9), LF (10), VT (11), FF (12), CR (13),
+and space (32). If locale-specific matching is taking place, the list of space
+characters may be different; there may be fewer or more of them. "Space" used
+to be different to \es, which did not include VT, for Perl compatibility.
+However, Perl changed at release 5.18, and PCRE followed at release 8.34.
+"Space" and \es now match the same set of characters.
.P
The name "word" is a Perl extension, and "blank" is a GNU extension from Perl
5.8. Another Perl extension is negation, which is indicated by a ^ character
@@ -1310,11 +1362,11 @@ matches "1", "2", or any non-digit. PCRE (and Perl) also recognize the POSIX
syntax [.ch.] and [=ch=] where "ch" is a "collating element", but these are not
supported, and an error is given if they are encountered.
.P
-By default, in UTF modes, characters with values greater than 128 do not match
-any of the POSIX character classes. However, if the PCRE_UCP option is passed
-to \fBpcre_compile()\fP, some of the classes are changed so that Unicode
-character properties are used. This is achieved by replacing the POSIX classes
-by other sequences, as follows:
+By default, characters with values greater than 128 do not match any of the
+POSIX character classes. However, if the PCRE_UCP option is passed to
+\fBpcre_compile()\fP, some of the classes are changed so that Unicode character
+properties are used. This is achieved by replacing certain POSIX classes by
+other sequences, as follows:
.sp
[:alnum:] becomes \ep{Xan}
[:alpha:] becomes \ep{L}
@@ -1325,9 +1377,54 @@ by other sequences, as follows:
[:upper:] becomes \ep{Lu}
[:word:] becomes \ep{Xwd}
.sp
-Negated versions, such as [:^alpha:] use \eP instead of \ep. The other POSIX
-classes are unchanged, and match only characters with code points less than
-128.
+Negated versions, such as [:^alpha:] use \eP instead of \ep. Three other POSIX
+classes are handled specially in UCP mode:
+.TP 10
+[:graph:]
+This matches characters that have glyphs that mark the page when printed. In
+Unicode property terms, it matches all characters with the L, M, N, P, S, or Cf
+properties, except for:
+.sp
+ U+061C Arabic Letter Mark
+ U+180E Mongolian Vowel Separator
+ U+2066 - U+2069 Various "isolate"s
+.sp
+.TP 10
+[:print:]
+This matches the same characters as [:graph:] plus space characters that are
+not controls, that is, characters with the Zs property.
+.TP 10
+[:punct:]
+This matches all characters that have the Unicode P (punctuation) property,
+plus those characters whose code points are less than 128 that have the S
+(Symbol) property.
+.P
+The other POSIX classes are unchanged, and match only characters with code
+points less than 128.
+.
+.
+.SH "COMPATIBILITY FEATURE FOR WORD BOUNDARIES"
+.rs
+.sp
+In the POSIX.2 compliant library that was included in 4.4BSD Unix, the ugly
+syntax [[:<:]] and [[:>:]] is used for matching "start of word" and "end of
+word". PCRE treats these items as follows:
+.sp
+ [[:<:]] is converted to \eb(?=\ew)
+ [[:>:]] is converted to \eb(?<=\ew)
+.sp
+Only these exact character sequences are recognized. A sequence such as
+[a[:<:]b] provokes error for an unrecognized POSIX class name. This support is
+not compatible with Perl. It is provided to help migrations from other
+environments, and is best not used in any new patterns. Note that \eb matches
+at the start and the end of a word (see
+.\" HTML <a href="#smallassertions">
+.\" </a>
+"Simple assertions"
+.\"
+above), and in a Perl-style pattern the preceding or following character
+normally shows which is wanted, without the need for the assertions that are
+used above in order to give exactly the POSIX behaviour.
.
.
.SH "VERTICAL BAR"
@@ -1547,11 +1644,12 @@ conditions,
.\"
can be made by name as well as by number.
.P
-Names consist of up to 32 alphanumeric characters and underscores. Named
-capturing parentheses are still allocated numbers as well as names, exactly as
-if the names were not present. The PCRE API provides function calls for
-extracting the name-to-number translation table from a compiled pattern. There
-is also a convenience function for extracting a captured substring by name.
+Names consist of up to 32 alphanumeric characters and underscores, but must
+start with a non-digit. Named capturing parentheses are still allocated numbers
+as well as names, exactly as if the names were not present. The PCRE API
+provides function calls for extracting the name-to-number translation table
+from a compiled pattern. There is also a convenience function for extracting a
+captured substring by name.
.P
By default, a name must be unique within a pattern, but it is possible to relax
this constraint by setting the PCRE_DUPNAMES option at compile time. (Duplicate
@@ -1577,9 +1675,20 @@ for the first (and in this example, the only) subpattern of that name that
matched. This saves searching to find which numbered subpattern it was.
.P
If you make a back reference to a non-unique named subpattern from elsewhere in
-the pattern, the one that corresponds to the first occurrence of the name is
-used. In the absence of duplicate numbers (see the previous section) this is
-the one with the lowest number. If you use a named reference in a condition
+the pattern, the subpatterns to which the name refers are checked in the order
+in which they appear in the overall pattern. The first one that is set is used
+for the reference. For example, this pattern matches both "foofoo" and
+"barbar" but not "foobar" or "barfoo":
+.sp
+ (?:(?<n>foo)|(?<n>bar))\ek<n>
+.sp
+.P
+If you make a subroutine call to a non-unique named subpattern, the one that
+corresponds to the first occurrence of the name is used. In the absence of
+duplicate numbers (see the previous section) this is the one with the lowest
+number.
+.P
+If you use a named reference in a condition
test (see the
.\"
.\" HTML <a href="#conditions">
@@ -1599,8 +1708,9 @@ documentation.
\fBWarning:\fP You cannot use different names to distinguish between two
subpatterns with the same number because PCRE uses only the numbers when
matching. For this reason, an error is given at compile time if different names
-are given to subpatterns with the same number. However, you can give the same
-name to subpatterns with the same number, even when PCRE_DUPNAMES is not set.
+are given to subpatterns with the same number. However, you can always give the
+same name to subpatterns with the same number, even when PCRE_DUPNAMES is not
+set.
.
.
.SH REPETITION
@@ -2271,12 +2381,7 @@ This makes the fragment independent of the parentheses in the larger pattern.
.sp
Perl uses the syntax (?(<name>)...) or (?('name')...) to test for a used
subpattern by name. For compatibility with earlier versions of PCRE, which had
-this facility before Perl, the syntax (?(name)...) is also recognized. However,
-there is a possible ambiguity with this syntax, because subpattern names may
-consist entirely of digits. PCRE looks first for a named subpattern; if it
-cannot find one and the name consists entirely of digits, PCRE looks for a
-subpattern of that number, which must be greater than zero. Using subpattern
-names that consist entirely of digits is not recommended.
+this facility before Perl, the syntax (?(name)...) is also recognized.
.P
Rewriting the above example to use a named subpattern gives this:
.sp
@@ -2698,8 +2803,13 @@ During matching, when PCRE reaches a callout point, the external function is
called. It is provided with the number of the callout, the position in the
pattern, and, optionally, one item of data originally supplied by the caller of
the matching function. The callout function may cause matching to proceed, to
-backtrack, or to fail altogether. A complete description of the interface to
-the callout function is given in the
+backtrack, or to fail altogether.
+.P
+By default, PCRE implements a number of optimizations at compile time and
+matching time, and one side-effect is that sometimes callouts are skipped. If
+you need all possible callouts to happen, you need to set options that disable
+the relevant optimizations. More details, and a complete description of the
+interface to the callout function, are given in the
.\" HREF
\fBpcrecallout\fP
.\"
@@ -3060,7 +3170,7 @@ example:
.sp
...(*COMMIT)(*PRUNE)...
.sp
-If there is a matching failure to the right, backtracking onto (*PRUNE) cases
+If there is a matching failure to the right, backtracking onto (*PRUNE) causes
it to be triggered, and its action is taken. There can never be a backtrack
onto (*COMMIT).
.
@@ -3145,6 +3255,6 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 26 April 2013
+Last updated: 03 December 2013
Copyright (c) 1997-2013 University of Cambridge.
.fi
diff --git a/pcre/doc/pcreposix.3 b/pcre/doc/pcreposix.3
index b25a89193c9..77890f36b46 100644
--- a/pcre/doc/pcreposix.3
+++ b/pcre/doc/pcreposix.3
@@ -1,25 +1,22 @@
.TH PCREPOSIX 3 "09 January 2012" "PCRE 8.30"
.SH NAME
PCRE - Perl-compatible regular expressions.
-.SH "SYNOPSIS OF POSIX API"
+.SH "SYNOPSIS"
.rs
.sp
.B #include <pcreposix.h>
.PP
-.SM
+.nf
.B int regcomp(regex_t *\fIpreg\fP, const char *\fIpattern\fP,
-.ti +5n
-.B int \fIcflags\fP);
-.PP
+.B " int \fIcflags\fP);"
+.sp
.B int regexec(regex_t *\fIpreg\fP, const char *\fIstring\fP,
-.ti +5n
-.B size_t \fInmatch\fP, regmatch_t \fIpmatch\fP[], int \fIeflags\fP);
-.PP
-.B size_t regerror(int \fIerrcode\fP, const regex_t *\fIpreg\fP,
-.ti +5n
-.B char *\fIerrbuf\fP, size_t \fIerrbuf_size\fP);
-.PP
+.B " size_t \fInmatch\fP, regmatch_t \fIpmatch\fP[], int \fIeflags\fP);"
+.B " size_t regerror(int \fIerrcode\fP, const regex_t *\fIpreg\fP,"
+.B " char *\fIerrbuf\fP, size_t \fIerrbuf_size\fP);"
+.sp
.B void regfree(regex_t *\fIpreg\fP);
+.fi
.
.SH DESCRIPTION
.rs
diff --git a/pcre/doc/pcreprecompile.3 b/pcre/doc/pcreprecompile.3
index 39eb82b02cc..40f257a98cb 100644
--- a/pcre/doc/pcreprecompile.3
+++ b/pcre/doc/pcreprecompile.3
@@ -1,4 +1,4 @@
-.TH PCREPRECOMPILE 3 "24 June 2012" "PCRE 8.30"
+.TH PCREPRECOMPILE 3 "12 November 2013" "PCRE 8.34"
.SH NAME
PCRE - Perl-compatible regular expressions
.SH "SAVING AND RE-USING PRECOMPILED PCRE PATTERNS"
@@ -90,8 +90,8 @@ study data.
.rs
.sp
Re-using a precompiled pattern is straightforward. Having reloaded it into main
-memory, called \fBpcre[16|32]_pattern_to_host_byte_order()\fP if necessary,
-you pass its pointer to \fBpcre[16|32]_exec()\fP or \fBpcre[16|32]_dfa_exec()\fP in
+memory, called \fBpcre[16|32]_pattern_to_host_byte_order()\fP if necessary, you
+pass its pointer to \fBpcre[16|32]_exec()\fP or \fBpcre[16|32]_dfa_exec()\fP in
the usual way.
.P
However, if you passed a pointer to custom character tables when the pattern
@@ -110,15 +110,19 @@ in the
.\"
documentation.
.P
+\fBWarning:\fP The tables that \fBpcre_exec()\fP and \fBpcre_dfa_exec()\fP use
+must be the same as those that were used when the pattern was compiled. If this
+is not the case, the behaviour is undefined.
+.P
If you did not provide custom character tables when the pattern was compiled,
the pointer in the compiled pattern is NULL, which causes the matching
functions to use PCRE's internal tables. Thus, you do not need to take any
special action at run time in this case.
.P
If you saved study data with the compiled pattern, you need to create your own
-\fBpcre[16|32]_extra\fP data block and set the \fIstudy_data\fP field to point to the
-reloaded study data. You must also set the PCRE_EXTRA_STUDY_DATA bit in the
-\fIflags\fP field to indicate that study data is present. Then pass the
+\fBpcre[16|32]_extra\fP data block and set the \fIstudy_data\fP field to point
+to the reloaded study data. You must also set the PCRE_EXTRA_STUDY_DATA bit in
+the \fIflags\fP field to indicate that study data is present. Then pass the
\fBpcre[16|32]_extra\fP block to the matching function in the usual way. If the
pattern was studied for just-in-time optimization, that data cannot be saved,
and so is lost by a save/restore cycle.
@@ -146,6 +150,6 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 24 June 2012
-Copyright (c) 1997-2012 University of Cambridge.
+Last updated: 12 November 2013
+Copyright (c) 1997-2013 University of Cambridge.
.fi
diff --git a/pcre/doc/pcresyntax.3 b/pcre/doc/pcresyntax.3
index 399bbe2535a..87f0cead743 100644
--- a/pcre/doc/pcresyntax.3
+++ b/pcre/doc/pcresyntax.3
@@ -1,4 +1,4 @@
-.TH PCRESYNTAX 3 "26 April 2013" "PCRE 8.33"
+.TH PCRESYNTAX 3 "12 November 2013" "PCRE 8.34"
.SH NAME
PCRE - Perl-compatible regular expressions
.SH "PCRE REGULAR EXPRESSION SYNTAX SUMMARY"
@@ -29,9 +29,14 @@ documentation. This document contains a quick-reference summary of the syntax.
\en newline (hex 0A)
\er carriage return (hex 0D)
\et tab (hex 09)
+ \e0dd character with octal code 0dd
\eddd character with octal code ddd, or backreference
+ \eo{ddd..} character with octal code ddd..
\exhh character with hex code hh
\ex{hhh..} character with hex code hhh..
+.sp
+Note that \e0dd is always an octal code, and that \e8 and \e9 are the literal
+characters "8" and "9".
.
.
.SH "CHARACTER TYPES"
@@ -56,9 +61,11 @@ documentation. This document contains a quick-reference summary of the syntax.
\eW a "non-word" character
\eX a Unicode extended grapheme cluster
.sp
-In PCRE, by default, \ed, \eD, \es, \eS, \ew, and \eW recognize only ASCII
-characters, even in a UTF mode. However, this can be changed by setting the
-PCRE_UCP option.
+By default, \ed, \es, and \ew match only ASCII characters, even in UTF-8 mode
+or in the 16- bit and 32-bit libraries. However, if locale-specific matching is
+happening, \es and \ew may also match characters with code points in the range
+128-255. If the PCRE_UCP option is set, the behaviour of these escape sequences
+is changed to use Unicode properties and they match many more characters.
.
.
.SH "GENERAL CATEGORY PROPERTIES FOR \ep and \eP"
@@ -115,10 +122,13 @@ PCRE_UCP option.
.sp
Xan Alphanumeric: union of properties L and N
Xps POSIX space: property Z or tab, NL, VT, FF, CR
- Xsp Perl space: property Z or tab, NL, FF, CR
+ Xsp Perl space: property Z or tab, NL, VT, FF, CR
Xuc Univerally-named character: one that can be
represented by a Universal Character Name
Xwd Perl word: property Xan or underscore
+.sp
+Perl and POSIX space are now the same. Perl added VT to its space character set
+at release 5.18 and PCRE changed at release 8.34.
.
.
.SH "SCRIPT NAMES FOR \ep AND \eP"
@@ -355,6 +365,9 @@ newline-setting options with similar syntax:
(*UTF32) set UTF-32 mode: 32-bit library (PCRE_UTF32)
(*UTF) set appropriate UTF mode for the library in use
(*UCP) set PCRE_UCP (use Unicode properties for \ed etc)
+.sp
+Note that LIMIT_MATCH and LIMIT_RECURSION can only reduce the value of the
+limits set by the caller of pcre_exec(), not increase them.
.
.
.SH "LOOKAHEAD AND LOOKBEHIND ASSERTIONS"
@@ -495,6 +508,6 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 26 April 2013
+Last updated: 12 November 2013
Copyright (c) 1997-2013 University of Cambridge.
.fi
diff --git a/pcre/doc/pcretest.1 b/pcre/doc/pcretest.1
index b71c897f2bb..f17c6f24088 100644
--- a/pcre/doc/pcretest.1
+++ b/pcre/doc/pcretest.1
@@ -1,4 +1,4 @@
-.TH PCRETEST 1 "26 April 2013" "PCRE 8.33"
+.TH PCRETEST 1 "12 November 2013" "PCRE 8.34"
.SH NAME
pcretest - a program for testing Perl-compatible regular expressions.
.SH SYNOPSIS
@@ -155,6 +155,10 @@ Output the size of each compiled pattern after it has been compiled. This is
equivalent to adding \fB/M\fP to each regular expression. The size is given in
bytes for both libraries.
.TP 10
+\fB-O\fP
+Behave as if each pattern has the \fB/O\fP modifier, that is disable
+auto-possessification for all patterns.
+.TP 10
\fB-o\fP \fIosize\fP
Set the number of elements in the output vector that is used when calling
\fBpcre[16|32]_exec()\fP or \fBpcre[16|32]_dfa_exec()\fP to be \fIosize\fP. The
@@ -216,17 +220,21 @@ contains (*MARK) items there may also be differences, for the same reason. The
should never be studied (see the \fB/S\fP pattern modifier below).
.TP 10
\fB-t\fP
-Run each compile, study, and match many times with a timer, and output
-resulting time per compile or match (in milliseconds). Do not set \fB-m\fP with
-\fB-t\fP, because you will then get the size output a zillion times, and the
-timing will be distorted. You can control the number of iterations that are
-used for timing by following \fB-t\fP with a number (as a separate item on the
-command line). For example, "-t 1000" would iterate 1000 times. The default is
-to iterate 500000 times.
+Run each compile, study, and match many times with a timer, and output the
+resulting times per compile, study, or match (in milliseconds). Do not set
+\fB-m\fP with \fB-t\fP, because you will then get the size output a zillion
+times, and the timing will be distorted. You can control the number of
+iterations that are used for timing by following \fB-t\fP with a number (as a
+separate item on the command line). For example, "-t 1000" iterates 1000 times.
+The default is to iterate 500000 times.
.TP 10
\fB-tm\fP
This is like \fB-t\fP except that it times only the matching phase, not the
compile or study phases.
+.TP 10
+\fB-T\fP \fB-TM\fP
+These behave like \fB-t\fP and \fB-tm\fP, but in addition, at the end of a run,
+the total times for all compiles, studies, and matches are output.
.
.
.SH DESCRIPTION
@@ -246,7 +254,7 @@ option states whether or not \fBreadline()\fP will be used.
.P
The program handles any number of sets of input on a single input file. Each
set starts with a regular expression, and continues with any number of data
-lines to be matched against the pattern.
+lines to be matched against that pattern.
.P
Each data line is matched separately and independently. If you want to do
multi-line matches, you have to use the \en escape sequence (or \er or \er\en,
@@ -320,6 +328,7 @@ sections.
\fB/M\fP show compiled memory size
\fB/m\fP set PCRE_MULTILINE
\fB/N\fP set PCRE_NO_AUTO_CAPTURE
+ \fB/O\fP set PCRE_NO_AUTO_POSSESS
\fB/P\fP use the POSIX wrapper
\fB/S\fP study the pattern after compilation
\fB/s\fP set PCRE_DOTALL
@@ -376,6 +385,7 @@ options that do not correspond to anything in Perl:
\fB/f\fP PCRE_FIRSTLINE
\fB/J\fP PCRE_DUPNAMES
\fB/N\fP PCRE_NO_AUTO_CAPTURE
+ \fB/O\fP PCRE_NO_AUTO_POSSESS
\fB/U\fP PCRE_UNGREEDY
\fB/W\fP PCRE_UCP
\fB/X\fP PCRE_EXTRA
@@ -508,8 +518,8 @@ expression has been compiled, and the results used when the expression is
matched. There are a number of qualifying characters that may follow \fB/S\fP.
They may appear in any order.
.P
-If \fBS\fP is followed by an exclamation mark, \fBpcre[16|32]_study()\fP is called
-with the PCRE_STUDY_EXTRA_NEEDED option, causing it always to return a
+If \fB/S\fP is followed by an exclamation mark, \fBpcre[16|32]_study()\fP is
+called with the PCRE_STUDY_EXTRA_NEEDED option, causing it always to return a
\fBpcre_extra\fP block, even when studying discovers no useful information.
.P
If \fB/S\fP is followed by a second S character, it suppresses studying, even
@@ -585,6 +595,37 @@ The \fB/+\fP modifier works as described above. All other modifiers are
ignored.
.
.
+.SS "Locking out certain modifiers"
+.rs
+.sp
+PCRE can be compiled with or without support for certain features such as
+UTF-8/16/32 or Unicode properties. Accordingly, the standard tests are split up
+into a number of different files that are selected for running depending on
+which features are available. When updating the tests, it is all too easy to
+put a new test into the wrong file by mistake; for example, to put a test that
+requires UTF support into a file that is used when it is not available. To help
+detect such mistakes as early as possible, there is a facility for locking out
+specific modifiers. If an input line for \fBpcretest\fP starts with the string
+"< forbid " the following sequence of characters is taken as a list of
+forbidden modifiers. For example, in the test files that must not use UTF or
+Unicode property support, this line appears:
+.sp
+ < forbid 8W
+.sp
+This locks out the /8 and /W modifiers. An immediate error is given if they are
+subsequently encountered. If the character string contains < but not >, all the
+multi-character modifiers that begin with < are locked out. Otherwise, such
+modifiers must be explicitly listed, for example:
+.sp
+ < forbid <JS><cr>
+.sp
+There must be a single space between < and "forbid" for this feature to be
+recognised. If there is not, the line is interpreted either as a request to
+re-load a pre-compiled pattern (see "SAVING AND RELOADING COMPILED PATTERNS"
+below) or, if there is a another < character, as a pattern that uses < as its
+delimiter.
+.
+.
.SH "DATA LINES"
.rs
.sp
@@ -608,6 +649,7 @@ recognized:
\ev vertical tab (\ex0b)
\ennn octal character (up to 3 octal digits); always
a byte unless > 255 in UTF-8 or 16-bit or 32-bit mode
+ \eo{dd...} octal character (any number of octal digits}
\exhh hexadecimal byte (up to 2 hex digits)
\ex{hh...} hexadecimal character (any number of hex digits)
.\" JOIN
@@ -1031,10 +1073,9 @@ exact copy of the compiled pattern. If there is additional study data, this
writing the file, \fBpcretest\fP expects to read a new pattern.
.P
A saved pattern can be reloaded into \fBpcretest\fP by specifying < and a file
-name instead of a pattern. The name of the file must not contain a < character,
-as otherwise \fBpcretest\fP will interpret the line as a pattern delimited by <
-characters.
-For example:
+name instead of a pattern. There must be no space between < and the file name,
+which must not contain a < character, as otherwise \fBpcretest\fP will
+interpret the line as a pattern delimited by < characters. For example:
.sp
re> </some/file
Compiled pattern loaded from /some/file
@@ -1094,6 +1135,6 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 26 April 2013
+Last updated: 12 November 2013
Copyright (c) 1997-2013 University of Cambridge.
.fi
diff --git a/pcre/doc/pcretest.txt b/pcre/doc/pcretest.txt
index 2644e27a147..f0609939f5c 100644
--- a/pcre/doc/pcretest.txt
+++ b/pcre/doc/pcretest.txt
@@ -138,32 +138,35 @@ COMMAND LINE OPTIONS
compiled. This is equivalent to adding /M to each regular
expression. The size is given in bytes for both libraries.
- -o osize Set the number of elements in the output vector that is used
- when calling pcre[16|32]_exec() or pcre[16|32]_dfa_exec() to
- be osize. The default value is 45, which is enough for 14
+ -O Behave as if each pattern has the /O modifier, that is dis-
+ able auto-possessification for all patterns.
+
+ -o osize Set the number of elements in the output vector that is used
+ when calling pcre[16|32]_exec() or pcre[16|32]_dfa_exec() to
+ be osize. The default value is 45, which is enough for 14
capturing subexpressions for pcre[16|32]_exec() or 22 differ-
- ent matches for pcre[16|32]_dfa_exec(). The vector size can
- be changed for individual matching calls by including \O in
+ ent matches for pcre[16|32]_dfa_exec(). The vector size can
+ be changed for individual matching calls by including \O in
the data line (see below).
- -p Behave as if each pattern has the /P modifier; the POSIX
- wrapper API is used to call PCRE. None of the other options
- has any effect when -p is set. This option can be used only
+ -p Behave as if each pattern has the /P modifier; the POSIX
+ wrapper API is used to call PCRE. None of the other options
+ has any effect when -p is set. This option can be used only
with the 8-bit library.
- -q Do not output the version number of pcretest at the start of
+ -q Do not output the version number of pcretest at the start of
execution.
- -S size On Unix-like systems, set the size of the run-time stack to
+ -S size On Unix-like systems, set the size of the run-time stack to
size megabytes.
- -s or -s+ Behave as if each pattern has the /S modifier; in other
- words, force each pattern to be studied. If -s+ is used, all
- the JIT compile options are passed to pcre[16|32]_study(),
- causing just-in-time optimization to be set up if it is
- available, for both full and partial matching. Specific JIT
+ -s or -s+ Behave as if each pattern has the /S modifier; in other
+ words, force each pattern to be studied. If -s+ is used, all
+ the JIT compile options are passed to pcre[16|32]_study(),
+ causing just-in-time optimization to be set up if it is
+ available, for both full and partial matching. Specific JIT
compile options can be selected by following -s+ with a digit
- in the range 1 to 7, which selects the JIT compile modes as
+ in the range 1 to 7, which selects the JIT compile modes as
follows:
1 normal match only
@@ -173,115 +176,119 @@ COMMAND LINE OPTIONS
6 soft and hard partial match
7 all three modes (default)
- If -s++ is used instead of -s+ (with or without a following
- digit), the text "(JIT)" is added to the first output line
+ If -s++ is used instead of -s+ (with or without a following
+ digit), the text "(JIT)" is added to the first output line
after a match or no match when JIT-compiled code was actually
used.
- Note that there are pattern options that can override -s,
+ Note that there are pattern options that can override -s,
either specifying no studying at all, or suppressing JIT com-
pilation.
- If the /I or /D option is present on a pattern (requesting
- output about the compiled pattern), information about the
- result of studying is not included when studying is caused
- only by -s and neither -i nor -d is present on the command
- line. This behaviour means that the output from tests that
- are run with and without -s should be identical, except when
+ If the /I or /D option is present on a pattern (requesting
+ output about the compiled pattern), information about the
+ result of studying is not included when studying is caused
+ only by -s and neither -i nor -d is present on the command
+ line. This behaviour means that the output from tests that
+ are run with and without -s should be identical, except when
options that output information about the actual running of a
match are set.
- The -M, -t, and -tm options, which give information about
- resources used, are likely to produce different output with
- and without -s. Output may also differ if the /C option is
+ The -M, -t, and -tm options, which give information about
+ resources used, are likely to produce different output with
+ and without -s. Output may also differ if the /C option is
present on an individual pattern. This uses callouts to trace
- the the matching process, and this may be different between
- studied and non-studied patterns. If the pattern contains
- (*MARK) items there may also be differences, for the same
+ the the matching process, and this may be different between
+ studied and non-studied patterns. If the pattern contains
+ (*MARK) items there may also be differences, for the same
reason. The -s command line option can be overridden for spe-
- cific patterns that should never be studied (see the /S pat-
+ cific patterns that should never be studied (see the /S pat-
tern modifier below).
- -t Run each compile, study, and match many times with a timer,
- and output resulting time per compile or match (in millisec-
- onds). Do not set -m with -t, because you will then get the
- size output a zillion times, and the timing will be dis-
- torted. You can control the number of iterations that are
- used for timing by following -t with a number (as a separate
- item on the command line). For example, "-t 1000" would iter-
- ate 1000 times. The default is to iterate 500000 times.
+ -t Run each compile, study, and match many times with a timer,
+ and output the resulting times per compile, study, or match
+ (in milliseconds). Do not set -m with -t, because you will
+ then get the size output a zillion times, and the timing will
+ be distorted. You can control the number of iterations that
+ are used for timing by following -t with a number (as a sepa-
+ rate item on the command line). For example, "-t 1000" iter-
+ ates 1000 times. The default is to iterate 500000 times.
-tm This is like -t except that it times only the matching phase,
not the compile or study phases.
+ -T -TM These behave like -t and -tm, but in addition, at the end of
+ a run, the total times for all compiles, studies, and matches
+ are output.
+
DESCRIPTION
- If pcretest is given two filename arguments, it reads from the first
+ If pcretest is given two filename arguments, it reads from the first
and writes to the second. If it is given only one filename argument, it
- reads from that file and writes to stdout. Otherwise, it reads from
- stdin and writes to stdout, and prompts for each line of input, using
+ reads from that file and writes to stdout. Otherwise, it reads from
+ stdin and writes to stdout, and prompts for each line of input, using
"re>" to prompt for regular expressions, and "data>" to prompt for data
lines.
- When pcretest is built, a configuration option can specify that it
- should be linked with the libreadline library. When this is done, if
+ When pcretest is built, a configuration option can specify that it
+ should be linked with the libreadline library. When this is done, if
the input is from a terminal, it is read using the readline() function.
- This provides line-editing and history facilities. The output from the
+ This provides line-editing and history facilities. The output from the
-help option states whether or not readline() will be used.
The program handles any number of sets of input on a single input file.
- Each set starts with a regular expression, and continues with any num-
- ber of data lines to be matched against the pattern.
+ Each set starts with a regular expression, and continues with any num-
+ ber of data lines to be matched against that pattern.
- Each data line is matched separately and independently. If you want to
+ Each data line is matched separately and independently. If you want to
do multi-line matches, you have to use the \n escape sequence (or \r or
\r\n, etc., depending on the newline setting) in a single line of input
- to encode the newline sequences. There is no limit on the length of
- data lines; the input buffer is automatically extended if it is too
+ to encode the newline sequences. There is no limit on the length of
+ data lines; the input buffer is automatically extended if it is too
small.
- An empty line signals the end of the data lines, at which point a new
- regular expression is read. The regular expressions are given enclosed
+ An empty line signals the end of the data lines, at which point a new
+ regular expression is read. The regular expressions are given enclosed
in any non-alphanumeric delimiters other than backslash, for example:
/(a|bc)x+yz/
- White space before the initial delimiter is ignored. A regular expres-
- sion may be continued over several input lines, in which case the new-
- line characters are included within it. It is possible to include the
+ White space before the initial delimiter is ignored. A regular expres-
+ sion may be continued over several input lines, in which case the new-
+ line characters are included within it. It is possible to include the
delimiter within the pattern by escaping it, for example
/abc\/def/
- If you do so, the escape and the delimiter form part of the pattern,
- but since delimiters are always non-alphanumeric, this does not affect
- its interpretation. If the terminating delimiter is immediately fol-
+ If you do so, the escape and the delimiter form part of the pattern,
+ but since delimiters are always non-alphanumeric, this does not affect
+ its interpretation. If the terminating delimiter is immediately fol-
lowed by a backslash, for example,
/abc/\
- then a backslash is added to the end of the pattern. This is done to
- provide a way of testing the error condition that arises if a pattern
+ then a backslash is added to the end of the pattern. This is done to
+ provide a way of testing the error condition that arises if a pattern
finishes with a backslash, because
/abc\/
- is interpreted as the first line of a pattern that starts with "abc/",
+ is interpreted as the first line of a pattern that starts with "abc/",
causing pcretest to read the next line as a continuation of the regular
expression.
PATTERN MODIFIERS
- A pattern may be followed by any number of modifiers, which are mostly
- single characters, though some of these can be qualified by further
- characters. Following Perl usage, these are referred to below as, for
- example, "the /i modifier", even though the delimiter of the pattern
- need not always be a slash, and no slash is used when writing modi-
- fiers. White space may appear between the final pattern delimiter and
- the first modifier, and between the modifiers themselves. For refer-
- ence, here is a complete list of modifiers. They fall into several
+ A pattern may be followed by any number of modifiers, which are mostly
+ single characters, though some of these can be qualified by further
+ characters. Following Perl usage, these are referred to below as, for
+ example, "the /i modifier", even though the delimiter of the pattern
+ need not always be a slash, and no slash is used when writing modi-
+ fiers. White space may appear between the final pattern delimiter and
+ the first modifier, and between the modifiers themselves. For refer-
+ ence, here is a complete list of modifiers. They fall into several
groups that are described in detail in the following sections.
/8 set UTF mode
@@ -307,6 +314,7 @@ PATTERN MODIFIERS
/M show compiled memory size
/m set PCRE_MULTILINE
/N set PCRE_NO_AUTO_CAPTURE
+ /O set PCRE_NO_AUTO_POSSESS
/P use the POSIX wrapper
/S study the pattern after compilation
/s set PCRE_DOTALL
@@ -331,8 +339,8 @@ PATTERN MODIFIERS
Perl-compatible modifiers
The /i, /m, /s, and /x modifiers set the PCRE_CASELESS, PCRE_MULTILINE,
- PCRE_DOTALL, or PCRE_EXTENDED options, respectively, when
- pcre[16|32]_compile() is called. These four modifier letters have the
+ PCRE_DOTALL, or PCRE_EXTENDED options, respectively, when
+ pcre[16|32]_compile() is called. These four modifier letters have the
same effect as they do in Perl. For example:
/caseless/i
@@ -340,7 +348,7 @@ PATTERN MODIFIERS
Modifiers for other PCRE options
- The following table shows additional modifiers for setting PCRE com-
+ The following table shows additional modifiers for setting PCRE com-
pile-time options that do not correspond to anything in Perl:
/8 PCRE_UTF8 ) when using the 8-bit
@@ -359,6 +367,7 @@ PATTERN MODIFIERS
/f PCRE_FIRSTLINE
/J PCRE_DUPNAMES
/N PCRE_NO_AUTO_CAPTURE
+ /O PCRE_NO_AUTO_POSSESS
/U PCRE_UNGREEDY
/W PCRE_UCP
/X PCRE_EXTRA
@@ -372,138 +381,138 @@ PATTERN MODIFIERS
/<bsr_unicode> PCRE_BSR_UNICODE
/<JS> PCRE_JAVASCRIPT_COMPAT
- The modifiers that are enclosed in angle brackets are literal strings
- as shown, including the angle brackets, but the letters within can be
- in either case. This example sets multiline matching with CRLF as the
+ The modifiers that are enclosed in angle brackets are literal strings
+ as shown, including the angle brackets, but the letters within can be
+ in either case. This example sets multiline matching with CRLF as the
line ending sequence:
/^abc/m<CRLF>
- As well as turning on the PCRE_UTF8/16/32 option, the /8 modifier
- causes all non-printing characters in output strings to be printed
+ As well as turning on the PCRE_UTF8/16/32 option, the /8 modifier
+ causes all non-printing characters in output strings to be printed
using the \x{hh...} notation. Otherwise, those less than 0x100 are out-
put in hex without the curly brackets.
- Full details of the PCRE options are given in the pcreapi documenta-
+ Full details of the PCRE options are given in the pcreapi documenta-
tion.
Finding all matches in a string
- Searching for all possible matches within each subject string can be
- requested by the /g or /G modifier. After finding a match, PCRE is
+ Searching for all possible matches within each subject string can be
+ requested by the /g or /G modifier. After finding a match, PCRE is
called again to search the remainder of the subject string. The differ-
ence between /g and /G is that the former uses the startoffset argument
- to pcre[16|32]_exec() to start searching at a new point within the
- entire string (which is in effect what Perl does), whereas the latter
- passes over a shortened substring. This makes a difference to the
- matching process if the pattern begins with a lookbehind assertion
+ to pcre[16|32]_exec() to start searching at a new point within the
+ entire string (which is in effect what Perl does), whereas the latter
+ passes over a shortened substring. This makes a difference to the
+ matching process if the pattern begins with a lookbehind assertion
(including \b or \B).
- If any call to pcre[16|32]_exec() in a /g or /G sequence matches an
- empty string, the next call is done with the PCRE_NOTEMPTY_ATSTART and
- PCRE_ANCHORED flags set in order to search for another, non-empty,
- match at the same point. If this second match fails, the start offset
- is advanced, and the normal match is retried. This imitates the way
+ If any call to pcre[16|32]_exec() in a /g or /G sequence matches an
+ empty string, the next call is done with the PCRE_NOTEMPTY_ATSTART and
+ PCRE_ANCHORED flags set in order to search for another, non-empty,
+ match at the same point. If this second match fails, the start offset
+ is advanced, and the normal match is retried. This imitates the way
Perl handles such cases when using the /g modifier or the split() func-
- tion. Normally, the start offset is advanced by one character, but if
- the newline convention recognizes CRLF as a newline, and the current
+ tion. Normally, the start offset is advanced by one character, but if
+ the newline convention recognizes CRLF as a newline, and the current
character is CR followed by LF, an advance of two is used.
Other modifiers
There are yet more modifiers for controlling the way pcretest operates.
- The /+ modifier requests that as well as outputting the substring that
- matched the entire pattern, pcretest should in addition output the
- remainder of the subject string. This is useful for tests where the
- subject contains multiple copies of the same substring. If the + modi-
- fier appears twice, the same action is taken for captured substrings.
- In each case the remainder is output on the following line with a plus
- character following the capture number. Note that this modifier must
- not immediately follow the /S modifier because /S+ and /S++ have other
+ The /+ modifier requests that as well as outputting the substring that
+ matched the entire pattern, pcretest should in addition output the
+ remainder of the subject string. This is useful for tests where the
+ subject contains multiple copies of the same substring. If the + modi-
+ fier appears twice, the same action is taken for captured substrings.
+ In each case the remainder is output on the following line with a plus
+ character following the capture number. Note that this modifier must
+ not immediately follow the /S modifier because /S+ and /S++ have other
meanings.
- The /= modifier requests that the values of all potential captured
- parentheses be output after a match. By default, only those up to the
+ The /= modifier requests that the values of all potential captured
+ parentheses be output after a match. By default, only those up to the
highest one actually used in the match are output (corresponding to the
return code from pcre[16|32]_exec()). Values in the offsets vector cor-
- responding to higher numbers should be set to -1, and these are output
- as "<unset>". This modifier gives a way of checking that this is hap-
+ responding to higher numbers should be set to -1, and these are output
+ as "<unset>". This modifier gives a way of checking that this is hap-
pening.
- The /B modifier is a debugging feature. It requests that pcretest out-
- put a representation of the compiled code after compilation. Normally
- this information contains length and offset values; however, if /Z is
- also present, this data is replaced by spaces. This is a special fea-
- ture for use in the automatic test scripts; it ensures that the same
+ The /B modifier is a debugging feature. It requests that pcretest out-
+ put a representation of the compiled code after compilation. Normally
+ this information contains length and offset values; however, if /Z is
+ also present, this data is replaced by spaces. This is a special fea-
+ ture for use in the automatic test scripts; it ensures that the same
output is generated for different internal link sizes.
- The /D modifier is a PCRE debugging feature, and is equivalent to /BI,
+ The /D modifier is a PCRE debugging feature, and is equivalent to /BI,
that is, both the /B and the /I modifiers.
- The /F modifier causes pcretest to flip the byte order of the 2-byte
+ The /F modifier causes pcretest to flip the byte order of the 2-byte
and 4-byte fields in the compiled pattern. This facility is for testing
- the feature in PCRE that allows it to execute patterns that were com-
+ the feature in PCRE that allows it to execute patterns that were com-
piled on a host with a different endianness. This feature is not avail-
- able when the POSIX interface to PCRE is being used, that is, when the
+ able when the POSIX interface to PCRE is being used, that is, when the
/P pattern modifier is specified. See also the section about saving and
reloading compiled patterns below.
- The /I modifier requests that pcretest output information about the
- compiled pattern (whether it is anchored, has a fixed first character,
- and so on). It does this by calling pcre[16|32]_fullinfo() after com-
- piling a pattern. If the pattern is studied, the results of that are
+ The /I modifier requests that pcretest output information about the
+ compiled pattern (whether it is anchored, has a fixed first character,
+ and so on). It does this by calling pcre[16|32]_fullinfo() after com-
+ piling a pattern. If the pattern is studied, the results of that are
also output.
- The /K modifier requests pcretest to show names from backtracking con-
- trol verbs that are returned from calls to pcre[16|32]_exec(). It
- causes pcretest to create a pcre[16|32]_extra block if one has not
- already been created by a call to pcre[16|32]_study(), and to set the
- PCRE_EXTRA_MARK flag and the mark field within it, every time that
- pcre[16|32]_exec() is called. If the variable that the mark field
- points to is non-NULL for a match, non-match, or partial match,
- pcretest prints the string to which it points. For a match, this is
- shown on a line by itself, tagged with "MK:". For a non-match it is
+ The /K modifier requests pcretest to show names from backtracking con-
+ trol verbs that are returned from calls to pcre[16|32]_exec(). It
+ causes pcretest to create a pcre[16|32]_extra block if one has not
+ already been created by a call to pcre[16|32]_study(), and to set the
+ PCRE_EXTRA_MARK flag and the mark field within it, every time that
+ pcre[16|32]_exec() is called. If the variable that the mark field
+ points to is non-NULL for a match, non-match, or partial match,
+ pcretest prints the string to which it points. For a match, this is
+ shown on a line by itself, tagged with "MK:". For a non-match it is
added to the message.
- The /L modifier must be followed directly by the name of a locale, for
+ The /L modifier must be followed directly by the name of a locale, for
example,
/pattern/Lfr_FR
For this reason, it must be the last modifier. The given locale is set,
- pcre[16|32]_maketables() is called to build a set of character tables
- for the locale, and this is then passed to pcre[16|32]_compile() when
- compiling the regular expression. Without an /L (or /T) modifier, NULL
- is passed as the tables pointer; that is, /L applies only to the
+ pcre[16|32]_maketables() is called to build a set of character tables
+ for the locale, and this is then passed to pcre[16|32]_compile() when
+ compiling the regular expression. Without an /L (or /T) modifier, NULL
+ is passed as the tables pointer; that is, /L applies only to the
expression on which it appears.
- The /M modifier causes the size in bytes of the memory block used to
- hold the compiled pattern to be output. This does not include the size
- of the pcre[16|32] block; it is just the actual compiled data. If the
+ The /M modifier causes the size in bytes of the memory block used to
+ hold the compiled pattern to be output. This does not include the size
+ of the pcre[16|32] block; it is just the actual compiled data. If the
pattern is successfully studied with the PCRE_STUDY_JIT_COMPILE option,
the size of the JIT compiled code is also output.
- The /S modifier causes pcre[16|32]_study() to be called after the
- expression has been compiled, and the results used when the expression
+ The /S modifier causes pcre[16|32]_study() to be called after the
+ expression has been compiled, and the results used when the expression
is matched. There are a number of qualifying characters that may follow
/S. They may appear in any order.
- If S is followed by an exclamation mark, pcre[16|32]_study() is called
- with the PCRE_STUDY_EXTRA_NEEDED option, causing it always to return a
+ If /S is followed by an exclamation mark, pcre[16|32]_study() is called
+ with the PCRE_STUDY_EXTRA_NEEDED option, causing it always to return a
pcre_extra block, even when studying discovers no useful information.
If /S is followed by a second S character, it suppresses studying, even
- if it was requested externally by the -s command line option. This
- makes it possible to specify that certain patterns are always studied,
+ if it was requested externally by the -s command line option. This
+ makes it possible to specify that certain patterns are always studied,
and others are never studied, independently of -s. This feature is used
in the test files in a few cases where the output is different when the
pattern is studied.
- If the /S modifier is followed by a + character, the call to
- pcre[16|32]_study() is made with all the JIT study options, requesting
- just-in-time optimization support if it is available, for both normal
- and partial matching. If you want to restrict the JIT compiling modes,
+ If the /S modifier is followed by a + character, the call to
+ pcre[16|32]_study() is made with all the JIT study options, requesting
+ just-in-time optimization support if it is available, for both normal
+ and partial matching. If you want to restrict the JIT compiling modes,
you can follow /S+ with a digit in the range 1 to 7:
1 normal match only
@@ -514,40 +523,40 @@ PATTERN MODIFIERS
7 all three modes (default)
If /S++ is used instead of /S+ (with or without a following digit), the
- text "(JIT)" is added to the first output line after a match or no
+ text "(JIT)" is added to the first output line after a match or no
match when JIT-compiled code was actually used.
- Note that there is also an independent /+ modifier; it must not be
+ Note that there is also an independent /+ modifier; it must not be
given immediately after /S or /S+ because this will be misinterpreted.
If JIT studying is successful, the compiled JIT code will automatically
- be used when pcre[16|32]_exec() is run, except when incompatible run-
- time options are specified. For more details, see the pcrejit documen-
- tation. See also the \J escape sequence below for a way of setting the
+ be used when pcre[16|32]_exec() is run, except when incompatible run-
+ time options are specified. For more details, see the pcrejit documen-
+ tation. See also the \J escape sequence below for a way of setting the
size of the JIT stack.
- Finally, if /S is followed by a minus character, JIT compilation is
- suppressed, even if it was requested externally by the -s command line
- option. This makes it possible to specify that JIT is never to be used
+ Finally, if /S is followed by a minus character, JIT compilation is
+ suppressed, even if it was requested externally by the -s command line
+ option. This makes it possible to specify that JIT is never to be used
for certain patterns.
- The /T modifier must be followed by a single digit. It causes a spe-
+ The /T modifier must be followed by a single digit. It causes a spe-
cific set of built-in character tables to be passed to pcre[16|32]_com-
- pile(). It is used in the standard PCRE tests to check behaviour with
+ pile(). It is used in the standard PCRE tests to check behaviour with
different character tables. The digit specifies the tables as follows:
0 the default ASCII tables, as distributed in
pcre_chartables.c.dist
1 a set of tables defining ISO 8859 characters
- In table 1, some characters whose codes are greater than 128 are iden-
+ In table 1, some characters whose codes are greater than 128 are iden-
tified as letters, digits, spaces, etc.
Using the POSIX wrapper API
- The /P modifier causes pcretest to call PCRE via the POSIX wrapper API
- rather than its native API. This supports only the 8-bit library. When
- /P is set, the following modifiers set options for the regcomp() func-
+ The /P modifier causes pcretest to call PCRE via the POSIX wrapper API
+ rather than its native API. This supports only the 8-bit library. When
+ /P is set, the following modifiers set options for the regcomp() func-
tion:
/i REG_ICASE
@@ -558,9 +567,40 @@ PATTERN MODIFIERS
/W REG_UCP ) the POSIX standard
/8 REG_UTF8 )
- The /+ modifier works as described above. All other modifiers are
+ The /+ modifier works as described above. All other modifiers are
ignored.
+ Locking out certain modifiers
+
+ PCRE can be compiled with or without support for certain features such
+ as UTF-8/16/32 or Unicode properties. Accordingly, the standard tests
+ are split up into a number of different files that are selected for
+ running depending on which features are available. When updating the
+ tests, it is all too easy to put a new test into the wrong file by mis-
+ take; for example, to put a test that requires UTF support into a file
+ that is used when it is not available. To help detect such mistakes as
+ early as possible, there is a facility for locking out specific modi-
+ fiers. If an input line for pcretest starts with the string "< forbid "
+ the following sequence of characters is taken as a list of forbidden
+ modifiers. For example, in the test files that must not use UTF or Uni-
+ code property support, this line appears:
+
+ < forbid 8W
+
+ This locks out the /8 and /W modifiers. An immediate error is given if
+ they are subsequently encountered. If the character string contains <
+ but not >, all the multi-character modifiers that begin with < are
+ locked out. Otherwise, such modifiers must be explicitly listed, for
+ example:
+
+ < forbid <JS><cr>
+
+ There must be a single space between < and "forbid" for this feature to
+ be recognised. If there is not, the line is interpreted either as a
+ request to re-load a pre-compiled pattern (see "SAVING AND RELOADING
+ COMPILED PATTERNS" below) or, if there is a another < character, as a
+ pattern that uses < as its delimiter.
+
DATA LINES
@@ -583,6 +623,7 @@ DATA LINES
\v vertical tab (\x0b)
\nnn octal character (up to 3 octal digits); always
a byte unless > 255 in UTF-8 or 16-bit or 32-bit mode
+ \o{dd...} octal character (any number of octal digits}
\xhh hexadecimal byte (up to 2 hex digits)
\x{hh...} hexadecimal character (any number of hex digits)
\A pass the PCRE_ANCHORED option to pcre[16|32]_exec()
@@ -974,50 +1015,51 @@ SAVING AND RELOADING COMPILED PATTERNS
writing the file, pcretest expects to read a new pattern.
A saved pattern can be reloaded into pcretest by specifying < and a
- file name instead of a pattern. The name of the file must not contain a
- < character, as otherwise pcretest will interpret the line as a pattern
- delimited by < characters. For example:
+ file name instead of a pattern. There must be no space between < and
+ the file name, which must not contain a < character, as otherwise
+ pcretest will interpret the line as a pattern delimited by < charac-
+ ters. For example:
re> </some/file
Compiled pattern loaded from /some/file
No study data
- If the pattern was previously studied with the JIT optimization, the
- JIT information cannot be saved and restored, and so is lost. When the
- pattern has been loaded, pcretest proceeds to read data lines in the
+ If the pattern was previously studied with the JIT optimization, the
+ JIT information cannot be saved and restored, and so is lost. When the
+ pattern has been loaded, pcretest proceeds to read data lines in the
usual way.
- You can copy a file written by pcretest to a different host and reload
- it there, even if the new host has opposite endianness to the one on
- which the pattern was compiled. For example, you can compile on an i86
- machine and run on a SPARC machine. When a pattern is reloaded on a
+ You can copy a file written by pcretest to a different host and reload
+ it there, even if the new host has opposite endianness to the one on
+ which the pattern was compiled. For example, you can compile on an i86
+ machine and run on a SPARC machine. When a pattern is reloaded on a
host with different endianness, the confirmation message is changed to:
Compiled pattern (byte-inverted) loaded from /some/file
The test suite contains some saved pre-compiled patterns with different
- endianness. These are reloaded using "<!" instead of just "<". This
+ endianness. These are reloaded using "<!" instead of just "<". This
suppresses the "(byte-inverted)" text so that the output is the same on
- all hosts. It also forces debugging output once the pattern has been
+ all hosts. It also forces debugging output once the pattern has been
reloaded.
- File names for saving and reloading can be absolute or relative, but
- note that the shell facility of expanding a file name that starts with
+ File names for saving and reloading can be absolute or relative, but
+ note that the shell facility of expanding a file name that starts with
a tilde (~) is not available.
- The ability to save and reload files in pcretest is intended for test-
- ing and experimentation. It is not intended for production use because
- only a single pattern can be written to a file. Furthermore, there is
- no facility for supplying custom character tables for use with a
- reloaded pattern. If the original pattern was compiled with custom
- tables, an attempt to match a subject string using a reloaded pattern
- is likely to cause pcretest to crash. Finally, if you attempt to load
+ The ability to save and reload files in pcretest is intended for test-
+ ing and experimentation. It is not intended for production use because
+ only a single pattern can be written to a file. Furthermore, there is
+ no facility for supplying custom character tables for use with a
+ reloaded pattern. If the original pattern was compiled with custom
+ tables, an attempt to match a subject string using a reloaded pattern
+ is likely to cause pcretest to crash. Finally, if you attempt to load
a file that is not in the correct format, the result is undefined.
SEE ALSO
- pcre(3), pcre16(3), pcre32(3), pcreapi(3), pcrecallout(3), pcrejit,
+ pcre(3), pcre16(3), pcre32(3), pcreapi(3), pcrecallout(3), pcrejit,
pcrematching(3), pcrepartial(d), pcrepattern(3), pcreprecompile(3).
@@ -1030,5 +1072,5 @@ AUTHOR
REVISION
- Last updated: 26 April 2013
+ Last updated: 12 November 2013
Copyright (c) 1997-2013 University of Cambridge.