summaryrefslogtreecommitdiff
path: root/pcre
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mnogosearch.org>2014-02-03 08:54:12 +0400
committerAlexander Barkov <bar@mnogosearch.org>2014-02-03 08:54:12 +0400
commit74cca641557196512468fafe77d22bfea4f243ea (patch)
tree4df5f82f7210d72a0ec3dcc2f9b49d50612b6a3a /pcre
parent2acc01b3cfa27074f93016b893cda20fa0a3497f (diff)
downloadmariadb-git-74cca641557196512468fafe77d22bfea4f243ea.tar.gz
Upgrading the bundled PCRE to 8.34
Diffstat (limited to 'pcre')
-rw-r--r--pcre/CMakeLists.txt24
-rw-r--r--pcre/ChangeLog210
-rw-r--r--pcre/HACKING269
-rw-r--r--pcre/NEWS47
-rw-r--r--pcre/NON-AUTOTOOLS-BUILD4
-rw-r--r--pcre/README28
-rwxr-xr-xpcre/RunGrepTest4
-rwxr-xr-xpcre/RunTest99
-rw-r--r--pcre/config-cmake.h.in5
-rw-r--r--pcre/configure.ac32
-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
-rw-r--r--pcre/maria-patches/pcre_stack_guard.diff57
-rw-r--r--pcre/pcre.h.in10
-rw-r--r--pcre/pcre_chartables.c2
-rw-r--r--pcre/pcre_chartables.c.dist2
-rw-r--r--pcre/pcre_compile.c3483
-rw-r--r--pcre/pcre_config.c4
-rw-r--r--pcre/pcre_dfa_exec.c154
-rw-r--r--pcre/pcre_exec.c535
-rw-r--r--pcre/pcre_fullinfo.c4
-rw-r--r--pcre/pcre_internal.h296
-rw-r--r--pcre/pcre_jit_compile.c670
-rw-r--r--pcre/pcre_jit_test.c18
-rw-r--r--pcre/pcre_maketables.c27
-rw-r--r--pcre/pcre_printint.c101
-rw-r--r--pcre/pcre_study.c86
-rw-r--r--pcre/pcre_ucd.c753
-rw-r--r--pcre/pcre_xclass.c89
-rw-r--r--pcre/pcregrep.c135
-rw-r--r--pcre/pcreposix.c11
-rw-r--r--pcre/pcreposix.h4
-rw-r--r--pcre/pcretest.c227
-rw-r--r--pcre/testdata/grepoutput3
-rw-r--r--pcre/testdata/saved16bin86 -> 86 bytes
-rw-r--r--pcre/testdata/saved16BE-1bin410 -> 410 bytes
-rw-r--r--pcre/testdata/saved16BE-2bin344 -> 344 bytes
-rw-r--r--pcre/testdata/saved16LE-1bin410 -> 410 bytes
-rw-r--r--pcre/testdata/saved16LE-2bin344 -> 344 bytes
-rw-r--r--pcre/testdata/saved32bin108 -> 108 bytes
-rw-r--r--pcre/testdata/saved32BE-1bin552 -> 552 bytes
-rw-r--r--pcre/testdata/saved32BE-2bin456 -> 456 bytes
-rw-r--r--pcre/testdata/saved32LE-1bin552 -> 552 bytes
-rw-r--r--pcre/testdata/saved32LE-2bin456 -> 456 bytes
-rw-r--r--pcre/testdata/saved8bin77 -> 77 bytes
-rw-r--r--pcre/testdata/testinput196
-rw-r--r--pcre/testdata/testinput1044
-rw-r--r--pcre/testdata/testinput1420
-rw-r--r--pcre/testdata/testinput158
-rw-r--r--pcre/testdata/testinput1711
-rw-r--r--pcre/testdata/testinput186
-rw-r--r--pcre/testdata/testinput2224
-rw-r--r--pcre/testdata/testinput216
-rw-r--r--pcre/testdata/testinput2215
-rw-r--r--pcre/testdata/testinput234
-rw-r--r--pcre/testdata/testinput242
-rw-r--r--pcre/testdata/testinput2512
-rw-r--r--pcre/testdata/testinput264
-rw-r--r--pcre/testdata/testinput32
-rw-r--r--pcre/testdata/testinput45
-rw-r--r--pcre/testdata/testinput519
-rw-r--r--pcre/testdata/testinput6176
-rw-r--r--pcre/testdata/testinput7100
-rw-r--r--pcre/testdata/testinput886
-rw-r--r--pcre/testdata/testinput924
-rw-r--r--pcre/testdata/testoutput1179
-rw-r--r--pcre/testdata/testoutput10470
-rw-r--r--pcre/testdata/testoutput11-1629
-rw-r--r--pcre/testdata/testoutput11-3229
-rw-r--r--pcre/testdata/testoutput11-829
-rw-r--r--pcre/testdata/testoutput127
-rw-r--r--pcre/testdata/testoutput131
-rw-r--r--pcre/testdata/testoutput1464
-rw-r--r--pcre/testdata/testoutput1524
-rw-r--r--pcre/testdata/testoutput1765
-rw-r--r--pcre/testdata/testoutput18-1620
-rw-r--r--pcre/testdata/testoutput18-3220
-rw-r--r--pcre/testdata/testoutput21616
-rw-r--r--pcre/testdata/testoutput203
-rw-r--r--pcre/testdata/testoutput21-1610
-rw-r--r--pcre/testdata/testoutput21-3210
-rw-r--r--pcre/testdata/testoutput22-1619
-rw-r--r--pcre/testdata/testoutput22-3219
-rw-r--r--pcre/testdata/testoutput236
-rw-r--r--pcre/testdata/testoutput242
-rw-r--r--pcre/testdata/testoutput2514
-rw-r--r--pcre/testdata/testoutput267
-rw-r--r--pcre/testdata/testoutput32
-rw-r--r--pcre/testdata/testoutput46
-rw-r--r--pcre/testdata/testoutput564
-rw-r--r--pcre/testdata/testoutput6331
-rw-r--r--pcre/testdata/testoutput7727
-rw-r--r--pcre/testdata/testoutput8427
-rw-r--r--pcre/testdata/testoutput9110
-rw-r--r--pcre/ucp.h5
168 files changed, 12145 insertions, 6705 deletions
diff --git a/pcre/CMakeLists.txt b/pcre/CMakeLists.txt
index 52cb0f65572..f885237c395 100644
--- a/pcre/CMakeLists.txt
+++ b/pcre/CMakeLists.txt
@@ -61,6 +61,10 @@
# 2012-09-08 ChPe added PCRE32 support
# 2012-10-23 PH added support for VALGRIND and GCOV
# 2012-12-08 PH added patch from Daniel Richard G to quash some MSVC warnings
+# 2013-07-01 PH realized that the "support" for GCOV was a total nonsense and
+# so it has been removed.
+# 2013-10-08 PH got rid of the "source" command, which is a bash-ism (use ".")
+# 2013-11-05 PH added support for PARENS_NEST_LIMIT
PROJECT(PCRE C CXX)
@@ -107,6 +111,9 @@ CHECK_TYPE_SIZE("unsigned long long" UNSIGNED_LONG_LONG)
SET(PCRE_LINK_SIZE "2" CACHE STRING
"Internal link size (2, 3 or 4 allowed). See LINK_SIZE in config.h.in for details.")
+SET(PCRE_PARENS_NEST_LIMIT "250" CACHE STRING
+ "Default nested parentheses limit. See PARENS_NEST_LIMIT in config.h.in for details.")
+
SET(PCRE_MATCH_LIMIT "10000000" CACHE STRING
"Default limit on internal looping. See MATCH_LIMIT in config.h.in for details.")
@@ -322,6 +329,15 @@ TARGET_LINK_LIBRARIES(pcreposix pcre)
# Executables
+# Removed by PH (2008-01-23) because pcredemo shouldn't really be built
+# automatically, and it gave trouble in some environments anyway.
+# ADD_EXECUTABLE(pcredemo pcredemo.c)
+# TARGET_LINK_LIBRARIES(pcredemo pcreposix)
+# IF(NOT BUILD_SHARED_LIBS)
+# # make sure to not use declspec(dllimport) in static mode on windows
+# SET_TARGET_PROPERTIES(pcredemo PROPERTIES COMPILE_FLAGS "-DPCRE_STATIC")
+# ENDIF(NOT BUILD_SHARED_LIBS)
+
IF(PCRE_BUILD_PCREGREP)
ADD_EXECUTABLE(pcregrep pcregrep.c)
SET(targets ${targets} pcregrep)
@@ -469,17 +485,25 @@ IF(PCRE_SHOW_REPORT)
MESSAGE(STATUS "")
MESSAGE(STATUS "PCRE configuration summary:")
MESSAGE(STATUS "")
+# MESSAGE(STATUS " Install prefix .................. : ${CMAKE_INSTALL_PREFIX}")
MESSAGE(STATUS " C compiler ...................... : ${CMAKE_C_COMPILER}")
+# MESSAGE(STATUS " C++ compiler .................... : ${CMAKE_CXX_COMPILER}")
MESSAGE(STATUS " C compiler flags ................ : ${CMAKE_C_FLAGS}${cfsp}${CMAKE_C_FLAGS_${buildtype}}")
# MESSAGE(STATUS " Enable JIT compiling support .... : ${PCRE_SUPPORT_JIT}")
MESSAGE(STATUS " Unicode properties .............. : ${PCRE_SUPPORT_UNICODE_PROPERTIES}")
MESSAGE(STATUS " Newline char/sequence ........... : ${PCRE_NEWLINE}")
MESSAGE(STATUS " \\R matches only ANYCRLF ......... : ${PCRE_SUPPORT_BSR_ANYCRLF}")
+# MESSAGE(STATUS " EBCDIC coding ................... : ${PCRE_EBCDIC}")
+# MESSAGE(STATUS " EBCDIC coding with NL=0x25 ...... : ${PCRE_EBCDIC_NL25}")
+# MESSAGE(STATUS " Rebuild char tables ............. : ${PCRE_REBUILD_CHARTABLES}")
MESSAGE(STATUS " No stack recursion .............. : ${PCRE_NO_RECURSE}")
MESSAGE(STATUS " POSIX mem threshold ............. : ${PCRE_POSIX_MALLOC_THRESHOLD}")
MESSAGE(STATUS " Internal link size .............. : ${PCRE_LINK_SIZE}")
+ MESSAGE(STATUS " Parentheses nest limit .......... : ${PCRE_PARENS_NEST_LIMIT}")
MESSAGE(STATUS " Match limit ..................... : ${PCRE_MATCH_LIMIT}")
MESSAGE(STATUS " Match limit recursion ........... : ${PCRE_MATCH_LIMIT_RECURSION}")
+# MESSAGE(STATUS " Build shared libs ............... : ${BUILD_SHARED_LIBS}")
+# MESSAGE(STATUS " Build static libs ............... : ${BUILD_STATIC_LIBS}")
MESSAGE(STATUS " Build pcregrep .................. : ${PCRE_BUILD_PCREGREP}")
# MESSAGE(STATUS " Enable JIT in pcregrep .......... : ${PCRE_SUPPORT_PCREGREP_JIT}")
MESSAGE(STATUS " Buffer size for pcregrep ........ : ${PCREGREP_BUFSIZE}")
diff --git a/pcre/ChangeLog b/pcre/ChangeLog
index 21cada49c9e..1f1e8600356 100644
--- a/pcre/ChangeLog
+++ b/pcre/ChangeLog
@@ -1,8 +1,216 @@
ChangeLog for PCRE
------------------
+Version 8.34 15-December-2013
+-----------------------------
+
+1. Add pcre[16|32]_jit_free_unused_memory to forcibly free unused JIT
+ executable memory. Patch inspired by Carsten Klein.
+
+2. ./configure --enable-coverage defined SUPPORT_GCOV in config.h, although
+ this macro is never tested and has no effect, because the work to support
+ coverage involves only compiling and linking options and special targets in
+ the Makefile. The comment in config.h implied that defining the macro would
+ enable coverage support, which is totally false. There was also support for
+ setting this macro in the CMake files (my fault, I just copied it from
+ configure). SUPPORT_GCOV has now been removed.
+
+3. Make a small performance improvement in strlen16() and strlen32() in
+ pcretest.
+
+4. Change 36 for 8.33 left some unreachable statements in pcre_exec.c,
+ detected by the Solaris compiler (gcc doesn't seem to be able to diagnose
+ these cases). There was also one in pcretest.c.
+
+5. Cleaned up a "may be uninitialized" compiler warning in pcre_exec.c.
+
+6. In UTF mode, the code for checking whether a group could match an empty
+ string (which is used for indefinitely repeated groups to allow for
+ breaking an infinite loop) was broken when the group contained a repeated
+ negated single-character class with a character that occupied more than one
+ data item and had a minimum repetition of zero (for example, [^\x{100}]* in
+ UTF-8 mode). The effect was undefined: the group might or might not be
+ deemed as matching an empty string, or the program might have crashed.
+
+7. The code for checking whether a group could match an empty string was not
+ recognizing that \h, \H, \v, \V, and \R must match a character.
+
+8. Implemented PCRE_INFO_MATCH_EMPTY, which yields 1 if the pattern can match
+ an empty string. If it can, pcretest shows this in its information output.
+
+9. Fixed two related bugs that applied to Unicode extended grapheme clusters
+ that were repeated with a maximizing qualifier (e.g. \X* or \X{2,5}) when
+ matched by pcre_exec() without using JIT:
+
+ (a) If the rest of the pattern did not match after a maximal run of
+ grapheme clusters, the code for backing up to try with fewer of them
+ did not always back up over a full grapheme when characters that do not
+ have the modifier quality were involved, e.g. Hangul syllables.
+
+ (b) If the match point in a subject started with modifier character, and
+ there was no match, the code could incorrectly back up beyond the match
+ point, and potentially beyond the first character in the subject,
+ leading to a segfault or an incorrect match result.
+
+10. A conditional group with an assertion condition could lead to PCRE
+ recording an incorrect first data item for a match if no other first data
+ item was recorded. For example, the pattern (?(?=ab)ab) recorded "a" as a
+ first data item, and therefore matched "ca" after "c" instead of at the
+ start.
+
+11. Change 40 for 8.33 (allowing pcregrep to find empty strings) showed up a
+ bug that caused the command "echo a | ./pcregrep -M '|a'" to loop.
+
+12. The source of pcregrep now includes z/OS-specific code so that it can be
+ compiled for z/OS as part of the special z/OS distribution.
+
+13. Added the -T and -TM options to pcretest.
+
+14. The code in pcre_compile.c for creating the table of named capturing groups
+ has been refactored. Instead of creating the table dynamically during the
+ actual compiling pass, the information is remembered during the pre-compile
+ pass (on the stack unless there are more than 20 named groups, in which
+ case malloc() is used) and the whole table is created before the actual
+ compile happens. This has simplified the code (it is now nearly 150 lines
+ shorter) and prepared the way for better handling of references to groups
+ with duplicate names.
+
+15. A back reference to a named subpattern when there is more than one of the
+ same name now checks them in the order in which they appear in the pattern.
+ The first one that is set is used for the reference. Previously only the
+ first one was inspected. This change makes PCRE more compatible with Perl.
+
+16. Unicode character properties were updated from Unicode 6.3.0.
+
+17. The compile-time code for auto-possessification has been refactored, based
+ on a patch by Zoltan Herczeg. It now happens after instead of during
+ compilation. The code is cleaner, and more cases are handled. The option
+ PCRE_NO_AUTO_POSSESS is added for testing purposes, and the -O and /O
+ options in pcretest are provided to set it. It can also be set by
+ (*NO_AUTO_POSSESS) at the start of a pattern.
+
+18. The character VT has been added to the default ("C" locale) set of
+ characters that match \s and are generally treated as white space,
+ following this same change in Perl 5.18. There is now no difference between
+ "Perl space" and "POSIX space". Whether VT is treated as white space in
+ other locales depends on the locale.
+
+19. The code for checking named groups as conditions, either for being set or
+ for being recursed, has been refactored (this is related to 14 and 15
+ above). Processing unduplicated named groups should now be as fast at
+ numerical groups, and processing duplicated groups should be faster than
+ before.
+
+20. Two patches to the CMake build system, by Alexander Barkov:
+
+ (1) Replace the "source" command by "." in CMakeLists.txt because
+ "source" is a bash-ism.
+
+ (2) Add missing HAVE_STDINT_H and HAVE_INTTYPES_H to config-cmake.h.in;
+ without these the CMake build does not work on Solaris.
+
+21. Perl has changed its handling of \8 and \9. If there is no previously
+ encountered capturing group of those numbers, they are treated as the
+ literal characters 8 and 9 instead of a binary zero followed by the
+ literals. PCRE now does the same.
+
+22. Following Perl, added \o{} to specify codepoints in octal, making it
+ possible to specify values greater than 0777 and also making them
+ unambiguous.
+
+23. Perl now gives an error for missing closing braces after \x{... instead of
+ treating the string as literal. PCRE now does the same.
+
+24. RunTest used to grumble if an inappropriate test was selected explicitly,
+ but just skip it when running all tests. This make it awkward to run ranges
+ of tests when one of them was inappropriate. Now it just skips any
+ inappropriate tests, as it always did when running all tests.
+
+25. If PCRE_AUTO_CALLOUT and PCRE_UCP were set for a pattern that contained
+ character types such as \d or \w, too many callouts were inserted, and the
+ data that they returned was rubbish.
+
+26. In UCP mode, \s was not matching two of the characters that Perl matches,
+ namely NEL (U+0085) and MONGOLIAN VOWEL SEPARATOR (U+180E), though they
+ were matched by \h. The code has now been refactored so that the lists of
+ the horizontal and vertical whitespace characters used for \h and \v (which
+ are defined only in one place) are now also used for \s.
+
+27. Add JIT support for the 64 bit TileGX architecture.
+ Patch by Jiong Wang (Tilera Corporation).
+
+28. Possessive quantifiers for classes (both explicit and automatically
+ generated) now use special opcodes instead of wrapping in ONCE brackets.
+
+29. Whereas an item such as A{4}+ ignored the possessivenes of the quantifier
+ (because it's meaningless), this was not happening when PCRE_CASELESS was
+ set. Not wrong, but inefficient.
+
+30. Updated perltest.pl to add /u (force Unicode mode) when /W (use Unicode
+ properties for \w, \d, etc) is present in a test regex. Otherwise if the
+ test contains no characters greater than 255, Perl doesn't realise it
+ should be using Unicode semantics.
+
+31. Upgraded the handling of the POSIX classes [:graph:], [:print:], and
+ [:punct:] when PCRE_UCP is set so as to include the same characters as Perl
+ does in Unicode mode.
+
+32. Added the "forbid" facility to pcretest so that putting tests into the
+ wrong test files can sometimes be quickly detected.
+
+33. There is now a limit (default 250) on the depth of nesting of parentheses.
+ This limit is imposed to control the amount of system stack used at compile
+ time. It can be changed at build time by --with-parens-nest-limit=xxx or
+ the equivalent in CMake.
+
+34. Character classes such as [A-\d] or [a-[:digit:]] now cause compile-time
+ errors. Perl warns for these when in warning mode, but PCRE has no facility
+ for giving warnings.
+
+35. Change 34 for 8.13 allowed quantifiers on assertions, because Perl does.
+ However, this was not working for (?!) because it is optimized to (*FAIL),
+ for which PCRE does not allow quantifiers. The optimization is now disabled
+ when a quantifier follows (?!). I can't see any use for this, but it makes
+ things uniform.
+
+36. Perl no longer allows group names to start with digits, so I have made this
+ change also in PCRE. It simplifies the code a bit.
+
+37. In extended mode, Perl ignores spaces before a + that indicates a
+ possessive quantifier. PCRE allowed a space before the quantifier, but not
+ before the possessive +. It now does.
+
+38. The use of \K (reset reported match start) within a repeated possessive
+ group such as (a\Kb)*+ was not working.
+
+40. Document that the same character tables must be used at compile time and
+ run time, and that the facility to pass tables to pcre_exec() and
+ pcre_dfa_exec() is for use only with saved/restored patterns.
+
+41. Applied Jeff Trawick's patch CMakeLists.txt, which "provides two new
+ features for Builds with MSVC:
+
+ 1. Support pcre.rc and/or pcreposix.rc (as is already done for MinGW
+ builds). The .rc files can be used to set FileDescription and many other
+ attributes.
+
+ 2. Add an option (-DINSTALL_MSVC_PDB) to enable installation of .pdb files.
+ This allows higher-level build scripts which want .pdb files to avoid
+ hard-coding the exact files needed."
+
+42. Added support for [[:<:]] and [[:>:]] as used in the BSD POSIX library to
+ mean "start of word" and "end of word", respectively, as a transition aid.
+
+43. A minimizing repeat of a class containing codepoints greater than 255 in
+ non-UTF 16-bit or 32-bit modes caused an internal error when PCRE was
+ compiled to use the heap for recursion.
+
+44. Got rid of some compiler warnings for unused variables when UTF but not UCP
+ is configured.
+
+
Version 8.33 28-May-2013
---------------------------
+------------------------
1. Added 'U' to some constants that are compared to unsigned integers, to
avoid compiler signed/unsigned warnings. Added (int) casts to unsigned
diff --git a/pcre/HACKING b/pcre/HACKING
index a90ddf87975..691b7a14e50 100644
--- a/pcre/HACKING
+++ b/pcre/HACKING
@@ -54,12 +54,12 @@ Support for 16-bit and 32-bit data strings
From release 8.30, PCRE supports 16-bit as well as 8-bit data strings; and from
release 8.32, PCRE supports 32-bit data strings. The library can be compiled
-in any combination of 8-bit, 16-bit or 32-bit modes, creating different
-libraries. In the description that follows, the word "short" is
-used for a 16-bit data quantity, and the word "unit" is used for a quantity
-that is a byte in 8-bit mode, a short in 16-bit mode and a 32-bit unsigned
-integer in 32-bit mode. However, so as not to over-complicate the text, the
-names of PCRE functions are given in 8-bit form only.
+in any combination of 8-bit, 16-bit or 32-bit modes, creating up to three
+different libraries. In the description that follows, the word "short" is used
+for a 16-bit data quantity, and the word "unit" is used for a quantity that is
+a byte in 8-bit mode, a short in 16-bit mode and a 32-bit word in 32-bit mode.
+However, so as not to over-complicate the text, the names of PCRE functions are
+given in 8-bit form only.
Computing the memory requirement: how it was
@@ -94,6 +94,11 @@ runs more slowly than before (30% or more, depending on the pattern) because it
is doing a full analysis of the pattern. My hope was that this would not be a
big issue, and in the event, nobody has commented on it.
+At release 8.34, a limit on the nesting depth of parentheses was re-introduced
+(default 250, settable at build time) so as to put a limit on the amount of
+system stack used by pcre_compile(). This is a safety feature for environments
+with small stacks where the patterns are provided by users.
+
Traditional matching function
-----------------------------
@@ -120,29 +125,30 @@ facilities are available, and those that are do not always work in quite the
same way. See the user documentation for details.
The algorithm that is used for pcre_dfa_exec() is not a traditional FSM,
-because it may have a number of states active at one time. More work would be
-needed at compile time to produce a traditional FSM where only one state is
-ever active at once. I believe some other regex matchers work this way.
+because it may have a number of states active at one time. More work would be
+needed at compile time to produce a traditional FSM where only one state is
+ever active at once. I believe some other regex matchers work this way. JIT
+support is not available for this kind of matching.
Changeable options
------------------
-The /i, /m, or /s options (PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL) may
-change in the middle of patterns. From PCRE 8.13, their processing is handled
-entirely at compile time by generating different opcodes for the different
-settings. The runtime functions do not need to keep track of an options state
-any more.
+The /i, /m, or /s options (PCRE_CASELESS, PCRE_MULTILINE, PCRE_DOTALL, and some
+others) may change in the middle of patterns. From PCRE 8.13, their processing
+is handled entirely at compile time by generating different opcodes for the
+different settings. The runtime functions do not need to keep track of an
+options state any more.
Format of compiled patterns
---------------------------
-The compiled form of a pattern is a vector of units (bytes in 8-bit mode, or
-shorts in 16-bit mode, 32-bit unsigned integers in 32-bit mode), containing
-items of variable length. The first unit in an item contains an opcode, and
-the length of the item is either implicit in the opcode or contained in the
-data that follows it.
+The compiled form of a pattern is a vector of unsigned units (bytes in 8-bit
+mode, shorts in 16-bit mode, 32-bit words in 32-bit mode), containing items of
+variable length. The first unit in an item contains an opcode, and the length
+of the item is either implicit in the opcode or contained in the data that
+follows it.
In many cases listed below, LINK_SIZE data values are specified for offsets
within the compiled pattern. LINK_SIZE always specifies a number of bytes. The
@@ -151,8 +157,10 @@ default value for LINK_SIZE is 2, but PCRE can be compiled to use 3-byte or
LINK_SIZE values are available only in 8-bit mode.) Specifing a LINK_SIZE
larger than 2 is necessary only when patterns whose compiled length is greater
than 64K are going to be processed. In this description, we assume the "normal"
-compilation options. Data values that are counts (e.g. for quantifiers) are
-always just two bytes long (one short in 16-bit mode).
+compilation options. Data values that are counts (e.g. quantifiers) are two
+bytes long in 8-bit mode (most significant byte first), or one unit in 16-bit
+and 32-bit modes.
+
Opcodes with no following data
------------------------------
@@ -162,7 +170,7 @@ These items are all just one unit long
OP_END end of pattern
OP_ANY match any one character other than newline
OP_ALLANY match any one character, including newline
- OP_ANYBYTE match any single byte, even in UTF-8 mode
+ OP_ANYBYTE match any single unit, even in UTF-8/16 mode
OP_SOD match start of data: \A
OP_SOM, start of match (subject + offset): \G
OP_SET_SOM, set start of match (\K)
@@ -180,28 +188,33 @@ These items are all just one unit long
OP_VSPACE \v
OP_NOT_WORDCHAR \W
OP_WORDCHAR \w
- OP_EODN match end of data or \n at end: \Z
+ OP_EODN match end of data or newline at end: \Z
OP_EOD match end of data: \z
OP_DOLL $ (end of data, or before final newline)
OP_DOLLM $ multiline mode (end of data or before newline)
- OP_EXTUNI match an extended Unicode character
+ OP_EXTUNI match an extended Unicode grapheme cluster
OP_ANYNL match any Unicode newline sequence
+ OP_ASSERT_ACCEPT )
OP_ACCEPT ) These are Perl 5.10's "backtracking control
OP_COMMIT ) verbs". If OP_ACCEPT is inside capturing
OP_FAIL ) parentheses, it may be preceded by one or more
- OP_PRUNE ) OP_CLOSE, followed by a 2-byte number,
- OP_SKIP ) indicating which parentheses must be closed.
+ OP_PRUNE ) OP_CLOSE, each followed by a count that
+ OP_SKIP ) indicates which parentheses must be closed.
+ OP_THEN )
+
+OP_ASSERT_ACCEPT is used when (*ACCEPT) is encountered within an assertion.
+This ends the assertion, not the entire pattern match.
-Backtracking control verbs with (optional) data
------------------------------------------------
+Backtracking control verbs with optional data
+---------------------------------------------
(*THEN) without an argument generates the opcode OP_THEN and no following data.
OP_MARK is followed by the mark name, preceded by a one-unit length, and
followed by a binary zero. For (*PRUNE), (*SKIP), and (*THEN) with arguments,
the opcodes OP_PRUNE_ARG, OP_SKIP_ARG, and OP_THEN_ARG are used, with the name
-following in the same format.
+following in the same format as OP_MARK.
Matching literal characters
@@ -212,6 +225,10 @@ casefully. For caseless matching, OP_CHARI is used. In UTF-8 or UTF-16 modes,
the character may be more than one unit long. In UTF-32 mode, characters
are always exactly one unit long.
+If there is only one character in a character class, OP_CHAR or OP_CHARI is
+used for a positive class, and OP_NOT or OP_NOTI for a negative one (that is,
+for something like [^a]).
+
Repeating single characters
---------------------------
@@ -232,10 +249,9 @@ following opcodes, which come in caseful and caseless versions:
Each opcode is followed by the character that is to be repeated. In ASCII mode,
these are two-unit items; in UTF-8 or UTF-16 modes, the length is variable; in
-UTF-32 mode these are one-unit items.
-Those with "MIN" in their names are the minimizing versions. Those with "POS"
-in their names are possessive versions. Other repeats make use of these
-opcodes:
+UTF-32 mode these are one-unit items. Those with "MIN" in their names are the
+minimizing versions. Those with "POS" in their names are possessive versions.
+Other repeats make use of these opcodes:
Caseful Caseless
OP_UPTO OP_UPTOI
@@ -243,10 +259,15 @@ opcodes:
OP_POSUPTO OP_POSUPTOI
OP_EXACT OP_EXACTI
-Each of these is followed by a two-byte (one short) count (most significant
-byte first in 8-bit mode) and then the repeated character. OP_UPTO matches from
-0 to the given number. A repeat with a non-zero minimum and a fixed maximum is
-coded as an OP_EXACT followed by an OP_UPTO (or OP_MINUPTO or OPT_POSUPTO).
+Each of these is followed by a count and then the repeated character. OP_UPTO
+matches from 0 to the given number. A repeat with a non-zero minimum and a
+fixed maximum is coded as an OP_EXACT followed by an OP_UPTO (or OP_MINUPTO or
+OPT_POSUPTO).
+
+Another set of matching repeating opcodes (called OP_NOTSTAR, OP_NOTSTARI,
+etc.) are used for repeated, negated, single-character classes such as [^a]*.
+The normal single-character opcodes (OP_STAR, etc.) are used for repeated
+positive single-character classes.
Repeating character types
@@ -277,7 +298,10 @@ Match by Unicode property
OP_PROP and OP_NOTPROP are used for positive and negative matches of a
character by testing its Unicode property (the \p and \P escape sequences).
Each is followed by two units that encode the desired property as a type and a
-value.
+value. The types are a set of #defines of the form PT_xxx, and the values are
+enumerations of the form ucp_xx, defined in the ucp.h source file. The value is
+relevant only for PT_GC (General Category), PT_PC (Particular Category), and
+PT_SC (Script).
Repeats of these items use the OP_TYPESTAR etc. set of opcodes, followed by
three units: OP_PROP or OP_NOTPROP, and then the desired property type and
@@ -287,67 +311,88 @@ value.
Character classes
-----------------
-If there is only one character in the class, OP_CHAR or OP_CHARI is used for a
+If there is only one character in a class, OP_CHAR or OP_CHARI is used for a
positive class, and OP_NOT or OP_NOTI for a negative one (that is, for
something like [^a]).
-Another set of 13 repeating opcodes (called OP_NOTSTAR etc.) are used for
-repeated, negated, single-character classes. The normal single-character
-opcodes (OP_STAR, etc.) are used for repeated positive single-character
-classes.
+A set of repeating opcodes (called OP_NOTSTAR etc.) are used for repeated,
+negated, single-character classes. The normal single-character opcodes
+(OP_STAR, etc.) are used for repeated positive single-character classes.
-When there is more than one character in a class and all the characters are
+When there is more than one character in a class, and all the code points are
less than 256, OP_CLASS is used for a positive class, and OP_NCLASS for a
-negative one. In either case, the opcode is followed by a 32-byte (16-short)
-bit map containing a 1 bit for every character that is acceptable. The bits are
-counted from the least significant end of each unit. In caseless mode, bits for
-both cases are set.
+negative one. In either case, the opcode is followed by a 32-byte (16-short,
+8-word) bit map containing a 1 bit for every character that is acceptable. The
+bits are counted from the least significant end of each unit. In caseless mode,
+bits for both cases are set.
+
+The reason for having both OP_CLASS and OP_NCLASS is so that, in UTF-8/16/32
+mode, subject characters with values greater than 255 can be handled correctly.
+For OP_CLASS they do not match, whereas for OP_NCLASS they do.
+
+For classes containing characters with values greater than 255 or that contain
+\p or \P, OP_XCLASS is used. It optionally uses a bit map if any code points
+are less than 256, followed by a list of pairs (for a range) and single
+characters. In caseless mode, both cases are explicitly listed.
-The reason for having both OP_CLASS and OP_NCLASS is so that, in UTF-8/16/32 mode,
-subject characters with values greater than 255 can be handled correctly. For
-OP_CLASS they do not match, whereas for OP_NCLASS they do.
+OP_XCLASS is followed by a unit containing flag bits: XCL_NOT indicates that
+this is a negative class, and XCL_MAP indicates that a bit map is present.
+There follows the bit map, if XCL_MAP is set, and then a sequence of items
+coded as follows:
-For classes containing characters with values greater than 255, OP_XCLASS is
-used. It optionally uses a bit map (if any characters lie within it), followed
-by a list of pairs (for a range) and single characters. In caseless mode, both
-cases are explicitly listed. There is a flag character than indicates whether
-it is a positive or a negative class.
+ XCL_END marks the end of the list
+ XCL_SINGLE one character follows
+ XCL_RANGE two characters follow
+ XCL_PROP a Unicode property (type, value) follows
+ XCL_NOTPROP a Unicode property (type, value) follows
+
+If a range starts with a code point less than 256 and ends with one greater
+than 256, an XCL_RANGE item is used, without setting any bits in the bit map.
+This means that if no other items in the class set bits in the map, a map is
+not needed.
Back references
---------------
-OP_REF (caseful) or OP_REFI (caseless) is followed by two bytes (one short)
-containing the reference number.
+OP_REF (caseful) or OP_REFI (caseless) is followed by a count containing the
+reference number if the reference is to a unique capturing group (either by
+number or by name). When named groups are used, there may be more than one
+group with the same name. In this case, a reference by name generates OP_DNREF
+or OP_DNREFI. These are followed by two counts: the index (not the byte offset)
+in the group name table of the first entry for the requred name, followed by
+the number of groups with the same name.
Repeating character classes and back references
-----------------------------------------------
Single-character classes are handled specially (see above). This section
-applies to OP_CLASS and OP_REF[I]. In both cases, the repeat information
-follows the base item. The matching code looks at the following opcode to see
-if it is one of
+applies to other classes and also to back references. In both cases, the repeat
+information follows the base item. The matching code looks at the following
+opcode to see if it is one of
OP_CRSTAR
OP_CRMINSTAR
+ OP_CRPOSSTAR
OP_CRPLUS
OP_CRMINPLUS
+ OP_CRPOSPLUS
OP_CRQUERY
OP_CRMINQUERY
+ OP_CRPOSQUERY
OP_CRRANGE
OP_CRMINRANGE
+ OP_CRPOSRANGE
-All but the last two are just single-unit items. The others are followed by
-four bytes (two shorts) of data, comprising the minimum and maximum repeat
-counts. There are no special possessive opcodes for these repeats; a possessive
-repeat is compiled into an atomic group.
+All but the last three are single-unit items, with no data. The others are
+followed by the minimum and maximum repeat counts.
Brackets and alternation
------------------------
-A pair of non-capturing (round) brackets is wrapped round each expression at
+A pair of non-capturing round brackets is wrapped round each expression at
compile time, so alternation always happens in the context of brackets.
[Note for North Americans: "bracket" to some English speakers, including
@@ -364,20 +409,20 @@ A bracket opcode is followed by LINK_SIZE bytes which give the offset to the
next alternative OP_ALT or, if there aren't any branches, to the matching
OP_KET opcode. Each OP_ALT is followed by LINK_SIZE bytes giving the offset to
the next one, or to the OP_KET opcode. For capturing brackets, the bracket
-number immediately follows the offset, always as a 2-byte (one short) item.
+number is a count that immediately follows the offset.
-OP_KET is used for subpatterns that do not repeat indefinitely, and
-OP_KETRMIN and OP_KETRMAX are used for indefinite repetitions, minimally or
-maximally respectively (see below for possessive repetitions). All three are
-followed by LINK_SIZE bytes giving (as a positive number) the offset back to
-the matching bracket opcode.
+OP_KET is used for subpatterns that do not repeat indefinitely, and OP_KETRMIN
+and OP_KETRMAX are used for indefinite repetitions, minimally or maximally
+respectively (see below for possessive repetitions). All three are followed by
+LINK_SIZE bytes giving (as a positive number) the offset back to the matching
+bracket opcode.
If a subpattern is quantified such that it is permitted to match zero times, it
is preceded by one of OP_BRAZERO, OP_BRAMINZERO, or OP_SKIPZERO. These are
single-unit opcodes that tell the matcher that skipping the following
subpattern entirely is a valid branch. In the case of the first two, not
skipping the pattern is also valid (greedy and non-greedy). The third is used
-when a pattern has the quantifier {0,0}. It cannot be entirely discarded,
+when a pattern has the quantifier {0,0}. It cannot be entirely discarded,
because it may be called as a subroutine from elsewhere in the regex.
A subpattern with an indefinite maximum repetition is replicated in the
@@ -397,6 +442,7 @@ final replication is changed to OP_SBRA or OP_SCBRA. This tells the matcher
that it needs to check for matching an empty string when it hits OP_KETRMIN or
OP_KETRMAX, and if so, to break the loop.
+
Possessive brackets
-------------------
@@ -407,26 +453,34 @@ of OP_SCBRA. The end of such a group is marked by OP_KETRPOS. If the minimum
repetition is zero, the group is preceded by OP_BRAPOSZERO.
-Assertions
-----------
+Once-only (atomic) groups
+-------------------------
-Forward assertions are just like other subpatterns, but starting with one of
-the opcodes OP_ASSERT or OP_ASSERT_NOT. Backward assertions use the opcodes
-OP_ASSERTBACK and OP_ASSERTBACK_NOT, and the first opcode inside the assertion
-is OP_REVERSE, followed by a two byte (one short) count of the number of
-characters to move back the pointer in the subject string. In ASCII mode, the
-count is a number of units, but in UTF-8/16 mode each character may occupy more
-than one unit; in UTF-32 mode each character occupies exactly one unit.
-A separate count is present in each alternative of a lookbehind
-assertion, allowing them to have different fixed lengths.
+These are just like other subpatterns, but they start with the opcode
+OP_ONCE or OP_ONCE_NC. The former is used when there are no capturing brackets
+within the atomic group; the latter when there are. The distinction is needed
+for when there is a backtrack to before the group - any captures within the
+group must be reset, so it is necessary to retain backtracking points inside
+the group even after it is complete in order to do this. When there are no
+captures in an atomic group, all the backtracking can be discarded when it is
+complete. This is more efficient, and also uses less stack.
+The check for matching an empty string in an unbounded repeat is handled
+entirely at runtime, so there are just these two opcodes for atomic groups.
-Once-only (atomic) subpatterns
-------------------------------
-These are also just like other subpatterns, but they start with the opcode
-OP_ONCE. The check for matching an empty string in an unbounded repeat is
-handled entirely at runtime, so there is just this one opcode.
+Assertions
+----------
+
+Forward assertions are also just like other subpatterns, but starting with one
+of the opcodes OP_ASSERT or OP_ASSERT_NOT. Backward assertions use the opcodes
+OP_ASSERTBACK and OP_ASSERTBACK_NOT, and the first opcode inside the assertion
+is OP_REVERSE, followed by a count of the number of characters to move back the
+pointer in the subject string. In ASCII mode, the count is a number of units,
+but in UTF-8/16 mode each character may occupy more than one unit; in UTF-32
+mode each character occupies exactly one unit. A separate count is present in
+each alternative of a lookbehind assertion, allowing them to have different
+fixed lengths.
Conditional subpatterns
@@ -435,28 +489,29 @@ Conditional subpatterns
These are like other subpatterns, but they start with the opcode OP_COND, or
OP_SCOND for one that might match an empty string in an unbounded repeat. If
the condition is a back reference, this is stored at the start of the
-subpattern using the opcode OP_CREF followed by two bytes (one short)
-containing the reference number. OP_NCREF is used instead if the reference was
-generated by name (so that the runtime code knows to check for duplicate
-names).
+subpattern using the opcode OP_CREF followed by a count containing the
+reference number, provided that the reference is to a unique capturing group.
+If the reference was by name and there is more than one group with that name,
+OP_DNCREF is used instead. It is followed by two counts: the index in the group
+names table, and the number of groups with the same name.
If the condition is "in recursion" (coded as "(?(R)"), or "in recursion of
group x" (coded as "(?(Rx)"), the group number is stored at the start of the
-subpattern using the opcode OP_RREF or OP_NRREF (cf OP_NCREF), and a value of
-zero for "the whole pattern". For a DEFINE condition, just the single unit
-OP_DEF is used (it has no associated data). Otherwise, a conditional subpattern
-always starts with one of the assertions.
+subpattern using the opcode OP_RREF (with a value of zero for "the whole
+pattern") or OP_DNRREF (with data as for OP_DNCREF). For a DEFINE condition,
+just the single unit OP_DEF is used (it has no associated data). Otherwise, a
+conditional subpattern always starts with one of the assertions.
Recursion
---------
Recursion either matches the current regex, or some subexpression. The opcode
-OP_RECURSE is followed by an value which is the offset to the starting bracket
-from the start of the whole pattern. From release 6.5, OP_RECURSE is
-automatically wrapped inside OP_ONCE brackets (because otherwise some patterns
-broke it). OP_RECURSE is also used for "subroutine" calls, even though they
-are not strictly a recursion.
+OP_RECURSE is followed by aLINK_SIZE value that is the offset to the starting
+bracket from the start of the whole pattern. From release 6.5, OP_RECURSE is
+automatically wrapped inside OP_ONCE brackets, because otherwise some patterns
+broke it. OP_RECURSE is also used for "subroutine" calls, even though they are
+not strictly a recursion.
Callout
@@ -464,10 +519,10 @@ Callout
OP_CALLOUT is followed by one unit of data that holds a callout number in the
range 0 to 254 for manual callouts, or 255 for an automatic callout. In both
-cases there follows a two-byte (one short) value giving the offset in the
-pattern to the start of the following item, and another two-byte (one short)
-item giving the length of the next item.
-
+cases there follows a count giving the offset in the pattern string to the
+start of the following item, and another count giving the length of this item.
+These values make is possible for pcretest to output useful tracing information
+using automatic callouts.
Philip Hazel
-February 2012
+November 2013
diff --git a/pcre/NEWS b/pcre/NEWS
index 2ff69cbdd78..5f52f153460 100644
--- a/pcre/NEWS
+++ b/pcre/NEWS
@@ -1,6 +1,53 @@
News about PCRE releases
------------------------
+Release 8.34 15-December-2013
+-----------------------------
+
+As well as fixing the inevitable bugs, performance has been improved by
+refactoring and extending the amount of "auto-possessification" that PCRE does.
+Other notable changes:
+
+. Implemented PCRE_INFO_MATCH_EMPTY, which yields 1 if the pattern can match
+ an empty string. If it can, pcretest shows this in its information output.
+
+. A back reference to a named subpattern when there is more than one of the
+ same name now checks them in the order in which they appear in the pattern.
+ The first one that is set is used for the reference. Previously only the
+ first one was inspected. This change makes PCRE more compatible with Perl.
+
+. Unicode character properties were updated from Unicode 6.3.0.
+
+. The character VT has been added to the set of characters that match \s and
+ are generally treated as white space, following this same change in Perl
+ 5.18. There is now no difference between "Perl space" and "POSIX space".
+
+. Perl has changed its handling of \8 and \9. If there is no previously
+ encountered capturing group of those numbers, they are treated as the
+ literal characters 8 and 9 instead of a binary zero followed by the
+ literals. PCRE now does the same.
+
+. Following Perl, added \o{} to specify codepoints in octal, making it
+ possible to specify values greater than 0777 and also making them
+ unambiguous.
+
+. In UCP mode, \s was not matching two of the characters that Perl matches,
+ namely NEL (U+0085) and MONGOLIAN VOWEL SEPARATOR (U+180E), though they
+ were matched by \h.
+
+. Add JIT support for the 64 bit TileGX architecture.
+
+. Upgraded the handling of the POSIX classes [:graph:], [:print:], and
+ [:punct:] when PCRE_UCP is set so as to include the same characters as Perl
+ does in Unicode mode.
+
+. Perl no longer allows group names to start with digits, so I have made this
+ change also in PCRE.
+
+. Added support for [[:<:]] and [[:>:]] as used in the BSD POSIX library to
+ mean "start of word" and "end of word", respectively, as a transition aid.
+
+
Release 8.33 28-May-2013
--------------------------
diff --git a/pcre/NON-AUTOTOOLS-BUILD b/pcre/NON-AUTOTOOLS-BUILD
index 74075f0160a..cddf3e0699b 100644
--- a/pcre/NON-AUTOTOOLS-BUILD
+++ b/pcre/NON-AUTOTOOLS-BUILD
@@ -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/README b/pcre/README
index e14935efeba..51197df7213 100644
--- a/pcre/README
+++ b/pcre/README
@@ -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/RunGrepTest b/pcre/RunGrepTest
index daaf8af47ac..e192ed77f7c 100755
--- a/pcre/RunGrepTest
+++ b/pcre/RunGrepTest
@@ -502,6 +502,10 @@ echo "---------------------------- Test 105 -----------------------------" >>tes
(cd $srcdir; $valgrind $pcregrep --colour=always "ipsum|" ./testdata/grepinput3) >>testtry 2>&1
echo "RC=$?" >>testtry
+echo "---------------------------- Test 106 -----------------------------" >>testtry
+(cd $srcdir; echo "a" | $valgrind $pcregrep -M "|a" ) >>testtry 2>&1
+echo "RC=$?" >>testtry
+
# Now compare the results.
diff --git a/pcre/RunTest b/pcre/RunTest
index 505a0bf14b5..7caa51d6772 100755
--- a/pcre/RunTest
+++ b/pcre/RunTest
@@ -14,11 +14,11 @@
# UTF-8 with the UTF-8 check turned off; for this, studying must also be
# disabled with /SS.
#
-# When JIT support is available, all the tests are also run with -s+ to test
-# (again, almost) everything with studying and the JIT option, unless "nojit"
-# is given on the command line. There are also two tests for JIT-specific
-# features, one to be run when JIT support is available (unless "nojit" is
-# specified), and one when it is not.
+# When JIT support is available, all appropriate tests are also run with -s+ to
+# test (again, almost) everything with studying and the JIT option, unless
+# "nojit" is given on the command line. There are also two tests for
+# JIT-specific features, one to be run when JIT support is available (unless
+# "nojit" is specified), and one when it is not.
#
# Whichever of the 8-, 16- and 32-bit libraries exist are tested. It is also
# possible to select which to test by giving "-8", "-16" or "-32" on the
@@ -30,9 +30,13 @@
# runs tests 3 to 15, excluding test 10, and just "~10" runs all the tests
# except test 10. Whatever order the arguments are in, the tests are always run
# in numerical order.
-
+#
+# Inappropriate tests are automatically skipped (with a comment to say so): for
+# example, if JIT support is not compiled, test 12 is skipped, whereas if JIT
+# support is compiled, test 13 is skipped.
+#
# Other arguments can be one of the words "valgrind", "valgrind-log", or "sim"
-# followed by an argument to run cross- compiled executables under a simulator,
+# followed by an argument to run cross-compiled executables under a simulator,
# for example:
#
# RunTest 3 sim "qemu-arm -s 8388608"
@@ -62,8 +66,8 @@ title8="Test 8: DFA matching main functionality"
title9="Test 9: DFA matching with UTF"
title10="Test 10: DFA matching with Unicode properties"
title11="Test 11: Internal offsets and code size tests"
-title12="Test 12: JIT-specific features (JIT available)"
-title13="Test 13: JIT-specific features (JIT not available)"
+title12="Test 12: JIT-specific features (when JIT is available)"
+title13="Test 13: JIT-specific features (when JIT is not available)"
title14="Test 14: Specials for the basic 8-bit library"
title15="Test 15: Specials for the 8-bit library with UTF-8 support"
title16="Test 16: Specials for the 8-bit library with Unicode propery support"
@@ -350,79 +354,6 @@ if [ $jit -ne 0 -a "$nojit" != "yes" ] ; then
jitopt=-s+
fi
-# Handle any explicit skips
-
-for i in $skip; do eval do$i=no; done
-
-# If any unsuitable tests were explicitly requested, grumble.
-
-if [ $utf -eq 0 ] ; then
- if [ $do4 = yes ] ; then
- echo "Can't run test 4 because UTF support is not configured"
- exit 1
- fi
- if [ $do5 = yes ] ; then
- echo "Can't run test 5 because UTF support is not configured"
- exit 1
- fi
- if [ $do9 = yes ] ; then
- echo "Can't run test 8 because UTF support is not configured"
- exit 1
- fi
- if [ $do15 = yes ] ; then
- echo "Can't run test 15 because UTF support is not configured"
- exit 1
- fi
- if [ $do18 = yes ] ; then
- echo "Can't run test 18 because UTF support is not configured"
- fi
- if [ $do22 = yes ] ; then
- echo "Can't run test 22 because UTF support is not configured"
- fi
-fi
-
-if [ $ucp -eq 0 ] ; then
- if [ $do6 = yes ] ; then
- echo "Can't run test 6 because Unicode property support is not configured"
- exit 1
- fi
- if [ $do7 = yes ] ; then
- echo "Can't run test 7 because Unicode property support is not configured"
- exit 1
- fi
- if [ $do10 = yes ] ; then
- echo "Can't run test 10 because Unicode property support is not configured"
- exit 1
- fi
- if [ $do16 = yes ] ; then
- echo "Can't run test 16 because Unicode property support is not configured"
- exit 1
- fi
- if [ $do19 = yes ] ; then
- echo "Can't run test 19 because Unicode property support is not configured"
- exit 1
- fi
-fi
-
-if [ $link_size -ne 2 ] ; then
- if [ $do11 = yes ] ; then
- echo "Can't run test 11 because the link size ($link_size) is not 2"
- exit 1
- fi
-fi
-
-if [ $jit -eq 0 ] ; then
- if [ $do12 = "yes" ] ; then
- echo "Can't run test 12 because JIT support is not configured"
- exit 1
- fi
-else
- if [ $do13 = "yes" ] ; then
- echo "Can't run test 13 because JIT support is configured"
- exit 1
- fi
-fi
-
# If no specific tests were requested, select all. Those that are not
# relevant will be automatically skipped.
@@ -461,8 +392,8 @@ if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
do26=yes
fi
-# Handle any explicit skips (again, so that an argument list may consist only
-# of explicit skips).
+# Handle any explicit skips at this stage, so that an argument list may consist
+# only of explicit skips.
for i in $skip; do eval do$i=no; done
diff --git a/pcre/config-cmake.h.in b/pcre/config-cmake.h.in
index ba3b73c6d5d..77d901165d7 100644
--- a/pcre/config-cmake.h.in
+++ b/pcre/config-cmake.h.in
@@ -5,8 +5,8 @@
#cmakedefine HAVE_SYS_TYPES_H 1
#cmakedefine HAVE_UNISTD_H 1
#cmakedefine HAVE_WINDOWS_H 1
-#cmakedefine HAVE_STDINT_H 1
-#cmakedefine HAVE_INTTYPES_H 1
+#cmakedefine HAVE_STDINT_H 1
+#cmakedefine HAVE_INTTYPES_H 1
#cmakedefine HAVE_TYPE_TRAITS_H 1
#cmakedefine HAVE_BITS_TYPE_TRAITS_H 1
@@ -46,6 +46,7 @@
#define NEWLINE @NEWLINE@
#define POSIX_MALLOC_THRESHOLD @PCRE_POSIX_MALLOC_THRESHOLD@
#define LINK_SIZE @PCRE_LINK_SIZE@
+#define PARENS_NEST_LIMIT @PCRE_PARENS_NEST_LIMIT@
#define MATCH_LIMIT @PCRE_MATCH_LIMIT@
#define MATCH_LIMIT_RECURSION @PCRE_MATCH_LIMIT_RECURSION@
#define PCREGREP_BUFSIZE @PCREGREP_BUFSIZE@
diff --git a/pcre/configure.ac b/pcre/configure.ac
index e70ceae2336..5ce6c62c0d3 100644
--- a/pcre/configure.ac
+++ b/pcre/configure.ac
@@ -9,17 +9,17 @@ dnl The PCRE_PRERELEASE feature is for identifying release candidates. It might
dnl be defined as -RC2, for example. For real releases, it should be empty.
m4_define(pcre_major, [8])
-m4_define(pcre_minor, [33])
+m4_define(pcre_minor, [34])
m4_define(pcre_prerelease, [])
-m4_define(pcre_date, [2013-05-28])
+m4_define(pcre_date, [2013-12-15])
# NOTE: The CMakeLists.txt file searches for the above variables in the first
# 50 lines of this file. Please update that if the variables above are moved.
# Libtool shared library interface versions (current:revision:age)
-m4_define(libpcre_version, [3:1:2])
-m4_define(libpcre16_version, [2:1:2])
-m4_define(libpcre32_version, [0:1:0])
+m4_define(libpcre_version, [3:2:2])
+m4_define(libpcre16_version, [2:2:2])
+m4_define(libpcre32_version, [0:2:0])
m4_define(libpcreposix_version, [0:2:0])
m4_define(libpcrecpp_version, [0:0:0])
@@ -275,6 +275,12 @@ AC_ARG_WITH(link-size,
[internal link size (2, 3, or 4 allowed; default=2)]),
, with_link_size=2)
+# Handle --with-parens-nest-limit=N
+AC_ARG_WITH(parens-nest-limit,
+ AS_HELP_STRING([--with-parens-nest-limit=N],
+ [nested parentheses limit (default=250)]),
+ , with_parens_nest_limit=250)
+
# Handle --with-match-limit=N
AC_ARG_WITH(match-limit,
AS_HELP_STRING([--with-match-limit=N],
@@ -784,6 +790,11 @@ AC_DEFINE_UNQUOTED([POSIX_MALLOC_THRESHOLD], [$with_posix_malloc_threshold], [
faster than using malloc() for each call. The threshold above which
the stack is no longer used is defined by POSIX_MALLOC_THRESHOLD.])
+AC_DEFINE_UNQUOTED([PARENS_NEST_LIMIT], [$with_parens_nest_limit], [
+ The value of PARENS_NEST_LIMIT specifies the maximum depth of nested
+ parentheses (of any kind) in a pattern. This limits the amount of system
+ stack that is used while compiling a pattern.])
+
AC_DEFINE_UNQUOTED([MATCH_LIMIT], [$with_match_limit], [
The value of MATCH_LIMIT determines the default number of times the
internal match() function can be called during a single execution of
@@ -957,7 +968,7 @@ if test "$enable_pcretest_libreadline" = "yes"; then
fi
fi
-# Check for valgrind
+# Handle valgrind support
if test "$enable_valgrind" = "yes"; then
m4_ifdef([PKG_CHECK_MODULES],
@@ -965,7 +976,7 @@ if test "$enable_valgrind" = "yes"; then
[AC_MSG_ERROR([pkg-config not supported])])
fi
-# test code coverage reporting
+# Handle code coverage reporting support
if test "$enable_coverage" = "yes"; then
if test "x$GCC" != "xyes"; then
AC_MSG_ERROR([Code coverage reports can only be generated when using GCC])
@@ -996,11 +1007,7 @@ if test "$enable_coverage" = "yes"; then
AC_MSG_ERROR([genhtml not found])
fi
- AC_DEFINE([SUPPORT_GCOV],[1], [
- Define to allow pcretest and pcregrep to be linked with gcov, so that they
- are able to generate code coverage reports.])
-
- # And add flags needed for gcov
+ # Set flags needed for gcov
GCOV_CFLAGS="-O0 -ggdb3 -fprofile-arcs -ftest-coverage"
GCOV_CXXFLAGS="-O0 -ggdb3 -fprofile-arcs -ftest-coverage"
GCOV_LIBS="-lgcov"
@@ -1075,6 +1082,7 @@ $PACKAGE-$VERSION configuration summary:
Use stack recursion ............. : ${enable_stack_for_recursion}
POSIX mem threshold ............. : ${with_posix_malloc_threshold}
Internal link size .............. : ${with_link_size}
+ Nested parentheses limit ........ : ${with_parens_nest_limit}
Match limit ..................... : ${with_match_limit}
Match limit recursion ........... : ${with_match_limit_recursion}
Build shared libs ............... : ${enable_shared}
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.
diff --git a/pcre/maria-patches/pcre_stack_guard.diff b/pcre/maria-patches/pcre_stack_guard.diff
new file mode 100644
index 00000000000..8cf4b7dbb34
--- /dev/null
+++ b/pcre/maria-patches/pcre_stack_guard.diff
@@ -0,0 +1,57 @@
+=== modified file 'pcre/pcre.h.in'
+--- pcre/pcre.h.in 2013-09-26 14:02:17 +0000
++++ pcre/pcre.h.in 2013-10-02 07:58:29 +0000
+@@ -486,6 +486,7 @@ PCRE_EXP_DECL void (*pcre_free)(void *)
+ PCRE_EXP_DECL void *(*pcre_stack_malloc)(size_t);
+ PCRE_EXP_DECL void (*pcre_stack_free)(void *);
+ PCRE_EXP_DECL int (*pcre_callout)(pcre_callout_block *);
++PCRE_EXP_DECL int (*pcre_stack_guard)(void);
+
+ PCRE_EXP_DECL void *(*pcre16_malloc)(size_t);
+ PCRE_EXP_DECL void (*pcre16_free)(void *);
+@@ -504,6 +505,7 @@ PCRE_EXP_DECL void pcre_free(void *);
+ PCRE_EXP_DECL void *pcre_stack_malloc(size_t);
+ PCRE_EXP_DECL void pcre_stack_free(void *);
+ PCRE_EXP_DECL int pcre_callout(pcre_callout_block *);
++PCRE_EXP_DECL int pcre_stack_guard(void);
+
+ PCRE_EXP_DECL void *pcre16_malloc(size_t);
+ PCRE_EXP_DECL void pcre16_free(void *);
+
+=== modified file 'pcre/pcre_compile.c'
+--- pcre/pcre_compile.c 2013-09-26 14:02:17 +0000
++++ pcre/pcre_compile.c 2013-10-02 07:58:29 +0000
+@@ -7107,6 +7107,12 @@ unsigned int orig_bracount;
+ unsigned int max_bracount;
+ branch_chain bc;
+
++if (pcre_stack_guard && pcre_stack_guard())
++{
++ *errorcodeptr= ERR23;
++ return FALSE;
++}
++
+ bc.outer = bcptr;
+ bc.current_branch = code;
+
+
+=== modified file 'pcre/pcre_globals.c'
+--- pcre/pcre_globals.c 2013-09-26 14:02:17 +0000
++++ pcre/pcre_globals.c 2013-10-02 07:58:29 +0000
+@@ -72,6 +72,7 @@ PCRE_EXP_DATA_DEFN void (*PUBL(free))(v
+ PCRE_EXP_DATA_DEFN void *(*PUBL(stack_malloc))(size_t) = LocalPcreMalloc;
+ PCRE_EXP_DATA_DEFN void (*PUBL(stack_free))(void *) = LocalPcreFree;
+ PCRE_EXP_DATA_DEFN int (*PUBL(callout))(PUBL(callout_block) *) = NULL;
++PCRE_EXP_DATA_DEFN int (*PUBL(stack_guard))(void) = NULL;
+
+ #elif !defined VPCOMPAT
+ PCRE_EXP_DATA_DEFN void *(*PUBL(malloc))(size_t) = malloc;
+@@ -79,6 +80,7 @@ PCRE_EXP_DATA_DEFN void (*PUBL(free))(v
+ PCRE_EXP_DATA_DEFN void *(*PUBL(stack_malloc))(size_t) = malloc;
+ PCRE_EXP_DATA_DEFN void (*PUBL(stack_free))(void *) = free;
+ PCRE_EXP_DATA_DEFN int (*PUBL(callout))(PUBL(callout_block) *) = NULL;
++PCRE_EXP_DATA_DEFN int (*PUBL(stack_guard))(void) = NULL;
+ #endif
+
+ /* End of pcre_globals.c */
+
diff --git a/pcre/pcre.h.in b/pcre/pcre.h.in
index 9de72356285..45cd875dd56 100644
--- a/pcre/pcre.h.in
+++ b/pcre/pcre.h.in
@@ -150,7 +150,10 @@ with J. */
#define PCRE_NEVER_UTF 0x00010000 /* C1 ) Overlaid */
#define PCRE_DFA_SHORTEST 0x00010000 /* D ) Overlaid */
-#define PCRE_DFA_RESTART 0x00020000 /* D */
+/* This pair use the same bit. */
+#define PCRE_NO_AUTO_POSSESS 0x00020000 /* C1 ) Overlaid */
+#define PCRE_DFA_RESTART 0x00020000 /* D ) Overlaid */
+
#define PCRE_FIRSTLINE 0x00040000 /* C3 */
#define PCRE_DUPNAMES 0x00080000 /* C1 */
#define PCRE_NEWLINE_CR 0x00100000 /* C3 E D */
@@ -277,6 +280,7 @@ with J. */
#define PCRE_INFO_REQUIREDCHARFLAGS 22
#define PCRE_INFO_MATCHLIMIT 23
#define PCRE_INFO_RECURSIONLIMIT 24
+#define PCRE_INFO_MATCH_EMPTY 25
/* Request types for pcre_config(). Do not re-arrange, in order to remain
compatible. */
@@ -294,6 +298,7 @@ compatible. */
#define PCRE_CONFIG_UTF16 10
#define PCRE_CONFIG_JITTARGET 11
#define PCRE_CONFIG_UTF32 12
+#define PCRE_CONFIG_PARENS_LIMIT 13
/* Request types for pcre_study(). Do not re-arrange, in order to remain
compatible. */
@@ -657,6 +662,9 @@ PCRE_EXP_DECL void pcre16_assign_jit_stack(pcre16_extra *,
pcre16_jit_callback, void *);
PCRE_EXP_DECL void pcre32_assign_jit_stack(pcre32_extra *,
pcre32_jit_callback, void *);
+PCRE_EXP_DECL void pcre_jit_free_unused_memory(void);
+PCRE_EXP_DECL void pcre16_jit_free_unused_memory(void);
+PCRE_EXP_DECL void pcre32_jit_free_unused_memory(void);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/pcre/pcre_chartables.c b/pcre/pcre_chartables.c
index 2a39e9ff33a..1e20ec29d05 100644
--- a/pcre/pcre_chartables.c
+++ b/pcre/pcre_chartables.c
@@ -163,7 +163,7 @@ graph, print, punct, and cntrl. Other classes are built from combinations. */
*/
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0- 7 */
- 0x00,0x01,0x01,0x00,0x01,0x01,0x00,0x00, /* 8- 15 */
+ 0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00, /* 8- 15 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 16- 23 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 24- 31 */
0x01,0x00,0x00,0x00,0x80,0x00,0x00,0x00, /* - ' */
diff --git a/pcre/pcre_chartables.c.dist b/pcre/pcre_chartables.c.dist
index 2a39e9ff33a..1e20ec29d05 100644
--- a/pcre/pcre_chartables.c.dist
+++ b/pcre/pcre_chartables.c.dist
@@ -163,7 +163,7 @@ graph, print, punct, and cntrl. Other classes are built from combinations. */
*/
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0- 7 */
- 0x00,0x01,0x01,0x00,0x01,0x01,0x00,0x00, /* 8- 15 */
+ 0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00, /* 8- 15 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 16- 23 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 24- 31 */
0x01,0x00,0x00,0x00,0x80,0x00,0x00,0x00, /* - ' */
diff --git a/pcre/pcre_compile.c b/pcre/pcre_compile.c
index 0ebb3f168f1..794cd6da223 100644
--- a/pcre/pcre_compile.c
+++ b/pcre/pcre_compile.c
@@ -115,6 +115,13 @@ kicks in at the same number of forward references in all cases. */
#define COMPILE_WORK_SIZE (2048*LINK_SIZE)
#define COMPILE_WORK_SIZE_MAX (100*COMPILE_WORK_SIZE)
+/* This value determines the size of the initial vector that is used for
+remembering named groups during the pre-compile. It is allocated on the stack,
+but if it is too small, it is expanded using malloc(), in a similar way to the
+workspace. The value is the number of slots in the list. */
+
+#define NAMED_GROUP_LIST_SIZE 20
+
/* The overrun tests check for a slightly smaller size so that they detect the
overrun before it actually does run off the end of the data block. */
@@ -253,11 +260,25 @@ static const verbitem verbs[] = {
static const int verbcount = sizeof(verbs)/sizeof(verbitem);
+/* Substitutes for [[:<:]] and [[:>:]], which mean start and end of word in
+another regex library. */
+
+static const pcre_uchar sub_start_of_word[] = {
+ CHAR_BACKSLASH, CHAR_b, CHAR_LEFT_PARENTHESIS, CHAR_QUESTION_MARK,
+ CHAR_EQUALS_SIGN, CHAR_BACKSLASH, CHAR_w, CHAR_RIGHT_PARENTHESIS, '\0' };
+
+static const pcre_uchar sub_end_of_word[] = {
+ CHAR_BACKSLASH, CHAR_b, CHAR_LEFT_PARENTHESIS, CHAR_QUESTION_MARK,
+ CHAR_LESS_THAN_SIGN, CHAR_EQUALS_SIGN, CHAR_BACKSLASH, CHAR_w,
+ CHAR_RIGHT_PARENTHESIS, '\0' };
+
+
/* Tables of names of POSIX character classes and their lengths. The names are
now all in a single string, to reduce the number of relocations when a shared
library is dynamically loaded. The list of lengths is terminated by a zero
length entry. The first three must be alpha, lower, upper, as this is assumed
-for handling case independence. */
+for handling case independence. The indices for graph, print, and punct are
+needed, so identify them. */
static const char posix_names[] =
STRING_alpha0 STRING_lower0 STRING_upper0 STRING_alnum0
@@ -268,6 +289,11 @@ static const char posix_names[] =
static const pcre_uint8 posix_name_lengths[] = {
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 6, 0 };
+#define PC_GRAPH 8
+#define PC_PRINT 9
+#define PC_PUNCT 10
+
+
/* Table of class bit maps for each POSIX class. Each class is formed from a
base map, with an optional addition or removal of another map. Then, for some
classes, there is some additional tweaking: for [:blank:] the vertical space
@@ -295,9 +321,8 @@ static const int posix_class_maps[] = {
cbit_xdigit,-1, 0 /* xdigit */
};
-/* Table of substitutes for \d etc when PCRE_UCP is set. The POSIX class
-substitutes must be in the order of the names, defined above, and there are
-both positive and negative cases. NULL means no substitute. */
+/* Table of substitutes for \d etc when PCRE_UCP is set. They are replaced by
+Unicode property escapes. */
#ifdef SUPPORT_UCP
static const pcre_uchar string_PNd[] = {
@@ -322,12 +347,18 @@ static const pcre_uchar string_pXwd[] = {
static const pcre_uchar *substitutes[] = {
string_PNd, /* \D */
string_pNd, /* \d */
- string_PXsp, /* \S */ /* NOTE: Xsp is Perl space */
- string_pXsp, /* \s */
+ string_PXsp, /* \S */ /* Xsp is Perl space, but from 8.34, Perl */
+ string_pXsp, /* \s */ /* space and POSIX space are the same. */
string_PXwd, /* \W */
string_pXwd /* \w */
};
+/* The POSIX class substitutes must be in the order of the POSIX class names,
+defined above, and there are both positive and negative cases. NULL means no
+general substitute of a Unicode property escape (\p or \P). However, for some
+POSIX classes (e.g. graph, print, punct) a special property code is compiled
+directly. */
+
static const pcre_uchar string_pL[] = {
CHAR_BACKSLASH, CHAR_p, CHAR_LEFT_CURLY_BRACKET,
CHAR_L, CHAR_RIGHT_CURLY_BRACKET, '\0' };
@@ -375,8 +406,8 @@ static const pcre_uchar *posix_substitutes[] = {
NULL, /* graph */
NULL, /* print */
NULL, /* punct */
- string_pXps, /* space */ /* NOTE: Xps is POSIX space */
- string_pXwd, /* word */
+ string_pXps, /* space */ /* Xps is POSIX space, but from 8.34 */
+ string_pXwd, /* word */ /* Perl and POSIX space are the same */
NULL, /* xdigit */
/* Negated cases */
string_PL, /* ^alpha */
@@ -390,8 +421,8 @@ static const pcre_uchar *posix_substitutes[] = {
NULL, /* ^graph */
NULL, /* ^print */
NULL, /* ^punct */
- string_PXps, /* ^space */ /* NOTE: Xps is POSIX space */
- string_PXwd, /* ^word */
+ string_PXps, /* ^space */ /* Xps is POSIX space, but from 8.34 */
+ string_PXwd, /* ^word */ /* Perl and POSIX space are the same */
NULL /* ^xdigit */
};
#define POSIX_SUBSIZE (sizeof(posix_substitutes) / sizeof(pcre_uchar *))
@@ -455,7 +486,7 @@ static const char error_texts[] =
"POSIX collating elements are not supported\0"
"this version of PCRE is compiled without UTF support\0"
"spare error\0" /** DEAD **/
- "character value in \\x{...} sequence is too large\0"
+ "character value in \\x{} or \\o{} is too large\0"
/* 35 */
"invalid condition (?(0)\0"
"\\C not allowed in lookbehind assertion\0"
@@ -509,6 +540,13 @@ static const char error_texts[] =
"character value in \\u.... sequence is too large\0"
"invalid UTF-32 string\0"
"setting UTF is disabled by the application\0"
+ "non-hex character in \\x{} (closing brace missing?)\0"
+ /* 80 */
+ "non-octal character in \\o{} (closing brace missing?)\0"
+ "missing opening brace after \\o\0"
+ "parentheses are too deeply nested\0"
+ "invalid range in character class\0"
+ "group name must start with a non-digit\0"
;
/* Table to identify digits and hex digits. This is used when compiling
@@ -648,6 +686,183 @@ static const pcre_uint8 ebcdic_chartab[] = { /* chartable partial dup */
#endif
+/* This table is used to check whether auto-possessification is possible
+between adjacent character-type opcodes. The left-hand (repeated) opcode is
+used to select the row, and the right-hand opcode is use to select the column.
+A value of 1 means that auto-possessification is OK. For example, the second
+value in the first row means that \D+\d can be turned into \D++\d.
+
+The Unicode property types (\P and \p) have to be present to fill out the table
+because of what their opcode values are, but the table values should always be
+zero because property types are handled separately in the code. The last four
+columns apply to items that cannot be repeated, so there is no need to have
+rows for them. Note that OP_DIGIT etc. are generated only when PCRE_UCP is
+*not* set. When it is set, \d etc. are converted into OP_(NOT_)PROP codes. */
+
+#define APTROWS (LAST_AUTOTAB_LEFT_OP - FIRST_AUTOTAB_OP + 1)
+#define APTCOLS (LAST_AUTOTAB_RIGHT_OP - FIRST_AUTOTAB_OP + 1)
+
+static const pcre_uint8 autoposstab[APTROWS][APTCOLS] = {
+/* \D \d \S \s \W \w . .+ \C \P \p \R \H \h \V \v \X \Z \z $ $M */
+ { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, /* \D */
+ { 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1 }, /* \d */
+ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1 }, /* \S */
+ { 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, /* \s */
+ { 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, /* \W */
+ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1 }, /* \w */
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, /* . */
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, /* .+ */
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, /* \C */
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* \P */
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* \p */
+ { 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0 }, /* \R */
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0 }, /* \H */
+ { 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0 }, /* \h */
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0 }, /* \V */
+ { 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0 }, /* \v */
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 } /* \X */
+};
+
+
+/* This table is used to check whether auto-possessification is possible
+between adjacent Unicode property opcodes (OP_PROP and OP_NOTPROP). The
+left-hand (repeated) opcode is used to select the row, and the right-hand
+opcode is used to select the column. The values are as follows:
+
+ 0 Always return FALSE (never auto-possessify)
+ 1 Character groups are distinct (possessify if both are OP_PROP)
+ 2 Check character categories in the same group (general or particular)
+ 3 TRUE if the two opcodes are not the same (PROP vs NOTPROP)
+
+ 4 Check left general category vs right particular category
+ 5 Check right general category vs left particular category
+
+ 6 Left alphanum vs right general category
+ 7 Left space vs right general category
+ 8 Left word vs right general category
+
+ 9 Right alphanum vs left general category
+ 10 Right space vs left general category
+ 11 Right word vs left general category
+
+ 12 Left alphanum vs right particular category
+ 13 Left space vs right particular category
+ 14 Left word vs right particular category
+
+ 15 Right alphanum vs left particular category
+ 16 Right space vs left particular category
+ 17 Right word vs left particular category
+*/
+
+static const pcre_uint8 propposstab[PT_TABSIZE][PT_TABSIZE] = {
+/* ANY LAMP GC PC SC ALNUM SPACE PXSPACE WORD CLIST UCNC */
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* PT_ANY */
+ { 0, 3, 0, 0, 0, 3, 1, 1, 0, 0, 0 }, /* PT_LAMP */
+ { 0, 0, 2, 4, 0, 9, 10, 10, 11, 0, 0 }, /* PT_GC */
+ { 0, 0, 5, 2, 0, 15, 16, 16, 17, 0, 0 }, /* PT_PC */
+ { 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0 }, /* PT_SC */
+ { 0, 3, 6, 12, 0, 3, 1, 1, 0, 0, 0 }, /* PT_ALNUM */
+ { 0, 1, 7, 13, 0, 1, 3, 3, 1, 0, 0 }, /* PT_SPACE */
+ { 0, 1, 7, 13, 0, 1, 3, 3, 1, 0, 0 }, /* PT_PXSPACE */
+ { 0, 0, 8, 14, 0, 0, 1, 1, 3, 0, 0 }, /* PT_WORD */
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* PT_CLIST */
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3 } /* PT_UCNC */
+};
+
+/* This table is used to check whether auto-possessification is possible
+between adjacent Unicode property opcodes (OP_PROP and OP_NOTPROP) when one
+specifies a general category and the other specifies a particular category. The
+row is selected by the general category and the column by the particular
+category. The value is 1 if the particular category is not part of the general
+category. */
+
+static const pcre_uint8 catposstab[7][30] = {
+/* Cc Cf Cn Co Cs Ll Lm Lo Lt Lu Mc Me Mn Nd Nl No Pc Pd Pe Pf Pi Po Ps Sc Sk Sm So Zl Zp Zs */
+ { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* C */
+ { 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* L */
+ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* M */
+ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* N */
+ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 }, /* P */
+ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1 }, /* S */
+ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 } /* Z */
+};
+
+/* This table is used when checking ALNUM, (PX)SPACE, SPACE, and WORD against
+a general or particular category. The properties in each row are those
+that apply to the character set in question. Duplication means that a little
+unnecessary work is done when checking, but this keeps things much simpler
+because they can all use the same code. For more details see the comment where
+this table is used.
+
+Note: SPACE and PXSPACE used to be different because Perl excluded VT from
+"space", but from Perl 5.18 it's included, so both categories are treated the
+same here. */
+
+static const pcre_uint8 posspropstab[3][4] = {
+ { ucp_L, ucp_N, ucp_N, ucp_Nl }, /* ALNUM, 3rd and 4th values redundant */
+ { ucp_Z, ucp_Z, ucp_C, ucp_Cc }, /* SPACE and PXSPACE, 2nd value redundant */
+ { ucp_L, ucp_N, ucp_P, ucp_Po } /* WORD */
+};
+
+/* This table is used when converting repeating opcodes into possessified
+versions as a result of an explicit possessive quantifier such as ++. A zero
+value means there is no possessified version - in those cases the item in
+question must be wrapped in ONCE brackets. The table is truncated at OP_CALLOUT
+because all relevant opcodes are less than that. */
+
+static const pcre_uint8 opcode_possessify[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0 - 15 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 16 - 31 */
+
+ 0, /* NOTI */
+ OP_POSSTAR, 0, /* STAR, MINSTAR */
+ OP_POSPLUS, 0, /* PLUS, MINPLUS */
+ OP_POSQUERY, 0, /* QUERY, MINQUERY */
+ OP_POSUPTO, 0, /* UPTO, MINUPTO */
+ 0, /* EXACT */
+ 0, 0, 0, 0, /* POS{STAR,PLUS,QUERY,UPTO} */
+
+ OP_POSSTARI, 0, /* STARI, MINSTARI */
+ OP_POSPLUSI, 0, /* PLUSI, MINPLUSI */
+ OP_POSQUERYI, 0, /* QUERYI, MINQUERYI */
+ OP_POSUPTOI, 0, /* UPTOI, MINUPTOI */
+ 0, /* EXACTI */
+ 0, 0, 0, 0, /* POS{STARI,PLUSI,QUERYI,UPTOI} */
+
+ OP_NOTPOSSTAR, 0, /* NOTSTAR, NOTMINSTAR */
+ OP_NOTPOSPLUS, 0, /* NOTPLUS, NOTMINPLUS */
+ OP_NOTPOSQUERY, 0, /* NOTQUERY, NOTMINQUERY */
+ OP_NOTPOSUPTO, 0, /* NOTUPTO, NOTMINUPTO */
+ 0, /* NOTEXACT */
+ 0, 0, 0, 0, /* NOTPOS{STAR,PLUS,QUERY,UPTO} */
+
+ OP_NOTPOSSTARI, 0, /* NOTSTARI, NOTMINSTARI */
+ OP_NOTPOSPLUSI, 0, /* NOTPLUSI, NOTMINPLUSI */
+ OP_NOTPOSQUERYI, 0, /* NOTQUERYI, NOTMINQUERYI */
+ OP_NOTPOSUPTOI, 0, /* NOTUPTOI, NOTMINUPTOI */
+ 0, /* NOTEXACTI */
+ 0, 0, 0, 0, /* NOTPOS{STARI,PLUSI,QUERYI,UPTOI} */
+
+ OP_TYPEPOSSTAR, 0, /* TYPESTAR, TYPEMINSTAR */
+ OP_TYPEPOSPLUS, 0, /* TYPEPLUS, TYPEMINPLUS */
+ OP_TYPEPOSQUERY, 0, /* TYPEQUERY, TYPEMINQUERY */
+ OP_TYPEPOSUPTO, 0, /* TYPEUPTO, TYPEMINUPTO */
+ 0, /* TYPEEXACT */
+ 0, 0, 0, 0, /* TYPEPOS{STAR,PLUS,QUERY,UPTO} */
+
+ OP_CRPOSSTAR, 0, /* CRSTAR, CRMINSTAR */
+ OP_CRPOSPLUS, 0, /* CRPLUS, CRMINPLUS */
+ OP_CRPOSQUERY, 0, /* CRQUERY, CRMINQUERY */
+ OP_CRPOSRANGE, 0, /* CRRANGE, CRMINRANGE */
+ 0, 0, 0, 0, /* CRPOS{STAR,PLUS,QUERY,RANGE} */
+
+ 0, 0, 0, /* CLASS, NCLASS, XCLASS */
+ 0, 0, /* REF, REFI */
+ 0, 0, /* DNREF, DNREFI */
+ 0, 0 /* RECURSE, CALLOUT */
+};
+
+
/*************************************************
* Find an error text *
@@ -675,6 +890,7 @@ return s;
}
+
/*************************************************
* Expand the workspace *
*************************************************/
@@ -752,16 +968,15 @@ return (*p == CHAR_RIGHT_CURLY_BRACKET);
*************************************************/
/* This function is called when a \ has been encountered. It either returns a
-positive value for a simple escape such as \n, or 0 for a data character
-which will be placed in chptr. A backreference to group n is returned as
-negative n. When UTF-8 is enabled, a positive value greater than 255 may
-be returned in chptr.
-On entry,ptr is pointing at the \. On exit, it is on the final character of the
-escape sequence.
+positive value for a simple escape such as \n, or 0 for a data character which
+will be placed in chptr. A backreference to group n is returned as negative n.
+When UTF-8 is enabled, a positive value greater than 255 may be returned in
+chptr. On entry, ptr is pointing at the \. On exit, it is on the final
+character of the escape sequence.
Arguments:
ptrptr points to the pattern position pointer
- chptr points to the data character
+ chptr points to a returned data character
errorcodeptr points to the errorcode variable
bracount number of previous extracting brackets
options the options bits
@@ -965,16 +1180,20 @@ else
break;
/* The handling of escape sequences consisting of a string of digits
- starting with one that is not zero is not straightforward. By experiment,
- the way Perl works seems to be as follows:
+ starting with one that is not zero is not straightforward. Perl has changed
+ over the years. Nowadays \g{} for backreferences and \o{} for octal are
+ recommended to avoid the ambiguities in the old syntax.
Outside a character class, the digits are read as a decimal number. If the
- number is less than 10, or if there are that many previous extracting
- left brackets, then it is a back reference. Otherwise, up to three octal
- digits are read to form an escaped byte. Thus \123 is likely to be octal
- 123 (cf \0123, which is octal 012 followed by the literal 3). If the octal
- value is greater than 377, the least significant 8 bits are taken. Inside a
- character class, \ followed by a digit is always an octal number. */
+ number is less than 8 (used to be 10), or if there are that many previous
+ extracting left brackets, then it is a back reference. Otherwise, up to
+ three octal digits are read to form an escaped byte. Thus \123 is likely to
+ be octal 123 (cf \0123, which is octal 012 followed by the literal 3). If
+ the octal value is greater than 377, the least significant 8 bits are
+ taken. \8 and \9 are treated as the literal characters 8 and 9.
+
+ Inside a character class, \ followed by a digit is always either a literal
+ 8 or 9 or an octal number. */
case CHAR_1: case CHAR_2: case CHAR_3: case CHAR_4: case CHAR_5:
case CHAR_6: case CHAR_7: case CHAR_8: case CHAR_9:
@@ -1001,7 +1220,7 @@ else
*errorcodeptr = ERR61;
break;
}
- if (s < 10 || s <= bracount)
+ if (s < 8 || s <= bracount) /* Check for back reference */
{
escape = -s;
break;
@@ -1009,16 +1228,14 @@ else
ptr = oldptr; /* Put the pointer back and fall through */
}
- /* Handle an octal number following \. If the first digit is 8 or 9, Perl
- generates a binary zero byte and treats the digit as a following literal.
- Thus we have to pull back the pointer by one. */
+ /* Handle a digit following \ when the number is not a back reference. If
+ the first digit is 8 or 9, Perl used to generate a binary zero byte and
+ then treat the digit as a following literal. At least by Perl 5.18 this
+ changed so as not to insert the binary zero. */
- if ((c = *ptr) >= CHAR_8)
- {
- ptr--;
- c = 0;
- break;
- }
+ if ((c = *ptr) >= CHAR_8) break;
+
+ /* Fall through with a digit less than 8 */
/* \0 always starts an octal number, but we may drop through to here with a
larger first octal digit. The original code used just to take the least
@@ -1035,15 +1252,50 @@ else
#endif
break;
- /* \x is complicated. \x{ddd} is a character number which can be greater
- than 0xff in utf or non-8bit mode, but only if the ddd are hex digits.
- If not, { is treated as a data character. */
+ /* \o is a relatively new Perl feature, supporting a more general way of
+ specifying character codes in octal. The only supported form is \o{ddd}. */
+
+ case CHAR_o:
+ if (ptr[1] != CHAR_LEFT_CURLY_BRACKET) *errorcodeptr = ERR81; else
+ {
+ ptr += 2;
+ c = 0;
+ overflow = FALSE;
+ while (*ptr >= CHAR_0 && *ptr <= CHAR_7)
+ {
+ register pcre_uint32 cc = *ptr++;
+ if (c == 0 && cc == CHAR_0) continue; /* Leading zeroes */
+#ifdef COMPILE_PCRE32
+ if (c >= 0x20000000l) { overflow = TRUE; break; }
+#endif
+ c = (c << 3) + cc - CHAR_0 ;
+#if defined COMPILE_PCRE8
+ if (c > (utf ? 0x10ffffU : 0xffU)) { overflow = TRUE; break; }
+#elif defined COMPILE_PCRE16
+ if (c > (utf ? 0x10ffffU : 0xffffU)) { overflow = TRUE; break; }
+#elif defined COMPILE_PCRE32
+ if (utf && c > 0x10ffffU) { overflow = TRUE; break; }
+#endif
+ }
+ if (overflow)
+ {
+ while (*ptr >= CHAR_0 && *ptr <= CHAR_7) ptr++;
+ *errorcodeptr = ERR34;
+ }
+ else if (*ptr == CHAR_RIGHT_CURLY_BRACKET)
+ {
+ if (utf && c >= 0xd800 && c <= 0xdfff) *errorcodeptr = ERR73;
+ }
+ else *errorcodeptr = ERR80;
+ }
+ break;
+
+ /* \x is complicated. In JavaScript, \x must be followed by two hexadecimal
+ numbers. Otherwise it is a lowercase x letter. */
case CHAR_x:
if ((options & PCRE_JAVASCRIPT_COMPAT) != 0)
{
- /* In JavaScript, \x must be followed by two hexadecimal numbers.
- Otherwise it is a lowercase x letter. */
if (MAX_255(ptr[1]) && (digitab[ptr[1]] & ctype_xdigit) != 0
&& MAX_255(ptr[2]) && (digitab[ptr[2]] & ctype_xdigit) != 0)
{
@@ -1060,73 +1312,86 @@ else
#endif
}
}
- break;
- }
+ } /* End JavaScript handling */
- if (ptr[1] == CHAR_LEFT_CURLY_BRACKET)
- {
- const pcre_uchar *pt = ptr + 2;
+ /* Handle \x in Perl's style. \x{ddd} is a character number which can be
+ greater than 0xff in utf or non-8bit mode, but only if the ddd are hex
+ digits. If not, { used to be treated as a data character. However, Perl
+ seems to read hex digits up to the first non-such, and ignore the rest, so
+ that, for example \x{zz} matches a binary zero. This seems crazy, so PCRE
+ now gives an error. */
- c = 0;
- overflow = FALSE;
- while (MAX_255(*pt) && (digitab[*pt] & ctype_xdigit) != 0)
+ else
+ {
+ if (ptr[1] == CHAR_LEFT_CURLY_BRACKET)
{
- register pcre_uint32 cc = *pt++;
- if (c == 0 && cc == CHAR_0) continue; /* Leading zeroes */
+ ptr += 2;
+ c = 0;
+ overflow = FALSE;
+ while (MAX_255(*ptr) && (digitab[*ptr] & ctype_xdigit) != 0)
+ {
+ register pcre_uint32 cc = *ptr++;
+ if (c == 0 && cc == CHAR_0) continue; /* Leading zeroes */
#ifdef COMPILE_PCRE32
- if (c >= 0x10000000l) { overflow = TRUE; break; }
+ if (c >= 0x10000000l) { overflow = TRUE; break; }
#endif
#ifndef EBCDIC /* ASCII/UTF-8 coding */
- if (cc >= CHAR_a) cc -= 32; /* Convert to upper case */
- c = (c << 4) + cc - ((cc < CHAR_A)? CHAR_0 : (CHAR_A - 10));
+ if (cc >= CHAR_a) cc -= 32; /* Convert to upper case */
+ c = (c << 4) + cc - ((cc < CHAR_A)? CHAR_0 : (CHAR_A - 10));
#else /* EBCDIC coding */
- if (cc >= CHAR_a && cc <= CHAR_z) cc += 64; /* Convert to upper case */
- c = (c << 4) + cc - ((cc >= CHAR_0)? CHAR_0 : (CHAR_A - 10));
+ if (cc >= CHAR_a && cc <= CHAR_z) cc += 64; /* Convert to upper case */
+ c = (c << 4) + cc - ((cc >= CHAR_0)? CHAR_0 : (CHAR_A - 10));
#endif
#if defined COMPILE_PCRE8
- if (c > (utf ? 0x10ffffU : 0xffU)) { overflow = TRUE; break; }
+ if (c > (utf ? 0x10ffffU : 0xffU)) { overflow = TRUE; break; }
#elif defined COMPILE_PCRE16
- if (c > (utf ? 0x10ffffU : 0xffffU)) { overflow = TRUE; break; }
+ if (c > (utf ? 0x10ffffU : 0xffffU)) { overflow = TRUE; break; }
#elif defined COMPILE_PCRE32
- if (utf && c > 0x10ffffU) { overflow = TRUE; break; }
+ if (utf && c > 0x10ffffU) { overflow = TRUE; break; }
#endif
- }
+ }
- if (overflow)
- {
- while (MAX_255(*pt) && (digitab[*pt] & ctype_xdigit) != 0) pt++;
- *errorcodeptr = ERR34;
- }
+ if (overflow)
+ {
+ while (MAX_255(*ptr) && (digitab[*ptr] & ctype_xdigit) != 0) ptr++;
+ *errorcodeptr = ERR34;
+ }
- if (*pt == CHAR_RIGHT_CURLY_BRACKET)
- {
- if (utf && c >= 0xd800 && c <= 0xdfff) *errorcodeptr = ERR73;
- ptr = pt;
- break;
- }
+ else if (*ptr == CHAR_RIGHT_CURLY_BRACKET)
+ {
+ if (utf && c >= 0xd800 && c <= 0xdfff) *errorcodeptr = ERR73;
+ }
- /* If the sequence of hex digits does not end with '}', then we don't
- recognize this construct; fall through to the normal \x handling. */
- }
+ /* If the sequence of hex digits does not end with '}', give an error.
+ We used just to recognize this construct and fall through to the normal
+ \x handling, but nowadays Perl gives an error, which seems much more
+ sensible, so we do too. */
- /* Read just a single-byte hex-defined char */
+ else *errorcodeptr = ERR79;
+ } /* End of \x{} processing */
- c = 0;
- while (i++ < 2 && MAX_255(ptr[1]) && (digitab[ptr[1]] & ctype_xdigit) != 0)
- {
- pcre_uint32 cc; /* Some compilers don't like */
- cc = *(++ptr); /* ++ in initializers */
+ /* Read a single-byte hex-defined char (up to two hex digits after \x) */
+
+ else
+ {
+ c = 0;
+ while (i++ < 2 && MAX_255(ptr[1]) && (digitab[ptr[1]] & ctype_xdigit) != 0)
+ {
+ pcre_uint32 cc; /* Some compilers don't like */
+ cc = *(++ptr); /* ++ in initializers */
#ifndef EBCDIC /* ASCII/UTF-8 coding */
- if (cc >= CHAR_a) cc -= 32; /* Convert to upper case */
- c = c * 16 + cc - ((cc < CHAR_A)? CHAR_0 : (CHAR_A - 10));
+ if (cc >= CHAR_a) cc -= 32; /* Convert to upper case */
+ c = c * 16 + cc - ((cc < CHAR_A)? CHAR_0 : (CHAR_A - 10));
#else /* EBCDIC coding */
- if (cc <= CHAR_z) cc += 64; /* Convert to upper case */
- c = c * 16 + cc - ((cc >= CHAR_0)? CHAR_0 : (CHAR_A - 10));
+ if (cc <= CHAR_z) cc += 64; /* Convert to upper case */
+ c = c * 16 + cc - ((cc >= CHAR_0)? CHAR_0 : (CHAR_A - 10));
#endif
- }
+ }
+ } /* End of \xdd handling */
+ } /* End of Perl-style \x handling */
break;
/* For \c, a following letter is upper-cased; then the 0x40 bit is flipped.
@@ -1192,6 +1457,8 @@ if ((options & PCRE_UCP) != 0 && escape >= ESC_D && escape <= ESC_w)
return escape;
}
+
+
#ifdef SUPPORT_UCP
/*************************************************
* Handle \P and \p *
@@ -1289,7 +1556,6 @@ return FALSE;
-
/*************************************************
* Read repeat counts *
*************************************************/
@@ -1358,306 +1624,6 @@ return p;
/*************************************************
-* Subroutine for finding forward reference *
-*************************************************/
-
-/* This recursive function is called only from find_parens() below. The
-top-level call starts at the beginning of the pattern. All other calls must
-start at a parenthesis. It scans along a pattern's text looking for capturing
-subpatterns, and counting them. If it finds a named pattern that matches the
-name it is given, it returns its number. Alternatively, if the name is NULL, it
-returns when it reaches a given numbered subpattern. Recursion is used to keep
-track of subpatterns that reset the capturing group numbers - the (?| feature.
-
-This function was originally called only from the second pass, in which we know
-that if (?< or (?' or (?P< is encountered, the name will be correctly
-terminated because that is checked in the first pass. There is now one call to
-this function in the first pass, to check for a recursive back reference by
-name (so that we can make the whole group atomic). In this case, we need check
-only up to the current position in the pattern, and that is still OK because
-and previous occurrences will have been checked. To make this work, the test
-for "end of pattern" is a check against cd->end_pattern in the main loop,
-instead of looking for a binary zero. This means that the special first-pass
-call can adjust cd->end_pattern temporarily. (Checks for binary zero while
-processing items within the loop are OK, because afterwards the main loop will
-terminate.)
-
-Arguments:
- ptrptr address of the current character pointer (updated)
- cd compile background data
- name name to seek, or NULL if seeking a numbered subpattern
- lorn name length, or subpattern number if name is NULL
- xmode TRUE if we are in /x mode
- utf TRUE if we are in UTF-8 / UTF-16 / UTF-32 mode
- count pointer to the current capturing subpattern number (updated)
-
-Returns: the number of the named subpattern, or -1 if not found
-*/
-
-static int
-find_parens_sub(pcre_uchar **ptrptr, compile_data *cd, const pcre_uchar *name, int lorn,
- BOOL xmode, BOOL utf, int *count)
-{
-pcre_uchar *ptr = *ptrptr;
-int start_count = *count;
-int hwm_count = start_count;
-BOOL dup_parens = FALSE;
-
-/* If the first character is a parenthesis, check on the type of group we are
-dealing with. The very first call may not start with a parenthesis. */
-
-if (ptr[0] == CHAR_LEFT_PARENTHESIS)
- {
- /* Handle specials such as (*SKIP) or (*UTF8) etc. */
-
- if (ptr[1] == CHAR_ASTERISK)
- {
- ptr += 2;
- while (ptr < cd->end_pattern && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++;
- }
-
- /* Handle a normal, unnamed capturing parenthesis. */
-
- else if (ptr[1] != CHAR_QUESTION_MARK)
- {
- *count += 1;
- if (name == NULL && *count == lorn) return *count;
- ptr++;
- }
-
- /* All cases now have (? at the start. Remember when we are in a group
- where the parenthesis numbers are duplicated. */
-
- else if (ptr[2] == CHAR_VERTICAL_LINE)
- {
- ptr += 3;
- dup_parens = TRUE;
- }
-
- /* Handle comments; all characters are allowed until a ket is reached. */
-
- else if (ptr[2] == CHAR_NUMBER_SIGN)
- {
- for (ptr += 3; *ptr != CHAR_NULL; ptr++)
- if (*ptr == CHAR_RIGHT_PARENTHESIS) break;
- goto FAIL_EXIT;
- }
-
- /* Handle a condition. If it is an assertion, just carry on so that it
- is processed as normal. If not, skip to the closing parenthesis of the
- condition (there can't be any nested parens). */
-
- else if (ptr[2] == CHAR_LEFT_PARENTHESIS)
- {
- ptr += 2;
- if (ptr[1] != CHAR_QUESTION_MARK)
- {
- while (*ptr != CHAR_NULL && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++;
- if (*ptr != CHAR_NULL) ptr++;
- }
- }
-
- /* Start with (? but not a condition. */
-
- else
- {
- ptr += 2;
- if (*ptr == CHAR_P) ptr++; /* Allow optional P */
-
- /* We have to disambiguate (?<! and (?<= from (?<name> for named groups */
-
- if ((*ptr == CHAR_LESS_THAN_SIGN && ptr[1] != CHAR_EXCLAMATION_MARK &&
- ptr[1] != CHAR_EQUALS_SIGN) || *ptr == CHAR_APOSTROPHE)
- {
- pcre_uchar term;
- const pcre_uchar *thisname;
- *count += 1;
- if (name == NULL && *count == lorn) return *count;
- term = *ptr++;
- if (term == CHAR_LESS_THAN_SIGN) term = CHAR_GREATER_THAN_SIGN;
- thisname = ptr;
- while (*ptr != term) ptr++;
- if (name != NULL && lorn == (int)(ptr - thisname) &&
- STRNCMP_UC_UC(name, thisname, (unsigned int)lorn) == 0)
- return *count;
- term++;
- }
- }
- }
-
-/* Past any initial parenthesis handling, scan for parentheses or vertical
-bars. Stop if we get to cd->end_pattern. Note that this is important for the
-first-pass call when this value is temporarily adjusted to stop at the current
-position. So DO NOT change this to a test for binary zero. */
-
-for (; ptr < cd->end_pattern; ptr++)
- {
- /* Skip over backslashed characters and also entire \Q...\E */
-
- if (*ptr == CHAR_BACKSLASH)
- {
- if (*(++ptr) == CHAR_NULL) goto FAIL_EXIT;
- if (*ptr == CHAR_Q) for (;;)
- {
- while (*(++ptr) != CHAR_NULL && *ptr != CHAR_BACKSLASH) {};
- if (*ptr == CHAR_NULL) goto FAIL_EXIT;
- if (*(++ptr) == CHAR_E) break;
- }
- continue;
- }
-
- /* Skip over character classes; this logic must be similar to the way they
- are handled for real. If the first character is '^', skip it. Also, if the
- first few characters (either before or after ^) are \Q\E or \E we skip them
- too. This makes for compatibility with Perl. Note the use of STR macros to
- encode "Q\\E" so that it works in UTF-8 on EBCDIC platforms. */
-
- if (*ptr == CHAR_LEFT_SQUARE_BRACKET)
- {
- BOOL negate_class = FALSE;
- for (;;)
- {
- if (ptr[1] == CHAR_BACKSLASH)
- {
- if (ptr[2] == CHAR_E)
- ptr+= 2;
- else if (STRNCMP_UC_C8(ptr + 2,
- STR_Q STR_BACKSLASH STR_E, 3) == 0)
- ptr += 4;
- else
- break;
- }
- else if (!negate_class && ptr[1] == CHAR_CIRCUMFLEX_ACCENT)
- {
- negate_class = TRUE;
- ptr++;
- }
- else break;
- }
-
- /* If the next character is ']', it is a data character that must be
- skipped, except in JavaScript compatibility mode. */
-
- if (ptr[1] == CHAR_RIGHT_SQUARE_BRACKET &&
- (cd->external_options & PCRE_JAVASCRIPT_COMPAT) == 0)
- ptr++;
-
- while (*(++ptr) != CHAR_RIGHT_SQUARE_BRACKET)
- {
- if (*ptr == CHAR_NULL) return -1;
- if (*ptr == CHAR_BACKSLASH)
- {
- if (*(++ptr) == CHAR_NULL) goto FAIL_EXIT;
- if (*ptr == CHAR_Q) for (;;)
- {
- while (*(++ptr) != CHAR_NULL && *ptr != CHAR_BACKSLASH) {};
- if (*ptr == CHAR_NULL) goto FAIL_EXIT;
- if (*(++ptr) == CHAR_E) break;
- }
- continue;
- }
- }
- continue;
- }
-
- /* Skip comments in /x mode */
-
- if (xmode && *ptr == CHAR_NUMBER_SIGN)
- {
- ptr++;
- while (*ptr != CHAR_NULL)
- {
- if (IS_NEWLINE(ptr)) { ptr += cd->nllen - 1; break; }
- ptr++;
-#ifdef SUPPORT_UTF
- if (utf) FORWARDCHAR(ptr);
-#endif
- }
- if (*ptr == CHAR_NULL) goto FAIL_EXIT;
- continue;
- }
-
- /* Check for the special metacharacters */
-
- if (*ptr == CHAR_LEFT_PARENTHESIS)
- {
- int rc = find_parens_sub(&ptr, cd, name, lorn, xmode, utf, count);
- if (rc > 0) return rc;
- if (*ptr == CHAR_NULL) goto FAIL_EXIT;
- }
-
- else if (*ptr == CHAR_RIGHT_PARENTHESIS)
- {
- if (dup_parens && *count < hwm_count) *count = hwm_count;
- goto FAIL_EXIT;
- }
-
- else if (*ptr == CHAR_VERTICAL_LINE && dup_parens)
- {
- if (*count > hwm_count) hwm_count = *count;
- *count = start_count;
- }
- }
-
-FAIL_EXIT:
-*ptrptr = ptr;
-return -1;
-}
-
-
-
-
-/*************************************************
-* Find forward referenced subpattern *
-*************************************************/
-
-/* This function scans along a pattern's text looking for capturing
-subpatterns, and counting them. If it finds a named pattern that matches the
-name it is given, it returns its number. Alternatively, if the name is NULL, it
-returns when it reaches a given numbered subpattern. This is used for forward
-references to subpatterns. We used to be able to start this scan from the
-current compiling point, using the current count value from cd->bracount, and
-do it all in a single loop, but the addition of the possibility of duplicate
-subpattern numbers means that we have to scan from the very start, in order to
-take account of such duplicates, and to use a recursive function to keep track
-of the different types of group.
-
-Arguments:
- cd compile background data
- name name to seek, or NULL if seeking a numbered subpattern
- lorn name length, or subpattern number if name is NULL
- xmode TRUE if we are in /x mode
- utf TRUE if we are in UTF-8 / UTF-16 / UTF-32 mode
-
-Returns: the number of the found subpattern, or -1 if not found
-*/
-
-static int
-find_parens(compile_data *cd, const pcre_uchar *name, int lorn, BOOL xmode,
- BOOL utf)
-{
-pcre_uchar *ptr = (pcre_uchar *)cd->start_pattern;
-int count = 0;
-int rc;
-
-/* If the pattern does not start with an opening parenthesis, the first call
-to find_parens_sub() will scan right to the end (if necessary). However, if it
-does start with a parenthesis, find_parens_sub() will return when it hits the
-matching closing parens. That is why we have to have a loop. */
-
-for (;;)
- {
- rc = find_parens_sub(&ptr, cd, name, lorn, xmode, utf, &count);
- if (rc > 0 || *ptr++ == CHAR_NULL) break;
- }
-
-return rc;
-}
-
-
-
-
-/*************************************************
* Find first significant op code *
*************************************************/
@@ -1696,9 +1662,9 @@ for (;;)
case OP_CALLOUT:
case OP_CREF:
- case OP_NCREF:
+ case OP_DNCREF:
case OP_RREF:
- case OP_NRREF:
+ case OP_DNRREF:
case OP_DEF:
code += PRIV(OP_lengths)[*code];
break;
@@ -1712,7 +1678,6 @@ for (;;)
-
/*************************************************
* Find the fixed length of a branch *
*************************************************/
@@ -1836,13 +1801,13 @@ for (;;)
case OP_COMMIT:
case OP_CREF:
case OP_DEF:
+ case OP_DNCREF:
+ case OP_DNRREF:
case OP_DOLL:
case OP_DOLLM:
case OP_EOD:
case OP_EODN:
case OP_FAIL:
- case OP_NCREF:
- case OP_NRREF:
case OP_NOT_WORD_BOUNDARY:
case OP_PRUNE:
case OP_REVERSE:
@@ -1937,16 +1902,20 @@ for (;;)
switch (*cc)
{
- case OP_CRPLUS:
- case OP_CRMINPLUS:
case OP_CRSTAR:
case OP_CRMINSTAR:
+ case OP_CRPLUS:
+ case OP_CRMINPLUS:
case OP_CRQUERY:
case OP_CRMINQUERY:
+ case OP_CRPOSSTAR:
+ case OP_CRPOSPLUS:
+ case OP_CRPOSQUERY:
return -1;
case OP_CRRANGE:
case OP_CRMINRANGE:
+ case OP_CRPOSRANGE:
if (GET2(cc,1) != GET2(cc,1+IMM2_SIZE)) return -1;
branchlength += (int)GET2(cc,1);
cc += 1 + 2 * IMM2_SIZE;
@@ -2015,6 +1984,8 @@ for (;;)
case OP_QUERYI:
case OP_REF:
case OP_REFI:
+ case OP_DNREF:
+ case OP_DNREFI:
case OP_SBRA:
case OP_SBRAPOS:
case OP_SCBRA:
@@ -2051,7 +2022,6 @@ for (;;)
-
/*************************************************
* Scan compiled regex for specific bracket *
*************************************************/
@@ -2353,15 +2323,23 @@ Arguments:
endcode points to where to stop
utf TRUE if in UTF-8 / UTF-16 / UTF-32 mode
cd contains pointers to tables etc.
+ recurses chain of recurse_check to catch mutual recursion
Returns: TRUE if what is matched could be empty
*/
+typedef struct recurse_check {
+ struct recurse_check *prev;
+ const pcre_uchar *group;
+} recurse_check;
+
static BOOL
could_be_empty_branch(const pcre_uchar *code, const pcre_uchar *endcode,
- BOOL utf, compile_data *cd)
+ BOOL utf, compile_data *cd, recurse_check *recurses)
{
register pcre_uchar c;
+recurse_check this_recurse;
+
for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE);
code < endcode;
code = first_significant_code(code + PRIV(OP_lengths)[c], TRUE))
@@ -2389,25 +2367,50 @@ for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE);
if (c == OP_RECURSE)
{
- const pcre_uchar *scode;
+ const pcre_uchar *scode = cd->start_code + GET(code, 1);
BOOL empty_branch;
- /* Test for forward reference */
+ /* Test for forward reference or uncompleted reference. This is disabled
+ when called to scan a completed pattern by setting cd->start_workspace to
+ NULL. */
- for (scode = cd->start_workspace; scode < cd->hwm; scode += LINK_SIZE)
- if ((int)GET(scode, 0) == (int)(code + 1 - cd->start_code)) return TRUE;
+ if (cd->start_workspace != NULL)
+ {
+ const pcre_uchar *tcode;
+ for (tcode = cd->start_workspace; tcode < cd->hwm; tcode += LINK_SIZE)
+ if ((int)GET(tcode, 0) == (int)(code + 1 - cd->start_code)) return TRUE;
+ if (GET(scode, 1) == 0) return TRUE; /* Unclosed */
+ }
- /* Not a forward reference, test for completed backward reference */
+ /* If we are scanning a completed pattern, there are no forward references
+ and all groups are complete. We need to detect whether this is a recursive
+ call, as otherwise there will be an infinite loop. If it is a recursion,
+ just skip over it. Simple recursions are easily detected. For mutual
+ recursions we keep a chain on the stack. */
- empty_branch = FALSE;
- scode = cd->start_code + GET(code, 1);
- if (GET(scode, 1) == 0) return TRUE; /* Unclosed */
+ else
+ {
+ recurse_check *r = recurses;
+ const pcre_uchar *endgroup = scode;
+
+ do endgroup += GET(endgroup, 1); while (*endgroup == OP_ALT);
+ if (code >= scode && code <= endgroup) continue; /* Simple recursion */
+
+ for (r = recurses; r != NULL; r = r->prev)
+ if (r->group == scode) break;
+ if (r != NULL) continue; /* Mutual recursion */
+ }
- /* Completed backwards reference */
+ /* Completed reference; scan the referenced group, remembering it on the
+ stack chain to detect mutual recursions. */
+
+ empty_branch = FALSE;
+ this_recurse.prev = recurses;
+ this_recurse.group = scode;
do
{
- if (could_be_empty_branch(scode, endcode, utf, cd))
+ if (could_be_empty_branch(scode, endcode, utf, cd, &this_recurse))
{
empty_branch = TRUE;
break;
@@ -2463,7 +2466,7 @@ for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE);
empty_branch = FALSE;
do
{
- if (!empty_branch && could_be_empty_branch(code, endcode, utf, cd))
+ if (!empty_branch && could_be_empty_branch(code, endcode, utf, cd, NULL))
empty_branch = TRUE;
code += GET(code, 1);
}
@@ -2505,15 +2508,19 @@ for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE);
case OP_CRMINSTAR:
case OP_CRQUERY:
case OP_CRMINQUERY:
+ case OP_CRPOSSTAR:
+ case OP_CRPOSQUERY:
break;
default: /* Non-repeat => class must match */
case OP_CRPLUS: /* These repeats aren't empty */
case OP_CRMINPLUS:
+ case OP_CRPOSPLUS:
return FALSE;
case OP_CRRANGE:
case OP_CRMINRANGE:
+ case OP_CRPOSRANGE:
if (GET2(ccode, 1) > 0) return FALSE; /* Minimum > 0 */
break;
}
@@ -2521,34 +2528,57 @@ for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE);
/* Opcodes that must match a character */
+ case OP_ANY:
+ case OP_ALLANY:
+ case OP_ANYBYTE:
+
case OP_PROP:
case OP_NOTPROP:
+ case OP_ANYNL:
+
+ case OP_NOT_HSPACE:
+ case OP_HSPACE:
+ case OP_NOT_VSPACE:
+ case OP_VSPACE:
case OP_EXTUNI:
+
case OP_NOT_DIGIT:
case OP_DIGIT:
case OP_NOT_WHITESPACE:
case OP_WHITESPACE:
case OP_NOT_WORDCHAR:
case OP_WORDCHAR:
- case OP_ANY:
- case OP_ALLANY:
- case OP_ANYBYTE:
+
case OP_CHAR:
case OP_CHARI:
case OP_NOT:
case OP_NOTI:
+
case OP_PLUS:
+ case OP_PLUSI:
case OP_MINPLUS:
- case OP_POSPLUS:
- case OP_EXACT:
+ case OP_MINPLUSI:
+
case OP_NOTPLUS:
+ case OP_NOTPLUSI:
case OP_NOTMINPLUS:
+ case OP_NOTMINPLUSI:
+
+ case OP_POSPLUS:
+ case OP_POSPLUSI:
case OP_NOTPOSPLUS:
+ case OP_NOTPOSPLUSI:
+
+ case OP_EXACT:
+ case OP_EXACTI:
case OP_NOTEXACT:
+ case OP_NOTEXACTI:
+
case OP_TYPEPLUS:
case OP_TYPEMINPLUS:
case OP_TYPEPOSPLUS:
case OP_TYPEEXACT:
+
return FALSE;
/* These are going to continue, as they may be empty, but we have to
@@ -2582,30 +2612,58 @@ for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE);
return TRUE;
/* In UTF-8 mode, STAR, MINSTAR, POSSTAR, QUERY, MINQUERY, POSQUERY, UPTO,
- MINUPTO, and POSUPTO may be followed by a multibyte character */
+ MINUPTO, and POSUPTO and their caseless and negative versions may be
+ followed by a multibyte character. */
#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
case OP_STAR:
case OP_STARI:
+ case OP_NOTSTAR:
+ case OP_NOTSTARI:
+
case OP_MINSTAR:
case OP_MINSTARI:
+ case OP_NOTMINSTAR:
+ case OP_NOTMINSTARI:
+
case OP_POSSTAR:
case OP_POSSTARI:
+ case OP_NOTPOSSTAR:
+ case OP_NOTPOSSTARI:
+
case OP_QUERY:
case OP_QUERYI:
+ case OP_NOTQUERY:
+ case OP_NOTQUERYI:
+
case OP_MINQUERY:
case OP_MINQUERYI:
+ case OP_NOTMINQUERY:
+ case OP_NOTMINQUERYI:
+
case OP_POSQUERY:
case OP_POSQUERYI:
+ case OP_NOTPOSQUERY:
+ case OP_NOTPOSQUERYI:
+
if (utf && HAS_EXTRALEN(code[1])) code += GET_EXTRALEN(code[1]);
break;
case OP_UPTO:
case OP_UPTOI:
+ case OP_NOTUPTO:
+ case OP_NOTUPTOI:
+
case OP_MINUPTO:
case OP_MINUPTOI:
+ case OP_NOTMINUPTO:
+ case OP_NOTMINUPTOI:
+
case OP_POSUPTO:
case OP_POSUPTOI:
+ case OP_NOTPOSUPTO:
+ case OP_NOTPOSUPTOI:
+
if (utf && HAS_EXTRALEN(code[1 + IMM2_SIZE])) code += GET_EXTRALEN(code[1 + IMM2_SIZE]);
break;
#endif
@@ -2659,7 +2717,7 @@ could_be_empty(const pcre_uchar *code, const pcre_uchar *endcode,
{
while (bcptr != NULL && bcptr->current_branch >= code)
{
- if (!could_be_empty_branch(bcptr->current_branch, endcode, utf, cd))
+ if (!could_be_empty_branch(bcptr->current_branch, endcode, utf, cd, NULL))
return FALSE;
bcptr = bcptr->outer;
}
@@ -2669,6 +2727,1072 @@ return TRUE;
/*************************************************
+* Base opcode of repeated opcodes *
+*************************************************/
+
+/* Returns the base opcode for repeated single character type opcodes. If the
+opcode is not a repeated character type, it returns with the original value.
+
+Arguments: c opcode
+Returns: base opcode for the type
+*/
+
+static pcre_uchar
+get_repeat_base(pcre_uchar c)
+{
+return (c > OP_TYPEPOSUPTO)? c :
+ (c >= OP_TYPESTAR)? OP_TYPESTAR :
+ (c >= OP_NOTSTARI)? OP_NOTSTARI :
+ (c >= OP_NOTSTAR)? OP_NOTSTAR :
+ (c >= OP_STARI)? OP_STARI :
+ OP_STAR;
+}
+
+
+
+#ifdef SUPPORT_UCP
+/*************************************************
+* Check a character and a property *
+*************************************************/
+
+/* This function is called by check_auto_possessive() when a property item
+is adjacent to a fixed character.
+
+Arguments:
+ c the character
+ ptype the property type
+ pdata the data for the type
+ negated TRUE if it's a negated property (\P or \p{^)
+
+Returns: TRUE if auto-possessifying is OK
+*/
+
+static BOOL
+check_char_prop(pcre_uint32 c, unsigned int ptype, unsigned int pdata,
+ BOOL negated)
+{
+const pcre_uint32 *p;
+const ucd_record *prop = GET_UCD(c);
+
+switch(ptype)
+ {
+ case PT_LAMP:
+ return (prop->chartype == ucp_Lu ||
+ prop->chartype == ucp_Ll ||
+ prop->chartype == ucp_Lt) == negated;
+
+ case PT_GC:
+ return (pdata == PRIV(ucp_gentype)[prop->chartype]) == negated;
+
+ case PT_PC:
+ return (pdata == prop->chartype) == negated;
+
+ case PT_SC:
+ return (pdata == prop->script) == negated;
+
+ /* These are specials */
+
+ case PT_ALNUM:
+ return (PRIV(ucp_gentype)[prop->chartype] == ucp_L ||
+ PRIV(ucp_gentype)[prop->chartype] == ucp_N) == negated;
+
+ /* Perl space used to exclude VT, but from Perl 5.18 it is included, which
+ means that Perl space and POSIX space are now identical. PCRE was changed
+ at release 8.34. */
+
+ case PT_SPACE: /* Perl space */
+ case PT_PXSPACE: /* POSIX space */
+ switch(c)
+ {
+ HSPACE_CASES:
+ VSPACE_CASES:
+ return negated;
+
+ default:
+ return (PRIV(ucp_gentype)[prop->chartype] == ucp_Z) == negated;
+ }
+ break; /* Control never reaches here */
+
+ case PT_WORD:
+ return (PRIV(ucp_gentype)[prop->chartype] == ucp_L ||
+ PRIV(ucp_gentype)[prop->chartype] == ucp_N ||
+ c == CHAR_UNDERSCORE) == negated;
+
+ case PT_CLIST:
+ p = PRIV(ucd_caseless_sets) + prop->caseset;
+ for (;;)
+ {
+ if (c < *p) return !negated;
+ if (c == *p++) return negated;
+ }
+ break; /* Control never reaches here */
+ }
+
+return FALSE;
+}
+#endif /* SUPPORT_UCP */
+
+
+
+/*************************************************
+* Fill the character property list *
+*************************************************/
+
+/* Checks whether the code points to an opcode that can take part in auto-
+possessification, and if so, fills a list with its properties.
+
+Arguments:
+ code points to start of expression
+ utf TRUE if in UTF-8 / UTF-16 / UTF-32 mode
+ fcc points to case-flipping table
+ list points to output list
+ list[0] will be filled with the opcode
+ list[1] will be non-zero if this opcode
+ can match an empty character string
+ list[2..7] depends on the opcode
+
+Returns: points to the start of the next opcode if *code is accepted
+ NULL if *code is not accepted
+*/
+
+static const pcre_uchar *
+get_chr_property_list(const pcre_uchar *code, BOOL utf,
+ const pcre_uint8 *fcc, pcre_uint32 *list)
+{
+pcre_uchar c = *code;
+pcre_uchar base;
+const pcre_uchar *end;
+pcre_uint32 chr;
+
+#ifdef SUPPORT_UCP
+pcre_uint32 *clist_dest;
+const pcre_uint32 *clist_src;
+#else
+utf = utf; /* Suppress "unused parameter" compiler warning */
+#endif
+
+list[0] = c;
+list[1] = FALSE;
+code++;
+
+if (c >= OP_STAR && c <= OP_TYPEPOSUPTO)
+ {
+ base = get_repeat_base(c);
+ c -= (base - OP_STAR);
+
+ if (c == OP_UPTO || c == OP_MINUPTO || c == OP_EXACT || c == OP_POSUPTO)
+ code += IMM2_SIZE;
+
+ list[1] = (c != OP_PLUS && c != OP_MINPLUS && c != OP_EXACT && c != OP_POSPLUS);
+
+ switch(base)
+ {
+ case OP_STAR:
+ list[0] = OP_CHAR;
+ break;
+
+ case OP_STARI:
+ list[0] = OP_CHARI;
+ break;
+
+ case OP_NOTSTAR:
+ list[0] = OP_NOT;
+ break;
+
+ case OP_NOTSTARI:
+ list[0] = OP_NOTI;
+ break;
+
+ case OP_TYPESTAR:
+ list[0] = *code;
+ code++;
+ break;
+ }
+ c = list[0];
+ }
+
+switch(c)
+ {
+ case OP_NOT_DIGIT:
+ case OP_DIGIT:
+ case OP_NOT_WHITESPACE:
+ case OP_WHITESPACE:
+ case OP_NOT_WORDCHAR:
+ case OP_WORDCHAR:
+ case OP_ANY:
+ case OP_ALLANY:
+ case OP_ANYNL:
+ case OP_NOT_HSPACE:
+ case OP_HSPACE:
+ case OP_NOT_VSPACE:
+ case OP_VSPACE:
+ case OP_EXTUNI:
+ case OP_EODN:
+ case OP_EOD:
+ case OP_DOLL:
+ case OP_DOLLM:
+ return code;
+
+ case OP_CHAR:
+ case OP_NOT:
+ GETCHARINCTEST(chr, code);
+ list[2] = chr;
+ list[3] = NOTACHAR;
+ return code;
+
+ case OP_CHARI:
+ case OP_NOTI:
+ list[0] = (c == OP_CHARI) ? OP_CHAR : OP_NOT;
+ GETCHARINCTEST(chr, code);
+ list[2] = chr;
+
+#ifdef SUPPORT_UCP
+ if (chr < 128 || (chr < 256 && !utf))
+ list[3] = fcc[chr];
+ else
+ list[3] = UCD_OTHERCASE(chr);
+#elif defined SUPPORT_UTF || !defined COMPILE_PCRE8
+ list[3] = (chr < 256) ? fcc[chr] : chr;
+#else
+ list[3] = fcc[chr];
+#endif
+
+ /* The othercase might be the same value. */
+
+ if (chr == list[3])
+ list[3] = NOTACHAR;
+ else
+ list[4] = NOTACHAR;
+ return code;
+
+#ifdef SUPPORT_UCP
+ case OP_PROP:
+ case OP_NOTPROP:
+ if (code[0] != PT_CLIST)
+ {
+ list[2] = code[0];
+ list[3] = code[1];
+ return code + 2;
+ }
+
+ /* Convert only if we have enough space. */
+
+ clist_src = PRIV(ucd_caseless_sets) + code[1];
+ clist_dest = list + 2;
+ code += 2;
+
+ do {
+ if (clist_dest >= list + 8)
+ {
+ /* Early return if there is not enough space. This should never
+ happen, since all clists are shorter than 5 character now. */
+ list[2] = code[0];
+ list[3] = code[1];
+ return code;
+ }
+ *clist_dest++ = *clist_src;
+ }
+ while(*clist_src++ != NOTACHAR);
+
+ /* All characters are stored. The terminating NOTACHAR
+ is copied form the clist itself. */
+
+ list[0] = (c == OP_PROP) ? OP_CHAR : OP_NOT;
+ return code;
+#endif
+
+ case OP_NCLASS:
+ case OP_CLASS:
+#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
+ case OP_XCLASS:
+ if (c == OP_XCLASS)
+ end = code + GET(code, 0) - 1;
+ else
+#endif
+ end = code + 32 / sizeof(pcre_uchar);
+
+ switch(*end)
+ {
+ case OP_CRSTAR:
+ case OP_CRMINSTAR:
+ case OP_CRQUERY:
+ case OP_CRMINQUERY:
+ case OP_CRPOSSTAR:
+ case OP_CRPOSQUERY:
+ list[1] = TRUE;
+ end++;
+ break;
+
+ case OP_CRPLUS:
+ case OP_CRMINPLUS:
+ case OP_CRPOSPLUS:
+ end++;
+ break;
+
+ case OP_CRRANGE:
+ case OP_CRMINRANGE:
+ case OP_CRPOSRANGE:
+ list[1] = (GET2(end, 1) == 0);
+ end += 1 + 2 * IMM2_SIZE;
+ break;
+ }
+ list[2] = end - code;
+ return end;
+ }
+return NULL; /* Opcode not accepted */
+}
+
+
+
+/*************************************************
+* Scan further character sets for match *
+*************************************************/
+
+/* Checks whether the base and the current opcode have a common character, in
+which case the base cannot be possessified.
+
+Arguments:
+ code points to the byte code
+ utf TRUE in UTF-8 / UTF-16 / UTF-32 mode
+ cd static compile data
+ base_list the data list of the base opcode
+
+Returns: TRUE if the auto-possessification is possible
+*/
+
+static BOOL
+compare_opcodes(const pcre_uchar *code, BOOL utf, const compile_data *cd,
+ const pcre_uint32 *base_list, const pcre_uchar *base_end)
+{
+pcre_uchar c;
+pcre_uint32 list[8];
+const pcre_uint32 *chr_ptr;
+const pcre_uint32 *ochr_ptr;
+const pcre_uint32 *list_ptr;
+const pcre_uchar *next_code;
+const pcre_uint8 *class_bitset;
+const pcre_uint32 *set1, *set2, *set_end;
+pcre_uint32 chr;
+BOOL accepted, invert_bits;
+
+/* Note: the base_list[1] contains whether the current opcode has greedy
+(represented by a non-zero value) quantifier. This is a different from
+other character type lists, which stores here that the character iterator
+matches to an empty string (also represented by a non-zero value). */
+
+for(;;)
+ {
+ /* All operations move the code pointer forward.
+ Therefore infinite recursions are not possible. */
+
+ c = *code;
+
+ /* Skip over callouts */
+
+ if (c == OP_CALLOUT)
+ {
+ code += PRIV(OP_lengths)[c];
+ continue;
+ }
+
+ if (c == OP_ALT)
+ {
+ do code += GET(code, 1); while (*code == OP_ALT);
+ c = *code;
+ }
+
+ switch(c)
+ {
+ case OP_END:
+ case OP_KETRPOS:
+ /* TRUE only in greedy case. The non-greedy case could be replaced by
+ an OP_EXACT, but it is probably not worth it. (And note that OP_EXACT
+ uses more memory, which we cannot get at this stage.) */
+
+ return base_list[1] != 0;
+
+ case OP_KET:
+ /* If the bracket is capturing, and referenced by an OP_RECURSE, or
+ it is an atomic sub-pattern (assert, once, etc.) the non-greedy case
+ cannot be converted to a possessive form. */
+
+ if (base_list[1] == 0) return FALSE;
+
+ switch(*(code - GET(code, 1)))
+ {
+ case OP_ASSERT:
+ case OP_ASSERT_NOT:
+ case OP_ASSERTBACK:
+ case OP_ASSERTBACK_NOT:
+ case OP_ONCE:
+ case OP_ONCE_NC:
+ /* Atomic sub-patterns and assertions can always auto-possessify their
+ last iterator. */
+ return TRUE;
+ }
+
+ code += PRIV(OP_lengths)[c];
+ continue;
+
+ case OP_ONCE:
+ case OP_ONCE_NC:
+ case OP_BRA:
+ case OP_CBRA:
+ next_code = code + GET(code, 1);
+ code += PRIV(OP_lengths)[c];
+
+ while (*next_code == OP_ALT)
+ {
+ if (!compare_opcodes(code, utf, cd, base_list, base_end)) return FALSE;
+ code = next_code + 1 + LINK_SIZE;
+ next_code += GET(next_code, 1);
+ }
+ continue;
+
+ case OP_BRAZERO:
+ case OP_BRAMINZERO:
+
+ next_code = code + 1;
+ if (*next_code != OP_BRA && *next_code != OP_CBRA
+ && *next_code != OP_ONCE && *next_code != OP_ONCE_NC) return FALSE;
+
+ do next_code += GET(next_code, 1); while (*next_code == OP_ALT);
+
+ /* The bracket content will be checked by the
+ OP_BRA/OP_CBRA case above. */
+ next_code += 1 + LINK_SIZE;
+ if (!compare_opcodes(next_code, utf, cd, base_list, base_end))
+ return FALSE;
+
+ code += PRIV(OP_lengths)[c];
+ continue;
+ }
+
+ /* Check for a supported opcode, and load its properties. */
+
+ code = get_chr_property_list(code, utf, cd->fcc, list);
+ if (code == NULL) return FALSE; /* Unsupported */
+
+ /* If either opcode is a small character list, set pointers for comparing
+ characters from that list with another list, or with a property. */
+
+ if (base_list[0] == OP_CHAR)
+ {
+ chr_ptr = base_list + 2;
+ list_ptr = list;
+ }
+ else if (list[0] == OP_CHAR)
+ {
+ chr_ptr = list + 2;
+ list_ptr = base_list;
+ }
+
+ /* Character bitsets can also be compared to certain opcodes. */
+
+ else if (base_list[0] == OP_CLASS || list[0] == OP_CLASS
+#ifdef COMPILE_PCRE8
+ /* In 8 bit, non-UTF mode, OP_CLASS and OP_NCLASS are the same. */
+ || (!utf && (base_list[0] == OP_NCLASS || list[0] == OP_NCLASS))
+#endif
+ )
+ {
+#ifdef COMPILE_PCRE8
+ if (base_list[0] == OP_CLASS || (!utf && base_list[0] == OP_NCLASS))
+#else
+ if (base_list[0] == OP_CLASS)
+#endif
+ {
+ set1 = (pcre_uint32 *)(base_end - base_list[2]);
+ list_ptr = list;
+ }
+ else
+ {
+ set1 = (pcre_uint32 *)(code - list[2]);
+ list_ptr = base_list;
+ }
+
+ invert_bits = FALSE;
+ switch(list_ptr[0])
+ {
+ case OP_CLASS:
+ case OP_NCLASS:
+ set2 = (pcre_uint32 *)
+ ((list_ptr == list ? code : base_end) - list_ptr[2]);
+ break;
+
+ /* OP_XCLASS cannot be supported here, because its bitset
+ is not necessarily complete. E.g: [a-\0x{200}] is stored
+ as a character range, and the appropriate bits are not set. */
+
+ case OP_NOT_DIGIT:
+ invert_bits = TRUE;
+ /* Fall through */
+ case OP_DIGIT:
+ set2 = (pcre_uint32 *)(cd->cbits + cbit_digit);
+ break;
+
+ case OP_NOT_WHITESPACE:
+ invert_bits = TRUE;
+ /* Fall through */
+ case OP_WHITESPACE:
+ set2 = (pcre_uint32 *)(cd->cbits + cbit_space);
+ break;
+
+ case OP_NOT_WORDCHAR:
+ invert_bits = TRUE;
+ /* Fall through */
+ case OP_WORDCHAR:
+ set2 = (pcre_uint32 *)(cd->cbits + cbit_word);
+ break;
+
+ default:
+ return FALSE;
+ }
+
+ /* Compare 4 bytes to improve speed. */
+ set_end = set1 + (32 / 4);
+ if (invert_bits)
+ {
+ do
+ {
+ if ((*set1++ & ~(*set2++)) != 0) return FALSE;
+ }
+ while (set1 < set_end);
+ }
+ else
+ {
+ do
+ {
+ if ((*set1++ & *set2++) != 0) return FALSE;
+ }
+ while (set1 < set_end);
+ }
+
+ if (list[1] == 0) return TRUE;
+ /* Might be an empty repeat. */
+ continue;
+ }
+
+ /* Some property combinations also acceptable. Unicode property opcodes are
+ processed specially; the rest can be handled with a lookup table. */
+
+ else
+ {
+ pcre_uint32 leftop, rightop;
+
+ leftop = base_list[0];
+ rightop = list[0];
+
+#ifdef SUPPORT_UCP
+ accepted = FALSE; /* Always set in non-unicode case. */
+ if (leftop == OP_PROP || leftop == OP_NOTPROP)
+ {
+ if (rightop == OP_EOD)
+ accepted = TRUE;
+ else if (rightop == OP_PROP || rightop == OP_NOTPROP)
+ {
+ int n;
+ const pcre_uint8 *p;
+ BOOL same = leftop == rightop;
+ BOOL lisprop = leftop == OP_PROP;
+ BOOL risprop = rightop == OP_PROP;
+ BOOL bothprop = lisprop && risprop;
+
+ /* There's a table that specifies how each combination is to be
+ processed:
+ 0 Always return FALSE (never auto-possessify)
+ 1 Character groups are distinct (possessify if both are OP_PROP)
+ 2 Check character categories in the same group (general or particular)
+ 3 Return TRUE if the two opcodes are not the same
+ ... see comments below
+ */
+
+ n = propposstab[base_list[2]][list[2]];
+ switch(n)
+ {
+ case 0: break;
+ case 1: accepted = bothprop; break;
+ case 2: accepted = (base_list[3] == list[3]) != same; break;
+ case 3: accepted = !same; break;
+
+ case 4: /* Left general category, right particular category */
+ accepted = risprop && catposstab[base_list[3]][list[3]] == same;
+ break;
+
+ case 5: /* Right general category, left particular category */
+ accepted = lisprop && catposstab[list[3]][base_list[3]] == same;
+ break;
+
+ /* This code is logically tricky. Think hard before fiddling with it.
+ The posspropstab table has four entries per row. Each row relates to
+ one of PCRE's special properties such as ALNUM or SPACE or WORD.
+ Only WORD actually needs all four entries, but using repeats for the
+ others means they can all use the same code below.
+
+ The first two entries in each row are Unicode general categories, and
+ apply always, because all the characters they include are part of the
+ PCRE character set. The third and fourth entries are a general and a
+ particular category, respectively, that include one or more relevant
+ characters. One or the other is used, depending on whether the check
+ is for a general or a particular category. However, in both cases the
+ category contains more characters than the specials that are defined
+ for the property being tested against. Therefore, it cannot be used
+ in a NOTPROP case.
+
+ Example: the row for WORD contains ucp_L, ucp_N, ucp_P, ucp_Po.
+ Underscore is covered by ucp_P or ucp_Po. */
+
+ case 6: /* Left alphanum vs right general category */
+ case 7: /* Left space vs right general category */
+ case 8: /* Left word vs right general category */
+ p = posspropstab[n-6];
+ accepted = risprop && lisprop ==
+ (list[3] != p[0] &&
+ list[3] != p[1] &&
+ (list[3] != p[2] || !lisprop));
+ break;
+
+ case 9: /* Right alphanum vs left general category */
+ case 10: /* Right space vs left general category */
+ case 11: /* Right word vs left general category */
+ p = posspropstab[n-9];
+ accepted = lisprop && risprop ==
+ (base_list[3] != p[0] &&
+ base_list[3] != p[1] &&
+ (base_list[3] != p[2] || !risprop));
+ break;
+
+ case 12: /* Left alphanum vs right particular category */
+ case 13: /* Left space vs right particular category */
+ case 14: /* Left word vs right particular category */
+ p = posspropstab[n-12];
+ accepted = risprop && lisprop ==
+ (catposstab[p[0]][list[3]] &&
+ catposstab[p[1]][list[3]] &&
+ (list[3] != p[3] || !lisprop));
+ break;
+
+ case 15: /* Right alphanum vs left particular category */
+ case 16: /* Right space vs left particular category */
+ case 17: /* Right word vs left particular category */
+ p = posspropstab[n-15];
+ accepted = lisprop && risprop ==
+ (catposstab[p[0]][base_list[3]] &&
+ catposstab[p[1]][base_list[3]] &&
+ (base_list[3] != p[3] || !risprop));
+ break;
+ }
+ }
+ }
+
+ else
+#endif /* SUPPORT_UCP */
+
+ accepted = leftop >= FIRST_AUTOTAB_OP && leftop <= LAST_AUTOTAB_LEFT_OP &&
+ rightop >= FIRST_AUTOTAB_OP && rightop <= LAST_AUTOTAB_RIGHT_OP &&
+ autoposstab[leftop - FIRST_AUTOTAB_OP][rightop - FIRST_AUTOTAB_OP];
+
+ if (!accepted)
+ return FALSE;
+
+ if (list[1] == 0) return TRUE;
+ /* Might be an empty repeat. */
+ continue;
+ }
+
+ /* Control reaches here only if one of the items is a small character list.
+ All characters are checked against the other side. */
+
+ do
+ {
+ chr = *chr_ptr;
+
+ switch(list_ptr[0])
+ {
+ case OP_CHAR:
+ ochr_ptr = list_ptr + 2;
+ do
+ {
+ if (chr == *ochr_ptr) return FALSE;
+ ochr_ptr++;
+ }
+ while(*ochr_ptr != NOTACHAR);
+ break;
+
+ case OP_NOT:
+ ochr_ptr = list_ptr + 2;
+ do
+ {
+ if (chr == *ochr_ptr)
+ break;
+ ochr_ptr++;
+ }
+ while(*ochr_ptr != NOTACHAR);
+ if (*ochr_ptr == NOTACHAR) return FALSE; /* Not found */
+ break;
+
+ /* Note that OP_DIGIT etc. are generated only when PCRE_UCP is *not*
+ set. When it is set, \d etc. are converted into OP_(NOT_)PROP codes. */
+
+ case OP_DIGIT:
+ if (chr < 256 && (cd->ctypes[chr] & ctype_digit) != 0) return FALSE;
+ break;
+
+ case OP_NOT_DIGIT:
+ if (chr > 255 || (cd->ctypes[chr] & ctype_digit) == 0) return FALSE;
+ break;
+
+ case OP_WHITESPACE:
+ if (chr < 256 && (cd->ctypes[chr] & ctype_space) != 0) return FALSE;
+ break;
+
+ case OP_NOT_WHITESPACE:
+ if (chr > 255 || (cd->ctypes[chr] & ctype_space) == 0) return FALSE;
+ break;
+
+ case OP_WORDCHAR:
+ if (chr < 255 && (cd->ctypes[chr] & ctype_word) != 0) return FALSE;
+ break;
+
+ case OP_NOT_WORDCHAR:
+ if (chr > 255 || (cd->ctypes[chr] & ctype_word) == 0) return FALSE;
+ break;
+
+ case OP_HSPACE:
+ switch(chr)
+ {
+ HSPACE_CASES: return FALSE;
+ default: break;
+ }
+ break;
+
+ case OP_NOT_HSPACE:
+ switch(chr)
+ {
+ HSPACE_CASES: break;
+ default: return FALSE;
+ }
+ break;
+
+ case OP_ANYNL:
+ case OP_VSPACE:
+ switch(chr)
+ {
+ VSPACE_CASES: return FALSE;
+ default: break;
+ }
+ break;
+
+ case OP_NOT_VSPACE:
+ switch(chr)
+ {
+ VSPACE_CASES: break;
+ default: return FALSE;
+ }
+ break;
+
+ case OP_DOLL:
+ case OP_EODN:
+ switch (chr)
+ {
+ case CHAR_CR:
+ case CHAR_LF:
+ case CHAR_VT:
+ case CHAR_FF:
+ case CHAR_NEL:
+#ifndef EBCDIC
+ case 0x2028:
+ case 0x2029:
+#endif /* Not EBCDIC */
+ return FALSE;
+ }
+ break;
+
+ case OP_EOD: /* Can always possessify before \z */
+ break;
+
+#ifdef SUPPORT_UCP
+ case OP_PROP:
+ case OP_NOTPROP:
+ if (!check_char_prop(chr, list_ptr[2], list_ptr[3],
+ list_ptr[0] == OP_NOTPROP))
+ return FALSE;
+ break;
+#endif
+
+ case OP_NCLASS:
+ if (chr > 255) return FALSE;
+ /* Fall through */
+
+ case OP_CLASS:
+ if (chr > 255) break;
+ class_bitset = (pcre_uint8 *)
+ ((list_ptr == list ? code : base_end) - list_ptr[2]);
+ if ((class_bitset[chr >> 3] & (1 << (chr & 7))) != 0) return FALSE;
+ break;
+
+#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
+ case OP_XCLASS:
+ if (PRIV(xclass)(chr, (list_ptr == list ? code : base_end) -
+ list_ptr[2] + LINK_SIZE, utf)) return FALSE;
+ break;
+#endif
+
+ default:
+ return FALSE;
+ }
+
+ chr_ptr++;
+ }
+ while(*chr_ptr != NOTACHAR);
+
+ /* At least one character must be matched from this opcode. */
+
+ if (list[1] == 0) return TRUE;
+ }
+
+return FALSE;
+}
+
+
+
+/*************************************************
+* Scan compiled regex for auto-possession *
+*************************************************/
+
+/* Replaces single character iterations with their possessive alternatives
+if appropriate. This function modifies the compiled opcode!
+
+Arguments:
+ code points to start of the byte code
+ utf TRUE in UTF-8 / UTF-16 / UTF-32 mode
+ cd static compile data
+
+Returns: nothing
+*/
+
+static void
+auto_possessify(pcre_uchar *code, BOOL utf, const compile_data *cd)
+{
+register pcre_uchar c;
+const pcre_uchar *end;
+pcre_uchar *repeat_opcode;
+pcre_uint32 list[8];
+
+for (;;)
+ {
+ c = *code;
+
+ if (c >= OP_STAR && c <= OP_TYPEPOSUPTO)
+ {
+ c -= get_repeat_base(c) - OP_STAR;
+ end = (c <= OP_MINUPTO) ?
+ get_chr_property_list(code, utf, cd->fcc, list) : NULL;
+ list[1] = c == OP_STAR || c == OP_PLUS || c == OP_QUERY || c == OP_UPTO;
+
+ if (end != NULL && compare_opcodes(end, utf, cd, list, end))
+ {
+ switch(c)
+ {
+ case OP_STAR:
+ *code += OP_POSSTAR - OP_STAR;
+ break;
+
+ case OP_MINSTAR:
+ *code += OP_POSSTAR - OP_MINSTAR;
+ break;
+
+ case OP_PLUS:
+ *code += OP_POSPLUS - OP_PLUS;
+ break;
+
+ case OP_MINPLUS:
+ *code += OP_POSPLUS - OP_MINPLUS;
+ break;
+
+ case OP_QUERY:
+ *code += OP_POSQUERY - OP_QUERY;
+ break;
+
+ case OP_MINQUERY:
+ *code += OP_POSQUERY - OP_MINQUERY;
+ break;
+
+ case OP_UPTO:
+ *code += OP_POSUPTO - OP_UPTO;
+ break;
+
+ case OP_MINUPTO:
+ *code += OP_MINUPTO - OP_UPTO;
+ break;
+ }
+ }
+ c = *code;
+ }
+ else if (c == OP_CLASS || c == OP_NCLASS || c == OP_XCLASS)
+ {
+#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
+ if (c == OP_XCLASS)
+ repeat_opcode = code + GET(code, 1);
+ else
+#endif
+ repeat_opcode = code + 1 + (32 / sizeof(pcre_uchar));
+
+ c = *repeat_opcode;
+ if (c >= OP_CRSTAR && c <= OP_CRMINRANGE)
+ {
+ /* end must not be NULL. */
+ end = get_chr_property_list(code, utf, cd->fcc, list);
+
+ list[1] = (c & 1) == 0;
+
+ if (compare_opcodes(end, utf, cd, list, end))
+ {
+ switch (c)
+ {
+ case OP_CRSTAR:
+ case OP_CRMINSTAR:
+ *repeat_opcode = OP_CRPOSSTAR;
+ break;
+
+ case OP_CRPLUS:
+ case OP_CRMINPLUS:
+ *repeat_opcode = OP_CRPOSPLUS;
+ break;
+
+ case OP_CRQUERY:
+ case OP_CRMINQUERY:
+ *repeat_opcode = OP_CRPOSQUERY;
+ break;
+
+ case OP_CRRANGE:
+ case OP_CRMINRANGE:
+ *repeat_opcode = OP_CRPOSRANGE;
+ break;
+ }
+ }
+ }
+ c = *code;
+ }
+
+ switch(c)
+ {
+ case OP_END:
+ return;
+
+ case OP_TYPESTAR:
+ case OP_TYPEMINSTAR:
+ case OP_TYPEPLUS:
+ case OP_TYPEMINPLUS:
+ case OP_TYPEQUERY:
+ case OP_TYPEMINQUERY:
+ case OP_TYPEPOSSTAR:
+ case OP_TYPEPOSPLUS:
+ case OP_TYPEPOSQUERY:
+ if (code[1] == OP_PROP || code[1] == OP_NOTPROP) code += 2;
+ break;
+
+ case OP_TYPEUPTO:
+ case OP_TYPEMINUPTO:
+ case OP_TYPEEXACT:
+ case OP_TYPEPOSUPTO:
+ if (code[1 + IMM2_SIZE] == OP_PROP || code[1 + IMM2_SIZE] == OP_NOTPROP)
+ code += 2;
+ break;
+
+#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
+ case OP_XCLASS:
+ code += GET(code, 1);
+ break;
+#endif
+
+ case OP_MARK:
+ case OP_PRUNE_ARG:
+ case OP_SKIP_ARG:
+ case OP_THEN_ARG:
+ code += code[1];
+ break;
+ }
+
+ /* Add in the fixed length from the table */
+
+ code += PRIV(OP_lengths)[c];
+
+ /* In UTF-8 mode, opcodes that are followed by a character may be followed by
+ a multi-byte character. The length in the table is a minimum, so we have to
+ arrange to skip the extra bytes. */
+
+#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
+ if (utf) switch(c)
+ {
+ case OP_CHAR:
+ case OP_CHARI:
+ case OP_NOT:
+ case OP_NOTI:
+ case OP_STAR:
+ case OP_MINSTAR:
+ case OP_PLUS:
+ case OP_MINPLUS:
+ case OP_QUERY:
+ case OP_MINQUERY:
+ case OP_UPTO:
+ case OP_MINUPTO:
+ case OP_EXACT:
+ case OP_POSSTAR:
+ case OP_POSPLUS:
+ case OP_POSQUERY:
+ case OP_POSUPTO:
+ case OP_STARI:
+ case OP_MINSTARI:
+ case OP_PLUSI:
+ case OP_MINPLUSI:
+ case OP_QUERYI:
+ case OP_MINQUERYI:
+ case OP_UPTOI:
+ case OP_MINUPTOI:
+ case OP_EXACTI:
+ case OP_POSSTARI:
+ case OP_POSPLUSI:
+ case OP_POSQUERYI:
+ case OP_POSUPTOI:
+ case OP_NOTSTAR:
+ case OP_NOTMINSTAR:
+ case OP_NOTPLUS:
+ case OP_NOTMINPLUS:
+ case OP_NOTQUERY:
+ case OP_NOTMINQUERY:
+ case OP_NOTUPTO:
+ case OP_NOTMINUPTO:
+ case OP_NOTEXACT:
+ case OP_NOTPOSSTAR:
+ case OP_NOTPOSPLUS:
+ case OP_NOTPOSQUERY:
+ case OP_NOTPOSUPTO:
+ case OP_NOTSTARI:
+ case OP_NOTMINSTARI:
+ case OP_NOTPLUSI:
+ case OP_NOTMINPLUSI:
+ case OP_NOTQUERYI:
+ case OP_NOTMINQUERYI:
+ case OP_NOTUPTOI:
+ case OP_NOTMINUPTOI:
+ case OP_NOTEXACTI:
+ case OP_NOTPOSSTARI:
+ case OP_NOTPOSPLUSI:
+ case OP_NOTPOSQUERYI:
+ case OP_NOTPOSUPTOI:
+ if (HAS_EXTRALEN(code[-1])) code += GET_EXTRALEN(code[-1]);
+ break;
+ }
+#else
+ (void)(utf); /* Keep compiler happy by referencing function argument */
+#endif
+ }
+}
+
+
+
+/*************************************************
* Check for POSIX class syntax *
*************************************************/
@@ -2689,7 +3813,7 @@ class, but [abc[:x\]pqr:]] is (so that an error can be generated). The code
below handles the special case of \], but does not try to do any other escape
processing. This makes it different from Perl for cases such as [:l\ower:]
where Perl recognizes it as the POSIX class "lower" but PCRE does not recognize
-"l\ower". This is a lesser evil that not diagnosing bad classes when Perl does,
+"l\ower". This is a lesser evil than not diagnosing bad classes when Perl does,
I think.
A user pointed out that PCRE was rejecting [:a[:digit:]] whereas Perl was not.
@@ -2951,477 +4075,11 @@ for (++c; c <= d; c++)
*cptr = c; /* Rest of input range */
return 0;
}
-
-
-
-/*************************************************
-* Check a character and a property *
-*************************************************/
-
-/* This function is called by check_auto_possessive() when a property item
-is adjacent to a fixed character.
-
-Arguments:
- c the character
- ptype the property type
- pdata the data for the type
- negated TRUE if it's a negated property (\P or \p{^)
-
-Returns: TRUE if auto-possessifying is OK
-*/
-
-static BOOL
-check_char_prop(pcre_uint32 c, unsigned int ptype, unsigned int pdata, BOOL negated)
-{
-#ifdef SUPPORT_UCP
-const pcre_uint32 *p;
-#endif
-
-const ucd_record *prop = GET_UCD(c);
-
-switch(ptype)
- {
- case PT_LAMP:
- return (prop->chartype == ucp_Lu ||
- prop->chartype == ucp_Ll ||
- prop->chartype == ucp_Lt) == negated;
-
- case PT_GC:
- return (pdata == PRIV(ucp_gentype)[prop->chartype]) == negated;
-
- case PT_PC:
- return (pdata == prop->chartype) == negated;
-
- case PT_SC:
- return (pdata == prop->script) == negated;
-
- /* These are specials */
-
- case PT_ALNUM:
- return (PRIV(ucp_gentype)[prop->chartype] == ucp_L ||
- PRIV(ucp_gentype)[prop->chartype] == ucp_N) == negated;
-
- case PT_SPACE: /* Perl space */
- return (PRIV(ucp_gentype)[prop->chartype] == ucp_Z ||
- c == CHAR_HT || c == CHAR_NL || c == CHAR_FF || c == CHAR_CR)
- == negated;
-
- case PT_PXSPACE: /* POSIX space */
- return (PRIV(ucp_gentype)[prop->chartype] == ucp_Z ||
- c == CHAR_HT || c == CHAR_NL || c == CHAR_VT ||
- c == CHAR_FF || c == CHAR_CR)
- == negated;
-
- case PT_WORD:
- return (PRIV(ucp_gentype)[prop->chartype] == ucp_L ||
- PRIV(ucp_gentype)[prop->chartype] == ucp_N ||
- c == CHAR_UNDERSCORE) == negated;
-
-#ifdef SUPPORT_UCP
- case PT_CLIST:
- p = PRIV(ucd_caseless_sets) + prop->caseset;
- for (;;)
- {
- if (c < *p) return !negated;
- if (c == *p++) return negated;
- }
- break; /* Control never reaches here */
-#endif
- }
-
-return FALSE;
-}
#endif /* SUPPORT_UCP */
/*************************************************
-* Check if auto-possessifying is possible *
-*************************************************/
-
-/* This function is called for unlimited repeats of certain items, to see
-whether the next thing could possibly match the repeated item. If not, it makes
-sense to automatically possessify the repeated item.
-
-Arguments:
- previous pointer to the repeated opcode
- utf TRUE in UTF-8 / UTF-16 / UTF-32 mode
- ptr next character in pattern
- options options bits
- cd contains pointers to tables etc.
-
-Returns: TRUE if possessifying is wanted
-*/
-
-static BOOL
-check_auto_possessive(const pcre_uchar *previous, BOOL utf,
- const pcre_uchar *ptr, int options, compile_data *cd)
-{
-pcre_uint32 c = NOTACHAR;
-pcre_uint32 next;
-int escape;
-pcre_uchar op_code = *previous++;
-
-/* Skip whitespace and comments in extended mode */
-
-if ((options & PCRE_EXTENDED) != 0)
- {
- for (;;)
- {
- while (MAX_255(*ptr) && (cd->ctypes[*ptr] & ctype_space) != 0) ptr++;
- if (*ptr == CHAR_NUMBER_SIGN)
- {
- ptr++;
- while (*ptr != CHAR_NULL)
- {
- if (IS_NEWLINE(ptr)) { ptr += cd->nllen; break; }
- ptr++;
-#ifdef SUPPORT_UTF
- if (utf) FORWARDCHAR(ptr);
-#endif
- }
- }
- else break;
- }
- }
-
-/* If the next item is one that we can handle, get its value. A non-negative
-value is a character, a negative value is an escape value. */
-
-if (*ptr == CHAR_BACKSLASH)
- {
- int temperrorcode = 0;
- escape = check_escape(&ptr, &next, &temperrorcode, cd->bracount, options,
- FALSE);
- if (temperrorcode != 0) return FALSE;
- ptr++; /* Point after the escape sequence */
- }
-else if (!MAX_255(*ptr) || (cd->ctypes[*ptr] & ctype_meta) == 0)
- {
- escape = 0;
-#ifdef SUPPORT_UTF
- if (utf) { GETCHARINC(next, ptr); } else
-#endif
- next = *ptr++;
- }
-else return FALSE;
-
-/* Skip whitespace and comments in extended mode */
-
-if ((options & PCRE_EXTENDED) != 0)
- {
- for (;;)
- {
- while (MAX_255(*ptr) && (cd->ctypes[*ptr] & ctype_space) != 0) ptr++;
- if (*ptr == CHAR_NUMBER_SIGN)
- {
- ptr++;
- while (*ptr != CHAR_NULL)
- {
- if (IS_NEWLINE(ptr)) { ptr += cd->nllen; break; }
- ptr++;
-#ifdef SUPPORT_UTF
- if (utf) FORWARDCHAR(ptr);
-#endif
- }
- }
- else break;
- }
- }
-
-/* If the next thing is itself optional, we have to give up. */
-
-if (*ptr == CHAR_ASTERISK || *ptr == CHAR_QUESTION_MARK ||
- STRNCMP_UC_C8(ptr, STR_LEFT_CURLY_BRACKET STR_0 STR_COMMA, 3) == 0)
- return FALSE;
-
-/* If the previous item is a character, get its value. */
-
-if (op_code == OP_CHAR || op_code == OP_CHARI ||
- op_code == OP_NOT || op_code == OP_NOTI)
- {
-#ifdef SUPPORT_UTF
- GETCHARTEST(c, previous);
-#else
- c = *previous;
-#endif
- }
-
-/* Now compare the next item with the previous opcode. First, handle cases when
-the next item is a character. */
-
-if (escape == 0)
- {
- /* For a caseless UTF match, the next character may have more than one other
- case, which maps to the special PT_CLIST property. Check this first. */
-
-#ifdef SUPPORT_UCP
- if (utf && c != NOTACHAR && (options & PCRE_CASELESS) != 0)
- {
- unsigned int ocs = UCD_CASESET(next);
- if (ocs > 0) return check_char_prop(c, PT_CLIST, ocs, op_code >= OP_NOT);
- }
-#endif
-
- switch(op_code)
- {
- case OP_CHAR:
- return c != next;
-
- /* For CHARI (caseless character) we must check the other case. If we have
- Unicode property support, we can use it to test the other case of
- high-valued characters. We know that next can have only one other case,
- because multi-other-case characters are dealt with above. */
-
- case OP_CHARI:
- if (c == next) return FALSE;
-#ifdef SUPPORT_UTF
- if (utf)
- {
- pcre_uint32 othercase;
- if (next < 128) othercase = cd->fcc[next]; else
-#ifdef SUPPORT_UCP
- othercase = UCD_OTHERCASE(next);
-#else
- othercase = NOTACHAR;
-#endif
- return c != othercase;
- }
- else
-#endif /* SUPPORT_UTF */
- return (c != TABLE_GET(next, cd->fcc, next)); /* Not UTF */
-
- case OP_NOT:
- return c == next;
-
- case OP_NOTI:
- if (c == next) return TRUE;
-#ifdef SUPPORT_UTF
- if (utf)
- {
- pcre_uint32 othercase;
- if (next < 128) othercase = cd->fcc[next]; else
-#ifdef SUPPORT_UCP
- othercase = UCD_OTHERCASE(next);
-#else
- othercase = NOTACHAR;
-#endif
- return c == othercase;
- }
- else
-#endif /* SUPPORT_UTF */
- return (c == TABLE_GET(next, cd->fcc, next)); /* Not UTF */
-
- /* Note that OP_DIGIT etc. are generated only when PCRE_UCP is *not* set.
- When it is set, \d etc. are converted into OP_(NOT_)PROP codes. */
-
- case OP_DIGIT:
- return next > 255 || (cd->ctypes[next] & ctype_digit) == 0;
-
- case OP_NOT_DIGIT:
- return next <= 255 && (cd->ctypes[next] & ctype_digit) != 0;
-
- case OP_WHITESPACE:
- return next > 255 || (cd->ctypes[next] & ctype_space) == 0;
-
- case OP_NOT_WHITESPACE:
- return next <= 255 && (cd->ctypes[next] & ctype_space) != 0;
-
- case OP_WORDCHAR:
- return next > 255 || (cd->ctypes[next] & ctype_word) == 0;
-
- case OP_NOT_WORDCHAR:
- return next <= 255 && (cd->ctypes[next] & ctype_word) != 0;
-
- case OP_HSPACE:
- case OP_NOT_HSPACE:
- switch(next)
- {
- HSPACE_CASES:
- return op_code == OP_NOT_HSPACE;
-
- default:
- return op_code != OP_NOT_HSPACE;
- }
-
- case OP_ANYNL:
- case OP_VSPACE:
- case OP_NOT_VSPACE:
- switch(next)
- {
- VSPACE_CASES:
- return op_code == OP_NOT_VSPACE;
-
- default:
- return op_code != OP_NOT_VSPACE;
- }
-
-#ifdef SUPPORT_UCP
- case OP_PROP:
- return check_char_prop(next, previous[0], previous[1], FALSE);
-
- case OP_NOTPROP:
- return check_char_prop(next, previous[0], previous[1], TRUE);
-#endif
-
- default:
- return FALSE;
- }
- }
-
-/* Handle the case when the next item is \d, \s, etc. Note that when PCRE_UCP
-is set, \d turns into ESC_du rather than ESC_d, etc., so ESC_d etc. are
-generated only when PCRE_UCP is *not* set, that is, when only ASCII
-characteristics are recognized. Similarly, the opcodes OP_DIGIT etc. are
-replaced by OP_PROP codes when PCRE_UCP is set. */
-
-switch(op_code)
- {
- case OP_CHAR:
- case OP_CHARI:
- switch(escape)
- {
- case ESC_d:
- return c > 255 || (cd->ctypes[c] & ctype_digit) == 0;
-
- case ESC_D:
- return c <= 255 && (cd->ctypes[c] & ctype_digit) != 0;
-
- case ESC_s:
- return c > 255 || (cd->ctypes[c] & ctype_space) == 0;
-
- case ESC_S:
- return c <= 255 && (cd->ctypes[c] & ctype_space) != 0;
-
- case ESC_w:
- return c > 255 || (cd->ctypes[c] & ctype_word) == 0;
-
- case ESC_W:
- return c <= 255 && (cd->ctypes[c] & ctype_word) != 0;
-
- case ESC_h:
- case ESC_H:
- switch(c)
- {
- HSPACE_CASES:
- return escape != ESC_h;
-
- default:
- return escape == ESC_h;
- }
-
- case ESC_v:
- case ESC_V:
- switch(c)
- {
- VSPACE_CASES:
- return escape != ESC_v;
-
- default:
- return escape == ESC_v;
- }
-
- /* When PCRE_UCP is set, these values get generated for \d etc. Find
- their substitutions and process them. The result will always be either
- ESC_p or ESC_P. Then fall through to process those values. */
-
-#ifdef SUPPORT_UCP
- case ESC_du:
- case ESC_DU:
- case ESC_wu:
- case ESC_WU:
- case ESC_su:
- case ESC_SU:
- {
- int temperrorcode = 0;
- ptr = substitutes[escape - ESC_DU];
- escape = check_escape(&ptr, &next, &temperrorcode, 0, options, FALSE);
- if (temperrorcode != 0) return FALSE;
- ptr++; /* For compatibility */
- }
- /* Fall through */
-
- case ESC_p:
- case ESC_P:
- {
- unsigned int ptype = 0, pdata = 0;
- int errorcodeptr;
- BOOL negated;
-
- ptr--; /* Make ptr point at the p or P */
- if (!get_ucp(&ptr, &negated, &ptype, &pdata, &errorcodeptr))
- return FALSE;
- ptr++; /* Point past the final curly ket */
-
- /* If the property item is optional, we have to give up. (When generated
- from \d etc by PCRE_UCP, this test will have been applied much earlier,
- to the original \d etc. At this point, ptr will point to a zero byte. */
-
- if (*ptr == CHAR_ASTERISK || *ptr == CHAR_QUESTION_MARK ||
- STRNCMP_UC_C8(ptr, STR_LEFT_CURLY_BRACKET STR_0 STR_COMMA, 3) == 0)
- return FALSE;
-
- /* Do the property check. */
-
- return check_char_prop(c, ptype, pdata, (escape == ESC_P) != negated);
- }
-#endif
-
- default:
- return FALSE;
- }
-
- /* In principle, support for Unicode properties should be integrated here as
- well. It means re-organizing the above code so as to get hold of the property
- values before switching on the op-code. However, I wonder how many patterns
- combine ASCII \d etc with Unicode properties? (Note that if PCRE_UCP is set,
- these op-codes are never generated.) */
-
- case OP_DIGIT:
- return escape == ESC_D || escape == ESC_s || escape == ESC_W ||
- escape == ESC_h || escape == ESC_v || escape == ESC_R;
-
- case OP_NOT_DIGIT:
- return escape == ESC_d;
-
- case OP_WHITESPACE:
- return escape == ESC_S || escape == ESC_d || escape == ESC_w;
-
- case OP_NOT_WHITESPACE:
- return escape == ESC_s || escape == ESC_h || escape == ESC_v || escape == ESC_R;
-
- case OP_HSPACE:
- return escape == ESC_S || escape == ESC_H || escape == ESC_d ||
- escape == ESC_w || escape == ESC_v || escape == ESC_R;
-
- case OP_NOT_HSPACE:
- return escape == ESC_h;
-
- /* Can't have \S in here because VT matches \S (Perl anomaly) */
- case OP_ANYNL:
- case OP_VSPACE:
- return escape == ESC_V || escape == ESC_d || escape == ESC_w;
-
- case OP_NOT_VSPACE:
- return escape == ESC_v || escape == ESC_R;
-
- case OP_WORDCHAR:
- return escape == ESC_W || escape == ESC_s || escape == ESC_h ||
- escape == ESC_v || escape == ESC_R;
-
- case OP_NOT_WORDCHAR:
- return escape == ESC_w || escape == ESC_d;
-
- default:
- return FALSE;
- }
-
-/* Control does not reach here */
-}
-
-
-
-/*************************************************
* Add a character or range to a class *
*************************************************/
@@ -3670,22 +4328,22 @@ to find out the amount of memory needed, as well as during the real compile
phase. The value of lengthptr distinguishes the two phases.
Arguments:
- optionsptr pointer to the option bits
- codeptr points to the pointer to the current code point
- ptrptr points to the current pattern pointer
- errorcodeptr points to error code variable
- firstcharptr place to put the first required character
+ optionsptr pointer to the option bits
+ codeptr points to the pointer to the current code point
+ ptrptr points to the current pattern pointer
+ errorcodeptr points to error code variable
+ firstcharptr place to put the first required character
firstcharflagsptr place to put the first character flags, or a negative number
- reqcharptr place to put the last required character
- reqcharflagsptr place to put the last required character flags, or a negative number
- bcptr points to current branch chain
- cond_depth conditional nesting depth
- cd contains pointers to tables etc.
- lengthptr NULL during the real compile phase
- points to length accumulator during pre-compile phase
-
-Returns: TRUE on success
- FALSE, with *errorcodeptr set non-zero on error
+ reqcharptr place to put the last required character
+ reqcharflagsptr place to put the last required character flags, or a negative number
+ bcptr points to current branch chain
+ cond_depth conditional nesting depth
+ cd contains pointers to tables etc.
+ lengthptr NULL during the real compile phase
+ points to length accumulator during pre-compile phase
+
+Returns: TRUE on success
+ FALSE, with *errorcodeptr set non-zero on error
*/
static BOOL
@@ -3908,58 +4566,67 @@ for (;; ptr++)
}
goto NORMAL_CHAR;
}
+ /* Control does not reach here. */
}
- /* Fill in length of a previous callout, except when the next thing is
- a quantifier. */
-
- is_quantifier =
- c == CHAR_ASTERISK || c == CHAR_PLUS || c == CHAR_QUESTION_MARK ||
- (c == CHAR_LEFT_CURLY_BRACKET && is_counted_repeat(ptr+1));
-
- if (!is_quantifier && previous_callout != NULL &&
- after_manual_callout-- <= 0)
- {
- if (lengthptr == NULL) /* Don't attempt in pre-compile phase */
- complete_callout(previous_callout, ptr, cd);
- previous_callout = NULL;
- }
-
- /* In extended mode, skip white space and comments. */
+ /* In extended mode, skip white space and comments. We need a loop in order
+ to check for more white space and more comments after a comment. */
if ((options & PCRE_EXTENDED) != 0)
{
- if (MAX_255(*ptr) && (cd->ctypes[c] & ctype_space) != 0) continue;
- if (c == CHAR_NUMBER_SIGN)
+ for (;;)
{
+ while (MAX_255(c) && (cd->ctypes[c] & ctype_space) != 0) c = *(++ptr);
+ if (c != CHAR_NUMBER_SIGN) break;
ptr++;
while (*ptr != CHAR_NULL)
{
- if (IS_NEWLINE(ptr)) { ptr += cd->nllen - 1; break; }
+ if (IS_NEWLINE(ptr)) /* For non-fixed-length newline cases, */
+ { /* IS_NEWLINE sets cd->nllen. */
+ ptr += cd->nllen;
+ break;
+ }
ptr++;
#ifdef SUPPORT_UTF
if (utf) FORWARDCHAR(ptr);
#endif
}
- if (*ptr != CHAR_NULL) continue;
-
- /* Else fall through to handle end of string */
- c = 0;
+ c = *ptr; /* Either NULL or the char after a newline */
}
}
- /* No auto callout for quantifiers. */
+ /* See if the next thing is a quantifier. */
+
+ is_quantifier =
+ c == CHAR_ASTERISK || c == CHAR_PLUS || c == CHAR_QUESTION_MARK ||
+ (c == CHAR_LEFT_CURLY_BRACKET && is_counted_repeat(ptr+1));
+
+ /* Fill in length of a previous callout, except when the next thing is a
+ quantifier or when processing a property substitution string in UCP mode. */
+
+ if (!is_quantifier && previous_callout != NULL && nestptr == NULL &&
+ after_manual_callout-- <= 0)
+ {
+ if (lengthptr == NULL) /* Don't attempt in pre-compile phase */
+ complete_callout(previous_callout, ptr, cd);
+ previous_callout = NULL;
+ }
+
+ /* Create auto callout, except for quantifiers, or while processing property
+ strings that are substituted for \w etc in UCP mode. */
- if ((options & PCRE_AUTO_CALLOUT) != 0 && !is_quantifier)
+ if ((options & PCRE_AUTO_CALLOUT) != 0 && !is_quantifier && nestptr == NULL)
{
previous_callout = code;
code = auto_callout(code, ptr, cd);
}
+ /* Process the next pattern item. */
+
switch(c)
{
/* ===================================================================*/
- case 0: /* The branch terminates at string end */
+ case CHAR_NULL: /* The branch terminates at string end */
case CHAR_VERTICAL_LINE: /* or | or ) */
case CHAR_RIGHT_PARENTHESIS:
*firstcharptr = firstchar;
@@ -4037,7 +4704,29 @@ for (;; ptr++)
}
goto NORMAL_CHAR;
+ /* In another (POSIX) regex library, the ugly syntax [[:<:]] and [[:>:]] is
+ used for "start of word" and "end of word". As these are otherwise illegal
+ sequences, we don't break anything by recognizing them. They are replaced
+ by \b(?=\w) and \b(?<=\w) respectively. Sequences like [a[:<:]] are
+ erroneous and are handled by the normal code below. */
+
case CHAR_LEFT_SQUARE_BRACKET:
+ if (STRNCMP_UC_C8(ptr+1, STRING_WEIRD_STARTWORD, 6) == 0)
+ {
+ nestptr = ptr + 7;
+ ptr = sub_start_of_word - 1;
+ continue;
+ }
+
+ if (STRNCMP_UC_C8(ptr+1, STRING_WEIRD_ENDWORD, 6) == 0)
+ {
+ nestptr = ptr + 7;
+ ptr = sub_end_of_word - 1;
+ continue;
+ }
+
+ /* Handle a real character class. */
+
previous = code;
/* PCRE supports POSIX class stuff inside a class. Perl gives an error if
@@ -4202,24 +4891,58 @@ for (;; ptr++)
posix_class = 0;
/* When PCRE_UCP is set, some of the POSIX classes are converted to
- different escape sequences that use Unicode properties. */
+ different escape sequences that use Unicode properties \p or \P. Others
+ that are not available via \p or \P generate XCL_PROP/XCL_NOTPROP
+ directly. */
#ifdef SUPPORT_UCP
if ((options & PCRE_UCP) != 0)
{
+ unsigned int ptype = 0;
int pc = posix_class + ((local_negate)? POSIX_SUBSIZE/2 : 0);
+
+ /* The posix_substitutes table specifies which POSIX classes can be
+ converted to \p or \P items. */
+
if (posix_substitutes[pc] != NULL)
{
nestptr = tempptr + 1;
ptr = posix_substitutes[pc] - 1;
continue;
}
+
+ /* There are three other classes that generate special property calls
+ that are recognized only in an XCLASS. */
+
+ else switch(posix_class)
+ {
+ case PC_GRAPH:
+ ptype = PT_PXGRAPH;
+ /* Fall through */
+ case PC_PRINT:
+ if (ptype == 0) ptype = PT_PXPRINT;
+ /* Fall through */
+ case PC_PUNCT:
+ if (ptype == 0) ptype = PT_PXPUNCT;
+ *class_uchardata++ = local_negate? XCL_NOTPROP : XCL_PROP;
+ *class_uchardata++ = ptype;
+ *class_uchardata++ = 0;
+ ptr = tempptr + 1;
+ continue;
+
+ /* For all other POSIX classes, no special action is taken in UCP
+ mode. Fall through to the non_UCP case. */
+
+ default:
+ break;
+ }
}
#endif
- /* In the non-UCP case, we build the bit map for the POSIX class in a
- chunk of local store because we may be adding and subtracting from it,
- and we don't want to subtract bits that may be in the main map already.
- At the end we or the result into the bit map that is being built. */
+ /* In the non-UCP case, or when UCP makes no difference, we build the
+ bit map for the POSIX class in a chunk of local store because we may be
+ adding and subtracting from it, and we don't want to subtract bits that
+ may be in the main map already. At the end we or the result into the
+ bit map that is being built. */
posix_class *= 3;
@@ -4336,21 +5059,20 @@ for (;; ptr++)
for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_word];
continue;
- /* Perl 5.004 onwards omits VT from \s, but we must preserve it
- if it was previously set by something earlier in the character
- class. Luckily, the value of CHAR_VT is 0x0b in both ASCII and
- EBCDIC, so we lazily just adjust the appropriate bit. */
+ /* Perl 5.004 onwards omitted VT from \s, but restored it at Perl
+ 5.18. Before PCRE 8.34, we had to preserve the VT bit if it was
+ previously set by something earlier in the character class.
+ Luckily, the value of CHAR_VT is 0x0b in both ASCII and EBCDIC, so
+ we could just adjust the appropriate bit. From PCRE 8.34 we no
+ longer treat \s and \S specially. */
case ESC_s:
- classbits[0] |= cbits[cbit_space];
- classbits[1] |= cbits[cbit_space+1] & ~0x08;
- for (c = 2; c < 32; c++) classbits[c] |= cbits[c+cbit_space];
+ for (c = 0; c < 32; c++) classbits[c] |= cbits[c+cbit_space];
continue;
case ESC_S:
should_flip_negation = TRUE;
for (c = 0; c < 32; c++) classbits[c] |= ~cbits[c+cbit_space];
- classbits[1] |= 0x08; /* Perl 5.004 onwards omits VT from \s */
continue;
/* The rest apply in both UCP and non-UCP cases. */
@@ -4472,26 +5194,43 @@ for (;; ptr++)
#endif
d = *ptr; /* Not UTF-8 mode */
- /* The second part of a range can be a single-character escape, but
- not any of the other escapes. Perl 5.6 treats a hyphen as a literal
- in such circumstances. */
+ /* The second part of a range can be a single-character escape
+ sequence, but not any of the other escapes. Perl treats a hyphen as a
+ literal in such circumstances. However, in Perl's warning mode, a
+ warning is given, so PCRE now faults it as it is almost certainly a
+ mistake on the user's part. */
- if (!inescq && d == CHAR_BACKSLASH)
+ if (!inescq)
{
- int descape;
- descape = check_escape(&ptr, &d, errorcodeptr, cd->bracount, options, TRUE);
- if (*errorcodeptr != 0) goto FAILED;
+ if (d == CHAR_BACKSLASH)
+ {
+ int descape;
+ descape = check_escape(&ptr, &d, errorcodeptr, cd->bracount, options, TRUE);
+ if (*errorcodeptr != 0) goto FAILED;
- /* \b is backspace; any other special means the '-' was literal. */
+ /* 0 means a character was put into d; \b is backspace; any other
+ special causes an error. */
- if (descape != 0)
- {
- if (descape == ESC_b) d = CHAR_BS; else
+ if (descape != 0)
{
- ptr = oldptr;
- goto CLASS_SINGLE_CHARACTER; /* A few lines below */
+ if (descape == ESC_b) d = CHAR_BS; else
+ {
+ *errorcodeptr = ERR83;
+ goto FAILED;
+ }
}
}
+
+ /* A hyphen followed by a POSIX class is treated in the same way. */
+
+ else if (d == CHAR_LEFT_SQUARE_BRACKET &&
+ (ptr[1] == CHAR_COLON || ptr[1] == CHAR_DOT ||
+ ptr[1] == CHAR_EQUALS_SIGN) &&
+ check_posix_syntax(ptr, &tempptr))
+ {
+ *errorcodeptr = ERR83;
+ goto FAILED;
+ }
}
/* Check that the two values are in the correct order. Optimize
@@ -4755,6 +5494,34 @@ for (;; ptr++)
tempcode = previous;
+ /* Before checking for a possessive quantifier, we must skip over
+ whitespace and comments in extended mode because Perl allows white space at
+ this point. */
+
+ if ((options & PCRE_EXTENDED) != 0)
+ {
+ const pcre_uchar *p = ptr + 1;
+ for (;;)
+ {
+ while (MAX_255(*p) && (cd->ctypes[*p] & ctype_space) != 0) p++;
+ if (*p != CHAR_NUMBER_SIGN) break;
+ p++;
+ while (*p != CHAR_NULL)
+ {
+ if (IS_NEWLINE(p)) /* For non-fixed-length newline cases, */
+ { /* IS_NEWLINE sets cd->nllen. */
+ p += cd->nllen;
+ break;
+ }
+ p++;
+#ifdef SUPPORT_UTF
+ if (utf) FORWARDCHAR(p);
+#endif
+ } /* Loop for comment characters */
+ } /* Loop for multiple comments */
+ ptr = p - 1; /* Character before the next significant one. */
+ }
+
/* If the next character is '+', we have a possessive quantifier. This
implies greediness, whatever the setting of the PCRE_UNGREEDY option.
If the next character is '?' this is a minimizing repeat, by default,
@@ -4849,19 +5616,6 @@ for (;; ptr++)
}
}
- /* If the repetition is unlimited, it pays to see if the next thing on
- the line is something that cannot possibly match this character. If so,
- automatically possessifying this item gains some performance in the case
- where the match fails. */
-
- if (!possessive_quantifier &&
- repeat_max < 0 &&
- check_auto_possessive(previous, utf, ptr + 1, options, cd))
- {
- repeat_type = 0; /* Force greedy */
- possessive_quantifier = TRUE;
- }
-
goto OUTPUT_SINGLE_REPEAT; /* Code shared with single character types */
}
@@ -4879,14 +5633,6 @@ for (;; ptr++)
op_type = OP_TYPESTAR - OP_STAR; /* Use type opcodes */
c = *previous;
- if (!possessive_quantifier &&
- repeat_max < 0 &&
- check_auto_possessive(previous, utf, ptr + 1, options, cd))
- {
- repeat_type = 0; /* Force greedy */
- possessive_quantifier = TRUE;
- }
-
OUTPUT_SINGLE_REPEAT:
if (*previous == OP_PROP || *previous == OP_NOTPROP)
{
@@ -5035,13 +5781,12 @@ for (;; ptr++)
/* If previous was a character class or a back reference, we put the repeat
stuff after it, but just skip the item if the repeat was {0,0}. */
- else if (*previous == OP_CLASS ||
- *previous == OP_NCLASS ||
+ else if (*previous == OP_CLASS || *previous == OP_NCLASS ||
#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
*previous == OP_XCLASS ||
#endif
- *previous == OP_REF ||
- *previous == OP_REFI)
+ *previous == OP_REF || *previous == OP_REFI ||
+ *previous == OP_DNREF || *previous == OP_DNREFI)
{
if (repeat_max == 0)
{
@@ -5069,8 +5814,9 @@ for (;; ptr++)
opcodes such as BRA and CBRA, as this is the place where they get converted
into the more special varieties such as BRAPOS and SBRA. A test for >=
OP_ASSERT and <= OP_COND includes ASSERT, ASSERT_NOT, ASSERTBACK,
- ASSERTBACK_NOT, ONCE, BRA, CBRA, and COND. Originally, PCRE did not allow
- repetition of assertions, but now it does, for Perl compatibility. */
+ ASSERTBACK_NOT, ONCE, ONCE_NC, BRA, BRAPOS, CBRA, CBRAPOS, and COND.
+ Originally, PCRE did not allow repetition of assertions, but now it does,
+ for Perl compatibility. */
else if (*previous >= OP_ASSERT && *previous <= OP_COND)
{
@@ -5088,7 +5834,7 @@ for (;; ptr++)
/* There is no sense in actually repeating assertions. The only potential
use of repetition is in cases when the assertion is optional. Therefore,
if the minimum is greater than zero, just ignore the repeat. If the
- maximum is not not zero or one, set it to 1. */
+ maximum is not zero or one, set it to 1. */
if (*previous < OP_ONCE) /* Assertion */
{
@@ -5391,7 +6137,7 @@ for (;; ptr++)
pcre_uchar *scode = bracode;
do
{
- if (could_be_empty_branch(scode, ketcode, utf, cd))
+ if (could_be_empty_branch(scode, ketcode, utf, cd, NULL))
{
*bracode += OP_SBRA - OP_BRA;
break;
@@ -5461,43 +6207,105 @@ for (;; ptr++)
goto FAILED;
}
- /* If the character following a repeat is '+', or if certain optimization
- tests above succeeded, possessive_quantifier is TRUE. For some opcodes,
- there are special alternative opcodes for this case. For anything else, we
- wrap the entire repeated item inside OP_ONCE brackets. Logically, the '+'
- notation is just syntactic sugar, taken from Sun's Java package, but the
- special opcodes can optimize it.
+ /* If the character following a repeat is '+', possessive_quantifier is
+ TRUE. For some opcodes, there are special alternative opcodes for this
+ case. For anything else, we wrap the entire repeated item inside OP_ONCE
+ brackets. Logically, the '+' notation is just syntactic sugar, taken from
+ Sun's Java package, but the special opcodes can optimize it.
Some (but not all) possessively repeated subpatterns have already been
completely handled in the code just above. For them, possessive_quantifier
- is always FALSE at this stage.
-
- Note that the repeated item starts at tempcode, not at previous, which
- might be the first part of a string whose (former) last char we repeated.
-
- Possessifying an 'exact' quantifier has no effect, so we can ignore it. But
- an 'upto' may follow. We skip over an 'exact' item, and then test the
- length of what remains before proceeding. */
+ is always FALSE at this stage. Note that the repeated item starts at
+ tempcode, not at previous, which might be the first part of a string whose
+ (former) last char we repeated. */
if (possessive_quantifier)
{
int len;
- if (*tempcode == OP_TYPEEXACT)
+ /* Possessifying an EXACT quantifier has no effect, so we can ignore it.
+ However, QUERY, STAR, or UPTO may follow (for quantifiers such as {5,6},
+ {5,}, or {5,10}). We skip over an EXACT item; if the length of what
+ remains is greater than zero, there's a further opcode that can be
+ handled. If not, do nothing, leaving the EXACT alone. */
+
+ switch(*tempcode)
+ {
+ case OP_TYPEEXACT:
tempcode += PRIV(OP_lengths)[*tempcode] +
((tempcode[1 + IMM2_SIZE] == OP_PROP
|| tempcode[1 + IMM2_SIZE] == OP_NOTPROP)? 2 : 0);
+ break;
- else if (*tempcode == OP_EXACT || *tempcode == OP_NOTEXACT)
- {
+ /* CHAR opcodes are used for exacts whose count is 1. */
+
+ case OP_CHAR:
+ case OP_CHARI:
+ case OP_NOT:
+ case OP_NOTI:
+ case OP_EXACT:
+ case OP_EXACTI:
+ case OP_NOTEXACT:
+ case OP_NOTEXACTI:
tempcode += PRIV(OP_lengths)[*tempcode];
#ifdef SUPPORT_UTF
if (utf && HAS_EXTRALEN(tempcode[-1]))
tempcode += GET_EXTRALEN(tempcode[-1]);
#endif
+ break;
+
+ /* For the class opcodes, the repeat operator appears at the end;
+ adjust tempcode to point to it. */
+
+ case OP_CLASS:
+ case OP_NCLASS:
+ tempcode += 1 + 32/sizeof(pcre_uchar);
+ break;
+
+#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
+ case OP_XCLASS:
+ tempcode += GET(tempcode, 1);
+ break;
+#endif
}
+ /* If tempcode is equal to code (which points to the end of the repeated
+ item), it means we have skipped an EXACT item but there is no following
+ QUERY, STAR, or UPTO; the value of len will be 0, and we do nothing. In
+ all other cases, tempcode will be pointing to the repeat opcode, and will
+ be less than code, so the value of len will be greater than 0. */
+
len = (int)(code - tempcode);
+ if (len > 0)
+ {
+ unsigned int repcode = *tempcode;
+
+ /* There is a table for possessifying opcodes, all of which are less
+ than OP_CALLOUT. A zero entry means there is no possessified version.
+ */
+
+ if (repcode < OP_CALLOUT && opcode_possessify[repcode] > 0)
+ *tempcode = opcode_possessify[repcode];
+
+ /* For opcode without a special possessified version, wrap the item in
+ ONCE brackets. Because we are moving code along, we must ensure that any
+ pending recursive references are updated. */
+
+ else
+ {
+ *code = OP_END;
+ adjust_recurse(tempcode, 1 + LINK_SIZE, utf, cd, save_hwm);
+ memmove(tempcode + 1 + LINK_SIZE, tempcode, IN_UCHARS(len));
+ code += 1 + LINK_SIZE;
+ len += 1 + LINK_SIZE;
+ tempcode[0] = OP_ONCE;
+ *code++ = OP_KET;
+ PUTINC(code, 0, len);
+ PUT(tempcode, 1, len);
+ }
+ }
+
+#ifdef NEVER
if (len > 0) switch (*tempcode)
{
case OP_STAR: *tempcode = OP_POSSTAR; break;
@@ -5525,6 +6333,11 @@ for (;; ptr++)
case OP_TYPEQUERY: *tempcode = OP_TYPEPOSQUERY; break;
case OP_TYPEUPTO: *tempcode = OP_TYPEPOSUPTO; break;
+ case OP_CRSTAR: *tempcode = OP_CRPOSSTAR; break;
+ case OP_CRPLUS: *tempcode = OP_CRPOSPLUS; break;
+ case OP_CRQUERY: *tempcode = OP_CRPOSQUERY; break;
+ case OP_CRRANGE: *tempcode = OP_CRPOSRANGE; break;
+
/* Because we are moving code along, we must ensure that any
pending recursive references are updated. */
@@ -5540,6 +6353,7 @@ for (;; ptr++)
PUT(tempcode, 1, len);
break;
}
+#endif
}
/* In all case we no longer have a previous item. We also set the
@@ -5728,17 +6542,16 @@ for (;; ptr++)
tempptr = ptr;
/* A condition can be an assertion, a number (referring to a numbered
- group), a name (referring to a named group), or 'R', referring to
- recursion. R<digits> and R&name are also permitted for recursion tests.
+ group's having been set), a name (referring to a named group), or 'R',
+ referring to recursion. R<digits> and R&name are also permitted for
+ recursion tests.
- There are several syntaxes for testing a named group: (?(name)) is used
- by Python; Perl 5.10 onwards uses (?(<name>) or (?('name')).
+ There are ways of testing a named group: (?(name)) is used by Python;
+ Perl 5.10 onwards uses (?(<name>) or (?('name')).
- There are two unfortunate ambiguities, caused by history. (a) 'R' can
- be the recursive thing or the name 'R' (and similarly for 'R' followed
- by digits), and (b) a number could be a name that consists of digits.
- In both cases, we look for a name first; if not found, we try the other
- cases.
+ There is one unfortunate ambiguity, caused by history. 'R' can be the
+ recursive thing or the name 'R' (and similarly for 'R' followed by
+ digits). We look for a name first; if not found, we try the other case.
For compatibility with auto-callouts, we allow a callout to be
specified before a condition that is an assertion. First, check for the
@@ -5762,8 +6575,8 @@ for (;; ptr++)
tempptr[2] == CHAR_LESS_THAN_SIGN))
break;
- /* Most other conditions use OP_CREF (a couple change to OP_RREF
- below), and all need to skip 1+IMM2_SIZE bytes at the start of the group. */
+ /* Other conditions use OP_CREF/OP_DNCREF/OP_RREF/OP_DNRREF, and all
+ need to skip at least 1+IMM2_SIZE bytes at the start of the group. */
code[1+LINK_SIZE] = OP_CREF;
skipbytes = 1+IMM2_SIZE;
@@ -5771,7 +6584,8 @@ for (;; ptr++)
/* Check for a test for recursion in a named group. */
- if (ptr[1] == CHAR_R && ptr[2] == CHAR_AMPERSAND)
+ ptr++;
+ if (*ptr == CHAR_R && ptr[1] == CHAR_AMPERSAND)
{
terminator = -1;
ptr += 2;
@@ -5779,14 +6593,15 @@ for (;; ptr++)
}
/* Check for a test for a named group's having been set, using the Perl
- syntax (?(<name>) or (?('name') */
+ syntax (?(<name>) or (?('name'), and also allow for the original PCRE
+ syntax of (?(name) or for (?(+n), (?(-n), and just (?(n). */
- else if (ptr[1] == CHAR_LESS_THAN_SIGN)
+ else if (*ptr == CHAR_LESS_THAN_SIGN)
{
terminator = CHAR_GREATER_THAN_SIGN;
ptr++;
}
- else if (ptr[1] == CHAR_APOSTROPHE)
+ else if (*ptr == CHAR_APOSTROPHE)
{
terminator = CHAR_APOSTROPHE;
ptr++;
@@ -5794,35 +6609,55 @@ for (;; ptr++)
else
{
terminator = CHAR_NULL;
- if (ptr[1] == CHAR_MINUS || ptr[1] == CHAR_PLUS) refsign = *(++ptr);
+ if (*ptr == CHAR_MINUS || *ptr == CHAR_PLUS) refsign = *ptr++;
+ else if (IS_DIGIT(*ptr)) refsign = 0;
}
- /* We now expect to read a name; any thing else is an error */
+ /* Handle a number */
- if (!MAX_255(ptr[1]) || (cd->ctypes[ptr[1]] & ctype_word) == 0)
+ if (refsign >= 0)
{
- ptr += 1; /* To get the right offset */
- *errorcodeptr = ERR28;
- goto FAILED;
+ recno = 0;
+ while (IS_DIGIT(*ptr))
+ {
+ recno = recno * 10 + (int)(*ptr - CHAR_0);
+ ptr++;
+ }
}
- /* Read the name, but also get it as a number if it's all digits */
+ /* Otherwise we expect to read a name; anything else is an error. When
+ a name is one of a number of duplicates, a different opcode is used and
+ it needs more memory. Unfortunately we cannot tell whether a name is a
+ duplicate in the first pass, so we have to allow for more memory. */
- recno = 0;
- name = ++ptr;
- while (MAX_255(*ptr) && (cd->ctypes[*ptr] & ctype_word) != 0)
+ else
{
- if (recno >= 0)
- recno = (IS_DIGIT(*ptr))? recno * 10 + (int)(*ptr - CHAR_0) : -1;
- ptr++;
+ if (IS_DIGIT(*ptr))
+ {
+ *errorcodeptr = ERR84;
+ goto FAILED;
+ }
+ if (!MAX_255(*ptr) || (cd->ctypes[*ptr] & ctype_word) == 0)
+ {
+ *errorcodeptr = ERR28; /* Assertion expected */
+ goto FAILED;
+ }
+ name = ptr++;
+ while (MAX_255(*ptr) && (cd->ctypes[*ptr] & ctype_word) != 0)
+ {
+ ptr++;
+ }
+ namelen = (int)(ptr - name);
+ if (lengthptr != NULL) *lengthptr += IMM2_SIZE;
}
- namelen = (int)(ptr - name);
+
+ /* Check the terminator */
if ((terminator > 0 && *ptr++ != (pcre_uchar)terminator) ||
*ptr++ != CHAR_RIGHT_PARENTHESIS)
{
- ptr--; /* Error offset */
- *errorcodeptr = ERR26;
+ ptr--; /* Error offset */
+ *errorcodeptr = ERR26; /* Malformed number or name */
goto FAILED;
}
@@ -5831,18 +6666,18 @@ for (;; ptr++)
if (lengthptr != NULL) break;
/* In the real compile we do the work of looking for the actual
- reference. If the string started with "+" or "-" we require the rest to
- be digits, in which case recno will be set. */
+ reference. If refsign is not negative, it means we have a number in
+ recno. */
- if (refsign > 0)
+ if (refsign >= 0)
{
if (recno <= 0)
{
- *errorcodeptr = ERR58;
+ *errorcodeptr = ERR35;
goto FAILED;
}
- recno = (refsign == CHAR_MINUS)?
- cd->bracount - recno + 1 : recno +cd->bracount;
+ if (refsign != 0) recno = (refsign == CHAR_MINUS)?
+ cd->bracount - recno + 1 : recno + cd->bracount;
if (recno <= 0 || recno > cd->final_bracount)
{
*errorcodeptr = ERR15;
@@ -5852,11 +6687,7 @@ for (;; ptr++)
break;
}
- /* Otherwise (did not start with "+" or "-"), start by looking for the
- name. If we find a name, add one to the opcode to change OP_CREF or
- OP_RREF into OP_NCREF or OP_NRREF. These behave exactly the same,
- except they record that the reference was originally to a name. The
- information is used to check duplicate names. */
+ /* Otherwise look for the name. */
slot = cd->name_table;
for (i = 0; i < cd->names_found; i++)
@@ -5865,29 +6696,40 @@ for (;; ptr++)
slot += cd->name_entry_size;
}
- /* Found a previous named subpattern */
+ /* Found the named subpattern. If the name is duplicated, add one to
+ the opcode to change CREF/RREF into DNCREF/DNRREF and insert
+ appropriate data values. Otherwise, just insert the unique subpattern
+ number. */
if (i < cd->names_found)
{
- recno = GET2(slot, 0);
- PUT2(code, 2+LINK_SIZE, recno);
- code[1+LINK_SIZE]++;
- }
-
- /* Search the pattern for a forward reference */
-
- else if ((i = find_parens(cd, name, namelen,
- (options & PCRE_EXTENDED) != 0, utf)) > 0)
- {
- PUT2(code, 2+LINK_SIZE, i);
- code[1+LINK_SIZE]++;
+ int offset = i++;
+ int count = 1;
+ recno = GET2(slot, 0); /* Number from first found */
+ for (; i < cd->names_found; i++)
+ {
+ slot += cd->name_entry_size;
+ if (STRNCMP_UC_UC(name, slot+IMM2_SIZE, namelen) != 0) break;
+ count++;
+ }
+ if (count > 1)
+ {
+ PUT2(code, 2+LINK_SIZE, offset);
+ PUT2(code, 2+LINK_SIZE+IMM2_SIZE, count);
+ skipbytes += IMM2_SIZE;
+ code[1+LINK_SIZE]++;
+ }
+ else /* Not a duplicated name */
+ {
+ PUT2(code, 2+LINK_SIZE, recno);
+ }
}
/* If terminator == CHAR_NULL it means that the name followed directly
after the opening parenthesis [e.g. (?(abc)...] and in this case there
are some further alternatives to try. For the cases where terminator !=
- 0 [things like (?(<name>... or (?('name')... or (?(R&name)... ] we have
- now checked all the possibilities, so give an error. */
+ CHAR_NULL [things like (?(<name>... or (?('name')... or (?(R&name)... ]
+ we have now checked all the possibilities, so give an error. */
else if (terminator != CHAR_NULL)
{
@@ -5924,19 +6766,11 @@ for (;; ptr++)
skipbytes = 1;
}
- /* Check for the "name" actually being a subpattern number. We are
- in the second pass here, so final_bracount is set. */
-
- else if (recno > 0 && recno <= cd->final_bracount)
- {
- PUT2(code, 2+LINK_SIZE, recno);
- }
-
- /* Either an unidentified subpattern, or a reference to (?(0) */
+ /* Reference to an unidentified subpattern. */
else
{
- *errorcodeptr = (recno == 0)? ERR35: ERR15;
+ *errorcodeptr = ERR15;
goto FAILED;
}
break;
@@ -5949,11 +6783,18 @@ for (;; ptr++)
ptr++;
break;
+ /* Optimize (?!) to (*FAIL) unless it is quantified - which is a weird
+ thing to do, but Perl allows all assertions to be quantified, and when
+ they contain capturing parentheses there may be a potential use for
+ this feature. Not that that applies to a quantified (?!) but we allow
+ it for uniformity. */
/* ------------------------------------------------------------ */
case CHAR_EXCLAMATION_MARK: /* Negative lookahead */
ptr++;
- if (*ptr == CHAR_RIGHT_PARENTHESIS) /* Optimize (?!) */
+ if (*ptr == CHAR_RIGHT_PARENTHESIS && ptr[1] != CHAR_ASTERISK &&
+ ptr[1] != CHAR_PLUS && ptr[1] != CHAR_QUESTION_MARK &&
+ (ptr[1] != CHAR_LEFT_CURLY_BRACKET || !is_counted_repeat(ptr+2)))
{
*code++ = OP_FAIL;
previous = NULL;
@@ -6046,124 +6887,110 @@ for (;; ptr++)
/* ------------------------------------------------------------ */
DEFINE_NAME: /* Come here from (?< handling */
case CHAR_APOSTROPHE:
+ terminator = (*ptr == CHAR_LESS_THAN_SIGN)?
+ CHAR_GREATER_THAN_SIGN : CHAR_APOSTROPHE;
+ name = ++ptr;
+ if (IS_DIGIT(*ptr))
{
- terminator = (*ptr == CHAR_LESS_THAN_SIGN)?
- CHAR_GREATER_THAN_SIGN : CHAR_APOSTROPHE;
- name = ++ptr;
+ *errorcodeptr = ERR84; /* Group name must start with non-digit */
+ goto FAILED;
+ }
+ while (MAX_255(*ptr) && (cd->ctypes[*ptr] & ctype_word) != 0) ptr++;
+ namelen = (int)(ptr - name);
- while (MAX_255(*ptr) && (cd->ctypes[*ptr] & ctype_word) != 0) ptr++;
- namelen = (int)(ptr - name);
+ /* In the pre-compile phase, do a syntax check, remember the longest
+ name, and then remember the group in a vector, expanding it if
+ necessary. Duplicates for the same number are skipped; other duplicates
+ are checked for validity. In the actual compile, there is nothing to
+ do. */
- /* In the pre-compile phase, just do a syntax check. */
+ if (lengthptr != NULL)
+ {
+ named_group *ng;
+ pcre_uint32 number = cd->bracount + 1;
- if (lengthptr != NULL)
+ if (*ptr != (pcre_uchar)terminator)
{
- if (*ptr != (pcre_uchar)terminator)
- {
- *errorcodeptr = ERR42;
- goto FAILED;
- }
- if (cd->names_found >= MAX_NAME_COUNT)
+ *errorcodeptr = ERR42;
+ goto FAILED;
+ }
+
+ if (cd->names_found >= MAX_NAME_COUNT)
+ {
+ *errorcodeptr = ERR49;
+ goto FAILED;
+ }
+
+ if (namelen + IMM2_SIZE + 1 > cd->name_entry_size)
+ {
+ cd->name_entry_size = namelen + IMM2_SIZE + 1;
+ if (namelen > MAX_NAME_SIZE)
{
- *errorcodeptr = ERR49;
+ *errorcodeptr = ERR48;
goto FAILED;
}
- if (namelen + IMM2_SIZE + 1 > cd->name_entry_size)
+ }
+
+ /* Scan the list to check for duplicates. For duplicate names, if the
+ number is the same, break the loop, which causes the name to be
+ discarded; otherwise, if DUPNAMES is not set, give an error.
+ If it is set, allow the name with a different number, but continue
+ scanning in case this is a duplicate with the same number. For
+ non-duplicate names, give an error if the number is duplicated. */
+
+ ng = cd->named_groups;
+ for (i = 0; i < cd->names_found; i++, ng++)
+ {
+ if (namelen == ng->length &&
+ STRNCMP_UC_UC(name, ng->name, namelen) == 0)
{
- cd->name_entry_size = namelen + IMM2_SIZE + 1;
- if (namelen > MAX_NAME_SIZE)
+ if (ng->number == number) break;
+ if ((options & PCRE_DUPNAMES) == 0)
{
- *errorcodeptr = ERR48;
+ *errorcodeptr = ERR43;
goto FAILED;
}
+ cd->dupnames = TRUE; /* Duplicate names exist */
+ }
+ else if (ng->number == number)
+ {
+ *errorcodeptr = ERR65;
+ goto FAILED;
}
}
- /* In the real compile, create the entry in the table, maintaining
- alphabetical order. Duplicate names for different numbers are
- permitted only if PCRE_DUPNAMES is set. Duplicate names for the same
- number are always OK. (An existing number can be re-used if (?|
- appears in the pattern.) In either event, a duplicate name results in
- a duplicate entry in the table, even if the number is the same. This
- is because the number of names, and hence the table size, is computed
- in the pre-compile, and it affects various numbers and pointers which
- would all have to be modified, and the compiled code moved down, if
- duplicates with the same number were omitted from the table. This
- doesn't seem worth the hassle. However, *different* names for the
- same number are not permitted. */
-
- else
+ if (i >= cd->names_found) /* Not a duplicate with same number */
{
- BOOL dupname = FALSE;
- slot = cd->name_table;
+ /* Increase the list size if necessary */
- for (i = 0; i < cd->names_found; i++)
+ if (cd->names_found >= cd->named_group_list_size)
{
- int crc = memcmp(name, slot+IMM2_SIZE, IN_UCHARS(namelen));
- if (crc == 0)
- {
- if (slot[IMM2_SIZE+namelen] == 0)
- {
- if (GET2(slot, 0) != cd->bracount + 1 &&
- (options & PCRE_DUPNAMES) == 0)
- {
- *errorcodeptr = ERR43;
- goto FAILED;
- }
- else dupname = TRUE;
- }
- else crc = -1; /* Current name is a substring */
- }
+ int newsize = cd->named_group_list_size * 2;
+ named_group *newspace = (PUBL(malloc))
+ (newsize * sizeof(named_group));
- /* Make space in the table and break the loop for an earlier
- name. For a duplicate or later name, carry on. We do this for
- duplicates so that in the simple case (when ?(| is not used) they
- are in order of their numbers. */
-
- if (crc < 0)
+ if (newspace == NULL)
{
- memmove(slot + cd->name_entry_size, slot,
- IN_UCHARS((cd->names_found - i) * cd->name_entry_size));
- break;
+ *errorcodeptr = ERR21;
+ goto FAILED;
}
- /* Continue the loop for a later or duplicate name */
-
- slot += cd->name_entry_size;
+ memcpy(newspace, cd->named_groups,
+ cd->named_group_list_size * sizeof(named_group));
+ if (cd->named_group_list_size > NAMED_GROUP_LIST_SIZE)
+ (PUBL(free))((void *)cd->named_groups);
+ cd->named_groups = newspace;
+ cd->named_group_list_size = newsize;
}
- /* For non-duplicate names, check for a duplicate number before
- adding the new name. */
-
- if (!dupname)
- {
- pcre_uchar *cslot = cd->name_table;
- for (i = 0; i < cd->names_found; i++)
- {
- if (cslot != slot)
- {
- if (GET2(cslot, 0) == cd->bracount + 1)
- {
- *errorcodeptr = ERR65;
- goto FAILED;
- }
- }
- else i--;
- cslot += cd->name_entry_size;
- }
- }
-
- PUT2(slot, 0, cd->bracount + 1);
- memcpy(slot + IMM2_SIZE, name, IN_UCHARS(namelen));
- slot[IMM2_SIZE + namelen] = 0;
+ cd->named_groups[cd->names_found].name = name;
+ cd->named_groups[cd->names_found].length = namelen;
+ cd->named_groups[cd->names_found].number = number;
+ cd->names_found++;
}
}
- /* In both pre-compile and compile, count the number of names we've
- encountered. */
-
- cd->names_found++;
- ptr++; /* Move past > or ' */
+ ptr++; /* Move past > or ' in both passes. */
goto NUMBERED_GROUP;
@@ -6181,6 +7008,11 @@ for (;; ptr++)
NAMED_REF_OR_RECURSE:
name = ++ptr;
+ if (IS_DIGIT(*ptr))
+ {
+ *errorcodeptr = ERR84; /* Group name must start with non-digit */
+ goto FAILED;
+ }
while (MAX_255(*ptr) && (cd->ctypes[*ptr] & ctype_word) != 0) ptr++;
namelen = (int)(ptr - name);
@@ -6193,7 +7025,7 @@ for (;; ptr++)
if (lengthptr != NULL)
{
- const pcre_uchar *temp;
+ named_group *ng;
if (namelen == 0)
{
@@ -6211,27 +7043,29 @@ for (;; ptr++)
goto FAILED;
}
- /* The name table does not exist in the first pass, so we cannot
- do a simple search as in the code below. Instead, we have to scan the
- pattern to find the number. It is important that we scan it only as
- far as we have got because the syntax of named subpatterns has not
- been checked for the rest of the pattern, and find_parens() assumes
- correct syntax. In any case, it's a waste of resources to scan
- further. We stop the scan at the current point by temporarily
- adjusting the value of cd->endpattern. */
-
- temp = cd->end_pattern;
- cd->end_pattern = ptr;
- recno = find_parens(cd, name, namelen,
- (options & PCRE_EXTENDED) != 0, utf);
- cd->end_pattern = temp;
- if (recno < 0) recno = 0; /* Forward ref; set dummy number */
+ /* The name table does not exist in the first pass; instead we must
+ scan the list of names encountered so far in order to get the
+ number. If the name is not found, set the value to 0 for a forward
+ reference. */
+
+ ng = cd->named_groups;
+ for (i = 0; i < cd->names_found; i++, ng++)
+ {
+ if (namelen == ng->length &&
+ STRNCMP_UC_UC(name, ng->name, namelen) == 0)
+ break;
+ }
+ recno = (i < cd->names_found)? ng->number : 0;
+
+ /* Count named back references. */
+
+ if (!is_recurse) cd->namedrefcount++;
}
- /* In the real compile, seek the name in the table. We check the name
+ /* In the real compile, search the name table. We check the name
first, and then check that we have reached the end of the name in the
- table. That way, if the name that is longer than any in the table,
- the comparison will fail without reading beyond the table entry. */
+ table. That way, if the name is longer than any in the table, the
+ comparison will fail without reading beyond the table entry. */
else
{
@@ -6244,24 +7078,76 @@ for (;; ptr++)
slot += cd->name_entry_size;
}
- if (i < cd->names_found) /* Back reference */
+ if (i < cd->names_found)
{
recno = GET2(slot, 0);
}
- else if ((recno = /* Forward back reference */
- find_parens(cd, name, namelen,
- (options & PCRE_EXTENDED) != 0, utf)) <= 0)
+ else
{
*errorcodeptr = ERR15;
goto FAILED;
}
}
- /* In both phases, we can now go to the code than handles numerical
- recursion or backreferences. */
+ /* In both phases, for recursions, we can now go to the code than
+ handles numerical recursion. */
if (is_recurse) goto HANDLE_RECURSION;
- else goto HANDLE_REFERENCE;
+
+ /* In the second pass we must see if the name is duplicated. If so, we
+ generate a different opcode. */
+
+ if (lengthptr == NULL && cd->dupnames)
+ {
+ int count = 1;
+ unsigned int index = i;
+ pcre_uchar *cslot = slot + cd->name_entry_size;
+
+ for (i++; i < cd->names_found; i++)
+ {
+ if (STRCMP_UC_UC(slot + IMM2_SIZE, cslot + IMM2_SIZE) != 0) break;
+ count++;
+ cslot += cd->name_entry_size;
+ }
+
+ if (count > 1)
+ {
+ if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
+ previous = code;
+ *code++ = ((options & PCRE_CASELESS) != 0)? OP_DNREFI : OP_DNREF;
+ PUT2INC(code, 0, index);
+ PUT2INC(code, 0, count);
+
+ /* Process each potentially referenced group. */
+
+ for (; slot < cslot; slot += cd->name_entry_size)
+ {
+ open_capitem *oc;
+ recno = GET2(slot, 0);
+ cd->backref_map |= (recno < 32)? (1 << recno) : 1;
+ if (recno > cd->top_backref) cd->top_backref = recno;
+
+ /* Check to see if this back reference is recursive, that it, it
+ is inside the group that it references. A flag is set so that the
+ group can be made atomic. */
+
+ for (oc = cd->open_caps; oc != NULL; oc = oc->next)
+ {
+ if (oc->number == recno)
+ {
+ oc->flag = TRUE;
+ break;
+ }
+ }
+ }
+
+ continue; /* End of back ref handling */
+ }
+ }
+
+ /* First pass, or a non-duplicated name. */
+
+ goto HANDLE_REFERENCE;
/* ------------------------------------------------------------ */
@@ -6360,8 +7246,7 @@ for (;; ptr++)
if (called == NULL)
{
- if (find_parens(cd, NULL, recno,
- (options & PCRE_EXTENDED) != 0, utf) < 0)
+ if (recno > cd->final_bracount)
{
*errorcodeptr = ERR15;
goto FAILED;
@@ -6520,10 +7405,19 @@ for (;; ptr++)
skipbytes = IMM2_SIZE;
}
- /* Process nested bracketed regex. Assertions used not to be repeatable,
- but this was changed for Perl compatibility, so all kinds can now be
- repeated. We copy code into a non-register variable (tempcode) in order to
- be able to pass its address because some compilers complain otherwise. */
+ /* Process nested bracketed regex. First check for parentheses nested too
+ deeply. */
+
+ if ((cd->parens_depth += 1) > PARENS_NEST_LIMIT)
+ {
+ *errorcodeptr = ERR82;
+ goto FAILED;
+ }
+
+ /* Assertions used not to be repeatable, but this was changed for Perl
+ compatibility, so all kinds can now be repeated. We copy code into a
+ non-register variable (tempcode) in order to be able to pass its address
+ because some compilers complain otherwise. */
previous = code; /* For handling repetition */
*code = bravalue;
@@ -6554,6 +7448,8 @@ for (;; ptr++)
))
goto FAILED;
+ cd->parens_depth -= 1;
+
/* If this was an atomic group and there are no capturing groups within it,
generate OP_ONCE_NC instead of OP_ONCE. */
@@ -6768,44 +7664,31 @@ for (;; ptr++)
if (escape == ESC_g)
{
const pcre_uchar *p;
+ pcre_uint32 cf;
+
save_hwm = cd->hwm; /* Normally this is set when '(' is read */
terminator = (*(++ptr) == CHAR_LESS_THAN_SIGN)?
CHAR_GREATER_THAN_SIGN : CHAR_APOSTROPHE;
/* These two statements stop the compiler for warning about possibly
unset variables caused by the jump to HANDLE_NUMERICAL_RECURSION. In
- fact, because we actually check for a number below, the paths that
+ fact, because we do the check for a number below, the paths that
would actually be in error are never taken. */
skipbytes = 0;
reset_bracount = FALSE;
- /* Test for a name */
+ /* If it's not a signed or unsigned number, treat it as a name. */
- if (ptr[1] != CHAR_PLUS && ptr[1] != CHAR_MINUS)
+ cf = ptr[1];
+ if (cf != CHAR_PLUS && cf != CHAR_MINUS && !IS_DIGIT(cf))
{
- BOOL is_a_number = TRUE;
- for (p = ptr + 1; *p != CHAR_NULL && *p != (pcre_uchar)terminator; p++)
- {
- if (!MAX_255(*p)) { is_a_number = FALSE; break; }
- if ((cd->ctypes[*p] & ctype_digit) == 0) is_a_number = FALSE;
- if ((cd->ctypes[*p] & ctype_word) == 0) break;
- }
- if (*p != (pcre_uchar)terminator)
- {
- *errorcodeptr = ERR57;
- break;
- }
- if (is_a_number)
- {
- ptr++;
- goto HANDLE_NUMERICAL_RECURSION;
- }
is_recurse = TRUE;
goto NAMED_REF_OR_RECURSE;
}
- /* Test a signed number in angle brackets or quotes. */
+ /* Signed or unsigned number (cf = ptr[1]) is known to be plus or minus
+ or a digit. */
p = ptr + 2;
while (IS_DIGIT(*p)) p++;
@@ -6845,7 +7728,10 @@ for (;; ptr++)
open_capitem *oc;
recno = -escape;
- HANDLE_REFERENCE: /* Come here from named backref handling */
+ /* Come here from named backref handling when the reference is to a
+ single group (i.e. not to a duplicated name. */
+
+ HANDLE_REFERENCE:
if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
previous = code;
*code++ = ((options & PCRE_CASELESS) != 0)? OP_REFI : OP_REF;
@@ -6942,8 +7828,8 @@ for (;; ptr++)
/* ===================================================================*/
/* Handle a literal character. It is guaranteed not to be whitespace or #
- when the extended flag is set. If we are in UTF-8 mode, it may be a
- multi-byte literal character. */
+ when the extended flag is set. If we are in a UTF mode, it may be a
+ multi-unit literal character. */
default:
NORMAL_CHAR:
@@ -6974,7 +7860,8 @@ for (;; ptr++)
*code++ = OP_PROP;
*code++ = PT_CLIST;
*code++ = c;
- if (firstcharflags == REQ_UNSET) firstcharflags = zerofirstcharflags = REQ_NONE;
+ if (firstcharflags == REQ_UNSET)
+ firstcharflags = zerofirstcharflags = REQ_NONE;
break;
}
}
@@ -7063,24 +7950,24 @@ out the amount of memory needed, as well as during the real compile phase. The
value of lengthptr distinguishes the two phases.
Arguments:
- options option bits, including any changes for this subpattern
- codeptr -> the address of the current code pointer
- ptrptr -> the address of the current pattern pointer
- errorcodeptr -> pointer to error code variable
- lookbehind TRUE if this is a lookbehind assertion
- reset_bracount TRUE to reset the count for each branch
- skipbytes skip this many bytes at start (for brackets and OP_COND)
- cond_depth depth of nesting for conditional subpatterns
- firstcharptr place to put the first required character
+ options option bits, including any changes for this subpattern
+ codeptr -> the address of the current code pointer
+ ptrptr -> the address of the current pattern pointer
+ errorcodeptr -> pointer to error code variable
+ lookbehind TRUE if this is a lookbehind assertion
+ reset_bracount TRUE to reset the count for each branch
+ skipbytes skip this many bytes at start (for brackets and OP_COND)
+ cond_depth depth of nesting for conditional subpatterns
+ firstcharptr place to put the first required character
firstcharflagsptr place to put the first character flags, or a negative number
- reqcharptr place to put the last required character
- reqcharflagsptr place to put the last required character flags, or a negative number
- bcptr pointer to the chain of currently open branches
- cd points to the data block with tables pointers etc.
- lengthptr NULL during the real compile phase
- points to length accumulator during pre-compile phase
-
-Returns: TRUE on success
+ reqcharptr place to put the last required character
+ reqcharflagsptr place to put the last required character flags, or a negative number
+ bcptr pointer to the chain of currently open branches
+ cd points to the data block with tables pointers etc.
+ lengthptr NULL during the real compile phase
+ points to length accumulator during pre-compile phase
+
+Returns: TRUE on success
*/
static BOOL
@@ -7537,9 +8424,9 @@ do {
switch (*scode)
{
case OP_CREF:
- case OP_NCREF:
+ case OP_DNCREF:
case OP_RREF:
- case OP_NRREF:
+ case OP_DNRREF:
case OP_DEF:
return FALSE;
@@ -7623,13 +8510,14 @@ return TRUE;
discarded, because they can cause conflicts with actual literals that follow.
However, if we end up without a first char setting for an unanchored pattern,
it is worth scanning the regex to see if there is an initial asserted first
-char. If all branches start with the same asserted char, or with a bracket all
-of whose alternatives start with the same asserted char (recurse ad lib), then
-we return that char, otherwise -1.
+char. If all branches start with the same asserted char, or with a
+non-conditional bracket all of whose alternatives start with the same asserted
+char (recurse ad lib), then we return that char, with the flags set to zero or
+REQ_CASELESS; otherwise return zero with REQ_NONE in the flags.
Arguments:
code points to start of expression (the bracket)
- flags points to the first char flags, or to REQ_NONE
+ flags points to the first char flags, or to REQ_NONE
inassert TRUE if in an assertion
Returns: the fixed first char, or 0 with REQ_NONE in flags
@@ -7666,7 +8554,6 @@ do {
case OP_ASSERT:
case OP_ONCE:
case OP_ONCE_NC:
- case OP_COND:
d = find_firstassertedchar(scode, &dflags, op == OP_ASSERT);
if (dflags < 0)
return 0;
@@ -7711,6 +8598,61 @@ return c;
/*************************************************
+* Add an entry to the name/number table *
+*************************************************/
+
+/* This function is called between compiling passes to add an entry to the
+name/number table, maintaining alphabetical order. Checking for permitted
+and forbidden duplicates has already been done.
+
+Arguments:
+ cd the compile data block
+ name the name to add
+ length the length of the name
+ groupno the group number
+
+Returns: nothing
+*/
+
+static void
+add_name(compile_data *cd, const pcre_uchar *name, int length,
+ unsigned int groupno)
+{
+int i;
+pcre_uchar *slot = cd->name_table;
+
+for (i = 0; i < cd->names_found; i++)
+ {
+ int crc = memcmp(name, slot+IMM2_SIZE, IN_UCHARS(length));
+ if (crc == 0 && slot[IMM2_SIZE+length] != 0)
+ crc = -1; /* Current name is a substring */
+
+ /* Make space in the table and break the loop for an earlier name. For a
+ duplicate or later name, carry on. We do this for duplicates so that in the
+ simple case (when ?(| is not used) they are in order of their numbers. In all
+ cases they are in the order in which they appear in the pattern. */
+
+ if (crc < 0)
+ {
+ memmove(slot + cd->name_entry_size, slot,
+ IN_UCHARS((cd->names_found - i) * cd->name_entry_size));
+ break;
+ }
+
+ /* Continue the loop for a later or duplicate name */
+
+ slot += cd->name_entry_size;
+ }
+
+PUT2(slot, 0, groupno);
+memcpy(slot + IMM2_SIZE, name, IN_UCHARS(length));
+slot[IMM2_SIZE + length] = 0;
+cd->names_found++;
+}
+
+
+
+/*************************************************
* Compile a Regular Expression *
*************************************************/
@@ -7797,6 +8739,11 @@ new memory is obtained from malloc(). */
pcre_uchar cworkspace[COMPILE_WORK_SIZE];
+/* This vector is used for remembering name groups during the pre-compile. In a
+similar way to cworkspace, it can be expanded using malloc() if necessary. */
+
+named_group named_groups[NAMED_GROUP_LIST_SIZE];
+
/* Set this early so that early errors get offset 0. */
ptr = (const pcre_uchar *)pattern;
@@ -7876,6 +8823,8 @@ PCRE_UTF8 == PCRE_UTF16 == PCRE_UTF32. */
{ skipatstart += 6; options |= PCRE_UTF8; continue; }
else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_UCP_RIGHTPAR, 4) == 0)
{ skipatstart += 6; options |= PCRE_UCP; continue; }
+ else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_NO_AUTO_POSSESS_RIGHTPAR, 16) == 0)
+ { skipatstart += 18; options |= PCRE_NO_AUTO_POSSESS; continue; }
else if (STRNCMP_UC_C8(ptr+skipatstart+2, STRING_NO_START_OPT_RIGHTPAR, 13) == 0)
{ skipatstart += 15; options |= PCRE_NO_START_OPTIMIZE; continue; }
@@ -8059,13 +9008,18 @@ cd->bracount = cd->final_bracount = 0;
cd->names_found = 0;
cd->name_entry_size = 0;
cd->name_table = NULL;
+cd->dupnames = FALSE;
+cd->namedrefcount = 0;
cd->start_code = cworkspace;
cd->hwm = cworkspace;
cd->start_workspace = cworkspace;
cd->workspace_size = COMPILE_WORK_SIZE;
+cd->named_groups = named_groups;
+cd->named_group_list_size = NAMED_GROUP_LIST_SIZE;
cd->start_pattern = (const pcre_uchar *)pattern;
cd->end_pattern = (const pcre_uchar *)(pattern + STRLEN_UC((const pcre_uchar *)pattern));
cd->req_varyopt = 0;
+cd->parens_depth = 0;
cd->assert_depth = 0;
cd->max_lookbehind = 0;
cd->external_options = options;
@@ -8080,6 +9034,7 @@ outside can help speed up starting point checks. */
ptr += skipatstart;
code = cworkspace;
*code = OP_BRA;
+
(void)compile_regex(cd->external_options, &code, &ptr, &errorcode, FALSE,
FALSE, 0, 0, &firstchar, &firstcharflags, &reqchar, &reqcharflags, NULL,
cd, &length);
@@ -8094,14 +9049,23 @@ if (length > MAX_PATTERN_SIZE)
goto PCRE_EARLY_ERROR_RETURN;
}
-/* Compute the size of data block needed and get it, either from malloc or
-externally provided function. Integer overflow should no longer be possible
-because nowadays we limit the maximum value of cd->names_found and
-cd->name_entry_size. */
+/* If there are groups with duplicate names and there are also references by
+name, we must allow for the possibility of named references to duplicated
+groups. These require an extra data item each. */
-size = sizeof(REAL_PCRE) + (length + cd->names_found * cd->name_entry_size) * sizeof(pcre_uchar);
-re = (REAL_PCRE *)(PUBL(malloc))(size);
+if (cd->dupnames && cd->namedrefcount > 0)
+ length += cd->namedrefcount * IMM2_SIZE * sizeof(pcre_uchar);
+
+/* Compute the size of the data block for storing the compiled pattern. Integer
+overflow should no longer be possible because nowadays we limit the maximum
+value of cd->names_found and cd->name_entry_size. */
+
+size = sizeof(REAL_PCRE) +
+ (length + cd->names_found * cd->name_entry_size) * sizeof(pcre_uchar);
+/* Get the memory. */
+
+re = (REAL_PCRE *)(PUBL(malloc))(size);
if (re == NULL)
{
errorcode = ERR21;
@@ -8142,10 +9106,10 @@ field; this time it's used for remembering forward references to subpatterns.
*/
cd->final_bracount = cd->bracount; /* Save for checking forward references */
+cd->parens_depth = 0;
cd->assert_depth = 0;
cd->bracount = 0;
cd->max_lookbehind = 0;
-cd->names_found = 0;
cd->name_table = (pcre_uchar *)re + re->name_table_offset;
codestart = cd->name_table + re->name_entry_size * re->name_count;
cd->start_code = codestart;
@@ -8156,6 +9120,20 @@ cd->had_pruneorskip = FALSE;
cd->check_lookbehind = FALSE;
cd->open_caps = NULL;
+/* If any named groups were found, create the name/number table from the list
+created in the first pass. */
+
+if (cd->names_found > 0)
+ {
+ int i = cd->names_found;
+ named_group *ng = cd->named_groups;
+ cd->names_found = 0;
+ for (; i > 0; i--, ng++)
+ add_name(cd, ng->name, ng->length, ng->number);
+ if (cd->named_group_list_size > NAMED_GROUP_LIST_SIZE)
+ (PUBL(free))((void *)cd->named_groups);
+ }
+
/* Set up a starting, non-extracting bracket, then compile the expression. On
error, errorcode will be set non-zero, so we don't need to look at the result
of the function here. */
@@ -8219,16 +9197,24 @@ if (cd->hwm > cd->start_workspace)
}
}
-/* If the workspace had to be expanded, free the new memory. */
+/* If the workspace had to be expanded, free the new memory. Set the pointer to
+NULL to indicate that forward references have been filled in. */
if (cd->workspace_size > COMPILE_WORK_SIZE)
(PUBL(free))((void *)cd->start_workspace);
+cd->start_workspace = NULL;
/* Give an error if there's back reference to a non-existent capturing
subpattern. */
if (errorcode == 0 && re->top_backref > re->top_bracket) errorcode = ERR15;
+/* Unless disabled, check whether single character iterators can be
+auto-possessified. The function overwrites the appropriate opcode values. */
+
+if ((options & PCRE_NO_AUTO_POSSESS) == 0)
+ auto_possessify((pcre_uchar *)codestart, utf, cd);
+
/* If there were any lookbehind assertions that contained OP_RECURSE
(recursions or subroutine calls), a flag is set for them to be checked here,
because they may contain forward references. Actual recursions cannot be fixed
@@ -8426,6 +9412,20 @@ if (code - codestart > length)
}
#endif /* PCRE_DEBUG */
+/* Check for a pattern than can match an empty string, so that this information
+can be provided to applications. */
+
+do
+ {
+ if (could_be_empty_branch(codestart, code, utf, cd, NULL))
+ {
+ re->flags |= PCRE_MATCH_EMPTY;
+ break;
+ }
+ codestart += GET(codestart, 1);
+ }
+while (*codestart == OP_ALT);
+
#if defined COMPILE_PCRE8
return (pcre *)re;
#elif defined COMPILE_PCRE16
@@ -8436,3 +9436,4 @@ return (pcre32 *)re;
}
/* End of pcre_compile.c */
+
diff --git a/pcre/pcre_config.c b/pcre/pcre_config.c
index 3d5689f62c3..1cbdd9c960c 100644
--- a/pcre/pcre_config.c
+++ b/pcre/pcre_config.c
@@ -161,6 +161,10 @@ switch (what)
*((int *)where) = POSIX_MALLOC_THRESHOLD;
break;
+ case PCRE_CONFIG_PARENS_LIMIT:
+ *((unsigned long int *)where) = PARENS_NEST_LIMIT;
+ break;
+
case PCRE_CONFIG_MATCH_LIMIT:
*((unsigned long int *)where) = MATCH_LIMIT;
break;
diff --git a/pcre/pcre_dfa_exec.c b/pcre/pcre_dfa_exec.c
index 02bd3f05534..4cbcf9106c4 100644
--- a/pcre/pcre_dfa_exec.c
+++ b/pcre/pcre_dfa_exec.c
@@ -120,7 +120,7 @@ static const pcre_uint8 coptable[] = {
0, 0, /* \P, \p */
0, 0, 0, 0, 0, /* \R, \H, \h, \V, \v */
0, /* \X */
- 0, 0, 0, 0, 0, 0, /* \Z, \z, ^, ^M, $, $M */
+ 0, 0, 0, 0, 0, 0, /* \Z, \z, $, $M, ^, ^M */
1, /* Char */
1, /* Chari */
1, /* not */
@@ -151,11 +151,14 @@ static const pcre_uint8 coptable[] = {
/* Character class & ref repeats */
0, 0, 0, 0, 0, 0, /* *, *?, +, +?, ?, ?? */
0, 0, /* CRRANGE, CRMINRANGE */
+ 0, 0, 0, 0, /* Possessive *+, ++, ?+, CRPOSRANGE */
0, /* CLASS */
0, /* NCLASS */
0, /* XCLASS - variable length */
0, /* REF */
0, /* REFI */
+ 0, /* DNREF */
+ 0, /* DNREFI */
0, /* RECURSE */
0, /* CALLOUT */
0, /* Alt */
@@ -171,8 +174,8 @@ static const pcre_uint8 coptable[] = {
0, 0, /* ONCE, ONCE_NC */
0, 0, 0, 0, 0, /* BRA, BRAPOS, CBRA, CBRAPOS, COND */
0, 0, 0, 0, 0, /* SBRA, SBRAPOS, SCBRA, SCBRAPOS, SCOND */
- 0, 0, /* CREF, NCREF */
- 0, 0, /* RREF, NRREF */
+ 0, 0, /* CREF, DNCREF */
+ 0, 0, /* RREF, DNRREF */
0, /* DEF */
0, 0, 0, /* BRAZERO, BRAMINZERO, BRAPOSZERO */
0, 0, 0, /* MARK, PRUNE, PRUNE_ARG */
@@ -194,7 +197,7 @@ static const pcre_uint8 poptable[] = {
1, 1, /* \P, \p */
1, 1, 1, 1, 1, /* \R, \H, \h, \V, \v */
1, /* \X */
- 0, 0, 0, 0, 0, 0, /* \Z, \z, ^, ^M, $, $M */
+ 0, 0, 0, 0, 0, 0, /* \Z, \z, $, $M, ^, ^M */
1, /* Char */
1, /* Chari */
1, /* not */
@@ -220,11 +223,14 @@ static const pcre_uint8 poptable[] = {
/* Character class & ref repeats */
1, 1, 1, 1, 1, 1, /* *, *?, +, +?, ?, ?? */
1, 1, /* CRRANGE, CRMINRANGE */
+ 1, 1, 1, 1, /* Possessive *+, ++, ?+, CRPOSRANGE */
1, /* CLASS */
1, /* NCLASS */
1, /* XCLASS - variable length */
0, /* REF */
0, /* REFI */
+ 0, /* DNREF */
+ 0, /* DNREFI */
0, /* RECURSE */
0, /* CALLOUT */
0, /* Alt */
@@ -240,8 +246,8 @@ static const pcre_uint8 poptable[] = {
0, 0, /* ONCE, ONCE_NC */
0, 0, 0, 0, 0, /* BRA, BRAPOS, CBRA, CBRAPOS, COND */
0, 0, 0, 0, 0, /* SBRA, SBRAPOS, SCBRA, SCBRAPOS, SCOND */
- 0, 0, /* CREF, NCREF */
- 0, 0, /* RREF, NRREF */
+ 0, 0, /* CREF, DNCREF */
+ 0, 0, /* RREF, DNRREF */
0, /* DEF */
0, 0, 0, /* BRAZERO, BRAMINZERO, BRAPOSZERO */
0, 0, 0, /* MARK, PRUNE, PRUNE_ARG */
@@ -1094,15 +1100,23 @@ for (;;)
PRIV(ucp_gentype)[prop->chartype] == ucp_N;
break;
- case PT_SPACE: /* Perl space */
- OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z ||
- c == CHAR_HT || c == CHAR_NL || c == CHAR_FF || c == CHAR_CR;
- break;
+ /* Perl space used to exclude VT, but from Perl 5.18 it is included,
+ which means that Perl space and POSIX space are now identical. PCRE
+ was changed at release 8.34. */
+ case PT_SPACE: /* Perl space */
case PT_PXSPACE: /* POSIX space */
- OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z ||
- c == CHAR_HT || c == CHAR_NL || c == CHAR_VT ||
- c == CHAR_FF || c == CHAR_CR;
+ switch(c)
+ {
+ HSPACE_CASES:
+ VSPACE_CASES:
+ OK = TRUE;
+ break;
+
+ default:
+ OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z;
+ break;
+ }
break;
case PT_WORD:
@@ -1344,15 +1358,23 @@ for (;;)
PRIV(ucp_gentype)[prop->chartype] == ucp_N;
break;
- case PT_SPACE: /* Perl space */
- OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z ||
- c == CHAR_HT || c == CHAR_NL || c == CHAR_FF || c == CHAR_CR;
- break;
+ /* Perl space used to exclude VT, but from Perl 5.18 it is included,
+ which means that Perl space and POSIX space are now identical. PCRE
+ was changed at release 8.34. */
+ case PT_SPACE: /* Perl space */
case PT_PXSPACE: /* POSIX space */
- OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z ||
- c == CHAR_HT || c == CHAR_NL || c == CHAR_VT ||
- c == CHAR_FF || c == CHAR_CR;
+ switch(c)
+ {
+ HSPACE_CASES:
+ VSPACE_CASES:
+ OK = TRUE;
+ break;
+
+ default:
+ OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z;
+ break;
+ }
break;
case PT_WORD:
@@ -1588,15 +1610,23 @@ for (;;)
PRIV(ucp_gentype)[prop->chartype] == ucp_N;
break;
- case PT_SPACE: /* Perl space */
- OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z ||
- c == CHAR_HT || c == CHAR_NL || c == CHAR_FF || c == CHAR_CR;
- break;
+ /* Perl space used to exclude VT, but from Perl 5.18 it is included,
+ which means that Perl space and POSIX space are now identical. PCRE
+ was changed at release 8.34. */
+ case PT_SPACE: /* Perl space */
case PT_PXSPACE: /* POSIX space */
- OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z ||
- c == CHAR_HT || c == CHAR_NL || c == CHAR_VT ||
- c == CHAR_FF || c == CHAR_CR;
+ switch(c)
+ {
+ HSPACE_CASES:
+ VSPACE_CASES:
+ OK = TRUE;
+ break;
+
+ default:
+ OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z;
+ break;
+ }
break;
case PT_WORD:
@@ -1857,15 +1887,23 @@ for (;;)
PRIV(ucp_gentype)[prop->chartype] == ucp_N;
break;
- case PT_SPACE: /* Perl space */
- OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z ||
- c == CHAR_HT || c == CHAR_NL || c == CHAR_FF || c == CHAR_CR;
- break;
+ /* Perl space used to exclude VT, but from Perl 5.18 it is included,
+ which means that Perl space and POSIX space are now identical. PCRE
+ was changed at release 8.34. */
+ case PT_SPACE: /* Perl space */
case PT_PXSPACE: /* POSIX space */
- OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z ||
- c == CHAR_HT || c == CHAR_NL || c == CHAR_VT ||
- c == CHAR_FF || c == CHAR_CR;
+ switch(c)
+ {
+ HSPACE_CASES:
+ VSPACE_CASES:
+ OK = TRUE;
+ break;
+
+ default:
+ OK = PRIV(ucp_gentype)[prop->chartype] == ucp_Z;
+ break;
+ }
break;
case PT_WORD:
@@ -2533,31 +2571,65 @@ for (;;)
{
case OP_CRSTAR:
case OP_CRMINSTAR:
+ case OP_CRPOSSTAR:
ADD_ACTIVE(next_state_offset + 1, 0);
- if (isinclass) { ADD_NEW(state_offset, 0); }
+ if (isinclass)
+ {
+ if (*ecode == OP_CRPOSSTAR)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
+ ADD_NEW(state_offset, 0);
+ }
break;
case OP_CRPLUS:
case OP_CRMINPLUS:
+ case OP_CRPOSPLUS:
count = current_state->count; /* Already matched */
if (count > 0) { ADD_ACTIVE(next_state_offset + 1, 0); }
- if (isinclass) { count++; ADD_NEW(state_offset, count); }
+ if (isinclass)
+ {
+ if (count > 0 && *ecode == OP_CRPOSPLUS)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
+ count++;
+ ADD_NEW(state_offset, count);
+ }
break;
case OP_CRQUERY:
case OP_CRMINQUERY:
+ case OP_CRPOSQUERY:
ADD_ACTIVE(next_state_offset + 1, 0);
- if (isinclass) { ADD_NEW(next_state_offset + 1, 0); }
+ if (isinclass)
+ {
+ if (*ecode == OP_CRPOSQUERY)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
+ ADD_NEW(next_state_offset + 1, 0);
+ }
break;
case OP_CRRANGE:
case OP_CRMINRANGE:
+ case OP_CRPOSRANGE:
count = current_state->count; /* Already matched */
if (count >= (int)GET2(ecode, 1))
{ ADD_ACTIVE(next_state_offset + 1 + 2 * IMM2_SIZE, 0); }
if (isinclass)
{
int max = (int)GET2(ecode, 1 + IMM2_SIZE);
+ if (*ecode == OP_CRPOSRANGE)
+ {
+ active_count--; /* Remove non-match possibility */
+ next_active_state--;
+ }
if (++count >= max && max != 0) /* Max 0 => no limit */
{ ADD_NEW(next_state_offset + 1 + 2 * IMM2_SIZE, 0); }
else
@@ -2657,9 +2729,11 @@ for (;;)
condcode = code[LINK_SIZE+1];
- /* Back reference conditions are not supported */
+ /* Back reference conditions and duplicate named recursion conditions
+ are not supported */
- if (condcode == OP_CREF || condcode == OP_NCREF)
+ if (condcode == OP_CREF || condcode == OP_DNCREF ||
+ condcode == OP_DNRREF)
return PCRE_ERROR_DFA_UCOND;
/* The DEFINE condition is always false */
@@ -2671,7 +2745,7 @@ for (;;)
which means "test if in any recursion". We can't test for specifically
recursed groups. */
- else if (condcode == OP_RREF || condcode == OP_NRREF)
+ else if (condcode == OP_RREF)
{
int value = GET2(code, LINK_SIZE + 2);
if (value != RREF_ANY) return PCRE_ERROR_DFA_UCOND;
diff --git a/pcre/pcre_exec.c b/pcre/pcre_exec.c
index ab76d020d16..a3f0c1923f2 100644
--- a/pcre/pcre_exec.c
+++ b/pcre/pcre_exec.c
@@ -107,8 +107,8 @@ because the offset vector is always a multiple of 3 long. */
/* Min and max values for the common repeats; for the maxima, 0 => infinity */
-static const char rep_min[] = { 0, 0, 1, 1, 0, 0 };
-static const char rep_max[] = { 0, 0, 0, 0, 1, 1 };
+static const char rep_min[] = { 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, };
+static const char rep_max[] = { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, };
#ifdef PCRE_DEBUG
/*************************************************
@@ -167,7 +167,7 @@ match_ref(int offset, register PCRE_PUCHAR eptr, int length, match_data *md,
{
PCRE_PUCHAR eptr_start = eptr;
register PCRE_PUCHAR p = md->start_subject + md->offset_vector[offset];
-#ifdef SUPPORT_UTF
+#if defined SUPPORT_UTF && defined SUPPORT_UCP
BOOL utf = md->utf;
#endif
@@ -195,8 +195,7 @@ ASCII characters. */
if (caseless)
{
-#ifdef SUPPORT_UTF
-#ifdef SUPPORT_UCP
+#if defined SUPPORT_UTF && defined SUPPORT_UCP
if (utf)
{
/* Match characters up to the end of the reference. NOTE: the number of
@@ -230,7 +229,6 @@ if (caseless)
}
else
#endif
-#endif
/* The same code works when not in UTF-8 mode and in UTF-8 mode when there
is no UCP support. */
@@ -312,7 +310,7 @@ enum { RM1=1, RM2, RM3, RM4, RM5, RM6, RM7, RM8, RM9, RM10,
RM31, RM32, RM33, RM34, RM35, RM36, RM37, RM38, RM39, RM40,
RM41, RM42, RM43, RM44, RM45, RM46, RM47, RM48, RM49, RM50,
RM51, RM52, RM53, RM54, RM55, RM56, RM57, RM58, RM59, RM60,
- RM61, RM62, RM63, RM64, RM65, RM66, RM67, RM68 };
+ RM61, RM62, RM63, RM64, RM65, RM66, RM67 };
/* These versions of the macros use the stack, as normal. There are debugging
versions and production versions. Note that the "rw" argument of RMATCH isn't
@@ -1173,6 +1171,7 @@ for (;;)
ecode = md->start_code + code_offset;
save_capture_last = md->capture_last;
matched_once = TRUE;
+ mstart = md->start_match_ptr; /* In case \K changed it */
continue;
}
@@ -1245,6 +1244,7 @@ for (;;)
eptr = md->end_match_ptr;
ecode = md->start_code + code_offset;
matched_once = TRUE;
+ mstart = md->start_match_ptr; /* In case \K reset it */
continue;
}
@@ -1274,25 +1274,32 @@ for (;;)
/* Control never reaches here. */
- /* Conditional group: compilation checked that there are no more than
- two branches. If the condition is false, skipping the first branch takes us
- past the end if there is only one branch, but that's OK because that is
- exactly what going to the ket would do. */
+ /* Conditional group: compilation checked that there are no more than two
+ branches. If the condition is false, skipping the first branch takes us
+ past the end of the item if there is only one branch, but that's exactly
+ what we want. */
case OP_COND:
case OP_SCOND:
- codelink = GET(ecode, 1);
+
+ /* The variable codelink will be added to ecode when the condition is
+ false, to get to the second branch. Setting it to the offset to the ALT
+ or KET, then incrementing ecode achieves this effect. We now have ecode
+ pointing to the condition or callout. */
+
+ codelink = GET(ecode, 1); /* Offset to the second branch */
+ ecode += 1 + LINK_SIZE; /* From this opcode */
/* Because of the way auto-callout works during compile, a callout item is
inserted between OP_COND and an assertion condition. */
- if (ecode[LINK_SIZE+1] == OP_CALLOUT)
+ if (*ecode == OP_CALLOUT)
{
if (PUBL(callout) != NULL)
{
PUBL(callout_block) cb;
cb.version = 2; /* Version 1 of the callout block */
- cb.callout_number = ecode[LINK_SIZE+2];
+ cb.callout_number = ecode[1];
cb.offset_vector = md->offset_vector;
#if defined COMPILE_PCRE8
cb.subject = (PCRE_SPTR)md->start_subject;
@@ -1304,8 +1311,8 @@ for (;;)
cb.subject_length = (int)(md->end_subject - md->start_subject);
cb.start_match = (int)(mstart - md->start_subject);
cb.current_position = (int)(eptr - md->start_subject);
- cb.pattern_position = GET(ecode, LINK_SIZE + 3);
- cb.next_item_length = GET(ecode, 3 + 2*LINK_SIZE);
+ cb.pattern_position = GET(ecode, 2);
+ cb.next_item_length = GET(ecode, 2 + LINK_SIZE);
cb.capture_top = offset_top/2;
cb.capture_last = md->capture_last & CAPLMASK;
/* Internal change requires this for API compatibility. */
@@ -1315,207 +1322,119 @@ for (;;)
if ((rrc = (*PUBL(callout))(&cb)) > 0) RRETURN(MATCH_NOMATCH);
if (rrc < 0) RRETURN(rrc);
}
+
+ /* Advance ecode past the callout, so it now points to the condition. We
+ must adjust codelink so that the value of ecode+codelink is unchanged. */
+
ecode += PRIV(OP_lengths)[OP_CALLOUT];
codelink -= PRIV(OP_lengths)[OP_CALLOUT];
}
- condcode = ecode[LINK_SIZE+1];
+ /* Test the various possible conditions */
- /* Now see what the actual condition is */
-
- if (condcode == OP_RREF || condcode == OP_NRREF) /* Recursion test */
+ condition = FALSE;
+ switch(condcode = *ecode)
{
- if (md->recursive == NULL) /* Not recursing => FALSE */
- {
- condition = FALSE;
- ecode += GET(ecode, 1);
- }
- else
+ case OP_RREF: /* Numbered group recursion test */
+ if (md->recursive != NULL) /* Not recursing => FALSE */
{
- unsigned int recno = GET2(ecode, LINK_SIZE + 2); /* Recursion group number*/
+ unsigned int recno = GET2(ecode, 1); /* Recursion group number*/
condition = (recno == RREF_ANY || recno == md->recursive->group_num);
+ }
+ break;
- /* If the test is for recursion into a specific subpattern, and it is
- false, but the test was set up by name, scan the table to see if the
- name refers to any other numbers, and test them. The condition is true
- if any one is set. */
-
- if (!condition && condcode == OP_NRREF)
+ case OP_DNRREF: /* Duplicate named group recursion test */
+ if (md->recursive != NULL)
+ {
+ int count = GET2(ecode, 1 + IMM2_SIZE);
+ pcre_uchar *slot = md->name_table + GET2(ecode, 1) * md->name_entry_size;
+ while (count-- > 0)
{
- pcre_uchar *slotA = md->name_table;
- for (i = 0; i < md->name_count; i++)
- {
- if (GET2(slotA, 0) == recno) break;
- slotA += md->name_entry_size;
- }
-
- /* Found a name for the number - there can be only one; duplicate
- names for different numbers are allowed, but not vice versa. First
- scan down for duplicates. */
-
- if (i < md->name_count)
- {
- pcre_uchar *slotB = slotA;
- while (slotB > md->name_table)
- {
- slotB -= md->name_entry_size;
- if (STRCMP_UC_UC(slotA + IMM2_SIZE, slotB + IMM2_SIZE) == 0)
- {
- condition = GET2(slotB, 0) == md->recursive->group_num;
- if (condition) break;
- }
- else break;
- }
-
- /* Scan up for duplicates */
-
- if (!condition)
- {
- slotB = slotA;
- for (i++; i < md->name_count; i++)
- {
- slotB += md->name_entry_size;
- if (STRCMP_UC_UC(slotA + IMM2_SIZE, slotB + IMM2_SIZE) == 0)
- {
- condition = GET2(slotB, 0) == md->recursive->group_num;
- if (condition) break;
- }
- else break;
- }
- }
- }
+ unsigned int recno = GET2(slot, 0);
+ condition = recno == md->recursive->group_num;
+ if (condition) break;
+ slot += md->name_entry_size;
}
-
- /* Chose branch according to the condition */
-
- ecode += condition? 1 + IMM2_SIZE : GET(ecode, 1);
}
- }
+ break;
- else if (condcode == OP_CREF || condcode == OP_NCREF) /* Group used test */
- {
- offset = GET2(ecode, LINK_SIZE+2) << 1; /* Doubled ref number */
+ case OP_CREF: /* Numbered group used test */
+ offset = GET2(ecode, 1) << 1; /* Doubled ref number */
condition = offset < offset_top && md->offset_vector[offset] >= 0;
+ break;
- /* If the numbered capture is unset, but the reference was by name,
- scan the table to see if the name refers to any other numbers, and test
- them. The condition is true if any one is set. This is tediously similar
- to the code above, but not close enough to try to amalgamate. */
-
- if (!condition && condcode == OP_NCREF)
+ case OP_DNCREF: /* Duplicate named group used test */
{
- unsigned int refno = offset >> 1;
- pcre_uchar *slotA = md->name_table;
-
- for (i = 0; i < md->name_count; i++)
+ int count = GET2(ecode, 1 + IMM2_SIZE);
+ pcre_uchar *slot = md->name_table + GET2(ecode, 1) * md->name_entry_size;
+ while (count-- > 0)
{
- if (GET2(slotA, 0) == refno) break;
- slotA += md->name_entry_size;
- }
-
- /* Found a name for the number - there can be only one; duplicate names
- for different numbers are allowed, but not vice versa. First scan down
- for duplicates. */
-
- if (i < md->name_count)
- {
- pcre_uchar *slotB = slotA;
- while (slotB > md->name_table)
- {
- slotB -= md->name_entry_size;
- if (STRCMP_UC_UC(slotA + IMM2_SIZE, slotB + IMM2_SIZE) == 0)
- {
- offset = GET2(slotB, 0) << 1;
- condition = offset < offset_top &&
- md->offset_vector[offset] >= 0;
- if (condition) break;
- }
- else break;
- }
-
- /* Scan up for duplicates */
-
- if (!condition)
- {
- slotB = slotA;
- for (i++; i < md->name_count; i++)
- {
- slotB += md->name_entry_size;
- if (STRCMP_UC_UC(slotA + IMM2_SIZE, slotB + IMM2_SIZE) == 0)
- {
- offset = GET2(slotB, 0) << 1;
- condition = offset < offset_top &&
- md->offset_vector[offset] >= 0;
- if (condition) break;
- }
- else break;
- }
- }
+ offset = GET2(slot, 0) << 1;
+ condition = offset < offset_top && md->offset_vector[offset] >= 0;
+ if (condition) break;
+ slot += md->name_entry_size;
}
}
+ break;
- /* Chose branch according to the condition */
-
- ecode += condition? 1 + IMM2_SIZE : GET(ecode, 1);
- }
-
- else if (condcode == OP_DEF) /* DEFINE - always false */
- {
- condition = FALSE;
- ecode += GET(ecode, 1);
- }
+ case OP_DEF: /* DEFINE - always false */
+ break;
- /* The condition is an assertion. Call match() to evaluate it - setting
- md->match_function_type to MATCH_CONDASSERT causes it to stop at the end of
- an assertion. */
+ /* The condition is an assertion. Call match() to evaluate it - setting
+ md->match_function_type to MATCH_CONDASSERT causes it to stop at the end
+ of an assertion. */
- else
- {
+ default:
md->match_function_type = MATCH_CONDASSERT;
- RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, NULL, RM3);
+ RMATCH(eptr, ecode, offset_top, md, NULL, RM3);
if (rrc == MATCH_MATCH)
{
if (md->end_offset_top > offset_top)
offset_top = md->end_offset_top; /* Captures may have happened */
condition = TRUE;
- ecode += 1 + LINK_SIZE + GET(ecode, LINK_SIZE + 2);
+
+ /* Advance ecode past the assertion to the start of the first branch,
+ but adjust it so that the general choosing code below works. */
+
+ ecode += GET(ecode, 1);
while (*ecode == OP_ALT) ecode += GET(ecode, 1);
+ ecode += 1 + LINK_SIZE - PRIV(OP_lengths)[condcode];
}
/* PCRE doesn't allow the effect of (*THEN) to escape beyond an
- assertion; it is therefore treated as NOMATCH. */
+ assertion; it is therefore treated as NOMATCH. Any other return is an
+ error. */
else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN)
{
RRETURN(rrc); /* Need braces because of following else */
}
- else
- {
- condition = FALSE;
- ecode += codelink;
- }
+ break;
}
- /* We are now at the branch that is to be obeyed. As there is only one, can
- use tail recursion to avoid using another stack frame, except when there is
- unlimited repeat of a possibly empty group. In the latter case, a recursive
- call to match() is always required, unless the second alternative doesn't
- exist, in which case we can just plough on. Note that, for compatibility
- with Perl, the | in a conditional group is NOT treated as creating two
- alternatives. If a THEN is encountered in the branch, it propagates out to
- the enclosing alternative (unless nested in a deeper set of alternatives,
- of course). */
-
- if (condition || *ecode == OP_ALT)
+ /* Choose branch according to the condition */
+
+ ecode += condition? PRIV(OP_lengths)[condcode] : codelink;
+
+ /* We are now at the branch that is to be obeyed. As there is only one, we
+ can use tail recursion to avoid using another stack frame, except when
+ there is unlimited repeat of a possibly empty group. In the latter case, a
+ recursive call to match() is always required, unless the second alternative
+ doesn't exist, in which case we can just plough on. Note that, for
+ compatibility with Perl, the | in a conditional group is NOT treated as
+ creating two alternatives. If a THEN is encountered in the branch, it
+ propagates out to the enclosing alternative (unless nested in a deeper set
+ of alternatives, of course). */
+
+ if (condition || ecode[-(1+LINK_SIZE)] == OP_ALT)
{
if (op != OP_SCOND)
{
- ecode += 1 + LINK_SIZE;
goto TAIL_RECURSE;
}
md->match_function_type = MATCH_CBEGROUP;
- RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, eptrb, RM49);
+ RMATCH(eptr, ecode, offset_top, md, eptrb, RM49);
RRETURN(rrc);
}
@@ -1523,7 +1442,6 @@ for (;;)
else
{
- ecode += 1 + LINK_SIZE;
}
break;
@@ -2089,6 +2007,7 @@ for (;;)
if (*ecode == OP_KETRPOS)
{
+ md->start_match_ptr = mstart; /* In case \K reset it */
md->end_match_ptr = eptr;
md->end_offset_top = offset_top;
RRETURN(MATCH_KETRPOS);
@@ -2656,19 +2575,24 @@ for (;;)
RRETURN(MATCH_NOMATCH);
break;
- case PT_SPACE: /* Perl space */
- if ((PRIV(ucp_gentype)[prop->chartype] == ucp_Z ||
- c == CHAR_HT || c == CHAR_NL || c == CHAR_FF || c == CHAR_CR)
- == (op == OP_NOTPROP))
- RRETURN(MATCH_NOMATCH);
- break;
+ /* Perl space used to exclude VT, but from Perl 5.18 it is included,
+ which means that Perl space and POSIX space are now identical. PCRE
+ was changed at release 8.34. */
+ case PT_SPACE: /* Perl space */
case PT_PXSPACE: /* POSIX space */
- if ((PRIV(ucp_gentype)[prop->chartype] == ucp_Z ||
- c == CHAR_HT || c == CHAR_NL || c == CHAR_VT ||
- c == CHAR_FF || c == CHAR_CR)
- == (op == OP_NOTPROP))
- RRETURN(MATCH_NOMATCH);
+ switch(c)
+ {
+ HSPACE_CASES:
+ VSPACE_CASES:
+ if (op == OP_NOTPROP) RRETURN(MATCH_NOMATCH);
+ break;
+
+ default:
+ if ((PRIV(ucp_gentype)[prop->chartype] == ucp_Z) ==
+ (op == OP_NOTPROP)) RRETURN(MATCH_NOMATCH);
+ break;
+ }
break;
case PT_WORD:
@@ -2742,15 +2666,7 @@ for (;;)
similar code to character type repeats - written out again for speed.
However, if the referenced string is the empty string, always treat
it as matched, any number of times (otherwise there could be infinite
- loops). */
-
- case OP_REF:
- case OP_REFI:
- caseless = op == OP_REFI;
- offset = GET2(ecode, 1) << 1; /* Doubled ref number */
- ecode += 1 + IMM2_SIZE;
-
- /* If the reference is unset, there are two possibilities:
+ loops). If the reference is unset, there are two possibilities:
(a) In the default, Perl-compatible state, set the length negative;
this ensures that every attempt at a match fails. We can't just fail
@@ -2760,8 +2676,39 @@ for (;;)
so that the back reference matches an empty string.
Otherwise, set the length to the length of what was matched by the
- referenced subpattern. */
+ referenced subpattern.
+
+ The OP_REF and OP_REFI opcodes are used for a reference to a numbered group
+ or to a non-duplicated named group. For a duplicated named group, OP_DNREF
+ and OP_DNREFI are used. In this case we must scan the list of groups to
+ which the name refers, and use the first one that is set. */
+
+ case OP_DNREF:
+ case OP_DNREFI:
+ caseless = op == OP_DNREFI;
+ {
+ int count = GET2(ecode, 1+IMM2_SIZE);
+ pcre_uchar *slot = md->name_table + GET2(ecode, 1) * md->name_entry_size;
+ ecode += 1 + 2*IMM2_SIZE;
+
+ while (count-- > 0)
+ {
+ offset = GET2(slot, 0) << 1;
+ if (offset < offset_top && md->offset_vector[offset] >= 0) break;
+ slot += md->name_entry_size;
+ }
+ if (count < 0)
+ length = (md->jscript_compat)? 0 : -1;
+ else
+ length = md->offset_vector[offset+1] - md->offset_vector[offset];
+ }
+ goto REF_REPEAT;
+ case OP_REF:
+ case OP_REFI:
+ caseless = op == OP_REFI;
+ offset = GET2(ecode, 1) << 1; /* Doubled ref number */
+ ecode += 1 + IMM2_SIZE;
if (offset >= offset_top || md->offset_vector[offset] < 0)
length = (md->jscript_compat)? 0 : -1;
else
@@ -2769,6 +2716,7 @@ for (;;)
/* Set up for repetition, or handle the non-repeated case */
+ REF_REPEAT:
switch (*ecode)
{
case OP_CRSTAR:
@@ -2917,8 +2865,12 @@ for (;;)
case OP_CRMINPLUS:
case OP_CRQUERY:
case OP_CRMINQUERY:
+ case OP_CRPOSSTAR:
+ case OP_CRPOSPLUS:
+ case OP_CRPOSQUERY:
c = *ecode++ - OP_CRSTAR;
- minimize = (c & 1) != 0;
+ if (c < OP_CRPOSSTAR - OP_CRSTAR) minimize = (c & 1) != 0;
+ else possessive = TRUE;
min = rep_min[c]; /* Pick up values from tables; */
max = rep_max[c]; /* zero for max => infinity */
if (max == 0) max = INT_MAX;
@@ -2926,7 +2878,9 @@ for (;;)
case OP_CRRANGE:
case OP_CRMINRANGE:
+ case OP_CRPOSRANGE:
minimize = (*ecode == OP_CRMINRANGE);
+ possessive = (*ecode == OP_CRPOSRANGE);
min = GET2(ecode, 1);
max = GET2(ecode, 1 + IMM2_SIZE);
if (max == 0) max = INT_MAX;
@@ -3068,6 +3022,9 @@ for (;;)
if ((BYTE_MAP[c/8] & (1 << (c&7))) == 0) break;
eptr += len;
}
+
+ if (possessive) continue; /* No backtracking */
+
for (;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM18);
@@ -3098,6 +3055,9 @@ for (;;)
if ((BYTE_MAP[c/8] & (1 << (c&7))) == 0) break;
eptr++;
}
+
+ if (possessive) continue; /* No backtracking */
+
while (eptr >= pp)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM19);
@@ -3113,9 +3073,10 @@ for (;;)
/* Control never gets here */
- /* Match an extended character class. This opcode is encountered only
- when UTF-8 mode mode is supported. Nevertheless, we may not be in UTF-8
- mode, because Unicode properties are supported in non-UTF-8 mode. */
+ /* Match an extended character class. In the 8-bit library, this opcode is
+ encountered only when UTF-8 mode mode is supported. In the 16-bit and
+ 32-bit libraries, codepoints greater than 255 may be encountered even when
+ UTF is not supported. */
#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
case OP_XCLASS:
@@ -3131,8 +3092,12 @@ for (;;)
case OP_CRMINPLUS:
case OP_CRQUERY:
case OP_CRMINQUERY:
+ case OP_CRPOSSTAR:
+ case OP_CRPOSPLUS:
+ case OP_CRPOSQUERY:
c = *ecode++ - OP_CRSTAR;
- minimize = (c & 1) != 0;
+ if (c < OP_CRPOSSTAR - OP_CRSTAR) minimize = (c & 1) != 0;
+ else possessive = TRUE;
min = rep_min[c]; /* Pick up values from tables; */
max = rep_max[c]; /* zero for max => infinity */
if (max == 0) max = INT_MAX;
@@ -3140,7 +3105,9 @@ for (;;)
case OP_CRRANGE:
case OP_CRMINRANGE:
+ case OP_CRPOSRANGE:
minimize = (*ecode == OP_CRMINRANGE);
+ possessive = (*ecode == OP_CRPOSRANGE);
min = GET2(ecode, 1);
max = GET2(ecode, 1 + IMM2_SIZE);
if (max == 0) max = INT_MAX;
@@ -3212,6 +3179,9 @@ for (;;)
if (!PRIV(xclass)(c, data, utf)) break;
eptr += len;
}
+
+ if (possessive) continue; /* No backtracking */
+
for(;;)
{
RMATCH(eptr, ecode, offset_top, md, eptrb, RM21);
@@ -3590,7 +3560,6 @@ for (;;)
if (fc != cc && foc != cc) break;
eptr++;
}
-
if (possessive) continue; /* No backtracking */
for (;;)
{
@@ -3599,9 +3568,8 @@ for (;;)
eptr--;
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
}
- RRETURN(MATCH_NOMATCH);
+ /* Control never gets here */
}
- /* Control never gets here */
}
/* Caseful comparisons (includes all multi-byte characters) */
@@ -3657,7 +3625,7 @@ for (;;)
eptr--;
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
}
- RRETURN(MATCH_NOMATCH);
+ /* Control never gets here */
}
}
/* Control never gets here */
@@ -3942,10 +3910,8 @@ for (;;)
eptr--;
}
}
-
- RRETURN(MATCH_NOMATCH);
+ /* Control never gets here */
}
- /* Control never gets here */
}
/* Caseful comparisons */
@@ -4079,8 +4045,7 @@ for (;;)
eptr--;
}
}
-
- RRETURN(MATCH_NOMATCH);
+ /* Control never gets here */
}
}
/* Control never gets here */
@@ -4262,7 +4227,12 @@ for (;;)
}
break;
+ /* Perl space used to exclude VT, but from Perl 5.18 it is included,
+ which means that Perl space and POSIX space are now identical. PCRE
+ was changed at release 8.34. */
+
case PT_SPACE: /* Perl space */
+ case PT_PXSPACE: /* POSIX space */
for (i = 1; i <= min; i++)
{
if (eptr >= md->end_subject)
@@ -4271,26 +4241,18 @@ for (;;)
RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
- if ((UCD_CATEGORY(c) == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
- c == CHAR_FF || c == CHAR_CR)
- == prop_fail_result)
- RRETURN(MATCH_NOMATCH);
- }
- break;
-
- case PT_PXSPACE: /* POSIX space */
- for (i = 1; i <= min; i++)
- {
- if (eptr >= md->end_subject)
+ switch(c)
{
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
+ HSPACE_CASES:
+ VSPACE_CASES:
+ if (prop_fail_result) RRETURN(MATCH_NOMATCH);
+ break;
+
+ default:
+ if ((UCD_CATEGORY(c) == ucp_Z) == prop_fail_result)
+ RRETURN(MATCH_NOMATCH);
+ break;
}
- GETCHARINCTEST(c, eptr);
- if ((UCD_CATEGORY(c) == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
- c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)
- == prop_fail_result)
- RRETURN(MATCH_NOMATCH);
}
break;
@@ -5010,25 +4972,11 @@ for (;;)
}
/* Control never gets here */
- case PT_SPACE: /* Perl space */
- for (fi = min;; fi++)
- {
- RMATCH(eptr, ecode, offset_top, md, eptrb, RM60);
- if (rrc != MATCH_NOMATCH) RRETURN(rrc);
- if (fi >= max) RRETURN(MATCH_NOMATCH);
- if (eptr >= md->end_subject)
- {
- SCHECK_PARTIAL();
- RRETURN(MATCH_NOMATCH);
- }
- GETCHARINCTEST(c, eptr);
- if ((UCD_CATEGORY(c) == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
- c == CHAR_FF || c == CHAR_CR)
- == prop_fail_result)
- RRETURN(MATCH_NOMATCH);
- }
- /* Control never gets here */
+ /* Perl space used to exclude VT, but from Perl 5.18 it is included,
+ which means that Perl space and POSIX space are now identical. PCRE
+ was changed at release 8.34. */
+ case PT_SPACE: /* Perl space */
case PT_PXSPACE: /* POSIX space */
for (fi = min;; fi++)
{
@@ -5041,10 +4989,18 @@ for (;;)
RRETURN(MATCH_NOMATCH);
}
GETCHARINCTEST(c, eptr);
- if ((UCD_CATEGORY(c) == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
- c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)
- == prop_fail_result)
- RRETURN(MATCH_NOMATCH);
+ switch(c)
+ {
+ HSPACE_CASES:
+ VSPACE_CASES:
+ if (prop_fail_result) RRETURN(MATCH_NOMATCH);
+ break;
+
+ default:
+ if ((UCD_CATEGORY(c) == ucp_Z) == prop_fail_result)
+ RRETURN(MATCH_NOMATCH);
+ break;
+ }
}
/* Control never gets here */
@@ -5097,7 +5053,7 @@ for (;;)
case PT_UCNC:
for (fi = min;; fi++)
{
- RMATCH(eptr, ecode, offset_top, md, eptrb, RM68);
+ RMATCH(eptr, ecode, offset_top, md, eptrb, RM60);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
if (fi >= max) RRETURN(MATCH_NOMATCH);
if (eptr >= md->end_subject)
@@ -5528,7 +5484,12 @@ for (;;)
}
break;
+ /* Perl space used to exclude VT, but from Perl 5.18 it is included,
+ which means that Perl space and POSIX space are now identical. PCRE
+ was changed at release 8.34. */
+
case PT_SPACE: /* Perl space */
+ case PT_PXSPACE: /* POSIX space */
for (i = min; i < max; i++)
{
int len = 1;
@@ -5538,30 +5499,21 @@ for (;;)
break;
}
GETCHARLENTEST(c, eptr, len);
- if ((UCD_CATEGORY(c) == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
- c == CHAR_FF || c == CHAR_CR)
- == prop_fail_result)
+ switch(c)
+ {
+ HSPACE_CASES:
+ VSPACE_CASES:
+ if (prop_fail_result) goto ENDLOOP99; /* Break the loop */
break;
- eptr+= len;
- }
- break;
- case PT_PXSPACE: /* POSIX space */
- for (i = min; i < max; i++)
- {
- int len = 1;
- if (eptr >= md->end_subject)
- {
- SCHECK_PARTIAL();
+ default:
+ if ((UCD_CATEGORY(c) == ucp_Z) == prop_fail_result)
+ goto ENDLOOP99; /* Break the loop */
break;
}
- GETCHARLENTEST(c, eptr, len);
- if ((UCD_CATEGORY(c) == ucp_Z || c == CHAR_HT || c == CHAR_NL ||
- c == CHAR_VT || c == CHAR_FF || c == CHAR_CR)
- == prop_fail_result)
- break;
eptr+= len;
}
+ ENDLOOP99:
break;
case PT_WORD:
@@ -5642,7 +5594,7 @@ for (;;)
}
}
- /* Match extended Unicode sequences. We will get here only if the
+ /* Match extended Unicode grapheme clusters. We will get here only if the
support is in the binary; otherwise a compile-time error occurs. */
else if (ctype == OP_EXTUNI)
@@ -5675,21 +5627,41 @@ for (;;)
/* eptr is now past the end of the maximum run */
if (possessive) continue; /* No backtracking */
+
for(;;)
{
- if (eptr == pp) goto TAIL_RECURSE;
+ int lgb, rgb;
+ PCRE_PUCHAR fptr;
+
+ if (eptr == pp) goto TAIL_RECURSE; /* At start of char run */
RMATCH(eptr, ecode, offset_top, md, eptrb, RM45);
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+
+ /* Backtracking over an extended grapheme cluster involves inspecting
+ the previous two characters (if present) to see if a break is
+ permitted between them. */
+
eptr--;
- for (;;) /* Move back over one extended */
+ if (!utf) c = *eptr; else
+ {
+ BACKCHAR(eptr);
+ GETCHAR(c, eptr);
+ }
+ rgb = UCD_GRAPHBREAK(c);
+
+ for (;;)
{
- if (!utf) c = *eptr; else
+ if (eptr == pp) goto TAIL_RECURSE; /* At start of char run */
+ fptr = eptr - 1;
+ if (!utf) c = *fptr; else
{
- BACKCHAR(eptr);
- GETCHAR(c, eptr);
+ BACKCHAR(fptr);
+ GETCHAR(c, fptr);
}
- if (UCD_CATEGORY(c) != ucp_M) break;
- eptr--;
+ lgb = UCD_GRAPHBREAK(c);
+ if ((PRIV(ucp_gbtable)[lgb] & (1 << rgb)) == 0) break;
+ eptr = fptr;
+ rgb = lgb;
}
}
}
@@ -6211,11 +6183,8 @@ for (;;)
}
}
- /* Get here if we can't make it match with any permitted repetitions */
-
- RRETURN(MATCH_NOMATCH);
+ /* Control never gets here */
}
- /* Control never gets here */
/* There's been some horrible disaster. Arrival here can only mean there is
something seriously wrong in the code above or the OP_xxx definitions. */
@@ -6249,15 +6218,15 @@ switch (frame->Xwhere)
LBL(53) LBL(54) LBL(55) LBL(56) LBL(57) LBL(58) LBL(63) LBL(64)
LBL(65) LBL(66)
#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
- LBL(21)
+ LBL(20) LBL(21)
#endif
#ifdef SUPPORT_UTF
- LBL(16) LBL(18) LBL(20)
+ LBL(16) LBL(18)
LBL(22) LBL(23) LBL(28) LBL(30)
LBL(32) LBL(34) LBL(42) LBL(46)
#ifdef SUPPORT_UCP
LBL(36) LBL(37) LBL(38) LBL(39) LBL(40) LBL(41) LBL(44) LBL(45)
- LBL(59) LBL(60) LBL(61) LBL(62) LBL(67) LBL(68)
+ LBL(59) LBL(60) LBL(61) LBL(62) LBL(67)
#endif /* SUPPORT_UCP */
#endif /* SUPPORT_UTF */
default:
@@ -6410,7 +6379,7 @@ const pcre_uint8 *start_bits = NULL;
PCRE_PUCHAR start_match = (PCRE_PUCHAR)subject + start_offset;
PCRE_PUCHAR end_subject;
PCRE_PUCHAR start_partial = NULL;
-PCRE_PUCHAR match_partial;
+PCRE_PUCHAR match_partial = NULL;
PCRE_PUCHAR req_char_ptr = start_match - 1;
const pcre_study_data *study;
@@ -7178,7 +7147,7 @@ if (rc != MATCH_NOMATCH && rc != PCRE_ERROR_PARTIAL)
/* Handle partial matches - disable any mark data */
-if (start_partial != NULL)
+if (match_partial != NULL)
{
DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n"));
md->mark = NULL;
diff --git a/pcre/pcre_fullinfo.c b/pcre/pcre_fullinfo.c
index c4eb5c0e1ad..a6c2ece6ca5 100644
--- a/pcre/pcre_fullinfo.c
+++ b/pcre/pcre_fullinfo.c
@@ -232,6 +232,10 @@ switch (what)
*((pcre_uint32 *)where) = re->limit_recursion;
break;
+ case PCRE_INFO_MATCH_EMPTY:
+ *((int *)where) = (re->flags & PCRE_MATCH_EMPTY) != 0;
+ break;
+
default: return PCRE_ERROR_BADOPTION;
}
diff --git a/pcre/pcre_internal.h b/pcre/pcre_internal.h
index 307069ca9d6..0b9798c5541 100644
--- a/pcre/pcre_internal.h
+++ b/pcre/pcre_internal.h
@@ -1149,6 +1149,7 @@ compatibility. */
#define PCRE_HASTHEN 0x00001000 /* pattern contains (*THEN) */
#define PCRE_MLSET 0x00002000 /* match limit set by regex */
#define PCRE_RLSET 0x00004000 /* recursion limit set by regex */
+#define PCRE_MATCH_EMPTY 0x00008000 /* pattern can match empty string */
#if defined COMPILE_PCRE8
#define PCRE_MODE PCRE_MODE8
@@ -1173,7 +1174,8 @@ time, run time, or study time, respectively. */
#define PUBLIC_COMPILE_OPTIONS \
(PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \
PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8| \
- PCRE_NO_AUTO_CAPTURE|PCRE_NO_UTF8_CHECK|PCRE_AUTO_CALLOUT|PCRE_FIRSTLINE| \
+ PCRE_NO_AUTO_CAPTURE|PCRE_NO_AUTO_POSSESS| \
+ PCRE_NO_UTF8_CHECK|PCRE_AUTO_CALLOUT|PCRE_FIRSTLINE| \
PCRE_DUPNAMES|PCRE_NEWLINE_BITS|PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE| \
PCRE_JAVASCRIPT_COMPAT|PCRE_UCP|PCRE_NO_START_OPTIMIZE|PCRE_NEVER_UTF)
@@ -1531,22 +1533,25 @@ a positive value. */
#define STRING_xdigit "xdigit"
#define STRING_DEFINE "DEFINE"
-
-#define STRING_CR_RIGHTPAR "CR)"
-#define STRING_LF_RIGHTPAR "LF)"
-#define STRING_CRLF_RIGHTPAR "CRLF)"
-#define STRING_ANY_RIGHTPAR "ANY)"
-#define STRING_ANYCRLF_RIGHTPAR "ANYCRLF)"
-#define STRING_BSR_ANYCRLF_RIGHTPAR "BSR_ANYCRLF)"
-#define STRING_BSR_UNICODE_RIGHTPAR "BSR_UNICODE)"
-#define STRING_UTF8_RIGHTPAR "UTF8)"
-#define STRING_UTF16_RIGHTPAR "UTF16)"
-#define STRING_UTF32_RIGHTPAR "UTF32)"
-#define STRING_UTF_RIGHTPAR "UTF)"
-#define STRING_UCP_RIGHTPAR "UCP)"
-#define STRING_NO_START_OPT_RIGHTPAR "NO_START_OPT)"
-#define STRING_LIMIT_MATCH_EQ "LIMIT_MATCH="
-#define STRING_LIMIT_RECURSION_EQ "LIMIT_RECURSION="
+#define STRING_WEIRD_STARTWORD "[:<:]]"
+#define STRING_WEIRD_ENDWORD "[:>:]]"
+
+#define STRING_CR_RIGHTPAR "CR)"
+#define STRING_LF_RIGHTPAR "LF)"
+#define STRING_CRLF_RIGHTPAR "CRLF)"
+#define STRING_ANY_RIGHTPAR "ANY)"
+#define STRING_ANYCRLF_RIGHTPAR "ANYCRLF)"
+#define STRING_BSR_ANYCRLF_RIGHTPAR "BSR_ANYCRLF)"
+#define STRING_BSR_UNICODE_RIGHTPAR "BSR_UNICODE)"
+#define STRING_UTF8_RIGHTPAR "UTF8)"
+#define STRING_UTF16_RIGHTPAR "UTF16)"
+#define STRING_UTF32_RIGHTPAR "UTF32)"
+#define STRING_UTF_RIGHTPAR "UTF)"
+#define STRING_UCP_RIGHTPAR "UCP)"
+#define STRING_NO_AUTO_POSSESS_RIGHTPAR "NO_AUTO_POSSESS)"
+#define STRING_NO_START_OPT_RIGHTPAR "NO_START_OPT)"
+#define STRING_LIMIT_MATCH_EQ "LIMIT_MATCH="
+#define STRING_LIMIT_RECURSION_EQ "LIMIT_RECURSION="
#else /* SUPPORT_UTF */
@@ -1794,22 +1799,25 @@ only. */
#define STRING_xdigit STR_x STR_d STR_i STR_g STR_i STR_t
#define STRING_DEFINE STR_D STR_E STR_F STR_I STR_N STR_E
-
-#define STRING_CR_RIGHTPAR STR_C STR_R STR_RIGHT_PARENTHESIS
-#define STRING_LF_RIGHTPAR STR_L STR_F STR_RIGHT_PARENTHESIS
-#define STRING_CRLF_RIGHTPAR STR_C STR_R STR_L STR_F STR_RIGHT_PARENTHESIS
-#define STRING_ANY_RIGHTPAR STR_A STR_N STR_Y STR_RIGHT_PARENTHESIS
-#define STRING_ANYCRLF_RIGHTPAR STR_A STR_N STR_Y STR_C STR_R STR_L STR_F STR_RIGHT_PARENTHESIS
-#define STRING_BSR_ANYCRLF_RIGHTPAR STR_B STR_S STR_R STR_UNDERSCORE STR_A STR_N STR_Y STR_C STR_R STR_L STR_F STR_RIGHT_PARENTHESIS
-#define STRING_BSR_UNICODE_RIGHTPAR STR_B STR_S STR_R STR_UNDERSCORE STR_U STR_N STR_I STR_C STR_O STR_D STR_E STR_RIGHT_PARENTHESIS
-#define STRING_UTF8_RIGHTPAR STR_U STR_T STR_F STR_8 STR_RIGHT_PARENTHESIS
-#define STRING_UTF16_RIGHTPAR STR_U STR_T STR_F STR_1 STR_6 STR_RIGHT_PARENTHESIS
-#define STRING_UTF32_RIGHTPAR STR_U STR_T STR_F STR_3 STR_2 STR_RIGHT_PARENTHESIS
-#define STRING_UTF_RIGHTPAR STR_U STR_T STR_F STR_RIGHT_PARENTHESIS
-#define STRING_UCP_RIGHTPAR STR_U STR_C STR_P STR_RIGHT_PARENTHESIS
-#define STRING_NO_START_OPT_RIGHTPAR STR_N STR_O STR_UNDERSCORE STR_S STR_T STR_A STR_R STR_T STR_UNDERSCORE STR_O STR_P STR_T STR_RIGHT_PARENTHESIS
-#define STRING_LIMIT_MATCH_EQ STR_L STR_I STR_M STR_I STR_T STR_UNDERSCORE STR_M STR_A STR_T STR_C STR_H STR_EQUALS_SIGN
-#define STRING_LIMIT_RECURSION_EQ STR_L STR_I STR_M STR_I STR_T STR_UNDERSCORE STR_R STR_E STR_C STR_U STR_R STR_S STR_I STR_O STR_N STR_EQUALS_SIGN
+#define STRING_WEIRD_STARTWORD STR_LEFT_SQUARE_BRACKET STR_COLON STR_LESS_THAN_SIGN STR_COLON STR_RIGHT_SQUARE_BRACKET STR_RIGHT_SQUARE_BRACKET
+#define STRING_WEIRD_ENDWORD STR_LEFT_SQUARE_BRACKET STR_COLON STR_GREATER_THAN_SIGN STR_COLON STR_RIGHT_SQUARE_BRACKET STR_RIGHT_SQUARE_BRACKET
+
+#define STRING_CR_RIGHTPAR STR_C STR_R STR_RIGHT_PARENTHESIS
+#define STRING_LF_RIGHTPAR STR_L STR_F STR_RIGHT_PARENTHESIS
+#define STRING_CRLF_RIGHTPAR STR_C STR_R STR_L STR_F STR_RIGHT_PARENTHESIS
+#define STRING_ANY_RIGHTPAR STR_A STR_N STR_Y STR_RIGHT_PARENTHESIS
+#define STRING_ANYCRLF_RIGHTPAR STR_A STR_N STR_Y STR_C STR_R STR_L STR_F STR_RIGHT_PARENTHESIS
+#define STRING_BSR_ANYCRLF_RIGHTPAR STR_B STR_S STR_R STR_UNDERSCORE STR_A STR_N STR_Y STR_C STR_R STR_L STR_F STR_RIGHT_PARENTHESIS
+#define STRING_BSR_UNICODE_RIGHTPAR STR_B STR_S STR_R STR_UNDERSCORE STR_U STR_N STR_I STR_C STR_O STR_D STR_E STR_RIGHT_PARENTHESIS
+#define STRING_UTF8_RIGHTPAR STR_U STR_T STR_F STR_8 STR_RIGHT_PARENTHESIS
+#define STRING_UTF16_RIGHTPAR STR_U STR_T STR_F STR_1 STR_6 STR_RIGHT_PARENTHESIS
+#define STRING_UTF32_RIGHTPAR STR_U STR_T STR_F STR_3 STR_2 STR_RIGHT_PARENTHESIS
+#define STRING_UTF_RIGHTPAR STR_U STR_T STR_F STR_RIGHT_PARENTHESIS
+#define STRING_UCP_RIGHTPAR STR_U STR_C STR_P STR_RIGHT_PARENTHESIS
+#define STRING_NO_AUTO_POSSESS_RIGHTPAR STR_N STR_O STR_UNDERSCORE STR_A STR_U STR_T STR_O STR_UNDERSCORE STR_P STR_O STR_S STR_S STR_E STR_S STR_S STR_RIGHT_PARENTHESIS
+#define STRING_NO_START_OPT_RIGHTPAR STR_N STR_O STR_UNDERSCORE STR_S STR_T STR_A STR_R STR_T STR_UNDERSCORE STR_O STR_P STR_T STR_RIGHT_PARENTHESIS
+#define STRING_LIMIT_MATCH_EQ STR_L STR_I STR_M STR_I STR_T STR_UNDERSCORE STR_M STR_A STR_T STR_C STR_H STR_EQUALS_SIGN
+#define STRING_LIMIT_RECURSION_EQ STR_L STR_I STR_M STR_I STR_T STR_UNDERSCORE STR_R STR_E STR_C STR_U STR_R STR_S STR_I STR_O STR_N STR_EQUALS_SIGN
#endif /* SUPPORT_UTF */
@@ -1851,6 +1859,17 @@ only. */
#define PT_WORD 8 /* Word - L plus N plus underscore */
#define PT_CLIST 9 /* Pseudo-property: match character list */
#define PT_UCNC 10 /* Universal Character nameable character */
+#define PT_TABSIZE 11 /* Size of square table for autopossessify tests */
+
+/* The following special properties are used only in XCLASS items, when POSIX
+classes are specified and PCRE_UCP is set - in other words, for Unicode
+handling of these classes. They are not available via the \p or \P escapes like
+those in the above list, and so they do not take part in the autopossessifying
+table. */
+
+#define PT_PXGRAPH 11 /* [:graph:] - characters that mark the paper */
+#define PT_PXPRINT 12 /* [:print:] - [:graph:] plus non-control spaces */
+#define PT_PXPUNCT 13 /* [:punct:] - punctuation characters */
/* Flag bits and data types for the extended class (OP_XCLASS) for classes that
contain characters with values greater than 255. */
@@ -1865,9 +1884,9 @@ contain characters with values greater than 255. */
#define XCL_NOTPROP 4 /* Unicode inverted property (ditto) */
/* These are escaped items that aren't just an encoding of a particular data
-value such as \n. They must have non-zero values, as check_escape() returns
-0 for a data character. Also, they must appear in the same order as in the opcode
-definitions below, up to ESC_z. There's a dummy for OP_ALLANY because it
+value such as \n. They must have non-zero values, as check_escape() returns 0
+for a data character. Also, they must appear in the same order as in the
+opcode definitions below, up to ESC_z. There's a dummy for OP_ALLANY because it
corresponds to "." in DOTALL mode rather than an escape sequence. It is also
used for [^] in JavaScript compatibility mode, and for \C in non-utf mode. In
non-DOTALL mode, "." behaves like \N.
@@ -1890,12 +1909,31 @@ enum { ESC_A = 1, ESC_G, ESC_K, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s,
ESC_E, ESC_Q, ESC_g, ESC_k,
ESC_DU, ESC_du, ESC_SU, ESC_su, ESC_WU, ESC_wu };
-/* Opcode table: Starting from 1 (i.e. after OP_END), the values up to
-OP_EOD must correspond in order to the list of escapes immediately above.
-*** NOTE NOTE NOTE *** Whenever this list is updated, the two macro definitions
-that follow must also be updated to match. There are also tables called
-"coptable" and "poptable" in pcre_dfa_exec.c that must be updated. */
+/********************** Opcode definitions ******************/
+
+/****** NOTE NOTE NOTE ******
+
+Starting from 1 (i.e. after OP_END), the values up to OP_EOD must correspond in
+order to the list of escapes immediately above. Furthermore, values up to
+OP_DOLLM must not be changed without adjusting the table called autoposstab in
+pcre_compile.c
+
+Whenever this list is updated, the two macro definitions that follow must be
+updated to match. The possessification table called "opcode_possessify" in
+pcre_compile.c must also be updated, and also the tables called "coptable"
+and "poptable" in pcre_dfa_exec.c.
+
+****** NOTE NOTE NOTE ******/
+
+
+/* The values between FIRST_AUTOTAB_OP and LAST_AUTOTAB_RIGHT_OP, inclusive,
+are used in a table for deciding whether a repeated character type can be
+auto-possessified. */
+
+#define FIRST_AUTOTAB_OP OP_NOT_DIGIT
+#define LAST_AUTOTAB_LEFT_OP OP_EXTUNI
+#define LAST_AUTOTAB_RIGHT_OP OP_DOLLM
enum {
OP_END, /* 0 End of pattern */
@@ -1928,10 +1966,15 @@ enum {
OP_EODN, /* 23 End of data or \n at end of data (\Z) */
OP_EOD, /* 24 End of data (\z) */
- OP_CIRC, /* 25 Start of line - not multiline */
- OP_CIRCM, /* 26 Start of line - multiline */
- OP_DOLL, /* 27 End of line - not multiline */
- OP_DOLLM, /* 28 End of line - multiline */
+ /* Line end assertions */
+
+ OP_DOLL, /* 25 End of line - not multiline */
+ OP_DOLLM, /* 26 End of line - multiline */
+ OP_CIRC, /* 27 Start of line - not multiline */
+ OP_CIRCM, /* 28 Start of line - multiline */
+
+ /* Single characters; caseful must precede the caseless ones */
+
OP_CHAR, /* 29 Match one character, casefully */
OP_CHARI, /* 30 Match one character, caselessly */
OP_NOT, /* 31 Match one character, not the given one, casefully */
@@ -1940,7 +1983,7 @@ enum {
/* The following sets of 13 opcodes must always be kept in step because
the offset from the first one is used to generate the others. */
- /**** Single characters, caseful, must precede the caseless ones ****/
+ /* Repeated characters; caseful must precede the caseless ones */
OP_STAR, /* 33 The maximizing and minimizing versions of */
OP_MINSTAR, /* 34 these six opcodes must come in pairs, with */
@@ -1958,7 +2001,7 @@ enum {
OP_POSQUERY, /* 44 Posesssified query, caseful */
OP_POSUPTO, /* 45 Possessified upto, caseful */
- /**** Single characters, caseless, must follow the caseful ones */
+ /* Repeated characters; caseless must follow the caseful ones */
OP_STARI, /* 46 */
OP_MINSTARI, /* 47 */
@@ -1976,8 +2019,8 @@ enum {
OP_POSQUERYI, /* 57 Posesssified query, caseless */
OP_POSUPTOI, /* 58 Possessified upto, caseless */
- /**** The negated ones must follow the non-negated ones, and match them ****/
- /**** Negated single character, caseful; must precede the caseless ones ****/
+ /* The negated ones must follow the non-negated ones, and match them */
+ /* Negated repeated character, caseful; must precede the caseless ones */
OP_NOTSTAR, /* 59 The maximizing and minimizing versions of */
OP_NOTMINSTAR, /* 60 these six opcodes must come in pairs, with */
@@ -1995,7 +2038,7 @@ enum {
OP_NOTPOSQUERY, /* 70 */
OP_NOTPOSUPTO, /* 71 */
- /**** Negated single character, caseless; must follow the caseful ones ****/
+ /* Negated repeated character, caseless; must follow the caseful ones */
OP_NOTSTARI, /* 72 */
OP_NOTMINSTARI, /* 73 */
@@ -2013,7 +2056,7 @@ enum {
OP_NOTPOSQUERYI, /* 83 */
OP_NOTPOSUPTOI, /* 84 */
- /**** Character types ****/
+ /* Character types */
OP_TYPESTAR, /* 85 The maximizing and minimizing versions of */
OP_TYPEMINSTAR, /* 86 these six opcodes must come in pairs, with */
@@ -2044,89 +2087,96 @@ enum {
OP_CRRANGE, /* 104 These are different to the three sets above. */
OP_CRMINRANGE, /* 105 */
+ OP_CRPOSSTAR, /* 106 Possessified versions */
+ OP_CRPOSPLUS, /* 107 */
+ OP_CRPOSQUERY, /* 108 */
+ OP_CRPOSRANGE, /* 109 */
+
/* End of quantifier opcodes */
- OP_CLASS, /* 106 Match a character class, chars < 256 only */
- OP_NCLASS, /* 107 Same, but the bitmap was created from a negative
+ OP_CLASS, /* 110 Match a character class, chars < 256 only */
+ OP_NCLASS, /* 111 Same, but the bitmap was created from a negative
class - the difference is relevant only when a
character > 255 is encountered. */
- OP_XCLASS, /* 108 Extended class for handling > 255 chars within the
+ OP_XCLASS, /* 112 Extended class for handling > 255 chars within the
class. This does both positive and negative. */
- OP_REF, /* 109 Match a back reference, casefully */
- OP_REFI, /* 110 Match a back reference, caselessly */
- OP_RECURSE, /* 111 Match a numbered subpattern (possibly recursive) */
- OP_CALLOUT, /* 112 Call out to external function if provided */
-
- OP_ALT, /* 113 Start of alternation */
- OP_KET, /* 114 End of group that doesn't have an unbounded repeat */
- OP_KETRMAX, /* 115 These two must remain together and in this */
- OP_KETRMIN, /* 116 order. They are for groups the repeat for ever. */
- OP_KETRPOS, /* 117 Possessive unlimited repeat. */
+ OP_REF, /* 113 Match a back reference, casefully */
+ OP_REFI, /* 114 Match a back reference, caselessly */
+ OP_DNREF, /* 115 Match a duplicate name backref, casefully */
+ OP_DNREFI, /* 116 Match a duplicate name backref, caselessly */
+ OP_RECURSE, /* 117 Match a numbered subpattern (possibly recursive) */
+ OP_CALLOUT, /* 118 Call out to external function if provided */
+
+ OP_ALT, /* 119 Start of alternation */
+ OP_KET, /* 120 End of group that doesn't have an unbounded repeat */
+ OP_KETRMAX, /* 121 These two must remain together and in this */
+ OP_KETRMIN, /* 122 order. They are for groups the repeat for ever. */
+ OP_KETRPOS, /* 123 Possessive unlimited repeat. */
/* The assertions must come before BRA, CBRA, ONCE, and COND, and the four
asserts must remain in order. */
- OP_REVERSE, /* 118 Move pointer back - used in lookbehind assertions */
- OP_ASSERT, /* 119 Positive lookahead */
- OP_ASSERT_NOT, /* 120 Negative lookahead */
- OP_ASSERTBACK, /* 121 Positive lookbehind */
- OP_ASSERTBACK_NOT, /* 122 Negative lookbehind */
+ OP_REVERSE, /* 124 Move pointer back - used in lookbehind assertions */
+ OP_ASSERT, /* 125 Positive lookahead */
+ OP_ASSERT_NOT, /* 126 Negative lookahead */
+ OP_ASSERTBACK, /* 127 Positive lookbehind */
+ OP_ASSERTBACK_NOT, /* 128 Negative lookbehind */
/* ONCE, ONCE_NC, BRA, BRAPOS, CBRA, CBRAPOS, and COND must come immediately
after the assertions, with ONCE first, as there's a test for >= ONCE for a
subpattern that isn't an assertion. The POS versions must immediately follow
the non-POS versions in each case. */
- OP_ONCE, /* 123 Atomic group, contains captures */
- OP_ONCE_NC, /* 124 Atomic group containing no captures */
- OP_BRA, /* 125 Start of non-capturing bracket */
- OP_BRAPOS, /* 126 Ditto, with unlimited, possessive repeat */
- OP_CBRA, /* 127 Start of capturing bracket */
- OP_CBRAPOS, /* 128 Ditto, with unlimited, possessive repeat */
- OP_COND, /* 129 Conditional group */
+ OP_ONCE, /* 129 Atomic group, contains captures */
+ OP_ONCE_NC, /* 130 Atomic group containing no captures */
+ OP_BRA, /* 131 Start of non-capturing bracket */
+ OP_BRAPOS, /* 132 Ditto, with unlimited, possessive repeat */
+ OP_CBRA, /* 133 Start of capturing bracket */
+ OP_CBRAPOS, /* 134 Ditto, with unlimited, possessive repeat */
+ OP_COND, /* 135 Conditional group */
/* These five must follow the previous five, in the same order. There's a
check for >= SBRA to distinguish the two sets. */
- OP_SBRA, /* 130 Start of non-capturing bracket, check empty */
- OP_SBRAPOS, /* 131 Ditto, with unlimited, possessive repeat */
- OP_SCBRA, /* 132 Start of capturing bracket, check empty */
- OP_SCBRAPOS, /* 133 Ditto, with unlimited, possessive repeat */
- OP_SCOND, /* 134 Conditional group, check empty */
+ OP_SBRA, /* 136 Start of non-capturing bracket, check empty */
+ OP_SBRAPOS, /* 137 Ditto, with unlimited, possessive repeat */
+ OP_SCBRA, /* 138 Start of capturing bracket, check empty */
+ OP_SCBRAPOS, /* 139 Ditto, with unlimited, possessive repeat */
+ OP_SCOND, /* 140 Conditional group, check empty */
/* The next two pairs must (respectively) be kept together. */
- OP_CREF, /* 135 Used to hold a capture number as condition */
- OP_NCREF, /* 136 Same, but generated by a name reference*/
- OP_RREF, /* 137 Used to hold a recursion number as condition */
- OP_NRREF, /* 138 Same, but generated by a name reference*/
- OP_DEF, /* 139 The DEFINE condition */
+ OP_CREF, /* 141 Used to hold a capture number as condition */
+ OP_DNCREF, /* 142 Used to point to duplicate names as a condition */
+ OP_RREF, /* 143 Used to hold a recursion number as condition */
+ OP_DNRREF, /* 144 Used to point to duplicate names as a condition */
+ OP_DEF, /* 145 The DEFINE condition */
- OP_BRAZERO, /* 140 These two must remain together and in this */
- OP_BRAMINZERO, /* 141 order. */
- OP_BRAPOSZERO, /* 142 */
+ OP_BRAZERO, /* 146 These two must remain together and in this */
+ OP_BRAMINZERO, /* 147 order. */
+ OP_BRAPOSZERO, /* 148 */
/* These are backtracking control verbs */
- OP_MARK, /* 143 always has an argument */
- OP_PRUNE, /* 144 */
- OP_PRUNE_ARG, /* 145 same, but with argument */
- OP_SKIP, /* 146 */
- OP_SKIP_ARG, /* 147 same, but with argument */
- OP_THEN, /* 148 */
- OP_THEN_ARG, /* 149 same, but with argument */
- OP_COMMIT, /* 150 */
+ OP_MARK, /* 149 always has an argument */
+ OP_PRUNE, /* 150 */
+ OP_PRUNE_ARG, /* 151 same, but with argument */
+ OP_SKIP, /* 152 */
+ OP_SKIP_ARG, /* 153 same, but with argument */
+ OP_THEN, /* 154 */
+ OP_THEN_ARG, /* 155 same, but with argument */
+ OP_COMMIT, /* 156 */
/* These are forced failure and success verbs */
- OP_FAIL, /* 151 */
- OP_ACCEPT, /* 152 */
- OP_ASSERT_ACCEPT, /* 153 Used inside assertions */
- OP_CLOSE, /* 154 Used before OP_ACCEPT to close open captures */
+ OP_FAIL, /* 157 */
+ OP_ACCEPT, /* 158 */
+ OP_ASSERT_ACCEPT, /* 159 Used inside assertions */
+ OP_CLOSE, /* 160 Used before OP_ACCEPT to close open captures */
/* This is used to skip a subpattern with a {0} quantifier */
- OP_SKIPZERO, /* 155 */
+ OP_SKIPZERO, /* 161 */
/* This is not an opcode, but is used to check that tables indexed by opcode
are the correct length, in order to catch updating errors - there have been
@@ -2137,7 +2187,8 @@ enum {
/* *** NOTE NOTE NOTE *** Whenever the list above is updated, the two macro
definitions that follow must also be updated to match. There are also tables
-called "coptable" and "poptable" in pcre_dfa_exec.c that must be updated. */
+called "opcode_possessify" in pcre_compile.c and "coptable" and "poptable" in
+pcre_dfa_exec.c that must be updated. */
/* This macro defines textual names for all the opcodes. These are used only
@@ -2150,7 +2201,7 @@ some cases doesn't actually use these names at all). */
"\\S", "\\s", "\\W", "\\w", "Any", "AllAny", "Anybyte", \
"notprop", "prop", "\\R", "\\H", "\\h", "\\V", "\\v", \
"extuni", "\\Z", "\\z", \
- "^", "^", "$", "$", "char", "chari", "not", "noti", \
+ "$", "$", "^", "^", "char", "chari", "not", "noti", \
"*", "*?", "+", "+?", "?", "??", \
"{", "{", "{", \
"*+","++", "?+", "{", \
@@ -2166,7 +2217,8 @@ some cases doesn't actually use these names at all). */
"*", "*?", "+", "+?", "?", "??", "{", "{", "{", \
"*+","++", "?+", "{", \
"*", "*?", "+", "+?", "?", "??", "{", "{", \
- "class", "nclass", "xclass", "Ref", "Refi", \
+ "*+","++", "?+", "{", \
+ "class", "nclass", "xclass", "Ref", "Refi", "DnRef", "DnRefi", \
"Recurse", "Callout", \
"Alt", "Ket", "KetRmax", "KetRmin", "KetRpos", \
"Reverse", "Assert", "Assert not", "AssertB", "AssertB not", \
@@ -2175,7 +2227,7 @@ some cases doesn't actually use these names at all). */
"Cond", \
"SBra", "SBraPos", "SCBra", "SCBraPos", \
"SCond", \
- "Cond ref", "Cond nref", "Cond rec", "Cond nrec", "Cond def", \
+ "Cond ref", "Cond dnref", "Cond rec", "Cond dnrec", "Cond def", \
"Brazero", "Braminzero", "Braposzero", \
"*MARK", "*PRUNE", "*PRUNE", "*SKIP", "*SKIP", \
"*THEN", "*THEN", "*COMMIT", "*FAIL", \
@@ -2200,7 +2252,7 @@ in UTF-8 mode. The code that uses this table must know about such things. */
3, 3, /* \P, \p */ \
1, 1, 1, 1, 1, /* \R, \H, \h, \V, \v */ \
1, /* \X */ \
- 1, 1, 1, 1, 1, 1, /* \Z, \z, ^, ^M, $, $M */ \
+ 1, 1, 1, 1, 1, 1, /* \Z, \z, $, $M ^, ^M */ \
2, /* Char - the minimum length */ \
2, /* Chari - the minimum length */ \
2, /* not */ \
@@ -2231,11 +2283,14 @@ in UTF-8 mode. The code that uses this table must know about such things. */
/* Character class & ref repeats */ \
1, 1, 1, 1, 1, 1, /* *, *?, +, +?, ?, ?? */ \
1+2*IMM2_SIZE, 1+2*IMM2_SIZE, /* CRRANGE, CRMINRANGE */ \
+ 1, 1, 1, 1+2*IMM2_SIZE, /* Possessive *+, ++, ?+, CRPOSRANGE */ \
1+(32/sizeof(pcre_uchar)), /* CLASS */ \
1+(32/sizeof(pcre_uchar)), /* NCLASS */ \
0, /* XCLASS - variable length */ \
1+IMM2_SIZE, /* REF */ \
1+IMM2_SIZE, /* REFI */ \
+ 1+2*IMM2_SIZE, /* DNREF */ \
+ 1+2*IMM2_SIZE, /* DNREFI */ \
1+LINK_SIZE, /* RECURSE */ \
2+2*LINK_SIZE, /* CALLOUT */ \
1+LINK_SIZE, /* Alt */ \
@@ -2260,8 +2315,8 @@ in UTF-8 mode. The code that uses this table must know about such things. */
1+LINK_SIZE+IMM2_SIZE, /* SCBRA */ \
1+LINK_SIZE+IMM2_SIZE, /* SCBRAPOS */ \
1+LINK_SIZE, /* SCOND */ \
- 1+IMM2_SIZE, 1+IMM2_SIZE, /* CREF, NCREF */ \
- 1+IMM2_SIZE, 1+IMM2_SIZE, /* RREF, NRREF */ \
+ 1+IMM2_SIZE, 1+2*IMM2_SIZE, /* CREF, DNCREF */ \
+ 1+IMM2_SIZE, 1+2*IMM2_SIZE, /* RREF, DNRREF */ \
1, /* DEF */ \
1, 1, 1, /* BRAZERO, BRAMINZERO, BRAPOSZERO */ \
3, 1, 3, /* MARK, PRUNE, PRUNE_ARG */ \
@@ -2270,8 +2325,7 @@ in UTF-8 mode. The code that uses this table must know about such things. */
1, 1, 1, 1, /* COMMIT, FAIL, ACCEPT, ASSERT_ACCEPT */ \
1+IMM2_SIZE, 1 /* CLOSE, SKIPZERO */
-/* A magic value for OP_RREF and OP_NRREF to indicate the "any recursion"
-condition. */
+/* A magic value for OP_RREF to indicate the "any recursion" condition. */
#define RREF_ANY 0xffff
@@ -2286,9 +2340,11 @@ enum { ERR0, ERR1, ERR2, ERR3, ERR4, ERR5, ERR6, ERR7, ERR8, ERR9,
ERR40, ERR41, ERR42, ERR43, ERR44, ERR45, ERR46, ERR47, ERR48, ERR49,
ERR50, ERR51, ERR52, ERR53, ERR54, ERR55, ERR56, ERR57, ERR58, ERR59,
ERR60, ERR61, ERR62, ERR63, ERR64, ERR65, ERR66, ERR67, ERR68, ERR69,
- ERR70, ERR71, ERR72, ERR73, ERR74, ERR75, ERR76, ERR77, ERR78, ERRCOUNT };
+ ERR70, ERR71, ERR72, ERR73, ERR74, ERR75, ERR76, ERR77, ERR78, ERR79,
+ ERR80, ERR81, ERR82, ERR83, ERR84, ERRCOUNT };
/* JIT compiling modes. The function list is indexed by them. */
+
enum { JIT_COMPILE, JIT_PARTIAL_SOFT_COMPILE, JIT_PARTIAL_HARD_COMPILE,
JIT_NUMBER_OF_COMPILE_MODES };
@@ -2406,6 +2462,15 @@ typedef struct open_capitem {
pcre_uint16 flag; /* Set TRUE if recursive back ref */
} open_capitem;
+/* Structure for building a list of named groups during the first pass of
+compiling. */
+
+typedef struct named_group {
+ const pcre_uchar *name; /* Points to the name in the pattern */
+ int length; /* Length of the name */
+ pcre_uint32 number; /* Group number */
+} named_group;
+
/* Structure for passing "static" information around between the functions
doing the compiling, so that they are thread-safe. */
@@ -2418,17 +2483,21 @@ typedef struct compile_data {
const pcre_uchar *start_code; /* The start of the compiled code */
const pcre_uchar *start_pattern; /* The start of the pattern */
const pcre_uchar *end_pattern; /* The end of the pattern */
- open_capitem *open_caps; /* Chain of open capture items */
pcre_uchar *hwm; /* High watermark of workspace */
+ open_capitem *open_caps; /* Chain of open capture items */
+ named_group *named_groups; /* Points to vector in pre-compile */
pcre_uchar *name_table; /* The name/number table */
int names_found; /* Number of entries so far */
int name_entry_size; /* Size of each entry */
+ int named_group_list_size; /* Number of entries in the list */
int workspace_size; /* Size of workspace */
unsigned int bracount; /* Count of capturing parens as we compile */
int final_bracount; /* Saved value after first pass */
int max_lookbehind; /* Maximum lookbehind (characters) */
int top_backref; /* Maximum back reference */
unsigned int backref_map; /* Bitmap of low back refs */
+ unsigned int namedrefcount; /* Number of backreferences by name */
+ int parens_depth; /* Depth of nested parentheses */
int assert_depth; /* Depth of nested assertions */
pcre_uint32 external_options; /* External (initial) options */
pcre_uint32 external_flags; /* External flag bits to be set */
@@ -2436,6 +2505,7 @@ typedef struct compile_data {
BOOL had_accept; /* (*ACCEPT) encountered */
BOOL had_pruneorskip; /* (*PRUNE) or (*SKIP) encountered */
BOOL check_lookbehind; /* Lookbehinds need later checking */
+ BOOL dupnames; /* Duplicate names exist */
int nltype; /* Newline type */
int nllen; /* Newline string length */
pcre_uchar nl[4]; /* Newline string when fixed length */
diff --git a/pcre/pcre_jit_compile.c b/pcre/pcre_jit_compile.c
index 201416dd264..63b32c51670 100644
--- a/pcre/pcre_jit_compile.c
+++ b/pcre/pcre_jit_compile.c
@@ -371,7 +371,7 @@ typedef struct compiler_common {
sljit_sw ctypes;
int digits[2 + MAX_RANGE_SIZE];
/* Named capturing brackets. */
- sljit_uw name_table;
+ pcre_uchar *name_table;
sljit_sw name_count;
sljit_sw name_entry_size;
@@ -481,8 +481,8 @@ to characters. The vector data is divided into two groups: the first
group contains the start / end character pointers, and the second is
the start pointers when the end of the capturing group has not yet reached. */
#define OVECTOR_START (common->ovector_start)
-#define OVECTOR(i) (OVECTOR_START + (i) * sizeof(sljit_sw))
-#define OVECTOR_PRIV(i) (common->cbra_ptr + (i) * sizeof(sljit_sw))
+#define OVECTOR(i) (OVECTOR_START + (i) * (sljit_sw)sizeof(sljit_sw))
+#define OVECTOR_PRIV(i) (common->cbra_ptr + (i) * (sljit_sw)sizeof(sljit_sw))
#define PRIVATE_DATA(cc) (common->private_data_ptrs[(cc) - common->start])
#if defined COMPILE_PCRE8
@@ -585,10 +585,16 @@ switch(*cc)
case OP_CRMINQUERY:
case OP_CRRANGE:
case OP_CRMINRANGE:
+ case OP_CRPOSSTAR:
+ case OP_CRPOSPLUS:
+ case OP_CRPOSQUERY:
+ case OP_CRPOSRANGE:
case OP_CLASS:
case OP_NCLASS:
case OP_REF:
case OP_REFI:
+ case OP_DNREF:
+ case OP_DNREFI:
case OP_RECURSE:
case OP_CALLOUT:
case OP_ALT:
@@ -614,9 +620,9 @@ switch(*cc)
case OP_SCBRAPOS:
case OP_SCOND:
case OP_CREF:
- case OP_NCREF:
+ case OP_DNCREF:
case OP_RREF:
- case OP_NRREF:
+ case OP_DNRREF:
case OP_DEF:
case OP_BRAZERO:
case OP_BRAMINZERO:
@@ -736,10 +742,8 @@ switch(*cc)
static BOOL check_opcode_types(compiler_common *common, pcre_uchar *cc, pcre_uchar *ccend)
{
-pcre_uchar *name;
-pcre_uchar *name2;
-unsigned int cbra_index;
-int i;
+int count;
+pcre_uchar *slot;
/* Calculate important variables (like stack size) and checks whether all opcodes are supported. */
while (cc < ccend)
@@ -773,29 +777,21 @@ while (cc < ccend)
break;
case OP_CREF:
- i = GET2(cc, 1);
- common->optimized_cbracket[i] = 0;
+ common->optimized_cbracket[GET2(cc, 1)] = 0;
cc += 1 + IMM2_SIZE;
break;
- case OP_NCREF:
- cbra_index = GET2(cc, 1);
- name = (pcre_uchar *)common->name_table;
- name2 = name;
- for (i = 0; i < common->name_count; i++)
- {
- if (GET2(name, 0) == cbra_index) break;
- name += common->name_entry_size;
- }
- SLJIT_ASSERT(i != common->name_count);
-
- for (i = 0; i < common->name_count; i++)
+ case OP_DNREF:
+ case OP_DNREFI:
+ case OP_DNCREF:
+ count = GET2(cc, 1 + IMM2_SIZE);
+ slot = common->name_table + GET2(cc, 1) * common->name_entry_size;
+ while (count-- > 0)
{
- if (STRCMP_UC_UC(name2 + IMM2_SIZE, name + IMM2_SIZE) == 0)
- common->optimized_cbracket[GET2(name2, 0)] = 0;
- name2 += common->name_entry_size;
+ common->optimized_cbracket[GET2(slot, 0)] = 0;
+ slot += common->name_entry_size;
}
- cc += 1 + IMM2_SIZE;
+ cc += 1 + 2 * IMM2_SIZE;
break;
case OP_RECURSE:
@@ -4027,14 +4023,15 @@ DEFINE_COMPILER;
jump_list *found = NULL;
jump_list **list = (*cc & XCL_NOT) == 0 ? &found : backtracks;
pcre_int32 c, charoffset;
-const pcre_uint32 *other_cases;
struct sljit_jump *jump = NULL;
pcre_uchar *ccbegin;
int compares, invertcmp, numberofcmps;
+
#ifdef SUPPORT_UCP
BOOL needstype = FALSE, needsscript = FALSE, needschar = FALSE;
BOOL charsaved = FALSE;
int typereg = TMP1, scriptreg = TMP1;
+const pcre_uint32 *other_cases;
pcre_int32 typeoffset;
#endif
@@ -4130,6 +4127,9 @@ while (*cc != XCL_END)
case PT_SPACE:
case PT_PXSPACE:
case PT_WORD:
+ case PT_PXGRAPH:
+ case PT_PXPRINT:
+ case PT_PXPUNCT:
needstype = TRUE;
needschar = TRUE;
break;
@@ -4317,16 +4317,15 @@ while (*cc != XCL_END)
case PT_SPACE:
case PT_PXSPACE:
- if (*cc == PT_SPACE)
- {
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 0);
- jump = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, 11 - charoffset);
- }
SET_CHAR_OFFSET(9);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 13 - 9);
+ OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd - 0x9);
OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_LESS_EQUAL);
- if (*cc == PT_SPACE)
- JUMPHERE(jump);
+
+ OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x9);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+
+ OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e - 0x9);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
SET_TYPE_OFFSET(ucp_Zl);
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Zs - ucp_Zl);
@@ -4418,6 +4417,67 @@ while (*cc != XCL_END)
OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_GREATER_EQUAL);
jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);
break;
+
+ case PT_PXGRAPH:
+ /* C and Z groups are the farthest two groups. */
+ SET_TYPE_OFFSET(ucp_Ll);
+ OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Ll);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_GREATER);
+
+ jump = CMP(SLJIT_C_NOT_EQUAL, typereg, 0, SLJIT_IMM, ucp_Cf - ucp_Ll);
+
+ /* In case of ucp_Cf, we overwrite the result. */
+ SET_CHAR_OFFSET(0x2066);
+ OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_LESS_EQUAL);
+
+ OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+
+ OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e - 0x2066);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+
+ JUMPHERE(jump);
+ jump = CMP(SLJIT_C_ZERO ^ invertcmp, TMP2, 0, SLJIT_IMM, 0);
+ break;
+
+ case PT_PXPRINT:
+ /* C and Z groups are the farthest two groups. */
+ SET_TYPE_OFFSET(ucp_Ll);
+ OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Ll);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_GREATER);
+
+ OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Zs - ucp_Ll);
+ OP_FLAGS(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_C_NOT_EQUAL);
+
+ jump = CMP(SLJIT_C_NOT_EQUAL, typereg, 0, SLJIT_IMM, ucp_Cf - ucp_Ll);
+
+ /* In case of ucp_Cf, we overwrite the result. */
+ SET_CHAR_OFFSET(0x2066);
+ OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_LESS_EQUAL);
+
+ OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
+
+ JUMPHERE(jump);
+ jump = CMP(SLJIT_C_ZERO ^ invertcmp, TMP2, 0, SLJIT_IMM, 0);
+ break;
+
+ case PT_PXPUNCT:
+ SET_TYPE_OFFSET(ucp_Sc);
+ OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Sc);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_LESS_EQUAL);
+
+ SET_CHAR_OFFSET(0);
+ OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xff);
+ OP_FLAGS(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_C_LESS_EQUAL);
+
+ SET_TYPE_OFFSET(ucp_Pc);
+ OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Ps - ucp_Pc);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_LESS_EQUAL);
+ jump = JUMP(SLJIT_C_NOT_ZERO ^ invertcmp);
+ break;
}
cc += 2;
}
@@ -5056,28 +5116,6 @@ if (context.length > 0)
return compile_char1_matchingpath(common, *cc, cc + 1, backtracks);
}
-static struct sljit_jump *compile_ref_checks(compiler_common *common, pcre_uchar *cc, jump_list **backtracks)
-{
-DEFINE_COMPILER;
-int offset = GET2(cc, 1) << 1;
-
-OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset));
-if (!common->jscript_compat)
- {
- if (backtracks == NULL)
- {
- /* OVECTOR(1) contains the "string begin - 1" constant. */
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1));
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_C_EQUAL);
- return JUMP(SLJIT_C_NOT_ZERO);
- }
- add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)));
- }
-return CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));
-}
-
/* Forward definitions. */
static void compile_matchingpath(compiler_common *, pcre_uchar *, pcre_uchar *, backtrack_common *);
static void compile_backtrackingpath(compiler_common *, struct backtrack_common *);
@@ -5110,24 +5148,65 @@ static void compile_backtrackingpath(compiler_common *, struct backtrack_common
#define BACKTRACK_AS(type) ((type *)backtrack)
-static pcre_uchar *compile_ref_matchingpath(compiler_common *common, pcre_uchar *cc, jump_list **backtracks, BOOL withchecks, BOOL emptyfail)
+static void compile_dnref_search(compiler_common *common, pcre_uchar *cc, jump_list **backtracks)
+{
+/* The OVECTOR offset goes to TMP2. */
+DEFINE_COMPILER;
+int count = GET2(cc, 1 + IMM2_SIZE);
+pcre_uchar *slot = common->name_table + GET2(cc, 1) * common->name_entry_size;
+unsigned int offset;
+jump_list *found = NULL;
+
+SLJIT_ASSERT(*cc == OP_DNREF || *cc == OP_DNREFI);
+
+OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1));
+
+count--;
+while (count-- > 0)
+ {
+ offset = GET2(slot, 0) << 1;
+ GET_LOCAL_BASE(TMP2, 0, OVECTOR(offset));
+ add_jump(compiler, &found, CMP(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0));
+ slot += common->name_entry_size;
+ }
+
+offset = GET2(slot, 0) << 1;
+GET_LOCAL_BASE(TMP2, 0, OVECTOR(offset));
+if (backtracks != NULL && !common->jscript_compat)
+ add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset), TMP1, 0));
+
+set_jumps(found, LABEL());
+}
+
+static void compile_ref_matchingpath(compiler_common *common, pcre_uchar *cc, jump_list **backtracks, BOOL withchecks, BOOL emptyfail)
{
DEFINE_COMPILER;
-int offset = GET2(cc, 1) << 1;
+BOOL ref = (*cc == OP_REF || *cc == OP_REFI);
+int offset = 0;
struct sljit_jump *jump = NULL;
struct sljit_jump *partial;
struct sljit_jump *nopartial;
-OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset));
-/* OVECTOR(1) contains the "string begin - 1" constant. */
-if (withchecks && !common->jscript_compat)
- add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)));
+if (ref)
+ {
+ offset = GET2(cc, 1) << 1;
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset));
+ /* OVECTOR(1) contains the "string begin - 1" constant. */
+ if (withchecks && !common->jscript_compat)
+ add_jump(compiler, backtracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)));
+ }
+else
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), 0);
#if defined SUPPORT_UTF && defined SUPPORT_UCP
if (common->utf && *cc == OP_REFI)
{
SLJIT_ASSERT(TMP1 == SLJIT_SCRATCH_REG1 && STACK_TOP == SLJIT_SCRATCH_REG2 && TMP2 == SLJIT_SCRATCH_REG3);
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));
+ if (ref)
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));
+ else
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
+
if (withchecks)
jump = CMP(SLJIT_C_EQUAL, TMP1, 0, TMP2, 0);
@@ -5152,7 +5231,11 @@ if (common->utf && *cc == OP_REFI)
else
#endif /* SUPPORT_UTF && SUPPORT_UCP */
{
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), TMP1, 0);
+ if (ref)
+ OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1), TMP1, 0);
+ else
+ OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw), TMP1, 0);
+
if (withchecks)
jump = JUMP(SLJIT_C_ZERO);
@@ -5189,14 +5272,15 @@ if (jump != NULL)
else
JUMPHERE(jump);
}
-return cc + 1 + IMM2_SIZE;
}
static SLJIT_INLINE pcre_uchar *compile_ref_iterator_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
{
DEFINE_COMPILER;
+BOOL ref = (*cc == OP_REF || *cc == OP_REFI);
backtrack_common *backtrack;
pcre_uchar type;
+int offset = 0;
struct sljit_label *label;
struct sljit_jump *zerolength;
struct sljit_jump *jump = NULL;
@@ -5206,7 +5290,13 @@ BOOL minimize;
PUSH_BACKTRACK(sizeof(iterator_backtrack), cc, NULL);
+if (ref)
+ offset = GET2(cc, 1) << 1;
+else
+ cc += IMM2_SIZE;
type = cc[1 + IMM2_SIZE];
+
+SLJIT_COMPILE_ASSERT((OP_CRSTAR & 0x1) == 0, crstar_opcode_must_be_even);
minimize = (type & 0x1) != 0;
switch(type)
{
@@ -5244,25 +5334,52 @@ if (!minimize)
if (min == 0)
{
allocate_stack(common, 2);
+ if (ref)
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 0);
/* Temporary release of STR_PTR. */
OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
- zerolength = compile_ref_checks(common, ccbegin, NULL);
+ /* Handles both invalid and empty cases. Since the minimum repeat,
+ is zero the invalid case is basically the same as an empty case. */
+ if (ref)
+ zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));
+ else
+ {
+ compile_dnref_search(common, ccbegin, NULL);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), 0);
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, TMP2, 0);
+ zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
+ }
/* Restore if not zero length. */
OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
}
else
{
allocate_stack(common, 1);
+ if (ref)
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);
- zerolength = compile_ref_checks(common, ccbegin, &backtrack->topbacktracks);
+ if (ref)
+ {
+ add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)));
+ zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));
+ }
+ else
+ {
+ compile_dnref_search(common, ccbegin, &backtrack->topbacktracks);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), 0);
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, TMP2, 0);
+ zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
+ }
}
if (min > 1 || max > 1)
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE0, SLJIT_IMM, 0);
label = LABEL();
+ if (!ref)
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1);
compile_ref_matchingpath(common, ccbegin, &backtrack->topbacktracks, FALSE, FALSE);
if (min > 1 || max > 1)
@@ -5297,24 +5414,52 @@ if (!minimize)
return cc;
}
-allocate_stack(common, 2);
+allocate_stack(common, ref ? 2 : 3);
+if (ref)
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);
if (type != OP_CRMINSTAR)
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 0);
if (min == 0)
{
- zerolength = compile_ref_checks(common, ccbegin, NULL);
+ /* Handles both invalid and empty cases. Since the minimum repeat,
+ is zero the invalid case is basically the same as an empty case. */
+ if (ref)
+ zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));
+ else
+ {
+ compile_dnref_search(common, ccbegin, NULL);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), 0);
+ OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(2), TMP2, 0);
+ zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
+ }
+ /* Length is non-zero, we can match real repeats. */
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
jump = JUMP(SLJIT_JUMP);
}
else
- zerolength = compile_ref_checks(common, ccbegin, &backtrack->topbacktracks);
+ {
+ if (ref)
+ {
+ add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)));
+ zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(offset + 1));
+ }
+ else
+ {
+ compile_dnref_search(common, ccbegin, &backtrack->topbacktracks);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), 0);
+ OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(2), TMP2, 0);
+ zerolength = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
+ }
+ }
BACKTRACK_AS(iterator_backtrack)->matchingpath = LABEL();
if (max > 0)
add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_GREATER_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, max));
+if (!ref)
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(2));
compile_ref_matchingpath(common, ccbegin, &backtrack->topbacktracks, TRUE, TRUE);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
@@ -5902,116 +6047,6 @@ common->accept = save_accept;
return cc + 1 + LINK_SIZE;
}
-static sljit_sw SLJIT_CALL do_searchovector(sljit_uw refno, sljit_sw* locals, pcre_uchar *name_table)
-{
-int condition = FALSE;
-pcre_uchar *slotA = name_table;
-pcre_uchar *slotB;
-sljit_sw name_count = locals[LOCALS0 / sizeof(sljit_sw)];
-sljit_sw name_entry_size = locals[LOCALS1 / sizeof(sljit_sw)];
-sljit_sw no_capture;
-int i;
-
-locals += refno & 0xff;
-refno >>= 8;
-no_capture = locals[1];
-
-for (i = 0; i < name_count; i++)
- {
- if (GET2(slotA, 0) == refno) break;
- slotA += name_entry_size;
- }
-
-if (i < name_count)
- {
- /* Found a name for the number - there can be only one; duplicate names
- for different numbers are allowed, but not vice versa. First scan down
- for duplicates. */
-
- slotB = slotA;
- while (slotB > name_table)
- {
- slotB -= name_entry_size;
- if (STRCMP_UC_UC(slotA + IMM2_SIZE, slotB + IMM2_SIZE) == 0)
- {
- condition = locals[GET2(slotB, 0) << 1] != no_capture;
- if (condition) break;
- }
- else break;
- }
-
- /* Scan up for duplicates */
- if (!condition)
- {
- slotB = slotA;
- for (i++; i < name_count; i++)
- {
- slotB += name_entry_size;
- if (STRCMP_UC_UC(slotA + IMM2_SIZE, slotB + IMM2_SIZE) == 0)
- {
- condition = locals[GET2(slotB, 0) << 1] != no_capture;
- if (condition) break;
- }
- else break;
- }
- }
- }
-return condition;
-}
-
-static sljit_sw SLJIT_CALL do_searchgroups(sljit_uw recno, sljit_uw* locals, pcre_uchar *name_table)
-{
-int condition = FALSE;
-pcre_uchar *slotA = name_table;
-pcre_uchar *slotB;
-sljit_uw name_count = locals[LOCALS0 / sizeof(sljit_sw)];
-sljit_uw name_entry_size = locals[LOCALS1 / sizeof(sljit_sw)];
-sljit_uw group_num = locals[POSSESSIVE0 / sizeof(sljit_sw)];
-sljit_uw i;
-
-for (i = 0; i < name_count; i++)
- {
- if (GET2(slotA, 0) == recno) break;
- slotA += name_entry_size;
- }
-
-if (i < name_count)
- {
- /* Found a name for the number - there can be only one; duplicate
- names for different numbers are allowed, but not vice versa. First
- scan down for duplicates. */
-
- slotB = slotA;
- while (slotB > name_table)
- {
- slotB -= name_entry_size;
- if (STRCMP_UC_UC(slotA + IMM2_SIZE, slotB + IMM2_SIZE) == 0)
- {
- condition = GET2(slotB, 0) == group_num;
- if (condition) break;
- }
- else break;
- }
-
- /* Scan up for duplicates */
- if (!condition)
- {
- slotB = slotA;
- for (i++; i < name_count; i++)
- {
- slotB += name_entry_size;
- if (STRCMP_UC_UC(slotA + IMM2_SIZE, slotB + IMM2_SIZE) == 0)
- {
- condition = GET2(slotB, 0) == group_num;
- if (condition) break;
- }
- else break;
- }
- }
- }
-return condition;
-}
-
static SLJIT_INLINE void match_once_common(compiler_common *common, pcre_uchar ket, int framesize, int private_data_ptr, BOOL has_alternatives, BOOL needs_control_head)
{
DEFINE_COMPILER;
@@ -6144,11 +6179,12 @@ backtrack_common *backtrack;
pcre_uchar opcode;
int private_data_ptr = 0;
int offset = 0;
-int stacksize;
+int i, stacksize;
int repeat_ptr = 0, repeat_length = 0;
int repeat_type = 0, repeat_count = 0;
pcre_uchar *ccbegin;
pcre_uchar *matchingpath;
+pcre_uchar *slot;
pcre_uchar bra = OP_BRA;
pcre_uchar ket;
assert_backtrack *assert;
@@ -6198,20 +6234,8 @@ SLJIT_ASSERT(!((bra == OP_BRAZERO && ket == OP_KETRMIN) || (bra == OP_BRAMINZERO
cc += GET(cc, 1);
has_alternatives = *cc == OP_ALT;
-if (SLJIT_UNLIKELY(opcode == OP_COND) || SLJIT_UNLIKELY(opcode == OP_SCOND))
- {
- has_alternatives = (*matchingpath == OP_RREF) ? FALSE : TRUE;
- if (*matchingpath == OP_NRREF)
- {
- stacksize = GET2(matchingpath, 1);
- if (common->currententry == NULL || stacksize == RREF_ANY)
- has_alternatives = FALSE;
- else if (common->currententry->start == 0)
- has_alternatives = stacksize != 0;
- else
- has_alternatives = stacksize != (int)GET2(common->start, common->currententry->start + 1 + LINK_SIZE);
- }
- }
+if (SLJIT_UNLIKELY(opcode == OP_COND || opcode == OP_SCOND))
+ has_alternatives = (*matchingpath == OP_RREF || *matchingpath == OP_DNRREF) ? FALSE : TRUE;
if (SLJIT_UNLIKELY(opcode == OP_COND) && (*cc == OP_KETRMAX || *cc == OP_KETRMIN))
opcode = OP_SCOND;
@@ -6448,47 +6472,73 @@ if (opcode == OP_COND || opcode == OP_SCOND)
CMP(SLJIT_C_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(GET2(matchingpath, 1) << 1), SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1)));
matchingpath += 1 + IMM2_SIZE;
}
- else if (*matchingpath == OP_NCREF)
+ else if (*matchingpath == OP_DNCREF)
{
SLJIT_ASSERT(has_alternatives);
- stacksize = GET2(matchingpath, 1);
- jump = CMP(SLJIT_C_NOT_EQUAL, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(stacksize << 1), SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1));
-
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, STACK_TOP, 0);
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, SLJIT_IMM, common->name_count);
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, SLJIT_IMM, common->name_entry_size);
- OP1(SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, (stacksize << 8) | (common->ovector_start / sizeof(sljit_sw)));
- GET_LOCAL_BASE(SLJIT_SCRATCH_REG2, 0, 0);
- OP1(SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, common->name_table);
- sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_searchovector));
- OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1);
- add_jump(compiler, &(BACKTRACK_AS(bracket_backtrack)->u.condfailed), CMP(SLJIT_C_EQUAL, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0));
- JUMPHERE(jump);
- matchingpath += 1 + IMM2_SIZE;
+ i = GET2(matchingpath, 1 + IMM2_SIZE);
+ slot = common->name_table + GET2(matchingpath, 1) * common->name_entry_size;
+ OP1(SLJIT_MOV, TMP3, 0, STR_PTR, 0);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(1));
+ OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(GET2(slot, 0) << 1), TMP1, 0);
+ slot += common->name_entry_size;
+ i--;
+ while (i-- > 0)
+ {
+ OP2(SLJIT_SUB, STR_PTR, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), OVECTOR(GET2(slot, 0) << 1), TMP1, 0);
+ OP2(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, STR_PTR, 0);
+ slot += common->name_entry_size;
+ }
+ OP1(SLJIT_MOV, STR_PTR, 0, TMP3, 0);
+ add_jump(compiler, &(BACKTRACK_AS(bracket_backtrack)->u.condfailed), JUMP(SLJIT_C_ZERO));
+ matchingpath += 1 + 2 * IMM2_SIZE;
}
- else if (*matchingpath == OP_RREF || *matchingpath == OP_NRREF)
+ else if (*matchingpath == OP_RREF || *matchingpath == OP_DNRREF)
{
/* Never has other case. */
BACKTRACK_AS(bracket_backtrack)->u.condfailed = NULL;
+ SLJIT_ASSERT(!has_alternatives);
- stacksize = GET2(matchingpath, 1);
- if (common->currententry == NULL)
- stacksize = 0;
- else if (stacksize == RREF_ANY)
- stacksize = 1;
- else if (common->currententry->start == 0)
- stacksize = stacksize == 0;
- else
- stacksize = stacksize == (int)GET2(common->start, common->currententry->start + 1 + LINK_SIZE);
-
- if (*matchingpath == OP_RREF || stacksize || common->currententry == NULL)
+ if (*matchingpath == OP_RREF)
{
- SLJIT_ASSERT(!has_alternatives);
+ stacksize = GET2(matchingpath, 1);
+ if (common->currententry == NULL)
+ stacksize = 0;
+ else if (stacksize == RREF_ANY)
+ stacksize = 1;
+ else if (common->currententry->start == 0)
+ stacksize = stacksize == 0;
+ else
+ stacksize = stacksize == (int)GET2(common->start, common->currententry->start + 1 + LINK_SIZE);
+
if (stacksize != 0)
matchingpath += 1 + IMM2_SIZE;
+ }
+ else
+ {
+ if (common->currententry == NULL || common->currententry->start == 0)
+ stacksize = 0;
else
{
+ stacksize = GET2(matchingpath, 1 + IMM2_SIZE);
+ slot = common->name_table + GET2(matchingpath, 1) * common->name_entry_size;
+ i = (int)GET2(common->start, common->currententry->start + 1 + LINK_SIZE);
+ while (stacksize > 0)
+ {
+ if ((int)GET2(slot, 0) == i)
+ break;
+ slot += common->name_entry_size;
+ stacksize--;
+ }
+ }
+
+ if (stacksize != 0)
+ matchingpath += 1 + 2 * IMM2_SIZE;
+ }
+
+ /* The stacksize == 0 is a common "else" case. */
+ if (stacksize == 0)
+ {
if (*cc == OP_ALT)
{
matchingpath = cc + 1 + LINK_SIZE;
@@ -6497,24 +6547,6 @@ if (opcode == OP_COND || opcode == OP_SCOND)
else
matchingpath = cc;
}
- }
- else
- {
- SLJIT_ASSERT(has_alternatives);
-
- stacksize = GET2(matchingpath, 1);
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, STACK_TOP, 0);
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS0, SLJIT_IMM, common->name_count);
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), LOCALS1, SLJIT_IMM, common->name_entry_size);
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE0, SLJIT_IMM, GET2(common->start, common->currententry->start + 1 + LINK_SIZE));
- OP1(SLJIT_MOV, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, stacksize);
- GET_LOCAL_BASE(SLJIT_SCRATCH_REG2, 0, 0);
- OP1(SLJIT_MOV, SLJIT_SCRATCH_REG3, 0, SLJIT_IMM, common->name_table);
- sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_searchgroups));
- OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1);
- add_jump(compiler, &(BACKTRACK_AS(bracket_backtrack)->u.condfailed), CMP(SLJIT_C_EQUAL, SLJIT_SCRATCH_REG1, 0, SLJIT_IMM, 0));
- matchingpath += 1 + IMM2_SIZE;
- }
}
else
{
@@ -6956,7 +6988,7 @@ count_match(common);
return cc + 1 + LINK_SIZE;
}
-static SLJIT_INLINE pcre_uchar *get_iterator_parameters(compiler_common *common, pcre_uchar *cc, pcre_uchar *opcode, pcre_uchar *type, int *arg1, int *arg2, pcre_uchar **end)
+static SLJIT_INLINE pcre_uchar *get_iterator_parameters(compiler_common *common, pcre_uchar *cc, pcre_uchar *opcode, pcre_uchar *type, int *max, int *min, pcre_uchar **end)
{
int class_len;
@@ -6992,7 +7024,7 @@ else if (*opcode >= OP_TYPESTAR && *opcode <= OP_TYPEPOSUPTO)
}
else
{
- SLJIT_ASSERT(*opcode >= OP_CLASS || *opcode <= OP_XCLASS);
+ SLJIT_ASSERT(*opcode == OP_CLASS || *opcode == OP_NCLASS || *opcode == OP_XCLASS);
*type = *opcode;
cc++;
class_len = (*type < OP_XCLASS) ? (int)(1 + (32 / sizeof(pcre_uchar))) : GET(cc, 0);
@@ -7003,18 +7035,24 @@ else
if (end != NULL)
*end = cc + class_len;
}
+ else if (*opcode >= OP_CRPOSSTAR && *opcode <= OP_CRPOSQUERY)
+ {
+ *opcode -= OP_CRPOSSTAR - OP_POSSTAR;
+ if (end != NULL)
+ *end = cc + class_len;
+ }
else
{
- SLJIT_ASSERT(*opcode == OP_CRRANGE || *opcode == OP_CRMINRANGE);
- *arg1 = GET2(cc, (class_len + IMM2_SIZE));
- *arg2 = GET2(cc, class_len);
+ SLJIT_ASSERT(*opcode == OP_CRRANGE || *opcode == OP_CRMINRANGE || *opcode == OP_CRPOSRANGE);
+ *max = GET2(cc, (class_len + IMM2_SIZE));
+ *min = GET2(cc, class_len);
- if (*arg2 == 0)
+ if (*min == 0)
{
- SLJIT_ASSERT(*arg1 != 0);
- *opcode = (*opcode == OP_CRRANGE) ? OP_UPTO : OP_MINUPTO;
+ SLJIT_ASSERT(*max != 0);
+ *opcode = (*opcode == OP_CRRANGE) ? OP_UPTO : (*opcode == OP_CRMINRANGE ? OP_MINUPTO : OP_POSUPTO);
}
- if (*arg1 == *arg2)
+ if (*max == *min)
*opcode = OP_EXACT;
if (end != NULL)
@@ -7025,7 +7063,7 @@ else
if (*opcode == OP_UPTO || *opcode == OP_MINUPTO || *opcode == OP_EXACT || *opcode == OP_POSUPTO)
{
- *arg1 = GET2(cc, 0);
+ *max = GET2(cc, 0);
cc += IMM2_SIZE;
}
@@ -7054,7 +7092,7 @@ DEFINE_COMPILER;
backtrack_common *backtrack;
pcre_uchar opcode;
pcre_uchar type;
-int arg1 = -1, arg2 = -1;
+int max = -1, min = -1;
pcre_uchar* end;
jump_list *nomatch = NULL;
struct sljit_jump *jump = NULL;
@@ -7067,7 +7105,7 @@ int tmp_base, tmp_offset;
PUSH_BACKTRACK(sizeof(iterator_backtrack), cc, NULL);
-cc = get_iterator_parameters(common, cc, &opcode, &type, &arg1, &arg2, &end);
+cc = get_iterator_parameters(common, cc, &opcode, &type, &max, &min, &end);
switch(type)
{
@@ -7138,10 +7176,10 @@ switch(opcode)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE0);
OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
- if (opcode == OP_CRRANGE && arg2 > 0)
- CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, arg2, label);
- if (opcode == OP_UPTO || (opcode == OP_CRRANGE && arg1 > 0))
- jump = CMP(SLJIT_C_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, arg1);
+ if (opcode == OP_CRRANGE && min > 0)
+ CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, min, label);
+ if (opcode == OP_UPTO || (opcode == OP_CRRANGE && max > 0))
+ jump = CMP(SLJIT_C_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, max);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE0, TMP1, 0);
}
@@ -7168,7 +7206,7 @@ switch(opcode)
OP1(SLJIT_MOV, base, offset0, STR_PTR, 0);
if (opcode <= OP_PLUS)
JUMPTO(SLJIT_JUMP, label);
- else if (opcode == OP_CRRANGE && arg1 == 0)
+ else if (opcode == OP_CRRANGE && max == 0)
{
OP2(SLJIT_ADD, base, offset1, base, offset1, SLJIT_IMM, 1);
JUMPTO(SLJIT_JUMP, label);
@@ -7178,11 +7216,11 @@ switch(opcode)
OP1(SLJIT_MOV, TMP1, 0, base, offset1);
OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP1(SLJIT_MOV, base, offset1, TMP1, 0);
- CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, arg1 + 1, label);
+ CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, max + 1, label);
}
set_jumps(nomatch, LABEL());
if (opcode == OP_CRRANGE)
- add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_LESS, base, offset1, SLJIT_IMM, arg2 + 1));
+ add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_C_LESS, base, offset1, SLJIT_IMM, min + 1));
OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
}
BACKTRACK_AS(iterator_backtrack)->matchingpath = LABEL();
@@ -7220,7 +7258,7 @@ switch(opcode)
break;
case OP_EXACT:
- OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, arg1);
+ OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max);
label = LABEL();
compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);
OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
@@ -7233,7 +7271,7 @@ switch(opcode)
if (opcode == OP_POSPLUS)
compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);
if (opcode == OP_POSUPTO)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, SLJIT_IMM, arg1);
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, SLJIT_IMM, max);
OP1(SLJIT_MOV, tmp_base, tmp_offset, STR_PTR, 0);
label = LABEL();
compile_char1_matchingpath(common, type, cc, &nomatch);
@@ -7257,6 +7295,34 @@ switch(opcode)
OP1(SLJIT_MOV, STR_PTR, 0, tmp_base, tmp_offset);
break;
+ case OP_CRPOSRANGE:
+ /* Combination of OP_EXACT and OP_POSSTAR or OP_POSUPTO */
+ OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, min);
+ label = LABEL();
+ compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks);
+ OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ JUMPTO(SLJIT_C_NOT_ZERO, label);
+
+ if (max != 0)
+ {
+ SLJIT_ASSERT(max - min > 0);
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, SLJIT_IMM, max - min);
+ }
+ OP1(SLJIT_MOV, tmp_base, tmp_offset, STR_PTR, 0);
+ label = LABEL();
+ compile_char1_matchingpath(common, type, cc, &nomatch);
+ OP1(SLJIT_MOV, tmp_base, tmp_offset, STR_PTR, 0);
+ if (max == 0)
+ JUMPTO(SLJIT_JUMP, label);
+ else
+ {
+ OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, SLJIT_MEM1(SLJIT_LOCALS_REG), POSSESSIVE1, SLJIT_IMM, 1);
+ JUMPTO(SLJIT_C_NOT_ZERO, label);
+ }
+ set_jumps(nomatch, LABEL());
+ OP1(SLJIT_MOV, STR_PTR, 0, tmp_base, tmp_offset);
+ break;
+
default:
SLJIT_ASSERT_STOP();
break;
@@ -7534,7 +7600,7 @@ while (cc < ccend)
case OP_CLASS:
case OP_NCLASS:
- if (cc[1 + (32 / sizeof(pcre_uchar))] >= OP_CRSTAR && cc[1 + (32 / sizeof(pcre_uchar))] <= OP_CRMINRANGE)
+ if (cc[1 + (32 / sizeof(pcre_uchar))] >= OP_CRSTAR && cc[1 + (32 / sizeof(pcre_uchar))] <= OP_CRPOSRANGE)
cc = compile_iterator_matchingpath(common, cc, parent);
else
cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks);
@@ -7542,7 +7608,7 @@ while (cc < ccend)
#if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
case OP_XCLASS:
- if (*(cc + GET(cc, 1)) >= OP_CRSTAR && *(cc + GET(cc, 1)) <= OP_CRMINRANGE)
+ if (*(cc + GET(cc, 1)) >= OP_CRSTAR && *(cc + GET(cc, 1)) <= OP_CRPOSRANGE)
cc = compile_iterator_matchingpath(common, cc, parent);
else
cc = compile_char1_matchingpath(common, *cc, cc + 1, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks);
@@ -7551,10 +7617,25 @@ while (cc < ccend)
case OP_REF:
case OP_REFI:
- if (cc[1 + IMM2_SIZE] >= OP_CRSTAR && cc[1 + IMM2_SIZE] <= OP_CRMINRANGE)
+ if (cc[1 + IMM2_SIZE] >= OP_CRSTAR && cc[1 + IMM2_SIZE] <= OP_CRPOSRANGE)
+ cc = compile_ref_iterator_matchingpath(common, cc, parent);
+ else
+ {
+ compile_ref_matchingpath(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE, FALSE);
+ cc += 1 + IMM2_SIZE;
+ }
+ break;
+
+ case OP_DNREF:
+ case OP_DNREFI:
+ if (cc[1 + 2 * IMM2_SIZE] >= OP_CRSTAR && cc[1 + 2 * IMM2_SIZE] <= OP_CRPOSRANGE)
cc = compile_ref_iterator_matchingpath(common, cc, parent);
else
- cc = compile_ref_matchingpath(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE, FALSE);
+ {
+ compile_dnref_search(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks);
+ compile_ref_matchingpath(common, cc, parent->top != NULL ? &parent->top->nextbacktracks : &parent->topbacktracks, TRUE, FALSE);
+ cc += 1 + 2 * IMM2_SIZE;
+ }
break;
case OP_RECURSE:
@@ -7707,7 +7788,7 @@ DEFINE_COMPILER;
pcre_uchar *cc = current->cc;
pcre_uchar opcode;
pcre_uchar type;
-int arg1 = -1, arg2 = -1;
+int max = -1, min = -1;
struct sljit_label *label = NULL;
struct sljit_jump *jump = NULL;
jump_list *jumplist = NULL;
@@ -7716,7 +7797,7 @@ int base = (private_data_ptr == 0) ? SLJIT_MEM1(STACK_TOP) : SLJIT_MEM1(SLJIT_LO
int offset0 = (private_data_ptr == 0) ? STACK(0) : private_data_ptr;
int offset1 = (private_data_ptr == 0) ? STACK(1) : private_data_ptr + (int)sizeof(sljit_sw);
-cc = get_iterator_parameters(common, cc, &opcode, &type, &arg1, &arg2, NULL);
+cc = get_iterator_parameters(common, cc, &opcode, &type, &max, &min, NULL);
switch(opcode)
{
@@ -7735,7 +7816,7 @@ switch(opcode)
else
{
if (opcode == OP_UPTO)
- arg2 = 0;
+ min = 0;
if (opcode <= OP_PLUS)
{
OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
@@ -7745,7 +7826,7 @@ switch(opcode)
{
OP1(SLJIT_MOV, TMP1, 0, base, offset1);
OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
- jump = CMP(SLJIT_C_LESS_EQUAL, TMP1, 0, SLJIT_IMM, arg2 + 1);
+ jump = CMP(SLJIT_C_LESS_EQUAL, TMP1, 0, SLJIT_IMM, min + 1);
OP2(SLJIT_SUB, base, offset1, TMP1, 0, SLJIT_IMM, 1);
}
skip_char_back(common);
@@ -7790,12 +7871,12 @@ switch(opcode)
OP1(SLJIT_MOV, base, offset1, TMP1, 0);
if (opcode == OP_CRMINRANGE)
- CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, arg2 + 1, label);
+ CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, min + 1, label);
- if (opcode == OP_CRMINRANGE && arg1 == 0)
+ if (opcode == OP_CRMINRANGE && max == 0)
JUMPTO(SLJIT_JUMP, CURRENT_AS(iterator_backtrack)->matchingpath);
else
- CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, arg1 + 2, CURRENT_AS(iterator_backtrack)->matchingpath);
+ CMPTO(SLJIT_C_LESS, TMP1, 0, SLJIT_IMM, max + 2, CURRENT_AS(iterator_backtrack)->matchingpath);
set_jumps(jumplist, LABEL());
if (private_data_ptr == 0)
@@ -7830,6 +7911,7 @@ switch(opcode)
case OP_EXACT:
case OP_POSPLUS:
+ case OP_CRPOSRANGE:
set_jumps(current->topbacktracks, LABEL());
break;
@@ -7848,11 +7930,14 @@ static SLJIT_INLINE void compile_ref_iterator_backtrackingpath(compiler_common *
{
DEFINE_COMPILER;
pcre_uchar *cc = current->cc;
+BOOL ref = (*cc == OP_REF || *cc == OP_REFI);
pcre_uchar type;
-type = cc[1 + IMM2_SIZE];
+type = cc[ref ? 1 + IMM2_SIZE : 1 + 2 * IMM2_SIZE];
+
if ((type & 0x1) == 0)
{
+ /* Maximize case. */
set_jumps(current->topbacktracks, LABEL());
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
free_stack(common, 1);
@@ -7863,7 +7948,7 @@ if ((type & 0x1) == 0)
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
CMPTO(SLJIT_C_NOT_EQUAL, STR_PTR, 0, SLJIT_IMM, 0, CURRENT_AS(iterator_backtrack)->matchingpath);
set_jumps(current->topbacktracks, LABEL());
-free_stack(common, 2);
+free_stack(common, ref ? 2 : 3);
}
static SLJIT_INLINE void compile_recurse_backtrackingpath(compiler_common *common, struct backtrack_common *current)
@@ -8664,6 +8749,8 @@ while (current)
case OP_REF:
case OP_REFI:
+ case OP_DNREF:
+ case OP_DNREFI:
compile_ref_iterator_backtrackingpath(common, current);
break;
@@ -8958,7 +9045,7 @@ else
common->endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;
common->ctypes = (sljit_sw)(tables + ctypes_offset);
common->digits[0] = -2;
-common->name_table = (sljit_sw)((pcre_uchar *)re + re->name_table_offset);
+common->name_table = ((pcre_uchar *)re) + re->name_table_offset;
common->name_count = re->name_count;
common->name_entry_size = re->name_entry_size;
common->jscript_compat = (re->options & PCRE_JAVASCRIPT_COMPAT) != 0;
@@ -9696,6 +9783,20 @@ if (extra != NULL &&
}
}
+#if defined COMPILE_PCRE8
+PCRE_EXP_DECL void
+pcre_jit_free_unused_memory(void)
+#elif defined COMPILE_PCRE16
+PCRE_EXP_DECL void
+pcre16_jit_free_unused_memory(void)
+#elif defined COMPILE_PCRE32
+PCRE_EXP_DECL void
+pcre32_jit_free_unused_memory(void)
+#endif
+{
+sljit_free_unused_memory_exec();
+}
+
#else /* SUPPORT_JIT */
/* These are dummy functions to avoid linking errors when JIT support is not
@@ -9747,6 +9848,19 @@ pcre32_assign_jit_stack(pcre32_extra *extra, pcre32_jit_callback callback, void
(void)userdata;
}
+#if defined COMPILE_PCRE8
+PCRE_EXP_DECL void
+pcre_jit_free_unused_memory(void)
+#elif defined COMPILE_PCRE16
+PCRE_EXP_DECL void
+pcre16_jit_free_unused_memory(void)
+#elif defined COMPILE_PCRE32
+PCRE_EXP_DECL void
+pcre32_jit_free_unused_memory(void)
+#endif
+{
+}
+
#endif
/* End of pcre_jit_compile.c */
diff --git a/pcre/pcre_jit_test.c b/pcre/pcre_jit_test.c
index 1c247c58117..cabd2560c57 100644
--- a/pcre/pcre_jit_test.c
+++ b/pcre/pcre_jit_test.c
@@ -501,6 +501,22 @@ static struct regression_test_case regression_test_cases[] = {
{ MUAP, 0 | F_PROPERTY, "(\\P{N})\\1{1,2}ww", "wwwww" },
{ PCRE_UCP, 0 | F_PROPERTY, "(\\P{N})\\1{2,}", ".www." },
{ CMUAP, 0, "(\xf0\x90\x90\x80)\\1", "\xf0\x90\x90\xa8\xf0\x90\x90\xa8" },
+ { MUA | PCRE_DUPNAMES, 0 | F_NOMATCH, "\\k<A>{1,3}(?<A>aa)(?<A>bb)", "aabb" },
+ { MUA | PCRE_DUPNAMES | PCRE_JAVASCRIPT_COMPAT, 0, "\\k<A>{1,3}(?<A>aa)(?<A>bb)", "aabb" },
+ { MUA | PCRE_DUPNAMES | PCRE_JAVASCRIPT_COMPAT, 0, "\\k<A>*(?<A>aa)(?<A>bb)", "aabb" },
+ { MUA | PCRE_DUPNAMES, 0, "(?<A>aa)(?<A>bb)\\k<A>{0,3}aaaaaa", "aabbaaaaaa" },
+ { MUA | PCRE_DUPNAMES, 0, "(?<A>aa)(?<A>bb)\\k<A>{2,5}bb", "aabbaaaabb" },
+ { MUA | PCRE_DUPNAMES, 0, "(?:(?<A>aa)|(?<A>bb))\\k<A>{0,3}m", "aaaaaaaabbbbaabbbbm" },
+ { MUA | PCRE_DUPNAMES, 0 | F_NOMATCH, "\\k<A>{1,3}?(?<A>aa)(?<A>bb)", "aabb" },
+ { MUA | PCRE_DUPNAMES | PCRE_JAVASCRIPT_COMPAT, 0, "\\k<A>{1,3}?(?<A>aa)(?<A>bb)", "aabb" },
+ { MUA | PCRE_DUPNAMES, 0, "\\k<A>*?(?<A>aa)(?<A>bb)", "aabb" },
+ { MUA | PCRE_DUPNAMES, 0, "(?:(?<A>aa)|(?<A>bb))\\k<A>{0,3}?m", "aaaaaabbbbbbaabbbbbbbbbbm" },
+ { MUA | PCRE_DUPNAMES, 0, "(?:(?<A>aa)|(?<A>bb))\\k<A>*?m", "aaaaaabbbbbbaabbbbbbbbbbm" },
+ { MUA | PCRE_DUPNAMES, 0, "(?:(?<A>aa)|(?<A>bb))\\k<A>{2,3}?", "aaaabbbbaaaabbbbbbbbbb" },
+ { CMUA | PCRE_DUPNAMES, 0, "(?:(?<A>AA)|(?<A>BB))\\k<A>{0,3}M", "aaaaaaaabbbbaabbbbm" },
+ { CMUA | PCRE_DUPNAMES, 0, "(?:(?<A>AA)|(?<A>BB))\\k<A>{1,3}M", "aaaaaaaabbbbaabbbbm" },
+ { CMUA | PCRE_DUPNAMES, 0, "(?:(?<A>AA)|(?<A>BB))\\k<A>{0,3}?M", "aaaaaabbbbbbaabbbbbbbbbbm" },
+ { CMUA | PCRE_DUPNAMES, 0, "(?:(?<A>AA)|(?<A>BB))\\k<A>{2,3}?", "aaaabbbbaaaabbbbbbbbbb" },
/* Assertions. */
{ MUA, 0, "(?=xx|yy|zz)\\w{4}", "abczzdefg" },
@@ -1374,7 +1390,7 @@ static int regression_tests(void)
#endif
/* printf("[%d-%d-%d|%d-%d|%d-%d|%d-%d]%s",
- return_value8[0], return_value16[0],
+ return_value8[0], return_value16[0], return_value32[0],
ovector8_1[0], ovector8_1[1],
ovector16_1[0], ovector16_1[1],
ovector32_1[0], ovector32_1[1],
diff --git a/pcre/pcre_maketables.c b/pcre/pcre_maketables.c
index 610a669586b..a44a6eaa905 100644
--- a/pcre/pcre_maketables.c
+++ b/pcre/pcre_maketables.c
@@ -98,13 +98,17 @@ for (i = 0; i < 256; i++) *p++ = tolower(i);
for (i = 0; i < 256; i++) *p++ = islower(i)? toupper(i) : tolower(i);
/* Then the character class tables. Don't try to be clever and save effort on
-exclusive ones - in some locales things may be different. Note that the table
-for "space" includes everything "isspace" gives, including VT in the default
-locale. This makes it work for the POSIX class [:space:]. Note also that it is
-possible for a character to be alnum or alpha without being lower or upper,
-such as "male and female ordinals" (\xAA and \xBA) in the fr_FR locale (at
-least under Debian Linux's locales as of 12/2005). So we must test for alnum
-specially. */
+exclusive ones - in some locales things may be different.
+
+Note that the table for "space" includes everything "isspace" gives, including
+VT in the default locale. This makes it work for the POSIX class [:space:].
+From release 8.34 is is also correct for Perl space, because Perl added VT at
+release 5.18.
+
+Note also that it is possible for a character to be alnum or alpha without
+being lower or upper, such as "male and female ordinals" (\xAA and \xBA) in the
+fr_FR locale (at least under Debian Linux's locales as of 12/2005). So we must
+test for alnum specially. */
memset(p, 0, cbit_length);
for (i = 0; i < 256; i++)
@@ -123,14 +127,15 @@ for (i = 0; i < 256; i++)
}
p += cbit_length;
-/* Finally, the character type table. In this, we exclude VT from the white
-space chars, because Perl doesn't recognize it as such for \s and for comments
-within regexes. */
+/* Finally, the character type table. In this, we used to exclude VT from the
+white space chars, because Perl didn't recognize it as such for \s and for
+comments within regexes. However, Perl changed at release 5.18, so PCRE changed
+at release 8.34. */
for (i = 0; i < 256; i++)
{
int x = 0;
- if (i != CHAR_VT && isspace(i)) x += ctype_space;
+ if (isspace(i)) x += ctype_space;
if (isalpha(i)) x += ctype_letter;
if (isdigit(i)) x += ctype_digit;
if (isxdigit(i)) x += ctype_xdigit;
diff --git a/pcre/pcre_printint.c b/pcre/pcre_printint.c
index 10b575426b3..e4ef152d071 100644
--- a/pcre/pcre_printint.c
+++ b/pcre/pcre_printint.c
@@ -425,10 +425,19 @@ for(;;)
break;
case OP_CREF:
- case OP_NCREF:
fprintf(f, "%3d %s", GET2(code,1), priv_OP_names[*code]);
break;
+ case OP_DNCREF:
+ {
+ pcre_uchar *entry = (pcre_uchar *)re + offset + (GET2(code, 1) * size) +
+ IMM2_SIZE;
+ fprintf(f, " %s Cond ref <", flag);
+ print_puchar(f, entry);
+ fprintf(f, ">%d", GET2(code, 1 + IMM2_SIZE));
+ }
+ break;
+
case OP_RREF:
c = GET2(code, 1);
if (c == RREF_ANY)
@@ -437,12 +446,14 @@ for(;;)
fprintf(f, " Cond recurse %d", c);
break;
- case OP_NRREF:
- c = GET2(code, 1);
- if (c == RREF_ANY)
- fprintf(f, " Cond nrecurse any");
- else
- fprintf(f, " Cond nrecurse %d", c);
+ case OP_DNRREF:
+ {
+ pcre_uchar *entry = (pcre_uchar *)re + offset + (GET2(code, 1) * size) +
+ IMM2_SIZE;
+ fprintf(f, " %s Cond recurse <", flag);
+ print_puchar(f, entry);
+ fprintf(f, ">%d", GET2(code, 1 + IMM2_SIZE));
+ }
break;
case OP_DEF:
@@ -598,6 +609,20 @@ for(;;)
ccode = code + priv_OP_lengths[*code];
goto CLASS_REF_REPEAT;
+ case OP_DNREFI:
+ flag = "/i";
+ /* Fall through */
+ case OP_DNREF:
+ {
+ pcre_uchar *entry = (pcre_uchar *)re + offset + (GET2(code, 1) * size) +
+ IMM2_SIZE;
+ fprintf(f, " %s \\k<", flag);
+ print_puchar(f, entry);
+ fprintf(f, ">%d", GET2(code, 1 + IMM2_SIZE));
+ }
+ ccode = code + priv_OP_lengths[*code];
+ goto CLASS_REF_REPEAT;
+
case OP_CALLOUT:
fprintf(f, " %s %d %d %d", priv_OP_names[*code], code[1], GET(code,2),
GET(code, 2 + LINK_SIZE));
@@ -608,9 +633,9 @@ for(;;)
print_prop(f, code, " ", "");
break;
- /* OP_XCLASS can only occur in UTF or PCRE16 modes. However, there's no
- harm in having this code always here, and it makes it less messy without
- all those #ifdefs. */
+ /* OP_XCLASS cannot occur in 8-bit, non-UTF mode. However, there's no harm
+ in having this code always here, and it makes it less messy without all
+ those #ifdefs. */
case OP_CLASS:
case OP_NCLASS:
@@ -671,26 +696,51 @@ for(;;)
pcre_uchar ch;
while ((ch = *ccode++) != XCL_END)
{
- if (ch == XCL_PROP)
- {
- unsigned int ptype = *ccode++;
- unsigned int pvalue = *ccode++;
- fprintf(f, "\\p{%s}", get_ucpname(ptype, pvalue));
- }
- else if (ch == XCL_NOTPROP)
- {
- unsigned int ptype = *ccode++;
- unsigned int pvalue = *ccode++;
- fprintf(f, "\\P{%s}", get_ucpname(ptype, pvalue));
- }
- else
+ BOOL not = FALSE;
+ const char *notch = "";
+
+ switch(ch)
{
+ case XCL_NOTPROP:
+ not = TRUE;
+ notch = "^";
+ /* Fall through */
+
+ case XCL_PROP:
+ {
+ unsigned int ptype = *ccode++;
+ unsigned int pvalue = *ccode++;
+
+ switch(ptype)
+ {
+ case PT_PXGRAPH:
+ fprintf(f, "[:%sgraph:]", notch);
+ break;
+
+ case PT_PXPRINT:
+ fprintf(f, "[:%sprint:]", notch);
+ break;
+
+ case PT_PXPUNCT:
+ fprintf(f, "[:%spunct:]", notch);
+ break;
+
+ default:
+ fprintf(f, "\\%c{%s}", (not? 'P':'p'),
+ get_ucpname(ptype, pvalue));
+ break;
+ }
+ }
+ break;
+
+ default:
ccode += 1 + print_char(f, ccode, utf);
if (ch == XCL_RANGE)
{
fprintf(f, "-");
ccode += 1 + print_char(f, ccode, utf);
}
+ break;
}
}
}
@@ -710,17 +760,22 @@ for(;;)
case OP_CRMINPLUS:
case OP_CRQUERY:
case OP_CRMINQUERY:
+ case OP_CRPOSSTAR:
+ case OP_CRPOSPLUS:
+ case OP_CRPOSQUERY:
fprintf(f, "%s", priv_OP_names[*ccode]);
extra += priv_OP_lengths[*ccode];
break;
case OP_CRRANGE:
case OP_CRMINRANGE:
+ case OP_CRPOSRANGE:
min = GET2(ccode,1);
max = GET2(ccode,1 + IMM2_SIZE);
if (max == 0) fprintf(f, "{%u,}", min);
else fprintf(f, "{%u,%u}", min, max);
if (*ccode == OP_CRMINRANGE) fprintf(f, "?");
+ else if (*ccode == OP_CRPOSRANGE) fprintf(f, "+");
extra += priv_OP_lengths[*ccode];
break;
diff --git a/pcre/pcre_study.c b/pcre/pcre_study.c
index 12d2a66817b..c2aff517a5d 100644
--- a/pcre/pcre_study.c
+++ b/pcre/pcre_study.c
@@ -66,8 +66,9 @@ string of that length that matches. In UTF8 mode, the result is in characters
rather than bytes.
Arguments:
+ re compiled pattern block
code pointer to start of group (the bracket)
- startcode pointer to start of the whole pattern
+ startcode pointer to start of the whole pattern's code
options the compiling options
int RECURSE depth
@@ -78,8 +79,8 @@ Returns: the minimum length
*/
static int
-find_minlength(const pcre_uchar *code, const pcre_uchar *startcode, int options,
- int recurse_depth)
+find_minlength(const REAL_PCRE *re, const pcre_uchar *code,
+ const pcre_uchar *startcode, int options, int recurse_depth)
{
int length = -1;
/* PCRE_UTF16 has the same value as PCRE_UTF8. */
@@ -129,7 +130,7 @@ for (;;)
case OP_SBRAPOS:
case OP_ONCE:
case OP_ONCE_NC:
- d = find_minlength(cc, startcode, options, recurse_depth);
+ d = find_minlength(re, cc, startcode, options, recurse_depth);
if (d < 0) return d;
branchlength += d;
do cc += GET(cc, 1); while (*cc == OP_ALT);
@@ -175,9 +176,9 @@ for (;;)
case OP_REVERSE:
case OP_CREF:
- case OP_NCREF:
+ case OP_DNCREF:
case OP_RREF:
- case OP_NRREF:
+ case OP_DNRREF:
case OP_DEF:
case OP_CALLOUT:
case OP_SOD:
@@ -341,6 +342,7 @@ for (;;)
{
case OP_CRPLUS:
case OP_CRMINPLUS:
+ case OP_CRPOSPLUS:
branchlength++;
/* Fall through */
@@ -348,11 +350,14 @@ for (;;)
case OP_CRMINSTAR:
case OP_CRQUERY:
case OP_CRMINQUERY:
+ case OP_CRPOSSTAR:
+ case OP_CRPOSQUERY:
cc++;
break;
case OP_CRRANGE:
case OP_CRMINRANGE:
+ case OP_CRPOSRANGE:
branchlength += GET2(cc,1);
cc += 1 + 2 * IMM2_SIZE;
break;
@@ -375,7 +380,38 @@ for (;;)
matches an empty string (by default it causes a matching failure), so in
that case we must set the minimum length to zero. */
- case OP_REF:
+ case OP_DNREF: /* Duplicate named pattern back reference */
+ case OP_DNREFI:
+ if ((options & PCRE_JAVASCRIPT_COMPAT) == 0)
+ {
+ int count = GET2(cc, 1+IMM2_SIZE);
+ pcre_uchar *slot = (pcre_uchar *)re +
+ re->name_table_offset + GET2(cc, 1) * re->name_entry_size;
+ d = INT_MAX;
+ while (count-- > 0)
+ {
+ ce = cs = (pcre_uchar *)PRIV(find_bracket)(startcode, utf, GET2(slot, 0));
+ if (cs == NULL) return -2;
+ do ce += GET(ce, 1); while (*ce == OP_ALT);
+ if (cc > cs && cc < ce)
+ {
+ d = 0;
+ had_recurse = TRUE;
+ break;
+ }
+ else
+ {
+ int dd = find_minlength(re, cs, startcode, options, recurse_depth);
+ if (dd < d) d = dd;
+ }
+ slot += re->name_entry_size;
+ }
+ }
+ else d = 0;
+ cc += 1 + 2*IMM2_SIZE;
+ goto REPEAT_BACK_REFERENCE;
+
+ case OP_REF: /* Single back reference */
case OP_REFI:
if ((options & PCRE_JAVASCRIPT_COMPAT) == 0)
{
@@ -389,7 +425,7 @@ for (;;)
}
else
{
- d = find_minlength(cs, startcode, options, recurse_depth);
+ d = find_minlength(re, cs, startcode, options, recurse_depth);
}
}
else d = 0;
@@ -397,24 +433,29 @@ for (;;)
/* Handle repeated back references */
+ REPEAT_BACK_REFERENCE:
switch (*cc)
{
case OP_CRSTAR:
case OP_CRMINSTAR:
case OP_CRQUERY:
case OP_CRMINQUERY:
+ case OP_CRPOSSTAR:
+ case OP_CRPOSQUERY:
min = 0;
cc++;
break;
case OP_CRPLUS:
case OP_CRMINPLUS:
+ case OP_CRPOSPLUS:
min = 1;
cc++;
break;
case OP_CRRANGE:
case OP_CRMINRANGE:
+ case OP_CRPOSRANGE:
min = GET2(cc, 1);
cc += 1 + 2 * IMM2_SIZE;
break;
@@ -437,7 +478,8 @@ for (;;)
had_recurse = TRUE;
else
{
- branchlength += find_minlength(cs, startcode, options, recurse_depth + 1);
+ branchlength += find_minlength(re, cs, startcode, options,
+ recurse_depth + 1);
}
cc += 1 + LINK_SIZE;
break;
@@ -778,6 +820,10 @@ do
case OP_COND:
case OP_CREF:
case OP_DEF:
+ case OP_DNCREF:
+ case OP_DNREF:
+ case OP_DNREFI:
+ case OP_DNRREF:
case OP_DOLL:
case OP_DOLLM:
case OP_END:
@@ -786,7 +832,6 @@ do
case OP_EXTUNI:
case OP_FAIL:
case OP_MARK:
- case OP_NCREF:
case OP_NOT:
case OP_NOTEXACT:
case OP_NOTEXACTI:
@@ -818,7 +863,6 @@ do
case OP_NOTUPTOI:
case OP_NOT_HSPACE:
case OP_NOT_VSPACE:
- case OP_NRREF:
case OP_PROP:
case OP_PRUNE:
case OP_PRUNE_ARG:
@@ -1183,24 +1227,16 @@ do
set_type_bits(start_bits, cbit_digit, table_limit, cd);
break;
- /* The cbit_space table has vertical tab as whitespace; we have to
- ensure it gets set as not whitespace. Luckily, the code value is the
- same (0x0b) in ASCII and EBCDIC, so we can just adjust the appropriate
- bit. */
+ /* The cbit_space table has vertical tab as whitespace; we no longer
+ have to play fancy tricks because Perl added VT to its whitespace at
+ release 5.18. PCRE added it at release 8.34. */
case OP_NOT_WHITESPACE:
set_nottype_bits(start_bits, cbit_space, table_limit, cd);
- start_bits[1] |= 0x08;
break;
- /* The cbit_space table has vertical tab as whitespace; we have to
- avoid setting it. Luckily, the code value is the same (0x0b) in ASCII
- and EBCDIC, so we can just adjust the appropriate bit. */
-
case OP_WHITESPACE:
- c = start_bits[1]; /* Save in case it was already set */
set_type_bits(start_bits, cbit_space, table_limit, cd);
- start_bits[1] = (start_bits[1] & ~0x08) | c;
break;
case OP_NOT_WORDCHAR:
@@ -1277,11 +1313,14 @@ do
case OP_CRMINSTAR:
case OP_CRQUERY:
case OP_CRMINQUERY:
+ case OP_CRPOSSTAR:
+ case OP_CRPOSQUERY:
tcode++;
break;
case OP_CRRANGE:
case OP_CRMINRANGE:
+ case OP_CRPOSRANGE:
if (GET2(tcode, 1) == 0) tcode += 1 + 2 * IMM2_SIZE;
else try_next = FALSE;
break;
@@ -1346,6 +1385,7 @@ pcre_uchar *code;
compile_data compile_block;
const REAL_PCRE *re = (const REAL_PCRE *)external_re;
+
*errorptr = NULL;
if (re == NULL || re->magic_number != MAGIC_NUMBER)
@@ -1422,7 +1462,7 @@ if ((re->options & PCRE_ANCHORED) == 0 &&
/* Find the minimum length of subject string. */
-switch(min = find_minlength(code, code, re->options, 0))
+switch(min = find_minlength(re, code, code, re->options, 0))
{
case -2: *errorptr = "internal error: missing capturing bracket"; return NULL;
case -3: *errorptr = "internal error: opcode not recognized"; return NULL;
diff --git a/pcre/pcre_ucd.c b/pcre/pcre_ucd.c
index 56f31a1e69b..46ea70c44cc 100644
--- a/pcre/pcre_ucd.c
+++ b/pcre/pcre_ucd.c
@@ -20,7 +20,7 @@ needed. */
/* Unicode character database. */
/* This file was autogenerated by the MultiStage2.py script. */
-/* Total size: 65696 bytes, block size: 128. */
+/* Total size: 65688 bytes, block size: 128. */
/* The tables herein are needed only when UCP support is built
into PCRE. This module should not be referenced otherwise, so
@@ -79,7 +79,7 @@ const pcre_uint32 PRIV(ucd_caseless_sets)[] = {
#ifndef PCRE_INCLUDED
-const ucd_record PRIV(ucd_records)[] = { /* 5024 bytes, record size 8 */
+const ucd_record PRIV(ucd_records)[] = { /* 5016 bytes, record size 8 */
{ 9, 0, 2, 0, 0, }, /* 0 */
{ 9, 0, 1, 0, 0, }, /* 1 */
{ 9, 0, 0, 0, 0, }, /* 2 */
@@ -422,7 +422,7 @@ const ucd_record PRIV(ucd_records)[] = { /* 5024 bytes, record size 8 */
{ 37, 21, 12, 0, 0, }, /* 339 */
{ 37, 17, 12, 0, 0, }, /* 340 */
{ 37, 12, 3, 0, 0, }, /* 341 */
- { 37, 29, 12, 0, 0, }, /* 342 */
+ { 37, 1, 2, 0, 0, }, /* 342 */
{ 37, 13, 12, 0, 0, }, /* 343 */
{ 37, 7, 12, 0, 0, }, /* 344 */
{ 37, 6, 12, 0, 0, }, /* 345 */
@@ -598,116 +598,115 @@ const ucd_record PRIV(ucd_records)[] = { /* 5024 bytes, record size 8 */
{ 83, 10, 5, 0, 0, }, /* 515 */
{ 83, 7, 12, 0, 0, }, /* 516 */
{ 83, 21, 12, 0, 0, }, /* 517 */
- { 83, 6, 12, 0, 0, }, /* 518 */
- { 83, 13, 12, 0, 0, }, /* 519 */
- { 67, 7, 12, 0, 0, }, /* 520 */
- { 67, 12, 3, 0, 0, }, /* 521 */
- { 67, 10, 5, 0, 0, }, /* 522 */
- { 67, 13, 12, 0, 0, }, /* 523 */
- { 67, 21, 12, 0, 0, }, /* 524 */
- { 38, 6, 12, 0, 0, }, /* 525 */
- { 91, 7, 12, 0, 0, }, /* 526 */
- { 91, 12, 3, 0, 0, }, /* 527 */
- { 91, 6, 12, 0, 0, }, /* 528 */
- { 91, 21, 12, 0, 0, }, /* 529 */
- { 86, 7, 12, 0, 0, }, /* 530 */
- { 86, 10, 5, 0, 0, }, /* 531 */
- { 86, 12, 3, 0, 0, }, /* 532 */
- { 86, 21, 12, 0, 0, }, /* 533 */
- { 86, 6, 12, 0, 0, }, /* 534 */
- { 86, 13, 12, 0, 0, }, /* 535 */
- { 23, 7, 9, 0, 0, }, /* 536 */
- { 23, 7, 10, 0, 0, }, /* 537 */
- { 9, 4, 2, 0, 0, }, /* 538 */
- { 9, 3, 12, 0, 0, }, /* 539 */
- { 25, 25, 12, 0, 0, }, /* 540 */
- { 0, 24, 12, 0, 0, }, /* 541 */
- { 9, 6, 3, 0, 0, }, /* 542 */
- { 35, 7, 12, 0, 0, }, /* 543 */
- { 19, 14, 12, 0, 0, }, /* 544 */
- { 19, 15, 12, 0, 0, }, /* 545 */
- { 19, 26, 12, 0, 0, }, /* 546 */
- { 70, 7, 12, 0, 0, }, /* 547 */
- { 66, 7, 12, 0, 0, }, /* 548 */
- { 41, 7, 12, 0, 0, }, /* 549 */
- { 41, 15, 12, 0, 0, }, /* 550 */
- { 18, 7, 12, 0, 0, }, /* 551 */
- { 18, 14, 12, 0, 0, }, /* 552 */
- { 59, 7, 12, 0, 0, }, /* 553 */
- { 59, 21, 12, 0, 0, }, /* 554 */
- { 42, 7, 12, 0, 0, }, /* 555 */
- { 42, 21, 12, 0, 0, }, /* 556 */
- { 42, 14, 12, 0, 0, }, /* 557 */
- { 13, 9, 12, 0, 40, }, /* 558 */
- { 13, 5, 12, 0, -40, }, /* 559 */
- { 46, 7, 12, 0, 0, }, /* 560 */
- { 44, 7, 12, 0, 0, }, /* 561 */
- { 44, 13, 12, 0, 0, }, /* 562 */
- { 11, 7, 12, 0, 0, }, /* 563 */
- { 80, 7, 12, 0, 0, }, /* 564 */
- { 80, 21, 12, 0, 0, }, /* 565 */
- { 80, 15, 12, 0, 0, }, /* 566 */
- { 65, 7, 12, 0, 0, }, /* 567 */
- { 65, 15, 12, 0, 0, }, /* 568 */
- { 65, 21, 12, 0, 0, }, /* 569 */
- { 71, 7, 12, 0, 0, }, /* 570 */
- { 71, 21, 12, 0, 0, }, /* 571 */
- { 97, 7, 12, 0, 0, }, /* 572 */
- { 96, 7, 12, 0, 0, }, /* 573 */
- { 30, 7, 12, 0, 0, }, /* 574 */
- { 30, 12, 3, 0, 0, }, /* 575 */
- { 30, 15, 12, 0, 0, }, /* 576 */
- { 30, 21, 12, 0, 0, }, /* 577 */
- { 87, 7, 12, 0, 0, }, /* 578 */
- { 87, 15, 12, 0, 0, }, /* 579 */
- { 87, 21, 12, 0, 0, }, /* 580 */
- { 77, 7, 12, 0, 0, }, /* 581 */
- { 77, 21, 12, 0, 0, }, /* 582 */
- { 82, 7, 12, 0, 0, }, /* 583 */
- { 82, 15, 12, 0, 0, }, /* 584 */
- { 81, 7, 12, 0, 0, }, /* 585 */
- { 81, 15, 12, 0, 0, }, /* 586 */
- { 88, 7, 12, 0, 0, }, /* 587 */
- { 0, 15, 12, 0, 0, }, /* 588 */
- { 93, 10, 5, 0, 0, }, /* 589 */
- { 93, 12, 3, 0, 0, }, /* 590 */
- { 93, 7, 12, 0, 0, }, /* 591 */
- { 93, 21, 12, 0, 0, }, /* 592 */
- { 93, 15, 12, 0, 0, }, /* 593 */
- { 93, 13, 12, 0, 0, }, /* 594 */
- { 84, 12, 3, 0, 0, }, /* 595 */
- { 84, 10, 5, 0, 0, }, /* 596 */
- { 84, 7, 12, 0, 0, }, /* 597 */
- { 84, 21, 12, 0, 0, }, /* 598 */
- { 84, 1, 2, 0, 0, }, /* 599 */
- { 100, 7, 12, 0, 0, }, /* 600 */
- { 100, 13, 12, 0, 0, }, /* 601 */
- { 95, 12, 3, 0, 0, }, /* 602 */
- { 95, 7, 12, 0, 0, }, /* 603 */
- { 95, 10, 5, 0, 0, }, /* 604 */
- { 95, 13, 12, 0, 0, }, /* 605 */
- { 95, 21, 12, 0, 0, }, /* 606 */
- { 99, 12, 3, 0, 0, }, /* 607 */
- { 99, 10, 5, 0, 0, }, /* 608 */
- { 99, 7, 12, 0, 0, }, /* 609 */
- { 99, 21, 12, 0, 0, }, /* 610 */
- { 99, 13, 12, 0, 0, }, /* 611 */
- { 101, 7, 12, 0, 0, }, /* 612 */
- { 101, 12, 3, 0, 0, }, /* 613 */
- { 101, 10, 5, 0, 0, }, /* 614 */
- { 101, 13, 12, 0, 0, }, /* 615 */
- { 62, 7, 12, 0, 0, }, /* 616 */
- { 62, 14, 12, 0, 0, }, /* 617 */
- { 62, 21, 12, 0, 0, }, /* 618 */
- { 79, 7, 12, 0, 0, }, /* 619 */
- { 98, 7, 12, 0, 0, }, /* 620 */
- { 98, 10, 5, 0, 0, }, /* 621 */
- { 98, 12, 3, 0, 0, }, /* 622 */
- { 98, 6, 12, 0, 0, }, /* 623 */
- { 9, 10, 3, 0, 0, }, /* 624 */
- { 19, 12, 3, 0, 0, }, /* 625 */
- { 9, 26, 11, 0, 0, }, /* 626 */
- { 26, 26, 12, 0, 0, }, /* 627 */
+ { 83, 13, 12, 0, 0, }, /* 518 */
+ { 67, 7, 12, 0, 0, }, /* 519 */
+ { 67, 12, 3, 0, 0, }, /* 520 */
+ { 67, 10, 5, 0, 0, }, /* 521 */
+ { 67, 13, 12, 0, 0, }, /* 522 */
+ { 67, 21, 12, 0, 0, }, /* 523 */
+ { 38, 6, 12, 0, 0, }, /* 524 */
+ { 91, 7, 12, 0, 0, }, /* 525 */
+ { 91, 12, 3, 0, 0, }, /* 526 */
+ { 91, 6, 12, 0, 0, }, /* 527 */
+ { 91, 21, 12, 0, 0, }, /* 528 */
+ { 86, 7, 12, 0, 0, }, /* 529 */
+ { 86, 10, 5, 0, 0, }, /* 530 */
+ { 86, 12, 3, 0, 0, }, /* 531 */
+ { 86, 21, 12, 0, 0, }, /* 532 */
+ { 86, 6, 12, 0, 0, }, /* 533 */
+ { 86, 13, 12, 0, 0, }, /* 534 */
+ { 23, 7, 9, 0, 0, }, /* 535 */
+ { 23, 7, 10, 0, 0, }, /* 536 */
+ { 9, 4, 2, 0, 0, }, /* 537 */
+ { 9, 3, 12, 0, 0, }, /* 538 */
+ { 25, 25, 12, 0, 0, }, /* 539 */
+ { 0, 24, 12, 0, 0, }, /* 540 */
+ { 9, 6, 3, 0, 0, }, /* 541 */
+ { 35, 7, 12, 0, 0, }, /* 542 */
+ { 19, 14, 12, 0, 0, }, /* 543 */
+ { 19, 15, 12, 0, 0, }, /* 544 */
+ { 19, 26, 12, 0, 0, }, /* 545 */
+ { 70, 7, 12, 0, 0, }, /* 546 */
+ { 66, 7, 12, 0, 0, }, /* 547 */
+ { 41, 7, 12, 0, 0, }, /* 548 */
+ { 41, 15, 12, 0, 0, }, /* 549 */
+ { 18, 7, 12, 0, 0, }, /* 550 */
+ { 18, 14, 12, 0, 0, }, /* 551 */
+ { 59, 7, 12, 0, 0, }, /* 552 */
+ { 59, 21, 12, 0, 0, }, /* 553 */
+ { 42, 7, 12, 0, 0, }, /* 554 */
+ { 42, 21, 12, 0, 0, }, /* 555 */
+ { 42, 14, 12, 0, 0, }, /* 556 */
+ { 13, 9, 12, 0, 40, }, /* 557 */
+ { 13, 5, 12, 0, -40, }, /* 558 */
+ { 46, 7, 12, 0, 0, }, /* 559 */
+ { 44, 7, 12, 0, 0, }, /* 560 */
+ { 44, 13, 12, 0, 0, }, /* 561 */
+ { 11, 7, 12, 0, 0, }, /* 562 */
+ { 80, 7, 12, 0, 0, }, /* 563 */
+ { 80, 21, 12, 0, 0, }, /* 564 */
+ { 80, 15, 12, 0, 0, }, /* 565 */
+ { 65, 7, 12, 0, 0, }, /* 566 */
+ { 65, 15, 12, 0, 0, }, /* 567 */
+ { 65, 21, 12, 0, 0, }, /* 568 */
+ { 71, 7, 12, 0, 0, }, /* 569 */
+ { 71, 21, 12, 0, 0, }, /* 570 */
+ { 97, 7, 12, 0, 0, }, /* 571 */
+ { 96, 7, 12, 0, 0, }, /* 572 */
+ { 30, 7, 12, 0, 0, }, /* 573 */
+ { 30, 12, 3, 0, 0, }, /* 574 */
+ { 30, 15, 12, 0, 0, }, /* 575 */
+ { 30, 21, 12, 0, 0, }, /* 576 */
+ { 87, 7, 12, 0, 0, }, /* 577 */
+ { 87, 15, 12, 0, 0, }, /* 578 */
+ { 87, 21, 12, 0, 0, }, /* 579 */
+ { 77, 7, 12, 0, 0, }, /* 580 */
+ { 77, 21, 12, 0, 0, }, /* 581 */
+ { 82, 7, 12, 0, 0, }, /* 582 */
+ { 82, 15, 12, 0, 0, }, /* 583 */
+ { 81, 7, 12, 0, 0, }, /* 584 */
+ { 81, 15, 12, 0, 0, }, /* 585 */
+ { 88, 7, 12, 0, 0, }, /* 586 */
+ { 0, 15, 12, 0, 0, }, /* 587 */
+ { 93, 10, 5, 0, 0, }, /* 588 */
+ { 93, 12, 3, 0, 0, }, /* 589 */
+ { 93, 7, 12, 0, 0, }, /* 590 */
+ { 93, 21, 12, 0, 0, }, /* 591 */
+ { 93, 15, 12, 0, 0, }, /* 592 */
+ { 93, 13, 12, 0, 0, }, /* 593 */
+ { 84, 12, 3, 0, 0, }, /* 594 */
+ { 84, 10, 5, 0, 0, }, /* 595 */
+ { 84, 7, 12, 0, 0, }, /* 596 */
+ { 84, 21, 12, 0, 0, }, /* 597 */
+ { 84, 1, 2, 0, 0, }, /* 598 */
+ { 100, 7, 12, 0, 0, }, /* 599 */
+ { 100, 13, 12, 0, 0, }, /* 600 */
+ { 95, 12, 3, 0, 0, }, /* 601 */
+ { 95, 7, 12, 0, 0, }, /* 602 */
+ { 95, 10, 5, 0, 0, }, /* 603 */
+ { 95, 13, 12, 0, 0, }, /* 604 */
+ { 95, 21, 12, 0, 0, }, /* 605 */
+ { 99, 12, 3, 0, 0, }, /* 606 */
+ { 99, 10, 5, 0, 0, }, /* 607 */
+ { 99, 7, 12, 0, 0, }, /* 608 */
+ { 99, 21, 12, 0, 0, }, /* 609 */
+ { 99, 13, 12, 0, 0, }, /* 610 */
+ { 101, 7, 12, 0, 0, }, /* 611 */
+ { 101, 12, 3, 0, 0, }, /* 612 */
+ { 101, 10, 5, 0, 0, }, /* 613 */
+ { 101, 13, 12, 0, 0, }, /* 614 */
+ { 62, 7, 12, 0, 0, }, /* 615 */
+ { 62, 14, 12, 0, 0, }, /* 616 */
+ { 62, 21, 12, 0, 0, }, /* 617 */
+ { 79, 7, 12, 0, 0, }, /* 618 */
+ { 98, 7, 12, 0, 0, }, /* 619 */
+ { 98, 10, 5, 0, 0, }, /* 620 */
+ { 98, 12, 3, 0, 0, }, /* 621 */
+ { 98, 6, 12, 0, 0, }, /* 622 */
+ { 9, 10, 3, 0, 0, }, /* 623 */
+ { 19, 12, 3, 0, 0, }, /* 624 */
+ { 9, 26, 11, 0, 0, }, /* 625 */
+ { 26, 26, 12, 0, 0, }, /* 626 */
};
const pcre_uint8 PRIV(ucd_stage1)[] = { /* 8704 bytes */
@@ -1380,7 +1379,7 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
/* block 12 */
185,185,185,185,185,109,186,186,186,187,187,188, 4,187,189,189,
-190,190,190,190,190,190,190,190,190,190,190, 4,109,109,187, 4,
+190,190,190,190,190,190,190,190,190,190,190, 4,185,109,187, 4,
191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
102,191,191,191,191,191,191,191,191,191,191,104,104,104,104,104,
@@ -1760,7 +1759,7 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
/* block 50 */
360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,
-360,360,360,360,360,360,360,361,361,362,362,362,109,109,363,363,
+360,360,360,360,360,360,360,361,361,362,362,361,109,109,363,363,
364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,
364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,
364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,364,
@@ -1885,7 +1884,7 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
4, 4, 4, 4, 4, 4, 4, 4, 4, 21, 25, 4, 4, 4, 4, 15,
15, 4, 4, 4, 8, 6, 7, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 8, 4, 15, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3,
- 22, 22, 22, 22, 22,426,426,426,426,426, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22,426, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
23,101,109,109, 23, 23, 23, 23, 23, 23, 8, 8, 8, 6, 7,101,
/* block 63 */
@@ -1929,7 +1928,7 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
/* block 67 */
- 19, 19, 19, 19, 19, 19, 19, 19, 8, 8, 8, 8, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 6, 7, 6, 7, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
8, 8, 19, 19, 19, 19, 19, 19, 19, 6, 7, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
@@ -2353,30 +2352,30 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,516,
516,516,516,514,515,515,514,514,514,514,515,515,514,515,515,515,
-515,517,517,517,517,517,517,517,517,517,517,517,517,517,109,518,
-519,519,519,519,519,519,519,519,519,519,109,109,109,109,517,517,
+515,517,517,517,517,517,517,517,517,517,517,517,517,517,109,102,
+518,518,518,518,518,518,518,518,518,518,109,109,109,109,517,517,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
/* block 110 */
-520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,
-520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,
-520,520,520,520,520,520,520,520,520,521,521,521,521,521,521,522,
-522,521,521,522,522,521,521,109,109,109,109,109,109,109,109,109,
-520,520,520,521,520,520,520,520,520,520,520,520,521,522,109,109,
-523,523,523,523,523,523,523,523,523,523,109,109,524,524,524,524,
+519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,
+519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,
+519,519,519,519,519,519,519,519,519,520,520,520,520,520,520,521,
+521,520,520,521,521,520,520,109,109,109,109,109,109,109,109,109,
+519,519,519,520,519,519,519,519,519,519,519,519,520,521,109,109,
+522,522,522,522,522,522,522,522,522,522,109,109,523,523,523,523,
295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,295,
-525,295,295,295,295,295,295,301,301,301,295,296,109,109,109,109,
+524,295,295,295,295,295,295,301,301,301,295,296,109,109,109,109,
/* block 111 */
-526,526,526,526,526,526,526,526,526,526,526,526,526,526,526,526,
-526,526,526,526,526,526,526,526,526,526,526,526,526,526,526,526,
-526,526,526,526,526,526,526,526,526,526,526,526,526,526,526,526,
-527,526,527,527,527,526,526,527,527,526,526,526,526,526,527,527,
-526,527,526,109,109,109,109,109,109,109,109,109,109,109,109,109,
-109,109,109,109,109,109,109,109,109,109,109,526,526,528,529,529,
-530,530,530,530,530,530,530,530,530,530,530,531,532,532,531,531,
-533,533,530,534,534,531,532,109,109,109,109,109,109,109,109,109,
+525,525,525,525,525,525,525,525,525,525,525,525,525,525,525,525,
+525,525,525,525,525,525,525,525,525,525,525,525,525,525,525,525,
+525,525,525,525,525,525,525,525,525,525,525,525,525,525,525,525,
+526,525,526,526,526,525,525,526,526,525,525,525,525,525,526,526,
+525,526,525,109,109,109,109,109,109,109,109,109,109,109,109,109,
+109,109,109,109,109,109,109,109,109,109,109,525,525,527,528,528,
+529,529,529,529,529,529,529,529,529,529,529,530,531,531,530,530,
+532,532,529,533,533,530,531,109,109,109,109,109,109,109,109,109,
/* block 112 */
109,308,308,308,308,308,308,109,109,308,308,308,308,308,308,109,
@@ -2393,85 +2392,85 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
-530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
-530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,
-530,530,530,531,531,532,531,531,532,531,531,533,531,532,109,109,
-535,535,535,535,535,535,535,535,535,535,109,109,109,109,109,109,
+529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,
+529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,
+529,529,529,530,530,531,530,530,531,530,530,532,530,531,109,109,
+534,534,534,534,534,534,534,534,534,534,109,109,109,109,109,109,
/* block 114 */
-536,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,536,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,536,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,536,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-536,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
+535,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,535,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,535,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,535,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+535,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
/* block 115 */
-537,537,537,537,537,537,537,537,537,537,537,537,536,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,536,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,536,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-536,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,536,537,537,537,
+536,536,536,536,536,536,536,536,536,536,536,536,535,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,535,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,535,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+535,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,535,536,536,536,
/* block 116 */
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,536,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,536,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-536,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,536,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,535,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,535,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+535,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,535,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
/* block 117 */
-537,537,537,537,537,537,537,537,536,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,536,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-536,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,536,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,536,537,537,537,537,537,537,537,
+536,536,536,536,536,536,536,536,535,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,535,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+535,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,535,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,535,536,536,536,536,536,536,536,
/* block 118 */
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,536,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-536,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,536,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,536,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,535,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+535,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,535,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,535,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
/* block 119 */
-537,537,537,537,536,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-536,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,536,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,536,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,536,537,537,537,537,537,537,537,537,537,537,537,
+536,536,536,536,535,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+535,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,535,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,535,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,535,536,536,536,536,536,536,536,536,536,536,536,
/* block 120 */
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-536,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,536,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,536,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,536,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+535,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,535,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,535,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,535,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
/* block 121 */
-537,537,537,537,537,537,537,537,536,537,537,537,537,537,537,537,
-537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
-537,537,537,537,109,109,109,109,109,109,109,109,109,109,109,109,
+536,536,536,536,536,536,536,536,535,536,536,536,536,536,536,536,
+536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,536,
+536,536,536,536,109,109,109,109,109,109,109,109,109,109,109,109,
306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,306,
306,306,306,306,306,306,306,109,109,109,109,307,307,307,307,307,
307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,
@@ -2479,6 +2478,16 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
307,307,307,307,307,307,307,307,307,307,307,307,109,109,109,109,
/* block 122 */
+537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
+537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
+537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
+537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
+537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
+537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
+537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
+537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,537,
+
+/* block 123 */
538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,
538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,
538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,
@@ -2488,16 +2497,6 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,
538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,
-/* block 123 */
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
-
/* block 124 */
475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,
475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,475,
@@ -2521,7 +2520,7 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
/* block 126 */
33, 33, 33, 33, 33, 33, 33,109,109,109,109,109,109,109,109,109,
109,109,109,178,178,178,178,178,109,109,109,109,109,184,181,184,
-184,184,184,184,184,184,184,184,184,540,184,184,184,184,184,184,
+184,184,184,184,184,184,184,184,184,539,184,184,184,184,184,184,
184,184,184,184,184,184,184,109,184,184,184,184,184,109,184,109,
184,184,109,184,184,109,184,184,184,184,184,184,184,184,184,184,
191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
@@ -2532,8 +2531,8 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
-191,191,541,541,541,541,541,541,541,541,541,541,541,541,541,541,
-541,541,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
+191,191,540,540,540,540,540,540,540,540,540,540,540,540,540,540,
+540,540,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,191,191,191,191,191,191,191,191,191,191,191,191,191,
191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,
@@ -2600,7 +2599,7 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
/* block 134 */
469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,
-469,469,469,469,469,469,469,469,469,469,469,469,469,469,542,542,
+469,469,469,469,469,469,469,469,469,469,469,469,469,469,541,541,
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,
472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,109,
109,109,472,472,472,472,472,472,109,109,472,472,472,472,472,472,
@@ -2609,37 +2608,37 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
426,426,426,426,426,426,426,426,426, 22, 22, 22, 19, 19,109,109,
/* block 135 */
-543,543,543,543,543,543,543,543,543,543,543,543,109,543,543,543,
-543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,
-543,543,543,543,543,543,543,109,543,543,543,543,543,543,543,543,
-543,543,543,543,543,543,543,543,543,543,543,109,543,543,109,543,
-543,543,543,543,543,543,543,543,543,543,543,543,543,543,109,109,
-543,543,543,543,543,543,543,543,543,543,543,543,543,543,109,109,
+542,542,542,542,542,542,542,542,542,542,542,542,109,542,542,542,
+542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,
+542,542,542,542,542,542,542,109,542,542,542,542,542,542,542,542,
+542,542,542,542,542,542,542,542,542,542,542,109,542,542,109,542,
+542,542,542,542,542,542,542,542,542,542,542,542,542,542,109,109,
+542,542,542,542,542,542,542,542,542,542,542,542,542,542,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
/* block 136 */
-543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,
-543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,
-543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,
-543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,
-543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,
-543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,
-543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,
-543,543,543,543,543,543,543,543,543,543,543,109,109,109,109,109,
+542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,
+542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,
+542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,
+542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,
+542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,
+542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,
+542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,542,
+542,542,542,542,542,542,542,542,542,542,542,109,109,109,109,109,
/* block 137 */
4, 4, 4,109,109,109,109, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23,109,109,109, 19, 19, 19, 19, 19, 19, 19, 19, 19,
-544,544,544,544,544,544,544,544,544,544,544,544,544,544,544,544,
-544,544,544,544,544,544,544,544,544,544,544,544,544,544,544,544,
-544,544,544,544,544,544,544,544,544,544,544,544,544,544,544,544,
-544,544,544,544,544,545,545,545,545,546,546,546,546,546,546,546,
+543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,
+543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,
+543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,
+543,543,543,543,543,544,544,544,544,545,545,545,545,545,545,545,
/* block 138 */
-546,546,546,546,546,546,546,546,546,546,545,109,109,109,109,109,
+545,545,545,545,545,545,545,545,545,545,544,109,109,109,109,109,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
@@ -2649,49 +2648,49 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,104,109,109,
/* block 139 */
+546,546,546,546,546,546,546,546,546,546,546,546,546,546,546,546,
+546,546,546,546,546,546,546,546,546,546,546,546,546,109,109,109,
547,547,547,547,547,547,547,547,547,547,547,547,547,547,547,547,
-547,547,547,547,547,547,547,547,547,547,547,547,547,109,109,109,
-548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,
-548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,
-548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,
-548,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
+547,547,547,547,547,547,547,547,547,547,547,547,547,547,547,547,
+547,547,547,547,547,547,547,547,547,547,547,547,547,547,547,547,
+547,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
/* block 140 */
-549,549,549,549,549,549,549,549,549,549,549,549,549,549,549,549,
-549,549,549,549,549,549,549,549,549,549,549,549,549,549,549,109,
-550,550,550,550,109,109,109,109,109,109,109,109,109,109,109,109,
-551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,551,
-551,552,551,551,551,551,551,551,551,551,552,109,109,109,109,109,
+548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,
+548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,109,
+549,549,549,549,109,109,109,109,109,109,109,109,109,109,109,109,
+550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,
+550,551,550,550,550,550,550,550,550,550,551,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
/* block 141 */
-553,553,553,553,553,553,553,553,553,553,553,553,553,553,553,553,
-553,553,553,553,553,553,553,553,553,553,553,553,553,553,109,554,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,555,
-555,555,555,555,109,109,109,109,555,555,555,555,555,555,555,555,
-556,557,557,557,557,557,109,109,109,109,109,109,109,109,109,109,
+552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,
+552,552,552,552,552,552,552,552,552,552,552,552,552,552,109,553,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,
+554,554,554,554,109,109,109,109,554,554,554,554,554,554,554,554,
+555,556,556,556,556,556,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
/* block 142 */
+557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
+557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,557,
+557,557,557,557,557,557,557,557,558,558,558,558,558,558,558,558,
558,558,558,558,558,558,558,558,558,558,558,558,558,558,558,558,
558,558,558,558,558,558,558,558,558,558,558,558,558,558,558,558,
-558,558,558,558,558,558,558,558,559,559,559,559,559,559,559,559,
559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,
559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,
-560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,
-560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,
-560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,
+559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,559,
/* block 143 */
-561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,561,
-561,561,561,561,561,561,561,561,561,561,561,561,561,561,109,109,
-562,562,562,562,562,562,562,562,562,562,109,109,109,109,109,109,
+560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,560,
+560,560,560,560,560,560,560,560,560,560,560,560,560,560,109,109,
+561,561,561,561,561,561,561,561,561,561,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
@@ -2699,61 +2698,61 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
/* block 144 */
-563,563,563,563,563,563,109,109,563,109,563,563,563,563,563,563,
+562,562,562,562,562,562,109,109,562,109,562,562,562,562,562,562,
+562,562,562,562,562,562,562,562,562,562,562,562,562,562,562,562,
+562,562,562,562,562,562,562,562,562,562,562,562,562,562,562,562,
+562,562,562,562,562,562,109,562,562,109,109,109,562,109,109,562,
563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,
-563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,
-563,563,563,563,563,563,109,563,563,109,109,109,563,109,109,563,
-564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,
-564,564,564,564,564,564,109,565,566,566,566,566,566,566,566,566,
+563,563,563,563,563,563,109,564,565,565,565,565,565,565,565,565,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
/* block 145 */
-567,567,567,567,567,567,567,567,567,567,567,567,567,567,567,567,
-567,567,567,567,567,567,568,568,568,568,568,568,109,109,109,569,
-570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,570,
-570,570,570,570,570,570,570,570,570,570,109,109,109,109,109,571,
+566,566,566,566,566,566,566,566,566,566,566,566,566,566,566,566,
+566,566,566,566,566,566,567,567,567,567,567,567,109,109,109,568,
+569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,
+569,569,569,569,569,569,569,569,569,569,109,109,109,109,109,570,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
/* block 146 */
+571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,
+571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,
572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,
-572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,
-573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
-573,573,573,573,573,573,573,573,109,109,109,109,109,109,573,573,
+572,572,572,572,572,572,572,572,109,109,109,109,109,109,572,572,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
/* block 147 */
-574,575,575,575,109,575,575,109,109,109,109,109,575,575,575,575,
-574,574,574,574,109,574,574,574,109,574,574,574,574,574,574,574,
-574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,
-574,574,574,574,109,109,109,109,575,575,575,109,109,109,109,575,
-576,576,576,576,576,576,576,576,109,109,109,109,109,109,109,109,
-577,577,577,577,577,577,577,577,577,109,109,109,109,109,109,109,
-578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,
-578,578,578,578,578,578,578,578,578,578,578,578,578,579,579,580,
+573,574,574,574,109,574,574,109,109,109,109,109,574,574,574,574,
+573,573,573,573,109,573,573,573,109,573,573,573,573,573,573,573,
+573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,
+573,573,573,573,109,109,109,109,574,574,574,109,109,109,109,574,
+575,575,575,575,575,575,575,575,109,109,109,109,109,109,109,109,
+576,576,576,576,576,576,576,576,576,109,109,109,109,109,109,109,
+577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,
+577,577,577,577,577,577,577,577,577,577,577,577,577,578,578,579,
/* block 148 */
-581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
-581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
-581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,
-581,581,581,581,581,581,109,109,109,582,582,582,582,582,582,582,
-583,583,583,583,583,583,583,583,583,583,583,583,583,583,583,583,
-583,583,583,583,583,583,109,109,584,584,584,584,584,584,584,584,
-585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,
-585,585,585,109,109,109,109,109,586,586,586,586,586,586,586,586,
+580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,
+580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,
+580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,
+580,580,580,580,580,580,109,109,109,581,581,581,581,581,581,581,
+582,582,582,582,582,582,582,582,582,582,582,582,582,582,582,582,
+582,582,582,582,582,582,109,109,583,583,583,583,583,583,583,583,
+584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,
+584,584,584,109,109,109,109,109,585,585,585,585,585,585,585,585,
/* block 149 */
-587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
-587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
-587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
-587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
-587,587,587,587,587,587,587,587,587,109,109,109,109,109,109,109,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,
+586,586,586,586,586,586,586,586,586,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
@@ -2765,103 +2764,103 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
-588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,
-588,588,588,588,588,588,588,588,588,588,588,588,588,588,588,109,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,
+587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,109,
/* block 151 */
-589,590,589,591,591,591,591,591,591,591,591,591,591,591,591,591,
-591,591,591,591,591,591,591,591,591,591,591,591,591,591,591,591,
-591,591,591,591,591,591,591,591,591,591,591,591,591,591,591,591,
-591,591,591,591,591,591,591,591,590,590,590,590,590,590,590,590,
-590,590,590,590,590,590,590,592,592,592,592,592,592,592,109,109,
-109,109,593,593,593,593,593,593,593,593,593,593,593,593,593,593,
-593,593,593,593,593,593,594,594,594,594,594,594,594,594,594,594,
+588,589,588,590,590,590,590,590,590,590,590,590,590,590,590,590,
+590,590,590,590,590,590,590,590,590,590,590,590,590,590,590,590,
+590,590,590,590,590,590,590,590,590,590,590,590,590,590,590,590,
+590,590,590,590,590,590,590,590,589,589,589,589,589,589,589,589,
+589,589,589,589,589,589,589,591,591,591,591,591,591,591,109,109,
+109,109,592,592,592,592,592,592,592,592,592,592,592,592,592,592,
+592,592,592,592,592,592,593,593,593,593,593,593,593,593,593,593,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
/* block 152 */
-595,595,596,597,597,597,597,597,597,597,597,597,597,597,597,597,
-597,597,597,597,597,597,597,597,597,597,597,597,597,597,597,597,
-597,597,597,597,597,597,597,597,597,597,597,597,597,597,597,597,
-596,596,596,595,595,595,595,596,596,595,595,598,598,599,598,598,
-598,598,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
-600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,600,
-600,600,600,600,600,600,600,600,600,109,109,109,109,109,109,109,
-601,601,601,601,601,601,601,601,601,601,109,109,109,109,109,109,
+594,594,595,596,596,596,596,596,596,596,596,596,596,596,596,596,
+596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,
+596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,596,
+595,595,595,594,594,594,594,595,595,594,594,597,597,598,597,597,
+597,597,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
+599,599,599,599,599,599,599,599,599,599,599,599,599,599,599,599,
+599,599,599,599,599,599,599,599,599,109,109,109,109,109,109,109,
+600,600,600,600,600,600,600,600,600,600,109,109,109,109,109,109,
/* block 153 */
-602,602,602,603,603,603,603,603,603,603,603,603,603,603,603,603,
-603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,
-603,603,603,603,603,603,603,602,602,602,602,602,604,602,602,602,
-602,602,602,602,602,109,605,605,605,605,605,605,605,605,605,605,
-606,606,606,606,109,109,109,109,109,109,109,109,109,109,109,109,
+601,601,601,602,602,602,602,602,602,602,602,602,602,602,602,602,
+602,602,602,602,602,602,602,602,602,602,602,602,602,602,602,602,
+602,602,602,602,602,602,602,601,601,601,601,601,603,601,601,601,
+601,601,601,601,601,109,604,604,604,604,604,604,604,604,604,604,
+605,605,605,605,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
/* block 154 */
-607,607,608,609,609,609,609,609,609,609,609,609,609,609,609,609,
-609,609,609,609,609,609,609,609,609,609,609,609,609,609,609,609,
-609,609,609,609,609,609,609,609,609,609,609,609,609,609,609,609,
-609,609,609,608,608,608,607,607,607,607,607,607,607,607,607,608,
-608,609,609,609,609,610,610,610,610,109,109,109,109,109,109,109,
-611,611,611,611,611,611,611,611,611,611,109,109,109,109,109,109,
+606,606,607,608,608,608,608,608,608,608,608,608,608,608,608,608,
+608,608,608,608,608,608,608,608,608,608,608,608,608,608,608,608,
+608,608,608,608,608,608,608,608,608,608,608,608,608,608,608,608,
+608,608,608,607,607,607,606,606,606,606,606,606,606,606,606,607,
+607,608,608,608,608,609,609,609,609,109,109,109,109,109,109,109,
+610,610,610,610,610,610,610,610,610,610,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
/* block 155 */
-612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,
-612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,612,
-612,612,612,612,612,612,612,612,612,612,612,613,614,613,614,614,
-613,613,613,613,613,613,614,613,109,109,109,109,109,109,109,109,
-615,615,615,615,615,615,615,615,615,615,109,109,109,109,109,109,
+611,611,611,611,611,611,611,611,611,611,611,611,611,611,611,611,
+611,611,611,611,611,611,611,611,611,611,611,611,611,611,611,611,
+611,611,611,611,611,611,611,611,611,611,611,612,613,612,613,613,
+612,612,612,612,612,612,613,612,109,109,109,109,109,109,109,109,
+614,614,614,614,614,614,614,614,614,614,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
/* block 156 */
-616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,
-616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,
-616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,
-616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,
-616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,
-616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,
-616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,
-616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,
+615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,
+615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,
+615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,
+615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,
+615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,
+615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,
+615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,
+615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,
/* block 157 */
+615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,
+615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,
+615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,
+615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,
+615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,
+615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,
+615,615,615,615,615,615,615,615,615,615,615,615,615,615,615,109,
+109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
+
+/* block 158 */
616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,
616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,
616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,
616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,
616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,
616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,
-616,616,616,616,616,616,616,616,616,616,616,616,616,616,616,109,
-109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
-
-/* block 158 */
-617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,
-617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,
-617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,
-617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,
-617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,
-617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,
-617,617,617,109,109,109,109,109,109,109,109,109,109,109,109,109,
-618,618,618,618,109,109,109,109,109,109,109,109,109,109,109,109,
+616,616,616,109,109,109,109,109,109,109,109,109,109,109,109,109,
+617,617,617,617,109,109,109,109,109,109,109,109,109,109,109,109,
/* block 159 */
-619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,
-619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,
-619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,
-619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,
-619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,
-619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,
-619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,
-619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,
+618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,
+618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,
+618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,
+618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,
+618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,
+618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,
+618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,
+618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,
/* block 160 */
-619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,
-619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,
-619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,109,
+618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,
+618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,
+618,618,618,618,618,618,618,618,618,618,618,618,618,618,618,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
@@ -2889,18 +2888,18 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
/* block 163 */
+619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,
+619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,
+619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,
+619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,
+619,619,619,619,619,109,109,109,109,109,109,109,109,109,109,109,
+619,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
-620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
-620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
-620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,
-620,620,620,620,620,109,109,109,109,109,109,109,109,109,109,109,
-620,621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,
-621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,
-621,621,621,621,621,621,621,621,621,621,621,621,621,621,621,109,
+620,620,620,620,620,620,620,620,620,620,620,620,620,620,620,109,
/* block 164 */
-109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,622,
-622,622,622,623,623,623,623,623,623,623,623,623,623,623,623,623,
+109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,621,
+621,621,621,622,622,622,622,622,622,622,622,622,622,622,622,622,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
@@ -2935,8 +2934,8 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19,624,395,104,104,104, 19, 19, 19,395,624,624,
-624,624,624, 22, 22, 22, 22, 22, 22, 22, 22,104,104,104,104,104,
+ 19, 19, 19, 19, 19,623,395,104,104,104, 19, 19, 19,395,623,623,
+623,623,623, 22, 22, 22, 22, 22, 22, 22, 22,104,104,104,104,104,
/* block 168 */
104,104,104, 19, 19,104,104,104,104,104,104,104, 19, 19, 19, 19,
@@ -2949,11 +2948,11 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
/* block 169 */
-546,546,546,546,546,546,546,546,546,546,546,546,546,546,546,546,
-546,546,546,546,546,546,546,546,546,546,546,546,546,546,546,546,
-546,546,546,546,546,546,546,546,546,546,546,546,546,546,546,546,
-546,546,546,546,546,546,546,546,546,546,546,546,546,546,546,546,
-546,546,625,625,625,546,109,109,109,109,109,109,109,109,109,109,
+545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
+545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
+545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
+545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,
+545,545,624,624,624,545,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
@@ -3105,11 +3104,11 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,
-109,109,109,109,109,109,626,626,626,626,626,626,626,626,626,626,
-626,626,626,626,626,626,626,626,626,626,626,626,626,626,626,626,
+109,109,109,109,109,109,625,625,625,625,625,625,625,625,625,625,
+625,625,625,625,625,625,625,625,625,625,625,625,625,625,625,625,
/* block 185 */
-627, 19, 19,109,109,109,109,109,109,109,109,109,109,109,109,109,
+626, 19, 19,109,109,109,109,109,109,109,109,109,109,109,109,109,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,109,109,109,109,109,
@@ -3279,14 +3278,14 @@ const pcre_uint16 PRIV(ucd_stage2)[] = { /* 51968 bytes, block = 128 */
426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,
/* block 202 */
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,
-539,539,539,539,539,539,539,539,539,539,539,539,539,539,109,109,
+538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,
+538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,
+538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,
+538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,
+538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,
+538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,
+538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,
+538,538,538,538,538,538,538,538,538,538,538,538,538,538,109,109,
};
diff --git a/pcre/pcre_xclass.c b/pcre/pcre_xclass.c
index d777acb57c9..ad153be7851 100644
--- a/pcre/pcre_xclass.c
+++ b/pcre/pcre_xclass.c
@@ -128,55 +128,62 @@ while ((t = *data++) != XCL_END)
else /* XCL_PROP & XCL_NOTPROP */
{
const ucd_record *prop = GET_UCD(c);
+ BOOL isprop = t == XCL_PROP;
switch(*data)
{
case PT_ANY:
- if (t == XCL_PROP) return !negated;
+ if (isprop) return !negated;
break;
case PT_LAMP:
if ((prop->chartype == ucp_Lu || prop->chartype == ucp_Ll ||
- prop->chartype == ucp_Lt) == (t == XCL_PROP)) return !negated;
+ prop->chartype == ucp_Lt) == isprop) return !negated;
break;
case PT_GC:
- if ((data[1] == PRIV(ucp_gentype)[prop->chartype]) == (t == XCL_PROP))
+ if ((data[1] == PRIV(ucp_gentype)[prop->chartype]) == isprop)
return !negated;
break;
case PT_PC:
- if ((data[1] == prop->chartype) == (t == XCL_PROP)) return !negated;
+ if ((data[1] == prop->chartype) == isprop) return !negated;
break;
case PT_SC:
- if ((data[1] == prop->script) == (t == XCL_PROP)) return !negated;
+ if ((data[1] == prop->script) == isprop) return !negated;
break;
case PT_ALNUM:
if ((PRIV(ucp_gentype)[prop->chartype] == ucp_L ||
- PRIV(ucp_gentype)[prop->chartype] == ucp_N) == (t == XCL_PROP))
+ PRIV(ucp_gentype)[prop->chartype] == ucp_N) == isprop)
return !negated;
break;
- case PT_SPACE: /* Perl space */
- if ((PRIV(ucp_gentype)[prop->chartype] == ucp_Z ||
- c == CHAR_HT || c == CHAR_NL || c == CHAR_FF || c == CHAR_CR)
- == (t == XCL_PROP))
- return !negated;
- break;
+ /* Perl space used to exclude VT, but from Perl 5.18 it is included,
+ which means that Perl space and POSIX space are now identical. PCRE
+ was changed at release 8.34. */
+ case PT_SPACE: /* Perl space */
case PT_PXSPACE: /* POSIX space */
- if ((PRIV(ucp_gentype)[prop->chartype] == ucp_Z ||
- c == CHAR_HT || c == CHAR_NL || c == CHAR_VT ||
- c == CHAR_FF || c == CHAR_CR) == (t == XCL_PROP))
- return !negated;
+ switch(c)
+ {
+ HSPACE_CASES:
+ VSPACE_CASES:
+ if (isprop) return !negated;
+ break;
+
+ default:
+ if ((PRIV(ucp_gentype)[prop->chartype] == ucp_Z) == isprop)
+ return !negated;
+ break;
+ }
break;
case PT_WORD:
if ((PRIV(ucp_gentype)[prop->chartype] == ucp_L ||
PRIV(ucp_gentype)[prop->chartype] == ucp_N || c == CHAR_UNDERSCORE)
- == (t == XCL_PROP))
+ == isprop)
return !negated;
break;
@@ -184,16 +191,60 @@ while ((t = *data++) != XCL_END)
if (c < 0xa0)
{
if ((c == CHAR_DOLLAR_SIGN || c == CHAR_COMMERCIAL_AT ||
- c == CHAR_GRAVE_ACCENT) == (t == XCL_PROP))
+ c == CHAR_GRAVE_ACCENT) == isprop)
return !negated;
}
else
{
- if ((c < 0xd800 || c > 0xdfff) == (t == XCL_PROP))
+ if ((c < 0xd800 || c > 0xdfff) == isprop)
return !negated;
}
break;
+ /* The following three properties can occur only in an XCLASS, as there
+ is no \p or \P coding for them. */
+
+ /* Graphic character. Implement this as not Z (space or separator) and
+ not C (other), except for Cf (format) with a few exceptions. This seems
+ to be what Perl does. The exceptional characters are:
+
+ U+061C Arabic Letter Mark
+ U+180E Mongolian Vowel Separator
+ U+2066 - U+2069 Various "isolate"s
+ */
+
+ case PT_PXGRAPH:
+ if ((PRIV(ucp_gentype)[prop->chartype] != ucp_Z &&
+ (PRIV(ucp_gentype)[prop->chartype] != ucp_C ||
+ (prop->chartype == ucp_Cf &&
+ c != 0x061c && c != 0x180e && (c < 0x2066 || c > 0x2069))
+ )) == isprop)
+ return !negated;
+ break;
+
+ /* Printable character: same as graphic, with the addition of Zs, i.e.
+ not Zl and not Zp, and U+180E. */
+
+ case PT_PXPRINT:
+ if ((prop->chartype != ucp_Zl &&
+ prop->chartype != ucp_Zp &&
+ (PRIV(ucp_gentype)[prop->chartype] != ucp_C ||
+ (prop->chartype == ucp_Cf &&
+ c != 0x061c && (c < 0x2066 || c > 0x2069))
+ )) == isprop)
+ return !negated;
+ break;
+
+ /* Punctuation: all Unicode punctuation, plus ASCII characters that
+ Unicode treats as symbols rather than punctuation, for Perl
+ compatibility (these are $+<=>^`|~). */
+
+ case PT_PXPUNCT:
+ if ((PRIV(ucp_gentype)[prop->chartype] == ucp_P ||
+ (c < 256 && PRIV(ucp_gentype)[prop->chartype] == ucp_S)) == isprop)
+ return !negated;
+ break;
+
/* This should never occur, but compilers may mutter if there is no
default. */
diff --git a/pcre/pcregrep.c b/pcre/pcregrep.c
index 64023483d2d..f6b6ec39608 100644
--- a/pcre/pcregrep.c
+++ b/pcre/pcregrep.c
@@ -3,10 +3,16 @@
*************************************************/
/* This is a grep program that uses the PCRE regular expression library to do
-its pattern matching. On a Unix or Win32 system it can recurse into
-directories.
+its pattern matching. On Unix-like, Windows, and native z/OS systems it can
+recurse into directories, and in z/OS it can handle PDS files.
- Copyright (c) 1997-2012 University of Cambridge
+Note that for native z/OS, in addition to defining the NATIVE_ZOS macro, an
+additional header is required. That header is not included in the main PCRE
+distribution because other apparatus is needed to compile pcregrep for z/OS.
+The header can be found in the special z/OS distribution, which is available
+from www.zaconsultants.net or from www.cbttape.org.
+
+ Copyright (c) 1997-2013 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -530,17 +536,29 @@ while (fn != NULL)
* OS-specific functions *
*************************************************/
-/* These functions are defined so that they can be made system specific,
-although at present the only ones are for Unix, Win32, and for "no support". */
+/* These functions are defined so that they can be made system specific.
+At present there are versions for Unix-style environments, Windows, native
+z/OS, and "no support". */
-/************* Directory scanning in Unix ***********/
+/************* Directory scanning Unix-style and z/OS ***********/
-#if defined HAVE_SYS_STAT_H && defined HAVE_DIRENT_H && defined HAVE_SYS_TYPES_H
+#if (defined HAVE_SYS_STAT_H && defined HAVE_DIRENT_H && defined HAVE_SYS_TYPES_H) || defined NATIVE_ZOS
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
+#if defined NATIVE_ZOS
+/************* Directory and PDS/E scanning for z/OS ***********/
+/************* z/OS looks mostly like Unix with USS ************/
+/* However, z/OS needs the #include statements in this header */
+#include "pcrzosfs.h"
+/* That header is not included in the main PCRE distribution because
+ other apparatus is needed to compile pcregrep for z/OS. The header
+ can be found in the special z/OS distribution, which is available
+ from www.zaconsultants.net or from www.cbttape.org. */
+#endif
+
typedef DIR directory_type;
#define FILESEP '/'
@@ -579,7 +597,7 @@ closedir(dir);
}
-/************* Test for regular file in Unix **********/
+/************* Test for regular file, Unix-style **********/
static int
isregfile(char *filename)
@@ -591,8 +609,26 @@ return (statbuf.st_mode & S_IFMT) == S_IFREG;
}
-/************* Test for a terminal in Unix **********/
+#if defined NATIVE_ZOS
+/************* Test for a terminal in z/OS **********/
+/* isatty() does not work in a TSO environment, so always give FALSE.*/
+
+static BOOL
+is_stdout_tty(void)
+{
+return FALSE;
+}
+
+static BOOL
+is_file_tty(FILE *f)
+{
+return FALSE;
+}
+
+
+/************* Test for a terminal, Unix-style **********/
+#else
static BOOL
is_stdout_tty(void)
{
@@ -604,9 +640,12 @@ is_file_tty(FILE *f)
{
return isatty(fileno(f));
}
+#endif
+
+/* End of Unix-style or native z/OS environment functions. */
-/************* Directory scanning in Win32 ***********/
+/************* Directory scanning in Windows ***********/
/* I (Philip Hazel) have no means of testing this code. It was contributed by
Lionel Fourquaux. David Burgess added a patch to define INVALID_FILE_ATTRIBUTES
@@ -709,7 +748,7 @@ free(dir);
}
-/************* Test for regular file in Win32 **********/
+/************* Test for regular file in Windows **********/
/* I don't know how to do this, or if it can be done; assume all paths are
regular if they are not directories. */
@@ -720,7 +759,7 @@ return !isdirectory(filename);
}
-/************* Test for a terminal in Win32 **********/
+/************* Test for a terminal in Windows **********/
/* I don't know how to do this; assume never */
@@ -736,6 +775,8 @@ is_file_tty(FILE *f)
return FALSE;
}
+/* End of Windows functions */
+
/************* Directory scanning when we can't do it ***********/
@@ -752,7 +793,7 @@ char *readdirectory(directory_type *dir) { return (char*)0;}
void closedirectory(directory_type *dir) {}
-/************* Test for regular when we can't do it **********/
+/************* Test for regular file when we can't do it **********/
/* Assume all files are regular. */
@@ -773,7 +814,7 @@ is_file_tty(FILE *f)
return FALSE;
}
-#endif
+#endif /* End of system-specific functions */
@@ -1835,7 +1876,7 @@ while (ptr < endptr)
{
char *endmatch = ptr + offsets[1];
t = ptr;
- while (t < endmatch)
+ while (t <= endmatch)
{
t = end_of_line(t, endptr, &endlinelength);
if (t < endmatch) linenumber++; else break;
@@ -2068,6 +2109,11 @@ BZFILE *inbz2 = NULL;
int pathlen;
#endif
+#if defined NATIVE_ZOS
+int zos_type;
+FILE *zos_test_file;
+#endif
+
/* If the file name is "-" we scan stdin */
if (strcmp(pathname, "-") == 0)
@@ -2088,6 +2134,45 @@ lastcomp = (lastcomp == NULL)? pathname : lastcomp + 1;
Otherwise, scan the directory and recurse for each path within it. The scanning
code is localized so it can be made system-specific. */
+
+/* For z/OS, determine the file type. */
+
+#if defined NATIVE_ZOS
+zos_test_file = fopen(pathname,"rb");
+
+if (zos_test_file == NULL)
+ {
+ if (!silent) fprintf(stderr, "pcregrep: failed to test next file %s\n",
+ pathname, strerror(errno));
+ return -1;
+ }
+zos_type = identifyzosfiletype (zos_test_file);
+fclose (zos_test_file);
+
+/* Handle a PDS in separate code */
+
+if (zos_type == __ZOS_PDS || zos_type == __ZOS_PDSE)
+ {
+ return travelonpdsdir (pathname, only_one_at_top);
+ }
+
+/* Deal with regular files in the normal way below. These types are:
+ zos_type == __ZOS_PDS_MEMBER
+ zos_type == __ZOS_PS
+ zos_type == __ZOS_VSAM_KSDS
+ zos_type == __ZOS_VSAM_ESDS
+ zos_type == __ZOS_VSAM_RRDS
+*/
+
+/* Handle a z/OS directory using common code. */
+
+else if (zos_type == __ZOS_HFS)
+ {
+#endif /* NATIVE_ZOS */
+
+
+/* Handle directories: common code for all OS */
+
if (isdirectory(pathname))
{
if (dee_action == dee_SKIP ||
@@ -2122,12 +2207,22 @@ if (isdirectory(pathname))
}
}
-/* If the file is not a directory and not a regular file, skip it if that's
-been requested. Otherwise, check for explicit include/exclude. */
+#if defined NATIVE_ZOS
+ }
+#endif
+
+/* If the file is not a directory, check for a regular file, and if it is not,
+skip it if that's been requested. Otherwise, check for an explicit inclusion or
+exclusion. */
-else if ((!isregfile(pathname) && DEE_action == DEE_SKIP) ||
- !test_incexc(lastcomp, include_patterns, exclude_patterns))
- return -1;
+else if (
+#if defined NATIVE_ZOS
+ (zos_type == __ZOS_NOFILE && DEE_action == DEE_SKIP) ||
+#else /* all other OS */
+ (!isregfile(pathname) && DEE_action == DEE_SKIP) ||
+#endif
+ !test_incexc(lastcomp, include_patterns, exclude_patterns))
+ return -1; /* File skipped */
/* Control reaches here if we have a regular file, or if we have a directory
and recursion or skipping was not requested, or if we have anything else and
diff --git a/pcre/pcreposix.c b/pcre/pcreposix.c
index 95fa39d6fe8..7cf4a4a657b 100644
--- a/pcre/pcreposix.c
+++ b/pcre/pcreposix.c
@@ -110,7 +110,7 @@ static const int eint[] = {
REG_BADPAT, /* POSIX collating elements are not supported */
REG_INVARG, /* this version of PCRE is not compiled with PCRE_UTF8 support */
REG_BADPAT, /* spare error */
- REG_BADPAT, /* character value in \x{...} sequence is too large */
+ REG_BADPAT, /* character value in \x{} or \o{} is too large */
/* 35 */
REG_BADPAT, /* invalid condition (?(0) */
REG_BADPAT, /* \C not allowed in lookbehind assertion */
@@ -163,7 +163,14 @@ static const int eint[] = {
REG_BADPAT, /* overlong MARK name */
REG_BADPAT, /* character value in \u.... sequence is too large */
REG_BADPAT, /* invalid UTF-32 string (should not occur) */
- REG_BADPAT /* setting UTF is disabled by the application */
+ REG_BADPAT, /* setting UTF is disabled by the application */
+ REG_BADPAT, /* non-hex character in \\x{} (closing brace missing?) */
+ /* 80 */
+ REG_BADPAT, /* non-octal character in \o{} (closing brace missing?) */
+ REG_BADPAT, /* missing opening brace after \o */
+ REG_BADPAT, /* parentheses too deeply nested */
+ REG_BADPAT, /* invalid range in character class */
+ REG_BADPAT /* group name must start with a non-digit */
};
/* Table of texts corresponding to POSIX error codes */
diff --git a/pcre/pcreposix.h b/pcre/pcreposix.h
index b900a9697f3..c77c0b0523c 100644
--- a/pcre/pcreposix.h
+++ b/pcre/pcreposix.h
@@ -64,10 +64,6 @@ extern "C" {
#define REG_UNGREEDY 0x0200 /* NOT defined by POSIX; maps to PCRE_UNGREEDY */
#define REG_UCP 0x0400 /* NOT defined by POSIX; maps to PCRE_UCP */
-/*Defined in regex.h */
-#define REG_ATOI 255 /* convert name to number (!) */
-#define REG_ITOA 0400 /* convert number to name (!) */
-
/* This is not used by PCRE, but by defining it we make it easier
to slot PCRE into existing programs that make POSIX calls. */
diff --git a/pcre/pcretest.c b/pcre/pcretest.c
index 57ee041ef66..8452d2bab6f 100644
--- a/pcre/pcretest.c
+++ b/pcre/pcretest.c
@@ -1016,8 +1016,6 @@ static int jit_was_used;
static int locale_set = 0;
static int show_malloc;
static int use_utf;
-static size_t gotten_store;
-static size_t first_gotten_store = 0;
static const unsigned char *last_callout_mark = NULL;
/* The buffers grow automatically if very long input lines are encountered. */
@@ -1290,7 +1288,7 @@ graph, print, punct, and cntrl. Other classes are built from combinations. */
*/
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0- 7 */
- 0x00,0x01,0x01,0x00,0x01,0x01,0x00,0x00, /* 8- 15 */
+ 0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00, /* 8- 15 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 16- 23 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 24- 31 */
0x01,0x00,0x00,0x00,0x80,0x00,0x00,0x00, /* - ' */
@@ -1322,9 +1320,9 @@ graph, print, punct, and cntrl. Other classes are built from combinations. */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 240-247 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};/* 248-255 */
-/* This is a set of tables that came originally from a Windows user. It seems to
-be at least an approximation of ISO 8859. In particular, there are characters
-greater than 128 that are marked as spaces, letters, etc. */
+/* This is a set of tables that came originally from a Windows user. It seems
+to be at least an approximation of ISO 8859. In particular, there are
+characters greater than 128 that are marked as spaces, letters, etc. */
static const pcre_uint8 tables1[] = {
0,1,2,3,4,5,6,7,
@@ -1916,7 +1914,7 @@ for (;;)
}
}
-return NULL; /* Control never gets here */
+/* Control never gets here */
}
@@ -2031,9 +2029,9 @@ return yield;
static int strlen16(PCRE_SPTR16 p)
{
-int len = 0;
-while (*p++ != 0) len++;
-return len;
+PCRE_SPTR16 pp = p;
+while (*pp != 0) pp++;
+return (int)(pp - p);
}
#endif /* SUPPORT_PCRE16 */
@@ -2046,9 +2044,9 @@ return len;
static int strlen32(PCRE_SPTR32 p)
{
-int len = 0;
-while (*p++ != 0) len++;
-return len;
+PCRE_SPTR32 pp = p;
+while (*pp != 0) pp++;
+return (int)(pp - p);
}
#endif /* SUPPORT_PCRE32 */
@@ -2322,8 +2320,6 @@ show_malloc variable is set only during matching. */
static void *new_malloc(size_t size)
{
void *block = malloc(size);
-gotten_store = size;
-if (first_gotten_store == 0) first_gotten_store = size;
if (show_malloc)
fprintf(outfile, "malloc %3d %p\n", (int)size, block);
return block;
@@ -2827,7 +2823,7 @@ return 0;
/*************************************************
-* Check newline indicator *
+* Check multicharacter option *
*************************************************/
/* This is used both at compile and run-time to check for <xxx> escapes. Print
@@ -2836,12 +2832,14 @@ a message and return 0 if there is no match.
Arguments:
p points after the leading '<'
f file for error message
+ nl TRUE to check only for newline settings
+ stype "modifier" or "escape sequence"
Returns: appropriate PCRE_NEWLINE_xxx flags, or 0
*/
static int
-check_newline(pcre_uint8 *p, FILE *f)
+check_mc_option(pcre_uint8 *p, FILE *f, BOOL nl, const char *stype)
{
if (strncmpic(p, (pcre_uint8 *)"cr>", 3) == 0) return PCRE_NEWLINE_CR;
if (strncmpic(p, (pcre_uint8 *)"lf>", 3) == 0) return PCRE_NEWLINE_LF;
@@ -2850,7 +2848,13 @@ if (strncmpic(p, (pcre_uint8 *)"anycrlf>", 8) == 0) return PCRE_NEWLINE_ANYCRLF;
if (strncmpic(p, (pcre_uint8 *)"any>", 4) == 0) return PCRE_NEWLINE_ANY;
if (strncmpic(p, (pcre_uint8 *)"bsr_anycrlf>", 12) == 0) return PCRE_BSR_ANYCRLF;
if (strncmpic(p, (pcre_uint8 *)"bsr_unicode>", 12) == 0) return PCRE_BSR_UNICODE;
-fprintf(f, "Unknown newline type at: <%s\n", p);
+
+if (!nl)
+ {
+ if (strncmpic(p, (pcre_uint8 *)"JS>", 3) == 0) return PCRE_JAVASCRIPT_COMPAT;
+ }
+
+fprintf(f, "Unknown %s at: <%s\n", stype, p);
return 0;
}
@@ -2897,6 +2901,7 @@ printf(" -help show usage information\n");
printf(" -i show information about compiled patterns\n"
" -M find MATCH_LIMIT minimum for each subject\n"
" -m output memory used information\n"
+ " -O set PCRE_NO_AUTO_POSSESS on each pattern\n"
" -o <n> set size of offsets vector to <n>\n");
#if !defined NOPOSIX
printf(" -p use POSIX interface\n");
@@ -2913,6 +2918,8 @@ printf(" -s force each pattern to be studied at basic level\n"
printf(" -t <n> time compilation and execution, repeating <n> times\n");
printf(" -tm time execution (matching) only\n");
printf(" -tm <n> time execution (matching) only, repeating <n> times\n");
+printf(" -T same as -t, but show total times at the end\n");
+printf(" -TM same as -tm, but show total time at the end\n");
}
@@ -2932,9 +2939,11 @@ const char *version;
int options = 0;
int study_options = 0;
int default_find_match_limit = FALSE;
+pcre_uint32 default_options = 0;
int op = 1;
int timeit = 0;
int timeitm = 0;
+int showtotaltimes = 0;
int showinfo = 0;
int showstore = 0;
int force_study = -1;
@@ -2950,7 +2959,11 @@ int verify_jit = 0;
int yield = 0;
int stack_size;
pcre_uint8 *dbuffer = NULL;
+pcre_uint8 lockout[24] = { 0 };
size_t dbuffer_size = 1u << 14;
+clock_t total_compile_time = 0;
+clock_t total_study_time = 0;
+clock_t total_match_time = 0;
#if !defined NOPOSIX
int posix = 0;
@@ -3073,6 +3086,7 @@ while (argc > 1 && argv[op][0] == '-')
else if (strcmp(arg, "-i") == 0) showinfo = 1;
else if (strcmp(arg, "-d") == 0) showinfo = debug = 1;
else if (strcmp(arg, "-M") == 0) default_find_match_limit = TRUE;
+ else if (strcmp(arg, "-O") == 0) default_options |= PCRE_NO_AUTO_POSSESS;
#if !defined NODFA
else if (strcmp(arg, "-dfa") == 0) all_use_dfa = 1;
#endif
@@ -3083,10 +3097,12 @@ while (argc > 1 && argv[op][0] == '-')
op++;
argc--;
}
- else if (strcmp(arg, "-t") == 0 || strcmp(arg, "-tm") == 0)
+ else if (strcmp(arg, "-t") == 0 || strcmp(arg, "-tm") == 0 ||
+ strcmp(arg, "-T") == 0 || strcmp(arg, "-TM") == 0)
{
- int both = arg[2] == 0;
int temp;
+ int both = arg[2] == 0;
+ showtotaltimes = arg[1] == 'T';
if (argc > 2 && (temp = get_value((pcre_uint8 *)argv[op+1], &endptr),
*endptr == 0))
{
@@ -3287,6 +3303,8 @@ are set, either both UTFs are supported or both are not supported. */
printf(" Internal link size = %d\n", rc);
(void)PCRE_CONFIG(PCRE_CONFIG_POSIX_MALLOC_THRESHOLD, &rc);
printf(" POSIX malloc threshold = %d\n", rc);
+ (void)PCRE_CONFIG(PCRE_CONFIG_PARENS_LIMIT, &lrc);
+ printf(" Parentheses nest limit = %ld\n", lrc);
(void)PCRE_CONFIG(PCRE_CONFIG_MATCH_LIMIT, &lrc);
printf(" Default match limit = %ld\n", lrc);
(void)PCRE_CONFIG(PCRE_CONFIG_MATCH_LIMIT_RECURSION, &lrc);
@@ -3378,7 +3396,7 @@ pcre32_stack_malloc = stack_malloc;
pcre32_stack_free = stack_free;
#endif
-/* Heading line unless quiet, then prompt for first regex if stdin */
+/* Heading line unless quiet */
if (!quiet) fprintf(outfile, "PCRE version %s\n\n", version);
@@ -3401,7 +3419,7 @@ while (!done)
const pcre_uint8 *tables = NULL;
unsigned long int get_options;
unsigned long int true_size, true_study_size = 0;
- size_t size, regex_gotten_store;
+ size_t size;
int do_allcaps = 0;
int do_mark = 0;
int do_study = 0;
@@ -3430,6 +3448,30 @@ while (!done)
while (isspace(*p)) p++;
if (*p == 0) continue;
+ /* Handle option lock-out setting */
+
+ if (*p == '<' && p[1] == ' ')
+ {
+ p += 2;
+ while (isspace(*p)) p++;
+ if (strncmp((char *)p, "forbid ", 7) == 0)
+ {
+ p += 7;
+ while (isspace(*p)) p++;
+ pp = lockout;
+ while (!isspace(*p) && pp < lockout + sizeof(lockout) - 1)
+ *pp++ = *p++;
+ *pp = 0;
+ }
+ else
+ {
+ printf("** Unrecognized special command '%s'\n", p);
+ yield = 1;
+ goto EXIT;
+ }
+ continue;
+ }
+
/* See if the pattern is to be loaded pre-compiled from a file. */
if (*p == '<' && strchr((char *)(p+1), '<') == NULL)
@@ -3456,8 +3498,6 @@ while (!done)
fprintf(outfile, "Failed to open %s: %s\n", p, strerror(errno));
continue;
}
-
- first_gotten_store = 0;
if (fread(sbuf, 1, 8, f) != 8) goto FAIL_READ;
true_size =
@@ -3473,8 +3513,6 @@ while (!done)
yield = 1;
goto EXIT;
}
- regex_gotten_store = first_gotten_store;
-
if (fread(re, 1, true_size, f) != true_size) goto FAIL_READ;
magic = REAL_PCRE_MAGIC(re);
@@ -3613,14 +3651,62 @@ while (!done)
*pp++ = 0;
strcpy((char *)pbuffer, (char *)p);
- /* Look for options after final delimiter */
+ /* Look for modifiers and options after the final delimiter. */
- options = 0;
+ options = default_options;
study_options = force_study_options;
log_store = showstore; /* default from command line */
while (*pp != 0)
{
+ /* Check to see whether this modifier has been locked out for this file.
+ This is complicated for the multi-character options that begin with '<'.
+ If there is no '>' in the lockout string, all multi-character modifiers are
+ locked out. */
+
+ if (strchr((char *)lockout, *pp) != NULL)
+ {
+ if (*pp == '<' && strchr((char *)lockout, '>') != NULL)
+ {
+ int x = check_mc_option(pp+1, outfile, FALSE, "modifier");
+ if (x == 0) goto SKIP_DATA;
+
+ for (ppp = lockout; *ppp != 0; ppp++)
+ {
+ if (*ppp == '<')
+ {
+ int y = check_mc_option(ppp+1, outfile, FALSE, "modifier");
+ if (y == 0)
+ {
+ printf("** Error in modifier forbid data - giving up.\n");
+ yield = 1;
+ goto EXIT;
+ }
+ if (x == y)
+ {
+ ppp = pp;
+ while (*ppp != '>') ppp++;
+ printf("** The %.*s modifier is locked out - giving up.\n",
+ (int)(ppp - pp + 1), pp);
+ yield = 1;
+ goto EXIT;
+ }
+ }
+ }
+ }
+
+ /* The single-character modifiers are straightforward. */
+
+ else
+ {
+ printf("** The /%c modifier is locked out - giving up.\n", *pp);
+ yield = 1;
+ goto EXIT;
+ }
+ }
+
+ /* The modifier is not locked out; handle it. */
+
switch (*pp++)
{
case 'f': options |= PCRE_FIRSTLINE; break;
@@ -3647,6 +3733,7 @@ while (!done)
case 'K': do_mark = 1; break;
case 'M': log_store = 1; break;
case 'N': options |= PCRE_NO_AUTO_CAPTURE; break;
+ case 'O': options |= PCRE_NO_AUTO_POSSESS; break;
#if !defined NOPOSIX
case 'P': do_posix = 1; break;
@@ -3744,18 +3831,10 @@ while (!done)
case '<':
{
- if (strncmpic(pp, (pcre_uint8 *)"JS>", 3) == 0)
- {
- options |= PCRE_JAVASCRIPT_COMPAT;
- pp += 3;
- }
- else
- {
- int x = check_newline(pp, outfile);
- if (x == 0) goto SKIP_DATA;
- options |= x;
- while (*pp++ != '>');
- }
+ int x = check_mc_option(pp, outfile, FALSE, "modifier");
+ if (x == 0) goto SKIP_DATA;
+ options |= x;
+ while (*pp++ != '>');
}
break;
@@ -3765,7 +3844,7 @@ while (!done)
break;
default:
- fprintf(outfile, "** Unknown option '%c'\n", pp[-1]);
+ fprintf(outfile, "** Unknown modifier '%c'\n", pp[-1]);
goto SKIP_DATA;
}
}
@@ -3788,7 +3867,6 @@ while (!done)
if ((options & PCRE_UCP) != 0) cflags |= REG_UCP;
if ((options & PCRE_UNGREEDY) != 0) cflags |= REG_UNGREEDY;
- first_gotten_store = 0;
rc = regcomp(&preg, (char *)p, cflags);
/* Compilation failed; go back for another re, skipping to blank line
@@ -3875,13 +3953,12 @@ while (!done)
PCRE_COMPILE(re, p, options, &error, &erroroffset, tables);
if (re != NULL) free(re);
}
- time_taken = clock() - start_time;
+ total_compile_time += (time_taken = clock() - start_time);
fprintf(outfile, "Compile time %.4f milliseconds\n",
(((double)time_taken * 1000.0) / (double)timeit) /
(double)CLOCKS_PER_SEC);
}
- first_gotten_store = 0;
PCRE_COMPILE(re, p, options, &error, &erroroffset, tables);
/* Compilation failed; go back for another re, skipping to blank line
@@ -3921,7 +3998,6 @@ while (!done)
and remember the store that was got. */
true_size = REAL_PCRE_SIZE(re);
- regex_gotten_store = first_gotten_store;
/* Output code size information if requested */
@@ -3944,8 +4020,9 @@ while (!done)
if (REAL_PCRE_FLAGS(re) & PCRE_MODE32)
real_pcre_size = sizeof(real_pcre32);
#endif
+ new_info(re, NULL, PCRE_INFO_SIZE, &size);
fprintf(outfile, "Memory allocation (code space): %d\n",
- (int)(first_gotten_store - real_pcre_size - name_count * name_entry_size));
+ (int)(size - real_pcre_size - name_count * name_entry_size));
}
/* If -s or /S was present, study the regex to generate additional info to
@@ -3964,7 +4041,7 @@ while (!done)
{
PCRE_STUDY(extra, re, study_options, &error);
}
- time_taken = clock() - start_time;
+ total_study_time = (time_taken = clock() - start_time);
if (extra != NULL)
{
PCRE_FREE_STUDY(extra);
@@ -4020,12 +4097,11 @@ while (!done)
pcre_uint32 first_char, need_char;
pcre_uint32 match_limit, recursion_limit;
int count, backrefmax, first_char_set, need_char_set, okpartial, jchanged,
- hascrorlf, maxlookbehind;
+ hascrorlf, maxlookbehind, match_empty;
int nameentrysize, namecount;
const pcre_uint8 *nametable;
- if (new_info(re, NULL, PCRE_INFO_SIZE, &size) +
- new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count) +
+ if (new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count) +
new_info(re, NULL, PCRE_INFO_BACKREFMAX, &backrefmax) +
new_info(re, NULL, PCRE_INFO_FIRSTCHARACTER, &first_char) +
new_info(re, NULL, PCRE_INFO_FIRSTCHARACTERFLAGS, &first_char_set) +
@@ -4037,14 +4113,11 @@ while (!done)
new_info(re, NULL, PCRE_INFO_OKPARTIAL, &okpartial) +
new_info(re, NULL, PCRE_INFO_JCHANGED, &jchanged) +
new_info(re, NULL, PCRE_INFO_HASCRORLF, &hascrorlf) +
+ new_info(re, NULL, PCRE_INFO_MATCH_EMPTY, &match_empty) +
new_info(re, NULL, PCRE_INFO_MAXLOOKBEHIND, &maxlookbehind)
!= 0)
goto SKIP_DATA;
- if (size != regex_gotten_store) fprintf(outfile,
- "Size disagreement: pcre_fullinfo=%d call to malloc for %d\n",
- (int)size, (int)regex_gotten_store);
-
fprintf(outfile, "Capturing subpattern count = %d\n", count);
if (backrefmax > 0)
@@ -4085,14 +4158,15 @@ while (!done)
}
}
- if (!okpartial) fprintf(outfile, "Partial matching not supported\n");
- if (hascrorlf) fprintf(outfile, "Contains explicit CR or LF match\n");
+ if (!okpartial) fprintf(outfile, "Partial matching not supported\n");
+ if (hascrorlf) fprintf(outfile, "Contains explicit CR or LF match\n");
+ if (match_empty) fprintf(outfile, "May match empty string\n");
all_options = REAL_PCRE_OPTIONS(re);
if (do_flip) all_options = swap_uint32(all_options);
if (get_options == 0) fprintf(outfile, "No options\n");
- else fprintf(outfile, "Options:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+ else fprintf(outfile, "Options:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
((get_options & PCRE_ANCHORED) != 0)? " anchored" : "",
((get_options & PCRE_CASELESS) != 0)? " caseless" : "",
((get_options & PCRE_EXTENDED) != 0)? " extended" : "",
@@ -4105,6 +4179,7 @@ while (!done)
((get_options & PCRE_EXTRA) != 0)? " extra" : "",
((get_options & PCRE_UNGREEDY) != 0)? " ungreedy" : "",
((get_options & PCRE_NO_AUTO_CAPTURE) != 0)? " no_auto_capture" : "",
+ ((get_options & PCRE_NO_AUTO_POSSESS) != 0)? " no_auto_possessify" : "",
((get_options & PCRE_UTF8) != 0)? " utf" : "",
((get_options & PCRE_UCP) != 0)? " ucp" : "",
((get_options & PCRE_NO_UTF8_CHECK) != 0)? " no_utf_check" : "",
@@ -4498,6 +4573,23 @@ while (!done)
c = c * 8 + *p++ - '0';
break;
+ case 'o':
+ if (*p == '{')
+ {
+ pcre_uint8 *pt = p;
+ c = 0;
+ for (pt++; isdigit(*pt) && *pt != '8' && *pt != '9'; pt++)
+ {
+ if (++i == 12)
+ fprintf(outfile, "** Too many octal digits in \\o{...} item; "
+ "using only the first twelve.\n");
+ else c = c * 8 + *pt - '0';
+ }
+ if (*pt == '}') p = pt + 1;
+ else fprintf(outfile, "** Missing } after \\o{ (assumed)\n");
+ }
+ break;
+
case 'x':
if (*p == '{')
{
@@ -4740,7 +4832,7 @@ while (!done)
case '<':
{
- int x = check_newline(p, outfile);
+ int x = check_mc_option(p, outfile, TRUE, "escape sequence");
if (x == 0) goto NEXT_DATA;
options |= x;
while (*p++ != '>');
@@ -4982,7 +5074,7 @@ while (!done)
PCRE_EXEC(count, re, extra, bptr, len, start_offset,
(options | g_notempty), use_offsets, use_size_offsets);
}
- time_taken = clock() - start_time;
+ total_match_time += (time_taken = clock() - start_time);
fprintf(outfile, "Execute time %.4f milliseconds\n",
(((double)time_taken * 1000.0) / (double)timeitm) /
(double)CLOCKS_PER_SEC);
@@ -5492,6 +5584,23 @@ while (!done)
if (infile == stdin) fprintf(outfile, "\n");
+if (showtotaltimes)
+ {
+ fprintf(outfile, "--------------------------------------\n");
+ if (timeit > 0)
+ {
+ fprintf(outfile, "Total compile time %.4f milliseconds\n",
+ (((double)total_compile_time * 1000.0) / (double)timeit) /
+ (double)CLOCKS_PER_SEC);
+ fprintf(outfile, "Total study time %.4f milliseconds\n",
+ (((double)total_study_time * 1000.0) / (double)timeit) /
+ (double)CLOCKS_PER_SEC);
+ }
+ fprintf(outfile, "Total execute time %.4f milliseconds\n",
+ (((double)total_match_time * 1000.0) / (double)timeitm) /
+ (double)CLOCKS_PER_SEC);
+ }
+
EXIT:
if (infile != NULL && infile != stdin) fclose(infile);
diff --git a/pcre/testdata/grepoutput b/pcre/testdata/grepoutput
index cf04091f4a2..9bf9d9d62e9 100644
--- a/pcre/testdata/grepoutput
+++ b/pcre/testdata/grepoutput
@@ -740,3 +740,6 @@ RC=0

triple: t7_txt s1_tag s_txt p_tag p_txt o_tag o_txt
RC=0
+---------------------------- Test 106 -----------------------------
+a
+RC=0
diff --git a/pcre/testdata/saved16 b/pcre/testdata/saved16
index 583c4342862..f86326c9f87 100644
--- a/pcre/testdata/saved16
+++ b/pcre/testdata/saved16
Binary files differ
diff --git a/pcre/testdata/saved16BE-1 b/pcre/testdata/saved16BE-1
index e2e807d4fde..e6edddc6e0b 100644
--- a/pcre/testdata/saved16BE-1
+++ b/pcre/testdata/saved16BE-1
Binary files differ
diff --git a/pcre/testdata/saved16BE-2 b/pcre/testdata/saved16BE-2
index cc2718aa1ea..c91ce37bd4f 100644
--- a/pcre/testdata/saved16BE-2
+++ b/pcre/testdata/saved16BE-2
Binary files differ
diff --git a/pcre/testdata/saved16LE-1 b/pcre/testdata/saved16LE-1
index b037d4903e1..5035ec07215 100644
--- a/pcre/testdata/saved16LE-1
+++ b/pcre/testdata/saved16LE-1
Binary files differ
diff --git a/pcre/testdata/saved16LE-2 b/pcre/testdata/saved16LE-2
index d7034f757fe..656c058d260 100644
--- a/pcre/testdata/saved16LE-2
+++ b/pcre/testdata/saved16LE-2
Binary files differ
diff --git a/pcre/testdata/saved32 b/pcre/testdata/saved32
index 5b6fe34c948..a4e27041ce1 100644
--- a/pcre/testdata/saved32
+++ b/pcre/testdata/saved32
Binary files differ
diff --git a/pcre/testdata/saved32BE-1 b/pcre/testdata/saved32BE-1
index ebe62ca7c66..b4c2ffe42cc 100644
--- a/pcre/testdata/saved32BE-1
+++ b/pcre/testdata/saved32BE-1
Binary files differ
diff --git a/pcre/testdata/saved32BE-2 b/pcre/testdata/saved32BE-2
index 8168343931c..79bb5e88055 100644
--- a/pcre/testdata/saved32BE-2
+++ b/pcre/testdata/saved32BE-2
Binary files differ
diff --git a/pcre/testdata/saved32LE-1 b/pcre/testdata/saved32LE-1
index e008f3a5a7c..49392b89a10 100644
--- a/pcre/testdata/saved32LE-1
+++ b/pcre/testdata/saved32LE-1
Binary files differ
diff --git a/pcre/testdata/saved32LE-2 b/pcre/testdata/saved32LE-2
index cf3bd731928..5f64af9b9d5 100644
--- a/pcre/testdata/saved32LE-2
+++ b/pcre/testdata/saved32LE-2
Binary files differ
diff --git a/pcre/testdata/saved8 b/pcre/testdata/saved8
index 37d733eedf3..8cf0c1312de 100644
--- a/pcre/testdata/saved8
+++ b/pcre/testdata/saved8
Binary files differ
diff --git a/pcre/testdata/testinput1 b/pcre/testdata/testinput1
index e3050ef0a99..7b36360d044 100644
--- a/pcre/testdata/testinput1
+++ b/pcre/testdata/testinput1
@@ -1,6 +1,8 @@
/-- This set of tests is for features that are compatible with all versions of
- Perl >= 5.10, in non-UTF-8 mode. It should run clean for both the 8-bit and
- 16-bit PCRE libraries. --/
+ Perl >= 5.10, in non-UTF-8 mode. It should run clean for the 8-bit, 16-bit,
+ and 32-bit PCRE libraries. --/
+
+< forbid 89?=ABCDEFfGILMNPTUWXZ<
/the quick brown fox/
the quick brown fox
@@ -1483,14 +1485,19 @@
abc\100\x30
abc\100\060
abc\100\60
+
+/^A\8B\9C$/
+ A8B9C
+ *** Failers
+ A\08B\09C
+
+/^(A)(B)(C)(D)(E)(F)(G)(H)(I)\8\9$/
+ ABCDEFGHIHI
-/abc\81/
- abc\081
- abc\0\x38\x31
-
-/abc\91/
- abc\091
- abc\0\x39\x31
+/^[A\8B\9C]+$/
+ A8B9C
+ *** Failers
+ A8B9C\x00
/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/
abcdefghijkllS
@@ -3654,13 +3661,6 @@
/a*/g
abbab
-/^[a-\d]/
- abcde
- -things
- 0digit
- *** Failers
- bcdef
-
/^[\d-a]/
abcde
-things
@@ -4221,9 +4221,6 @@
ab
bc
-/^(?=(a)){0}b(?1)/
- backgammon
-
/^(?=(?1))?[az]([abc])d/
abd
zcdxx
@@ -5608,4 +5605,65 @@ AbcdCBefgBhiBqz
aaaa
aaa
+/(?(?=ab)ab)/+
+ ca
+ cd
+
+/(?:(?<n>foo)|(?<n>bar))\k<n>/J
+ foofoo
+ barbar
+
+/(?<n>A)(?:(?<n>foo)|(?<n>bar))\k<n>/J
+ AfooA
+ AbarA
+ ** Failers
+ Afoofoo
+ Abarbar
+
+/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
+ 1 IN SOA non-sp1 non-sp2(
+
+/^ (?:(?<A>A)|(?'B'B)(?<A>A)) (?('A')x) (?(<B>)y)$/xJ
+ Ax
+ BAxy
+
+/^A\xZ/
+ A\0Z
+
+/^A\o{123}B/
+ A\123B
+
+/ ^ a + + b $ /x
+ aaaab
+
+/ ^ a + #comment
+ + b $ /x
+ aaaab
+
+/ ^ a + #comment
+ #comment
+ + b $ /x
+ aaaab
+
+/ ^ (?> a + ) b $ /x
+ aaaab
+
+/ ^ ( a + ) + + \w $ /x
+ aaaab
+
+/(?:a\Kb)*+/+
+ ababc
+
+/(?>a\Kb)*/+
+ ababc
+
+/(?:a\Kb)*/+
+ ababc
+
+/(a\Kb)*+/+
+ ababc
+
+/(a\Kb)*/+
+ ababc
+
/-- End of testinput1 --/
diff --git a/pcre/testdata/testinput10 b/pcre/testdata/testinput10
index 7f522e6af8f..93ddb3a75b7 100644
--- a/pcre/testdata/testinput10
+++ b/pcre/testdata/testinput10
@@ -139,6 +139,12 @@
/^\p{Cf}/8
\x{601}
+ \x{180e}
+ \x{061c}
+ \x{2066}
+ \x{2067}
+ \x{2068}
+ \x{2069}
** Failers
\x{09f}
@@ -199,11 +205,12 @@
/^\p{Mn}/8
\x{300}
+ \x{1a1b}
** Failers
X
\x{903}
-/^\p{Nd}+/8
+/^\p{Nd}+/8O
0123456789\x{660}\x{661}\x{662}\x{663}\x{664}\x{665}\x{666}\x{667}\x{668}\x{669}\x{66a}
\x{6f0}\x{6f1}\x{6f2}\x{6f3}\x{6f4}\x{6f5}\x{6f6}\x{6f7}\x{6f8}\x{6f9}\x{6fa}
\x{966}\x{967}\x{968}\x{969}\x{96a}\x{96b}\x{96c}\x{96d}\x{96e}\x{96f}\x{970}
@@ -243,6 +250,8 @@
]
}
\x{f3b}
+ \x{2309}
+ \x{230b}
** Failers
X
\x{203f}
@@ -250,7 +259,7 @@
[
{
\x{f3c}
-
+
/^\p{Pf}/8
\x{bb}
\x{2019}
@@ -277,6 +286,8 @@
[
{
\x{f3c}
+ \x{2308}
+ \x{230a}
** Failers
X
)
@@ -326,7 +337,6 @@
\ \
\x{a0}
\x{1680}
- \x{180e}
\x{2000}
\x{2001}
** Failers
@@ -423,23 +433,23 @@
** Failers
1234
-/\D+/8
+/\D+/8O
11111111111111111111111111111111111111111111111111111111111111111111111
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-/\P{Nd}+/8
+/\P{Nd}+/8O
11111111111111111111111111111111111111111111111111111111111111111111111
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-/[\D]+/8
+/[\D]+/8O
11111111111111111111111111111111111111111111111111111111111111111111111
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-/[\P{Nd}]+/8
+/[\P{Nd}]+/8O
11111111111111111111111111111111111111111111111111111111111111111111111
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-/[\D\P{Nd}]+/8
+/[\D\P{Nd}]+/8O
11111111111111111111111111111111111111111111111111111111111111111111111
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -886,19 +896,19 @@
** Failers
\x{0b}
-/^>\p{Xsp}+/8
+/^>\p{Xsp}+/8O
> \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
-/^>\p{Xsp}*/8
+/^>\p{Xsp}*/8O
> \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
-/^>\p{Xsp}{2,9}/8
+/^>\p{Xsp}{2,9}/8O
> \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
-/^>[\p{Xsp}]/8
+/^>[\p{Xsp}]/8O
>\x{2028}\x{0b}
-/^>[\p{Xsp}]+/8
+/^>[\p{Xsp}]+/8O
> \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
/^>\p{Xps}/8
@@ -1398,4 +1408,12 @@
`abc
\x{1234}abc
+/^A\s+Z/8W
+ A\x{2005}Z
+ A\x{85}\x{180e}\x{2005}Z
+
+/^A[\s]+Z/8W
+ A\x{2005}Z
+ A\x{85}\x{180e}\x{2005}Z
+
/-- End of testinput10 --/
diff --git a/pcre/testdata/testinput14 b/pcre/testdata/testinput14
index e5e85207cce..325ed9e361f 100644
--- a/pcre/testdata/testinput14
+++ b/pcre/testdata/testinput14
@@ -1,6 +1,9 @@
-/-- This set of tests is run only with the 8-bit library. It starts with all
- the tests of the POSIX interface, because that is supported only with the
- 8-bit library. --/
+/-- This set of tests is run only with the 8-bit library. They do not require
+ UTF-8 or Unicode property support. The file starts with all the tests of
+ the POSIX interface, because that is supported only with the 8-bit library.
+ --/
+
+< forbid 8W
/abc/P
abc
@@ -85,9 +88,12 @@
a\nb
** Failers (too big char)
A\x{123}B
+ A\o{443}B
/\x{100}/I
+/\o{400}/I
+
/ (?: [\040\t] | \(
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
\) )* # optional leading comment
@@ -294,8 +300,12 @@ not matter. --/
/\h/SI
+/\H/SI
+
/\v/SI
+/\V/SI
+
/\R/SI
/[\h]/BZ
@@ -326,4 +336,8 @@ not matter. --/
/[\u0100-\u0200]/<JS>
+/[^\x00-a]{12,}[^b-\xff]*/BZ
+
+/[^\s]*\s* [^\W]+\W+ [^\d]*?\d0 [^\d\w]{4,6}?\w*A/BZ
+
/-- End of testinput14 --/
diff --git a/pcre/testdata/testinput15 b/pcre/testdata/testinput15
index 9aa8f6836a7..83e26773471 100644
--- a/pcre/testdata/testinput15
+++ b/pcre/testdata/testinput15
@@ -1,5 +1,7 @@
-/-- This set of tests is for UTF-8 support, and is relevant only to the 8-bit
- library. --/
+/-- This set of tests is for UTF-8 support but not Unicode property support,
+ and is relevant only to the 8-bit library. --/
+
+< forbid W
/X(\C{3})/8
X\x{1234}
@@ -47,7 +49,7 @@
/ÃÃÃxxx/8
-/ÃÃÃxxx/8?DZSS
+/ÃÃÃxxx/8?DZSSO
/badutf/8
\xdf
diff --git a/pcre/testdata/testinput17 b/pcre/testdata/testinput17
index ba80318857b..1d933c7942c 100644
--- a/pcre/testdata/testinput17
+++ b/pcre/testdata/testinput17
@@ -1,6 +1,8 @@
/-- This set of tests is for the 16- and 32-bit library's basic (non-UTF-16
or -32) features that are not compatible with the 8-bit library, or which
give different output in 16- or 32-bit mode. --/
+
+< forbid 8W
/a\Cb/
aXb
@@ -293,4 +295,13 @@
/^\x{ffff}{0,3}/i
\x{ffff}
+/[^\x00-a]{12,}[^b-\xff]*/BZ
+
+/[^\s]*\s* [^\W]+\W+ [^\d]*?\d0 [^\d\w]{4,6}?\w*A/BZ
+
+/a*[b-\x{200}]?a#a*[b-\x{200}]?b#[a-f]*[g-\x{200}]*#[g-\x{200}]*[a-c]*#[g-\x{200}]*[a-h]*/BZ
+
+/^[\x{1234}\x{4321}]{2,4}?/
+ \x{1234}\x{1234}\x{1234}
+
/-- End of testinput17 --/
diff --git a/pcre/testdata/testinput18 b/pcre/testdata/testinput18
index 42bad1fa418..abff34e73a5 100644
--- a/pcre/testdata/testinput18
+++ b/pcre/testdata/testinput18
@@ -1,5 +1,7 @@
-/-- This set of tests is for UTF-16 and UTF-32 support, and is relevant only to the
- 16- and 32-bit library. --/
+/-- This set of tests is for UTF-16 and UTF-32 support, and is relevant only to
+ the 16- and 32-bit libraries. --/
+
+< forbid W
/ÃÃÃxxx/8?DZSS
diff --git a/pcre/testdata/testinput2 b/pcre/testdata/testinput2
index 6c82fb56df6..00924ee98fa 100644
--- a/pcre/testdata/testinput2
+++ b/pcre/testdata/testinput2
@@ -7,6 +7,8 @@
NOTE: This is a non-UTF set of tests. When UTF support is needed, use
test 5, and if Unicode Property Support is needed, use test 7. --/
+
+< forbid 8W
/(a)b|/I
@@ -829,7 +831,13 @@
/x++/DZ
-/x{1,3}+/DZ
+/x{1,3}+/BZO
+
+/x{1,3}+/BZOi
+
+/[^x]{1,3}+/BZO
+
+/[^x]{1,3}+/BZOi
/(x)*+/DZ
@@ -1495,6 +1503,8 @@
a2b\CA
** Failers
a1b\CZ\CA
+
+/(?|(?<a>)(?<b>)(?<a>)|(?<a>)(?<b>)(?<a>))/IJ
/^(?P<A>a)(?P<A>b)/IJ
ab\CA
@@ -1935,10 +1945,7 @@ a random value. /Ix
/(?<A> (?'B' abc (?(R) (?(R&A)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x
abcabc1Xabc2XabcXabcabc
-/(?<A> (?'B' abc (?(R) (?(R&1)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x
-
-/(?<1> (?'B' abc (?(R) (?(R&1)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x
- abcabc1Xabc2XabcXabcabc
+/(?<A> (?'B' abc (?(R) (?(R&C)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x
/^(?(DEFINE) abc | xyz ) /x
@@ -2055,7 +2062,7 @@ a random value. /Ix
/^(a)\g{3/
-/^(a)\g{4a}/
+/^(a)\g{aa}/
/^a.b/<lf>
a\rb
@@ -2510,7 +2517,10 @@ a random value. /Ix
** Failers
ab
-/a(?!)+b/
+/a(?!)b/BZ
+
+/(?!)?a/BZ
+ ab
/a(*FAIL)+b/
@@ -2535,7 +2545,9 @@ a random value. /Ix
abcxypqr\Y
/(*NO_START_OPT)xyz/C
- abcxyz
+ abcxyz
+
+/(*NO_AUTO_POSSESS)a+b/BZ
/xyz/CY
abcxyz
@@ -3482,6 +3494,8 @@ with \Y. ---/
/a[B-\Nc]/
+/a[B\Nc]/
+
/(a)(?2){0,1999}?(b)/
/(a)(?(DEFINE)(b))(?2){0,1999}?(?2)/
@@ -3837,4 +3851,198 @@ backtracking verbs. --/
aaaaaaaaaaaaaz
aaaaaaaaaaaaaz\Q10
+/-- This test causes a segfault with Perl 5.18.0 --/
+
+/^(?=(a)){0}b(?1)/
+ backgammon
+
+/(?|(?<n>f)|(?<n>b))/JI
+
+/(?<a>abc)(?<a>z)\k<a>()/JDZS
+
+/a*[bcd]/BZ
+
+/[bcd]*a/BZ
+
+/-- A complete set of tests for auto-possessification of character types --/
+
+/\D+\D \D+\d \D+\S \D+\s \D+\W \D+\w \D+. \D+\C \D+\R \D+\H \D+\h \D+\V \D+\v \D+\Z \D+\z \D+$/BZx
+
+/\d+\D \d+\d \d+\S \d+\s \d+\W \d+\w \d+. \d+\C \d+\R \d+\H \d+\h \d+\V \d+\v \d+\Z \d+\z \d+$/BZx
+
+/\S+\D \S+\d \S+\S \S+\s \S+\W \S+\w \S+. \S+\C \S+\R \S+\H \S+\h \S+\V \S+\v \S+\Z \S+\z \S+$/BZx
+
+/\s+\D \s+\d \s+\S \s+\s \s+\W \s+\w \s+. \s+\C \s+\R \s+\H \s+\h \s+\V \s+\v \s+\Z \s+\z \s+$/BZx
+
+/\W+\D \W+\d \W+\S \W+\s \W+\W \W+\w \W+. \W+\C \W+\R \W+\H \W+\h \W+\V \W+\v \W+\Z \W+\z \W+$/BZx
+
+/\w+\D \w+\d \w+\S \w+\s \w+\W \w+\w \w+. \w+\C \w+\R \w+\H \w+\h \w+\V \w+\v \w+\Z \w+\z \w+$/BZx
+
+/\C+\D \C+\d \C+\S \C+\s \C+\W \C+\w \C+. \C+\C \C+\R \C+\H \C+\h \C+\V \C+\v \C+\Z \C+\z \C+$/BZx
+
+/\R+\D \R+\d \R+\S \R+\s \R+\W \R+\w \R+. \R+\C \R+\R \R+\H \R+\h \R+\V \R+\v \R+\Z \R+\z \R+$/BZx
+
+/\H+\D \H+\d \H+\S \H+\s \H+\W \H+\w \H+. \H+\C \H+\R \H+\H \H+\h \H+\V \H+\v \H+\Z \H+\z \H+$/BZx
+
+/\h+\D \h+\d \h+\S \h+\s \h+\W \h+\w \h+. \h+\C \h+\R \h+\H \h+\h \h+\V \h+\v \h+\Z \h+\z \h+$/BZx
+
+/\V+\D \V+\d \V+\S \V+\s \V+\W \V+\w \V+. \V+\C \V+\R \V+\H \V+\h \V+\V \V+\v \V+\Z \V+\z \V+$/BZx
+
+/\v+\D \v+\d \v+\S \v+\s \v+\W \v+\w \v+. \v+\C \v+\R \v+\H \v+\h \v+\V \v+\v \v+\Z \v+\z \v+$/BZx
+
+/ a+\D a+\d a+\S a+\s a+\W a+\w a+. a+\C a+\R a+\H a+\h a+\V a+\v a+\Z a+\z a+$/BZx
+
+/\n+\D \n+\d \n+\S \n+\s \n+\W \n+\w \n+. \n+\C \n+\R \n+\H \n+\h \n+\V \n+\v \n+\Z \n+\z \n+$/BZx
+
+/ .+\D .+\d .+\S .+\s .+\W .+\w .+. .+\C .+\R .+\H .+\h .+\V .+\v .+\Z .+\z .+$/BZx
+
+/ .+\D .+\d .+\S .+\s .+\W .+\w .+. .+\C .+\R .+\H .+\h .+\V .+\v .+\Z .+\z .+$/BZxs
+
+/\D+$ \d+$ \S+$ \s+$ \W+$ \w+$ \C+$ \R+$ \H+$ \h+$ \V+$ \v+$ a+$ \n+$ .+$ .+$/BZxm
+
+/(?=a+)a(a+)++a/BZ
+
+/a+(bb|cc)a+(?:bb|cc)a+(?>bb|cc)a+(?:bb|cc)+a+(aa)a+(?:bb|aa)/BZ
+
+/a+(bb|cc)?#a+(?:bb|cc)??#a+(?:bb|cc)?+#a+(?:bb|cc)*#a+(bb|cc)?a#a+(?:aa)?/BZ
+
+/a+(?:bb)?a#a+(?:|||)#a+(?:|b)a#a+(?:|||)?a/BZ
+
+/[ab]*/BZ
+ aaaa
+
+/[ab]*?/BZ
+ aaaa
+
+/[ab]?/BZ
+ aaaa
+
+/[ab]??/BZ
+ aaaa
+
+/[ab]+/BZ
+ aaaa
+
+/[ab]+?/BZ
+ aaaa
+
+/[ab]{2,3}/BZ
+ aaaa
+
+/[ab]{2,3}?/BZ
+ aaaa
+
+/[ab]{2,}/BZ
+ aaaa
+
+/[ab]{2,}?/BZ
+ aaaa
+
+/\d+\s{0,5}=\s*\S?=\w{0,4}\W*/BZ
+
+/[a-d]{5,12}[e-z0-9]*#[^a-z]+[b-y]*a[2-7]?[^0-9a-z]+/BZ
+
+/[a-z]*\s#[ \t]?\S#[a-c]*\S#[C-G]+?\d#[4-8]*\D#[4-9,]*\D#[!$]{0,5}\w#[M-Xf-l]+\W#[a-c,]?\W/BZ
+
+/a+(aa|bb)*c#a*(bb|cc)*a#a?(bb|cc)*d#[a-f]*(g|hh)*f/BZ
+
+/[a-f]*(g|hh|i)*i#[a-x]{4,}(y{0,6})*y#[a-k]+(ll|mm)+n/BZ
+
+/[a-f]*(?>gg|hh)+#[a-f]*(?>gg|hh)?#[a-f]*(?>gg|hh)*a#[a-f]*(?>gg|hh)*h/BZ
+
+/[a-c]*d/DZS
+
+/[a-c]+d/DZS
+
+/[a-c]?d/DZS
+
+/[a-c]{4,6}d/DZS
+
+/[a-c]{0,6}d/DZS
+
+/-- End of special auto-possessive tests --/
+
+/^A\o{1239}B/
+ A\123B
+
+/^A\oB/
+
+/^A\x{zz}B/
+
+/^A\x{12Z/
+
+/^A\x{/
+
+/[ab]++/BZO
+
+/[^ab]*+/BZO
+
+/a{4}+/BZO
+
+/a{4}+/BZOi
+
+/[a-[:digit:]]+/
+
+/[A-[:digit:]]+/
+
+/[a-[.xxx.]]+/
+
+/[a-[=xxx=]]+/
+
+/[a-[!xxx!]]+/
+
+/[A-[!xxx!]]+/
+ A]]]
+
+/[a-\d]+/
+
+/(?<0abc>xx)/
+
+/(?&1abc)xx(?<1abc>y)/
+
+/(?<ab-cd>xx)/
+
+/(?'0abc'xx)/
+
+/(?P<0abc>xx)/
+
+/\k<5ghj>/
+
+/\k'5ghj'/
+
+/\k{2fgh}/
+
+/(?P=8yuki)/
+
+/\g{4df}/
+
+/(?&1abc)xx(?<1abc>y)/
+
+/(?P>1abc)xx(?<1abc>y)/
+
+/\g'3gh'/
+
+/\g<5fg>/
+
+/(?(<4gh>)abc)/
+
+/(?('4gh')abc)/
+
+/(?(4gh)abc)/
+
+/(?(R&6yh)abc)/
+
+/-- Test the ugly "start or end of word" compatibility syntax --/
+
+/[[:<:]]red[[:>:]]/BZ
+ little red riding hood
+ a /red/ thing
+ red is a colour
+ put it all on red
+ ** Failers
+ no reduction
+ Alfred Winifred
+
+/[a[:<:]] should give error/
+
/-- End of testinput2 --/
diff --git a/pcre/testdata/testinput21 b/pcre/testdata/testinput21
index b285d637526..30895eef2d0 100644
--- a/pcre/testdata/testinput21
+++ b/pcre/testdata/testinput21
@@ -4,7 +4,11 @@ typical). The others require the link size to be 2. */x
<!testsaved8
-%-- Generated from: ^[aL](?P<name>(?:[AaLl]+)[^xX-]*?)(?P<other>[\x{150}-\x{250}\x{300}]|[^\x{800}aAs-uS-U\x{d800}-\x{dfff}])++[^#\b\x{500}\x{1000}]{3,5}$
+%-- Generated from:
+ /^[aL](?P<name>(?:[AaLl]+)[^xX-]*?)(?P<other>[\x{150}-\x{250}\x{300}]|
+ [^\x{800}aAs-uS-U\x{d800}-\x{dfff}])++[^#\b\x{500}\x{1000}]{3,5}$
+ /x
+
In 16-bit mode with options: S>testdata/saved16LE-1
FS>testdata/saved16BE-1
In 32-bit mode with options: S>testdata/saved32LE-1
diff --git a/pcre/testdata/testinput22 b/pcre/testdata/testinput22
index 58239f1f79c..ca408dbee97 100644
--- a/pcre/testdata/testinput22
+++ b/pcre/testdata/testinput22
@@ -1,10 +1,15 @@
/-- Tests for reloading pre-compile patterns with UTF-16 or UTF-32 support. */
-%-- Generated from: (?P<cbra1>[aZ\x{400}-\x{10ffff}]{4,}[\x{f123}\x{10039}\x{20000}-\x{21234}]?|[A-Cx-z\x{100000}-\x{1000a7}\x{101234}])(?<cb2>[^az])
- In 16-bit mode with options: S8>testdata/saved16LE-1
- FS8>testdata/saved16BE-1
- In 32-bit mode with options: S8>testdata/saved32LE-1
- FS8testdata/saved32BE-1
+%-- Generated from:
+ /(?P<cbra1>[aZ\x{400}-\x{10ffff}]{4,}
+ [\x{f123}\x{10039}\x{20000}-\x{21234}]?|
+ [A-Cx-z\x{100000}-\x{1000a7}\x{101234}])
+ (?<cb2>[^az])/x
+
+ In 16-bit mode with options: S8>testdata/saved16LE-2
+ FS8>testdata/saved16BE-2
+ In 32-bit mode with options: S8>testdata/saved32LE-2
+ FS8>testdata/saved32BE-2
--%8x
<!testsaved16LE-2
diff --git a/pcre/testdata/testinput23 b/pcre/testdata/testinput23
index 961ae35d445..0fdbae7c577 100644
--- a/pcre/testdata/testinput23
+++ b/pcre/testdata/testinput23
@@ -1,5 +1,7 @@
/-- Tests for the 16-bit library only */
+< forbid 8W
+
/-- Check maximum non-UTF character size --/
/\x{ffff}/
@@ -7,6 +9,8 @@
/\x{10000}/
+/\o{20000}/
+
/-- Check character ranges --/
/[\H]/BZSI
diff --git a/pcre/testdata/testinput24 b/pcre/testdata/testinput24
index 71a400ed138..23eb84e55d1 100644
--- a/pcre/testdata/testinput24
+++ b/pcre/testdata/testinput24
@@ -1,5 +1,7 @@
/-- Tests for the 16-bit library with UTF-16 support only */
+< forbid W
+
/bad/8
\x{d800}
diff --git a/pcre/testdata/testinput25 b/pcre/testdata/testinput25
index 2d65fd7b03e..ce9d9e19a40 100644
--- a/pcre/testdata/testinput25
+++ b/pcre/testdata/testinput25
@@ -1,5 +1,7 @@
/-- Tests for the 32-bit library only */
+< forbid 8w
+
/-- Check maximum character size --/
/\x{110000}/
@@ -10,6 +12,16 @@
/\x{ffffffff}/
+/\x{100000000}/
+
+/\o{17777777777}/
+
+/\o{20000000000}/
+
+/\o{37777777777}/
+
+/\o{40000000000}/
+
/\x{7fffffff}\x{7fffffff}/I
/\x{80000000}\x{80000000}/I
diff --git a/pcre/testdata/testinput26 b/pcre/testdata/testinput26
index 643a1d1cdbf..6b56ac1cc56 100644
--- a/pcre/testdata/testinput26
+++ b/pcre/testdata/testinput26
@@ -1,9 +1,13 @@
/-- Tests for the 32-bit library with UTF-32 support only */
+< forbid W
+
/-- Non-UTF characters --/
/\x{110000}/8
+/\o{4200000}/8
+
/\C/8
\x{110000}
diff --git a/pcre/testdata/testinput3 b/pcre/testdata/testinput3
index 6fea2f5b3bd..1d2e855386a 100644
--- a/pcre/testdata/testinput3
+++ b/pcre/testdata/testinput3
@@ -1,6 +1,8 @@
/-- This set of tests checks local-specific features, using the fr_FR locale.
It is not Perl-compatible. There is different version called wintestinput3
f or use on Windows, where the locale is called "french". --/
+
+< forbid 8W
/^[\w]+/
*** Failers
diff --git a/pcre/testdata/testinput4 b/pcre/testdata/testinput4
index b9f1a72e4f2..983f7a119b5 100644
--- a/pcre/testdata/testinput4
+++ b/pcre/testdata/testinput4
@@ -1,6 +1,8 @@
/-- This set of tests is for UTF support, excluding Unicode properties. It is
compatible with all versions of Perl >= 5.10 and both the 8-bit and 16-bit
PCRE libraries. --/
+
+< forbid 9?=ABCDEFfGILMNPTUWXZ<
/a.b/8
acb
@@ -711,4 +713,7 @@
\x{100}\x{100}\x{100}\x{100}
\x{100}\x{100}\x{100}
+/^a+[a\x{200}]/8
+ aa
+
/-- End of testinput4 --/
diff --git a/pcre/testdata/testinput5 b/pcre/testdata/testinput5
index 642749c315c..9e9a22a1a1f 100644
--- a/pcre/testdata/testinput5
+++ b/pcre/testdata/testinput5
@@ -1,21 +1,37 @@
/-- This set of tests checks the API, internals, and non-Perl stuff for UTF
support, excluding Unicode properties. However, tests that give different
results in 8-bit and 16-bit modes are excluded (see tests 16 and 17). --/
+
+< forbid W
/\x{110000}/8DZ
+/\o{4200000}/8DZ
+
/\x{ffffffff}/8
+/\o{37777777777}/8
+
/\x{100000000}/8
+/\o{77777777777}/8
+
/\x{d800}/8
+/\o{154000}/8
+
/\x{dfff}/8
+/\o{157777}/8
+
/\x{d7ff}/8
+/\o{153777}/8
+
/\x{e000}/8
+/\o{170000}/8
+
/^\x{100}a\x{1234}/8
\x{100}a\x{1234}bcd
@@ -769,4 +785,7 @@
/\ud800/<JS>8
+/^a+[a\x{200}]/8BZ
+ aa
+
/-- End of testinput5 --/
diff --git a/pcre/testdata/testinput6 b/pcre/testdata/testinput6
index adbf621a98e..1e450be04d3 100644
--- a/pcre/testdata/testinput6
+++ b/pcre/testdata/testinput6
@@ -1,5 +1,7 @@
/-- This set of tests is for Unicode property support. It is compatible with
Perl >= 5.15. --/
+
+< forbid 9?=ABCDEFfGILMNPTUXZ<
/^\pC\pL\pM\pN\pP\pS\pZ</8
\x7f\x{c0}\x{30f}\x{660}\x{66c}\x{f01}\x{1680}<
@@ -325,12 +327,6 @@
** Failers
abc
-/\p{Lu}/8i
- A
- aZ
- ** Failers
- abc
-
/\p{Ll}/8
a
Az
@@ -425,6 +421,7 @@
/^[\p{Arabic}]/8
\x{06e9}
\x{060b}
+ \x{061c}
** Failers
X\x{06e9}
@@ -882,6 +879,15 @@
\x{1111}\x{ae4c}\x{1111}\x{ae4c}\x{1111}\x{ae4c}X
\x{1111}\x{ae4c}\x{1111}\x{ae4c}\x{1111}\x{ae4c}\x{1111}\x{ae4c}X
+/\X*Z/8Y
+ A\x{300}
+
+/\X*(.)/8Y
+ A\x{1111}\x{ae4c}\x{1169}
+
+/\X?abc/8Y
+\xff\x7f\x00\x00\x03\x00\x41\xcc\x80\x41\x{300}\x61\x62\x63\x00\>06\?
+
/-- --/
/\x{1e9e}+/8i
@@ -1319,9 +1325,163 @@
/^\p{Any}*\d{4}/8
1234
123
-
+
/^\X*\w{4}/8
1234
123
-
+
+/^A\s+Z/8W
+ A\x{2005}Z
+ A\x{85}\x{180e}\x{2005}Z
+
+/^A[\s]+Z/8W
+ A\x{2005}Z
+ A\x{85}\x{180e}\x{2005}Z
+
+/^[[:graph:]]+$/8W
+ Letter:ABC
+ Mark:\x{300}\x{1d172}\x{1d17b}
+ Number:9\x{660}
+ Punctuation:\x{66a},;
+ Symbol:\x{6de}<>\x{fffc}
+ Cf-property:\x{ad}\x{600}\x{601}\x{602}\x{603}\x{604}\x{6dd}\x{70f}
+ \x{200b}\x{200c}\x{200d}\x{200e}\x{200f}
+ \x{202a}\x{202b}\x{202c}\x{202d}\x{202e}
+ \x{2060}\x{2061}\x{2062}\x{2063}\x{2064}
+ \x{206a}\x{206b}\x{206c}\x{206d}\x{206e}\x{206f}
+ \x{feff}
+ \x{fff9}\x{fffa}\x{fffb}
+ \x{110bd}
+ \x{1d173}\x{1d174}\x{1d175}\x{1d176}\x{1d177}\x{1d178}\x{1d179}\x{1d17a}
+ \x{e0001}
+ \x{e0020}\x{e0030}\x{e0040}\x{e0050}\x{e0060}\x{e0070}\x{e007f}
+ ** Failers
+ \x{09}
+ \x{0a}
+ \x{1D}
+ \x{20}
+ \x{85}
+ \x{a0}
+ \x{61c}
+ \x{1680}
+ \x{180e}
+ \x{2028}
+ \x{2029}
+ \x{202f}
+ \x{2065}
+ \x{2066}
+ \x{2067}
+ \x{2068}
+ \x{2069}
+ \x{3000}
+ \x{e0002}
+ \x{e001f}
+ \x{e0080}
+
+/^[[:print:]]+$/8W
+ Space: \x{a0}
+ \x{1680}\x{2000}\x{2001}\x{2002}\x{2003}\x{2004}\x{2005}
+ \x{2006}\x{2007}\x{2008}\x{2009}\x{200a}
+ \x{202f}\x{205f}
+ \x{3000}
+ Letter:ABC
+ Mark:\x{300}\x{1d172}\x{1d17b}
+ Number:9\x{660}
+ Punctuation:\x{66a},;
+ Symbol:\x{6de}<>\x{fffc}
+ Cf-property:\x{ad}\x{600}\x{601}\x{602}\x{603}\x{604}\x{6dd}\x{70f}
+ \x{180e}
+ \x{200b}\x{200c}\x{200d}\x{200e}\x{200f}
+ \x{202a}\x{202b}\x{202c}\x{202d}\x{202e}
+ \x{202f}
+ \x{2060}\x{2061}\x{2062}\x{2063}\x{2064}
+ \x{206a}\x{206b}\x{206c}\x{206d}\x{206e}\x{206f}
+ \x{feff}
+ \x{fff9}\x{fffa}\x{fffb}
+ \x{110bd}
+ \x{1d173}\x{1d174}\x{1d175}\x{1d176}\x{1d177}\x{1d178}\x{1d179}\x{1d17a}
+ \x{e0001}
+ \x{e0020}\x{e0030}\x{e0040}\x{e0050}\x{e0060}\x{e0070}\x{e007f}
+ ** Failers
+ \x{09}
+ \x{1D}
+ \x{85}
+ \x{61c}
+ \x{2028}
+ \x{2029}
+ \x{2065}
+ \x{2066}
+ \x{2067}
+ \x{2068}
+ \x{2069}
+ \x{e0002}
+ \x{e001f}
+ \x{e0080}
+
+/^[[:punct:]]+$/8W
+ \$+<=>^`|~
+ !\"#%&'()*,-./:;?@[\\]_{}
+ \x{a1}\x{a7}
+ \x{37e}
+ ** Failers
+ abcde
+
+/^[[:^graph:]]+$/8W
+ \x{09}\x{0a}\x{1D}\x{20}\x{85}\x{a0}\x{61c}\x{1680}\x{180e}
+ \x{2028}\x{2029}\x{202f}\x{2065}\x{2066}\x{2067}\x{2068}\x{2069}
+ \x{3000}\x{e0002}\x{e001f}\x{e0080}
+ ** Failers
+ Letter:ABC
+ Mark:\x{300}\x{1d172}\x{1d17b}
+ Number:9\x{660}
+ Punctuation:\x{66a},;
+ Symbol:\x{6de}<>\x{fffc}
+ Cf-property:\x{ad}\x{600}\x{601}\x{602}\x{603}\x{604}\x{6dd}\x{70f}
+ \x{200b}\x{200c}\x{200d}\x{200e}\x{200f}
+ \x{202a}\x{202b}\x{202c}\x{202d}\x{202e}
+ \x{2060}\x{2061}\x{2062}\x{2063}\x{2064}
+ \x{206a}\x{206b}\x{206c}\x{206d}\x{206e}\x{206f}
+ \x{feff}
+ \x{fff9}\x{fffa}\x{fffb}
+ \x{110bd}
+ \x{1d173}\x{1d174}\x{1d175}\x{1d176}\x{1d177}\x{1d178}\x{1d179}\x{1d17a}
+ \x{e0001}
+ \x{e0020}\x{e0030}\x{e0040}\x{e0050}\x{e0060}\x{e0070}\x{e007f}
+
+/^[[:^print:]]+$/8W
+ \x{09}\x{1D}\x{85}\x{61c}\x{2028}\x{2029}\x{2065}\x{2066}\x{2067}
+ \x{2068}\x{2069}\x{e0002}\x{e001f}\x{e0080}
+ ** Failers
+ Space: \x{a0}
+ \x{1680}\x{2000}\x{2001}\x{2002}\x{2003}\x{2004}\x{2005}
+ \x{2006}\x{2007}\x{2008}\x{2009}\x{200a}
+ \x{202f}\x{205f}
+ \x{3000}
+ Letter:ABC
+ Mark:\x{300}\x{1d172}\x{1d17b}
+ Number:9\x{660}
+ Punctuation:\x{66a},;
+ Symbol:\x{6de}<>\x{fffc}
+ Cf-property:\x{ad}\x{600}\x{601}\x{602}\x{603}\x{604}\x{6dd}\x{70f}
+ \x{180e}
+ \x{200b}\x{200c}\x{200d}\x{200e}\x{200f}
+ \x{202a}\x{202b}\x{202c}\x{202d}\x{202e}
+ \x{202f}
+ \x{2060}\x{2061}\x{2062}\x{2063}\x{2064}
+ \x{206a}\x{206b}\x{206c}\x{206d}\x{206e}\x{206f}
+ \x{feff}
+ \x{fff9}\x{fffa}\x{fffb}
+ \x{110bd}
+ \x{1d173}\x{1d174}\x{1d175}\x{1d176}\x{1d177}\x{1d178}\x{1d179}\x{1d17a}
+ \x{e0001}
+ \x{e0020}\x{e0030}\x{e0040}\x{e0050}\x{e0060}\x{e0070}\x{e007f}
+
+/^[[:^punct:]]+$/8W
+ abcde
+ ** Failers
+ \$+<=>^`|~
+ !\"#%&'()*,-./:;?@[\\]_{}
+ \x{a1}\x{a7}
+ \x{37e}
+
/-- End of testinput6 --/
diff --git a/pcre/testdata/testinput7 b/pcre/testdata/testinput7
index 24c00d278b4..9d145436350 100644
--- a/pcre/testdata/testinput7
+++ b/pcre/testdata/testinput7
@@ -100,11 +100,30 @@
/\p{Cc}{2}+/8BZ
+/^\p{Cf}/8
+ \x{180e}
+ \x{061c}
+ \x{2066}
+ \x{2067}
+ \x{2068}
+ \x{2069}
+
/^\p{Cs}/8
\?\x{dfff}
** Failers
\x{09f}
+/^\p{Mn}/8
+ \x{1a1b}
+
+/^\p{Pe}/8
+ \x{2309}
+ \x{230b}
+
+/^\p{Ps}/8
+ \x{2308}
+ \x{230a}
+
/^\p{Sc}+/8
$\x{a2}\x{a3}\x{a4}\x{a5}\x{a6}
\x{9f2}
@@ -116,15 +135,15 @@
\ \
\x{a0}
\x{1680}
- \x{180e}
\x{2000}
\x{2001}
** Failers
\x{2028}
\x{200d}
-/-- These four are here rather than in test 6 because Perl has problems with
- the negative versions of the properties. --/
+/-- These are here rather than in test 6 because Perl has problems with
+ the negative versions of the properties and behaves has changed how
+ it behaves for caseless matching. --/
/\p{^Lu}/8i
1234
@@ -149,6 +168,12 @@
a
\x{1d00}
+/\p{Lu}/8i
+ A
+ aZ
+ ** Failers
+ abc
+
/[\x{c0}\x{391}]/8i
\x{c0}
\x{e0}
@@ -734,5 +759,74 @@ of case for anything other than the ASCII letters. --/
@abc
`abc
\x{1234}abc
+
+/-- Some auto-possessification tests --/
+
+/\pN+\z/BZ
+
+/\PN+\z/BZ
+
+/\pN+/BZ
+
+/\PN+/BZ
+
+/\p{Any}+\p{Any} \p{Any}+\P{Any} \p{Any}+\p{L&} \p{Any}+\p{L} \p{Any}+\p{Lu} \p{Any}+\p{Han} \p{Any}+\p{Xan} \p{Any}+\p{Xsp} \p{Any}+\p{Xps} \p{Xwd}+\p{Any} \p{Any}+\p{Xuc}/BWZx
+
+/\p{L&}+\p{Any} \p{L&}+\p{L&} \P{L&}+\p{L&} \p{L&}+\p{L} \p{L&}+\p{Lu} \p{L&}+\p{Han} \p{L&}+\p{Xan} \p{L&}+\P{Xan} \p{L&}+\p{Xsp} \p{L&}+\p{Xps} \p{Xwd}+\p{L&} \p{L&}+\p{Xuc}/BWZx
+
+/\p{N}+\p{Any} \p{N}+\p{L&} \p{N}+\p{L} \p{N}+\P{L} \p{N}+\P{N} \p{N}+\p{Lu} \p{N}+\p{Han} \p{N}+\p{Xan} \p{N}+\p{Xsp} \p{N}+\p{Xps} \p{Xwd}+\p{N} \p{N}+\p{Xuc}/BWZx
+
+/\p{Lu}+\p{Any} \p{Lu}+\p{L&} \p{Lu}+\p{L} \p{Lu}+\p{Lu} \P{Lu}+\p{Lu} \p{Lu}+\p{Nd} \p{Lu}+\P{Nd} \p{Lu}+\p{Han} \p{Lu}+\p{Xan} \p{Lu}+\p{Xsp} \p{Lu}+\p{Xps} \p{Xwd}+\p{Lu} \p{Lu}+\p{Xuc}/BWZx
+
+/\p{Han}+\p{Lu} \p{Han}+\p{L&} \p{Han}+\p{L} \p{Han}+\p{Lu} \p{Han}+\p{Arabic} \p{Arabic}+\p{Arabic} \p{Han}+\p{Xan} \p{Han}+\p{Xsp} \p{Han}+\p{Xps} \p{Xwd}+\p{Han} \p{Han}+\p{Xuc}/BWZx
+
+/\p{Xan}+\p{Any} \p{Xan}+\p{L&} \P{Xan}+\p{L&} \p{Xan}+\p{L} \p{Xan}+\p{Lu} \p{Xan}+\p{Han} \p{Xan}+\p{Xan} \p{Xan}+\P{Xan} \p{Xan}+\p{Xsp} \p{Xan}+\p{Xps} \p{Xwd}+\p{Xan} \p{Xan}+\p{Xuc}/BWZx
+
+/\p{Xsp}+\p{Any} \p{Xsp}+\p{L&} \p{Xsp}+\p{L} \p{Xsp}+\p{Lu} \p{Xsp}+\p{Han} \p{Xsp}+\p{Xan} \p{Xsp}+\p{Xsp} \P{Xsp}+\p{Xsp} \p{Xsp}+\p{Xps} \p{Xwd}+\p{Xsp} \p{Xsp}+\p{Xuc}/BWZx
+
+/\p{Xwd}+\p{Any} \p{Xwd}+\p{L&} \p{Xwd}+\p{L} \p{Xwd}+\p{Lu} \p{Xwd}+\p{Han} \p{Xwd}+\p{Xan} \p{Xwd}+\p{Xsp} \p{Xwd}+\p{Xps} \p{Xwd}+\p{Xwd} \p{Xwd}+\P{Xwd} \p{Xwd}+\p{Xuc}/BWZx
+
+/\p{Xuc}+\p{Any} \p{Xuc}+\p{L&} \p{Xuc}+\p{L} \p{Xuc}+\p{Lu} \p{Xuc}+\p{Han} \p{Xuc}+\p{Xan} \p{Xuc}+\p{Xsp} \p{Xuc}+\p{Xps} \p{Xwd}+\p{Xuc} \p{Xuc}+\p{Xuc} \p{Xuc}+\P{Xuc}/BWZx
+
+/\p{N}+\p{Ll} \p{N}+\p{Nd} \p{N}+\P{Nd}/BWZx
+
+/\p{Xan}+\p{L} \p{Xan}+\p{N} \p{Xan}+\p{C} \p{Xan}+\P{L} \P{Xan}+\p{N} \p{Xan}+\P{C}/BWZx
+
+/\p{L}+\p{Xan} \p{N}+\p{Xan} \p{C}+\p{Xan} \P{L}+\p{Xan} \p{N}+\p{Xan} \P{C}+\p{Xan} \p{L}+\P{Xan}/BWZx
+
+/\p{Xan}+\p{Lu} \p{Xan}+\p{Nd} \p{Xan}+\p{Cc} \p{Xan}+\P{Ll} \P{Xan}+\p{No} \p{Xan}+\P{Cf}/BWZx
+
+/\p{Lu}+\p{Xan} \p{Nd}+\p{Xan} \p{Cs}+\p{Xan} \P{Lt}+\p{Xan} \p{Nl}+\p{Xan} \P{Cc}+\p{Xan} \p{Lt}+\P{Xan}/BWZx
+
+/\w+\p{P} \w+\p{Po} \w+\s \p{Xan}+\s \s+\p{Xan} \s+\w/BWZx
+
+/\w+\P{P} \W+\p{Po} \w+\S \P{Xan}+\s \s+\P{Xan} \s+\W/BWZx
+
+/\w+\p{Po} \w+\p{Pc} \W+\p{Po} \W+\p{Pc} \w+\P{Po} \w+\P{Pc}/BWZx
+
+/\p{Nl}+\p{Xan} \P{Nl}+\p{Xan} \p{Nl}+\P{Xan} \P{Nl}+\P{Xan}/BWZx
+
+/\p{Xan}+\p{Nl} \P{Xan}+\p{Nl} \p{Xan}+\P{Nl} \P{Xan}+\P{Nl}/BWZx
+
+/\p{Xan}+\p{Nd} \P{Xan}+\p{Nd} \p{Xan}+\P{Nd} \P{Xan}+\P{Nd}/BWZx
+
+/-- End auto-possessification tests --/
+
+/\w+/8CWBZ
+ abcd
+
+/[\p{N}]?+/BZO
+
+/[\p{L}ab]{2,3}+/BZO
+
+/\D+\X \d+\X \S+\X \s+\X \W+\X \w+\X \C+\X \R+\X \H+\X \h+\X \V+\X \v+\X a+\X \n+\X .+\X/BZx
+
+/.+\X/BZxs
+
+/\X+$/BZxm
+
+/\X+\D \X+\d \X+\S \X+\s \X+\W \X+\w \X+. \X+\C \X+\R \X+\H \X+\h \X+\V \X+\v \X+\X \X+\Z \X+\z \X+$/BZx
+
+/\d+\s{0,5}=\s*\S?=\w{0,4}\W*/8WBZ
/-- End of testinput7 --/
diff --git a/pcre/testdata/testinput8 b/pcre/testdata/testinput8
index d91013bb2be..bb2747b120d 100644
--- a/pcre/testdata/testinput8
+++ b/pcre/testdata/testinput8
@@ -1,5 +1,8 @@
-/-- This set of tests check the DFA matching functionality of pcre_dfa_exec().
- The -dfa flag must be used with pcretest when running it. --/
+/-- This set of tests check the DFA matching functionality of pcre_dfa_exec(),
+ excluding UTF and Unicode property support. The -dfa flag must be used with
+ pcretest when running it. --/
+
+< forbid 8W
/abc/
abc
@@ -16,7 +19,7 @@
ac
ab
-/a*/
+/a*/O
a
aaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -177,19 +180,19 @@
ayzq
axyzq
-/[^a]+/
+/[^a]+/O
bac
bcdefax
*** Failers
aaaaa
-/[^a]*/
+/[^a]*/O
bac
bcdefax
*** Failers
aaaaa
-/[^a]{3,5}/
+/[^a]{3,5}/O
xyz
awxyza
abcdefa
@@ -937,16 +940,16 @@
*** Failers
the abc
-/^[ab]{1,3}(ab*|b)/
+/^[ab]{1,3}(ab*|b)/O
aabbbbb
-/^[ab]{1,3}?(ab*|b)/
+/^[ab]{1,3}?(ab*|b)/O
aabbbbb
-/^[ab]{1,3}?(ab*?|b)/
+/^[ab]{1,3}?(ab*?|b)/O
aabbbbb
-/^[ab]{1,3}(ab*?|b)/
+/^[ab]{1,3}(ab*?|b)/O
aabbbbb
/ (?: [\040\t] | \(
@@ -1923,14 +1926,16 @@
abc\100\060
abc\100\60
-/abc\81/
- abc\081
- abc\0\x38\x31
-
-/abc\91/
- abc\091
- abc\0\x39\x31
-
+/^A\8B\9C$/
+ A8B9C
+ *** Failers
+ A\08B\09C
+
+/^[A\8B\9C]+$/
+ A8B9C
+ *** Failers
+ A8B9C\x00
+
/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
abcdefghijk\12S
@@ -2049,13 +2054,13 @@
/foo(.*?)bar/
The food is under the bar in the barn.
-/(.*)(\d*)/
+/(.*)(\d*)/O
I have 2 numbers: 53147
/(.*)(\d+)/
I have 2 numbers: 53147
-/(.*?)(\d*)/
+/(.*?)(\d*)/O
I have 2 numbers: 53147
/(.*?)(\d+)/
@@ -3825,13 +3830,6 @@
/a*/g
abbab
-/^[a-\d]/
- abcde
- -things
- 0digit
- *** Failers
- bcdef
-
/^[\d-a]/
abcde
-things
@@ -4699,7 +4697,7 @@
/(?(R)a*(?1)|((?R))b)/
aaaabcde
-/(a+)/
+/(a+)/O
\O6aaaa
\O8aaaa
@@ -4801,4 +4799,36 @@
/abcd/
abcd\O0
+/-- These tests show up auto-possessification --/
+
+/[ab]*/
+ aaaa
+
+/[ab]*?/
+ aaaa
+
+/[ab]?/
+ aaaa
+
+/[ab]??/
+ aaaa
+
+/[ab]+/
+ aaaa
+
+/[ab]+?/
+ aaaa
+
+/[ab]{2,3}/
+ aaaa
+
+/[ab]{2,3}?/
+ aaaa
+
+/[ab]{2,}/
+ aaaa
+
+/[ab]{2,}?/
+ aaaa
+
/-- End of testinput8 --/
diff --git a/pcre/testdata/testinput9 b/pcre/testdata/testinput9
index 766c9c0fb6f..4575ffe3198 100644
--- a/pcre/testdata/testinput9
+++ b/pcre/testdata/testinput9
@@ -1,6 +1,8 @@
/-- This set of tests checks UTF-8 support with the DFA matching functionality
- of pcre_dfa_exec(). The -dfa flag must be used with pcretest when running
- it. --/
+ of pcre_dfa_exec(), excluding Unicode property support. The -dfa flag must
+ be used with pcretest when running it. --/
+
+< forbid W
/\x{100}ab/8
\x{100}ab
@@ -239,16 +241,16 @@
/\x{100}{3,5}/8
abcd\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}XX
-/\x{100}{3,}/8
+/\x{100}{3,}/8O
abcd\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}XX
/(?<=a\x{100}{2}b)X/8
Xyyya\x{100}\x{100}bXzzz
-/\D*/8
+/\D*/8O
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-/\D*/8
+/\D*/8O
\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
/\D/8
@@ -584,16 +586,16 @@
a\n\n\n\rb
a\r
-/\h+\V?\v{3,4}/8
+/\h+\V?\v{3,4}/8O
\x09\x20\x{a0}X\x0a\x0b\x0c\x0d\x0a
-/\V?\v{3,4}/8
+/\V?\v{3,4}/8O
\x20\x{a0}X\x0a\x0b\x0c\x0d\x0a
-/\h+\V?\v{3,4}/8
+/\h+\V?\v{3,4}/8O
>\x09\x20\x{a0}X\x0a\x0a\x0a<
-/\V?\v{3,4}/8
+/\V?\v{3,4}/8O
>\x09\x20\x{a0}X\x0a\x0a\x0a<
/\H\h\V\v/8
@@ -602,7 +604,7 @@
** Failers
\x{a0} X\x0a
-/\H*\h+\V?\v{3,4}/8
+/\H*\h+\V?\v{3,4}/8O
\x09\x20\x{a0}X\x0a\x0b\x0c\x0d\x0a
\x09\x20\x{a0}\x0a\x0b\x0c\x0d\x0a
\x09\x20\x{a0}\x0a\x0b\x0c
@@ -615,7 +617,7 @@
** Failers
\x{2009} X\x0a
-/\H*\h+\V?\v{3,4}/8
+/\H*\h+\V?\v{3,4}/8O
\x{1680}\x{180e}\x{2007}X\x{2028}\x{2029}\x0c\x0d\x0a
\x09\x{205f}\x{a0}\x0a\x{2029}\x0c\x{2028}\x0a
\x09\x20\x{202f}\x0a\x0b\x0c
diff --git a/pcre/testdata/testoutput1 b/pcre/testdata/testoutput1
index 3ed635146a4..4dafc0496ab 100644
--- a/pcre/testdata/testoutput1
+++ b/pcre/testdata/testoutput1
@@ -1,6 +1,8 @@
/-- This set of tests is for features that are compatible with all versions of
- Perl >= 5.10, in non-UTF-8 mode. It should run clean for both the 8-bit and
- 16-bit PCRE libraries. --/
+ Perl >= 5.10, in non-UTF-8 mode. It should run clean for the 8-bit, 16-bit,
+ and 32-bit PCRE libraries. --/
+
+< forbid 89?=ABCDEFfGILMNPTUWXZ<
/the quick brown fox/
the quick brown fox
@@ -2149,18 +2151,35 @@ No match
abc\100\60
0: abc@0
1: abc
-
-/abc\81/
- abc\081
- 0: abc\x0081
- abc\0\x38\x31
- 0: abc\x0081
-
-/abc\91/
- abc\091
- 0: abc\x0091
- abc\0\x39\x31
- 0: abc\x0091
+
+/^A\8B\9C$/
+ A8B9C
+ 0: A8B9C
+ *** Failers
+No match
+ A\08B\09C
+No match
+
+/^(A)(B)(C)(D)(E)(F)(G)(H)(I)\8\9$/
+ ABCDEFGHIHI
+ 0: ABCDEFGHIHI
+ 1: A
+ 2: B
+ 3: C
+ 4: D
+ 5: E
+ 6: F
+ 7: G
+ 8: H
+ 9: I
+
+/^[A\8B\9C]+$/
+ A8B9C
+ 0: A8B9C
+ *** Failers
+No match
+ A8B9C\x00
+No match
/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/
abcdefghijkllS
@@ -5972,18 +5991,6 @@ No match
0:
0:
-/^[a-\d]/
- abcde
- 0: a
- -things
- 0: -
- 0digit
- 0: 0
- *** Failers
-No match
- bcdef
-No match
-
/^[\d-a]/
abcde
0: a
@@ -6006,15 +6013,15 @@ No match
/[\s]+/
> \x09\x0a\x0c\x0d\x0b<
- 0: \x09\x0a\x0c\x0d
+ 0: \x09\x0a\x0c\x0d\x0b
/\s+/
> \x09\x0a\x0c\x0d\x0b<
- 0: \x09\x0a\x0c\x0d
+ 0: \x09\x0a\x0c\x0d\x0b
/a b/x
ab
-No match
+ 0: ab
/(?!\A)x/m
a\nxb\n
@@ -6904,10 +6911,6 @@ No match
bc
0: b
-/^(?=(a)){0}b(?1)/
- backgammon
- 0: ba
-
/^(?=(?1))?[az]([abc])d/
abd
0: abd
@@ -9200,4 +9203,114 @@ No match
aaa
No match
+/(?(?=ab)ab)/+
+ ca
+ 0:
+ 0+ ca
+ cd
+ 0:
+ 0+ cd
+
+/(?:(?<n>foo)|(?<n>bar))\k<n>/J
+ foofoo
+ 0: foofoo
+ 1: foo
+ barbar
+ 0: barbar
+ 1: <unset>
+ 2: bar
+
+/(?<n>A)(?:(?<n>foo)|(?<n>bar))\k<n>/J
+ AfooA
+ 0: AfooA
+ 1: A
+ 2: foo
+ AbarA
+ 0: AbarA
+ 1: A
+ 2: <unset>
+ 3: bar
+ ** Failers
+No match
+ Afoofoo
+No match
+ Abarbar
+No match
+
+/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
+ 1 IN SOA non-sp1 non-sp2(
+ 0: 1 IN SOA non-sp1 non-sp2(
+ 1: 1
+ 2: non-sp1
+ 3: non-sp2
+
+/^ (?:(?<A>A)|(?'B'B)(?<A>A)) (?('A')x) (?(<B>)y)$/xJ
+ Ax
+ 0: Ax
+ 1: A
+ BAxy
+ 0: BAxy
+ 1: <unset>
+ 2: B
+ 3: A
+
+/^A\xZ/
+ A\0Z
+ 0: A\x00Z
+
+/^A\o{123}B/
+ A\123B
+ 0: ASB
+
+/ ^ a + + b $ /x
+ aaaab
+ 0: aaaab
+
+/ ^ a + #comment
+ + b $ /x
+ aaaab
+ 0: aaaab
+
+/ ^ a + #comment
+ #comment
+ + b $ /x
+ aaaab
+ 0: aaaab
+
+/ ^ (?> a + ) b $ /x
+ aaaab
+ 0: aaaab
+
+/ ^ ( a + ) + + \w $ /x
+ aaaab
+ 0: aaaab
+ 1: aaaa
+
+/(?:a\Kb)*+/+
+ ababc
+ 0: b
+ 0+ c
+
+/(?>a\Kb)*/+
+ ababc
+ 0: b
+ 0+ c
+
+/(?:a\Kb)*/+
+ ababc
+ 0: b
+ 0+ c
+
+/(a\Kb)*+/+
+ ababc
+ 0: b
+ 0+ c
+ 1: ab
+
+/(a\Kb)*/+
+ ababc
+ 0: b
+ 0+ c
+ 1: ab
+
/-- End of testinput1 --/
diff --git a/pcre/testdata/testoutput10 b/pcre/testdata/testoutput10
index 0e04205bb88..b89169cdd3c 100644
--- a/pcre/testdata/testoutput10
+++ b/pcre/testdata/testoutput10
@@ -39,9 +39,6 @@ No match
/^\pL+/8
abcd
0: abcd
- 1: abc
- 2: ab
- 3: a
a
0: a
*** Failers
@@ -50,45 +47,24 @@ No match
/^\PL+/8
1234
0: 1234
- 1: 123
- 2: 12
- 3: 1
=
0: =
*** Failers
0: ***
- 1: ***
- 2: **
- 3: *
abcd
No match
/^\X+/8
abcdA\x{300}\x{301}\x{302}
0: abcdA\x{300}\x{301}\x{302}
- 1: abcd
- 2: abc
- 3: ab
- 4: a
A\x{300}\x{301}\x{302}
0: A\x{300}\x{301}\x{302}
A\x{300}\x{301}\x{302}A\x{300}\x{301}\x{302}
0: A\x{300}\x{301}\x{302}A\x{300}\x{301}\x{302}
- 1: A\x{300}\x{301}\x{302}
a
0: a
*** Failers
0: *** Failers
- 1: *** Failer
- 2: *** Faile
- 3: *** Fail
- 4: *** Fai
- 5: *** Fa
- 6: *** F
- 7: ***
- 8: ***
- 9: **
-10: *
\x{300}\x{301}\x{302}
0: \x{300}\x{301}\x{302}
@@ -255,6 +231,18 @@ No match
/^\p{Cf}/8
\x{601}
0: \x{601}
+ \x{180e}
+ 0: \x{180e}
+ \x{061c}
+ 0: \x{61c}
+ \x{2066}
+ 0: \x{2066}
+ \x{2067}
+ 0: \x{2067}
+ \x{2068}
+ 0: \x{2068}
+ \x{2069}
+ 0: \x{2069}
** Failers
No match
\x{09f}
@@ -353,6 +341,8 @@ No match
/^\p{Mn}/8
\x{300}
0: \x{300}
+ \x{1a1b}
+ 0: \x{1a1b}
** Failers
No match
X
@@ -360,7 +350,7 @@ No match
\x{903}
No match
-/^\p{Nd}+/8
+/^\p{Nd}+/8O
0123456789\x{660}\x{661}\x{662}\x{663}\x{664}\x{665}\x{666}\x{667}\x{668}\x{669}\x{66a}
0: 0123456789\x{660}\x{661}\x{662}\x{663}\x{664}\x{665}\x{666}\x{667}\x{668}\x{669}
1: 0123456789\x{660}\x{661}\x{662}\x{663}\x{664}\x{665}\x{666}\x{667}\x{668}
@@ -466,6 +456,10 @@ No match
0: }
\x{f3b}
0: \x{f3b}
+ \x{2309}
+ 0: \x{2309}
+ \x{230b}
+ 0: \x{230b}
** Failers
No match
X
@@ -480,7 +474,7 @@ No match
No match
\x{f3c}
No match
-
+
/^\p{Pf}/8
\x{bb}
0: \x{bb}
@@ -526,6 +520,10 @@ No match
0: {
\x{f3c}
0: \x{f3c}
+ \x{2308}
+ 0: \x{2308}
+ \x{230a}
+ 0: \x{230a}
** Failers
No match
X
@@ -542,10 +540,6 @@ No match
/^\p{Sc}+/8
$\x{a2}\x{a3}\x{a4}\x{a5}\x{a6}
0: $\x{a2}\x{a3}\x{a4}\x{a5}
- 1: $\x{a2}\x{a3}\x{a4}
- 2: $\x{a2}\x{a3}
- 3: $\x{a2}
- 4: $
\x{9f2}
0: \x{9f2}
** Failers
@@ -568,11 +562,6 @@ No match
/^\p{Sm}+/8
+<|~\x{ac}\x{2044}
0: +<|~\x{ac}\x{2044}
- 1: +<|~\x{ac}
- 2: +<|~
- 3: +<|
- 4: +<
- 5: +
** Failers
No match
X
@@ -619,8 +608,6 @@ No match
0: \x{a0}
\x{1680}
0: \x{1680}
- \x{180e}
- 0: \x{180e}
\x{2000}
0: \x{2000}
\x{2001}
@@ -767,23 +754,10 @@ No match
/[\p{Nd}+-]+/8
1234
0: 1234
- 1: 123
- 2: 12
- 3: 1
12-34
0: 12-34
- 1: 12-3
- 2: 12-
- 3: 12
- 4: 1
12+\x{661}-34
0: 12+\x{661}-34
- 1: 12+\x{661}-3
- 2: 12+\x{661}-
- 3: 12+\x{661}
- 4: 12+
- 5: 12
- 6: 1
** Failers
No match
abcd
@@ -792,24 +766,12 @@ No match
/[\P{Nd}]+/8
abcd
0: abcd
- 1: abc
- 2: ab
- 3: a
** Failers
0: ** Failers
- 1: ** Failer
- 2: ** Faile
- 3: ** Fail
- 4: ** Fai
- 5: ** Fa
- 6: ** F
- 7: **
- 8: **
- 9: *
1234
No match
-/\D+/8
+/\D+/8O
11111111111111111111111111111111111111111111111111111111111111111111111
No match
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -837,7 +799,7 @@ Matched, but offsets vector is too small to show all matches
20: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
21: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-/\P{Nd}+/8
+/\P{Nd}+/8O
11111111111111111111111111111111111111111111111111111111111111111111111
No match
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -865,7 +827,7 @@ Matched, but offsets vector is too small to show all matches
20: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
21: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-/[\D]+/8
+/[\D]+/8O
11111111111111111111111111111111111111111111111111111111111111111111111
No match
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -893,7 +855,7 @@ Matched, but offsets vector is too small to show all matches
20: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
21: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-/[\P{Nd}]+/8
+/[\P{Nd}]+/8O
11111111111111111111111111111111111111111111111111111111111111111111111
No match
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -921,7 +883,7 @@ Matched, but offsets vector is too small to show all matches
20: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
21: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-/[\D\P{Nd}]+/8
+/[\D\P{Nd}]+/8O
11111111111111111111111111111111111111111111111111111111111111111111111
No match
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -1046,10 +1008,6 @@ No match
/\x{391}+/8i
\x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}
0: \x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}
- 1: \x{391}\x{3b1}\x{3b1}\x{3b1}
- 2: \x{391}\x{3b1}\x{3b1}
- 3: \x{391}\x{3b1}
- 4: \x{391}
/\x{391}{3,5}(.)/8i
\x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}X
@@ -1236,8 +1194,6 @@ No match
/^\p{Han}+/8
\x{2e81}\x{3007}\x{2f804}\x{31a0}
0: \x{2e81}\x{3007}\x{2f804}
- 1: \x{2e81}\x{3007}
- 2: \x{2e81}
** Failers
No match
\x{2e7f}
@@ -1248,15 +1204,6 @@ No match
0: \x{3105}
** Failers
0: ** Failers
- 1: ** Failer
- 2: ** Faile
- 3: ** Fail
- 4: ** Fai
- 5: ** Fa
- 6: ** F
- 7: **
- 8: **
- 9: *
\x{30ff}
No match
@@ -1469,12 +1416,8 @@ No match
/^\p{Any}{3,5}/8
abcdefgh
0: abcde
- 1: abcd
- 2: abc
\x{1234}\n\r\x{3456}xyz
0: \x{1234}\x{0a}\x{0d}\x{3456}x
- 1: \x{1234}\x{0a}\x{0d}\x{3456}
- 2: \x{1234}\x{0a}\x{0d}
/^\P{Any}{3,5}?/8
** Failers
@@ -1639,14 +1582,10 @@ No match
/\x{c0}+\x{116}+/8i
\x{c0}\x{e0}\x{116}\x{117}
0: \x{c0}\x{e0}\x{116}\x{117}
- 1: \x{c0}\x{e0}\x{116}
/[\x{c0}\x{116}]+/8i
\x{c0}\x{e0}\x{116}\x{117}
0: \x{c0}\x{e0}\x{116}\x{117}
- 1: \x{c0}\x{e0}\x{116}
- 2: \x{c0}\x{e0}
- 3: \x{c0}
/Check property support in non-UTF-8 mode/
@@ -1693,16 +1632,6 @@ No match
/^\p{Xan}+/8
ABCD1234\x{6ca}\x{a6c}\x{10a7}_
0: ABCD1234\x{6ca}\x{a6c}\x{10a7}
- 1: ABCD1234\x{6ca}\x{a6c}
- 2: ABCD1234\x{6ca}
- 3: ABCD1234
- 4: ABCD123
- 5: ABCD12
- 6: ABCD1
- 7: ABCD
- 8: ABC
- 9: AB
-10: A
** Failers
No match
_ABC
@@ -1711,28 +1640,10 @@ No match
/^\p{Xan}*/8
ABCD1234\x{6ca}\x{a6c}\x{10a7}_
0: ABCD1234\x{6ca}\x{a6c}\x{10a7}
- 1: ABCD1234\x{6ca}\x{a6c}
- 2: ABCD1234\x{6ca}
- 3: ABCD1234
- 4: ABCD123
- 5: ABCD12
- 6: ABCD1
- 7: ABCD
- 8: ABC
- 9: AB
-10: A
-11:
/^\p{Xan}{2,9}/8
ABCD1234\x{6ca}\x{a6c}\x{10a7}_
0: ABCD1234\x{6ca}
- 1: ABCD1234
- 2: ABCD123
- 3: ABCD12
- 4: ABCD1
- 5: ABCD
- 6: ABC
- 7: AB
/^[\p{Xan}]/8
ABCD1234_
@@ -1753,16 +1664,6 @@ No match
/^[\p{Xan}]+/8
ABCD1234\x{6ca}\x{a6c}\x{10a7}_
0: ABCD1234\x{6ca}\x{a6c}\x{10a7}
- 1: ABCD1234\x{6ca}\x{a6c}
- 2: ABCD1234\x{6ca}
- 3: ABCD1234
- 4: ABCD123
- 5: ABCD12
- 6: ABCD1
- 7: ABCD
- 8: ABC
- 9: AB
-10: A
** Failers
No match
_ABC
@@ -1776,53 +1677,57 @@ No match
\x{0b}
No match
-/^>\p{Xsp}+/8
+/^>\p{Xsp}+/8O
> \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
- 0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}
- 1: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}
- 2: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}
- 3: > \x{09}\x{0a}\x{0c}\x{0d}
- 4: > \x{09}\x{0a}\x{0c}
- 5: > \x{09}\x{0a}
- 6: > \x{09}
- 7: >
-
-/^>\p{Xsp}*/8
+ 0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
+ 1: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}
+ 2: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}
+ 3: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}
+ 4: > \x{09}\x{0a}\x{0c}\x{0d}
+ 5: > \x{09}\x{0a}\x{0c}
+ 6: > \x{09}\x{0a}
+ 7: > \x{09}
+ 8: >
+
+/^>\p{Xsp}*/8O
> \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
- 0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}
- 1: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}
- 2: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}
- 3: > \x{09}\x{0a}\x{0c}\x{0d}
- 4: > \x{09}\x{0a}\x{0c}
- 5: > \x{09}\x{0a}
- 6: > \x{09}
- 7: >
- 8: >
+ 0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
+ 1: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}
+ 2: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}
+ 3: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}
+ 4: > \x{09}\x{0a}\x{0c}\x{0d}
+ 5: > \x{09}\x{0a}\x{0c}
+ 6: > \x{09}\x{0a}
+ 7: > \x{09}
+ 8: >
+ 9: >
-/^>\p{Xsp}{2,9}/8
+/^>\p{Xsp}{2,9}/8O
> \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
- 0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}
- 1: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}
- 2: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}
- 3: > \x{09}\x{0a}\x{0c}\x{0d}
- 4: > \x{09}\x{0a}\x{0c}
- 5: > \x{09}\x{0a}
- 6: > \x{09}
+ 0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
+ 1: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}
+ 2: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}
+ 3: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}
+ 4: > \x{09}\x{0a}\x{0c}\x{0d}
+ 5: > \x{09}\x{0a}\x{0c}
+ 6: > \x{09}\x{0a}
+ 7: > \x{09}
-/^>[\p{Xsp}]/8
+/^>[\p{Xsp}]/8O
>\x{2028}\x{0b}
0: >\x{2028}
-/^>[\p{Xsp}]+/8
+/^>[\p{Xsp}]+/8O
> \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
- 0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}
- 1: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}
- 2: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}
- 3: > \x{09}\x{0a}\x{0c}\x{0d}
- 4: > \x{09}\x{0a}\x{0c}
- 5: > \x{09}\x{0a}
- 6: > \x{09}
- 7: >
+ 0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
+ 1: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}
+ 2: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}
+ 3: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}
+ 4: > \x{09}\x{0a}\x{0c}\x{0d}
+ 5: > \x{09}\x{0a}\x{0c}
+ 6: > \x{09}\x{0a}
+ 7: > \x{09}
+ 8: >
/^>\p{Xps}/8
>\x{1680}\x{2028}\x{0b}
@@ -1837,14 +1742,6 @@ No match
/^>\p{Xps}+/8
> \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
- 1: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}
- 2: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}
- 3: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}
- 4: > \x{09}\x{0a}\x{0c}\x{0d}
- 5: > \x{09}\x{0a}\x{0c}
- 6: > \x{09}\x{0a}
- 7: > \x{09}
- 8: >
/^>\p{Xps}+?/8
>\x{1680}\x{2028}\x{0b}
@@ -1855,26 +1752,10 @@ No match
/^>\p{Xps}*/8
> \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
- 1: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}
- 2: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}
- 3: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}
- 4: > \x{09}\x{0a}\x{0c}\x{0d}
- 5: > \x{09}\x{0a}\x{0c}
- 6: > \x{09}\x{0a}
- 7: > \x{09}
- 8: >
- 9: >
/^>\p{Xps}{2,9}/8
> \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
- 1: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}
- 2: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}
- 3: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}
- 4: > \x{09}\x{0a}\x{0c}\x{0d}
- 5: > \x{09}\x{0a}\x{0c}
- 6: > \x{09}\x{0a}
- 7: > \x{09}
/^>\p{Xps}{2,9}?/8
> \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
@@ -1894,14 +1775,6 @@ No match
/^>[\p{Xps}]+/8
> \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
- 1: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}
- 2: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}
- 3: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}
- 4: > \x{09}\x{0a}\x{0c}\x{0d}
- 5: > \x{09}\x{0a}\x{0c}
- 6: > \x{09}\x{0a}
- 7: > \x{09}
- 8: >
/^\p{Xwd}/8
ABCD
@@ -1924,42 +1797,14 @@ No match
/^\p{Xwd}+/8
ABCD1234\x{6ca}\x{a6c}\x{10a7}_
0: ABCD1234\x{6ca}\x{a6c}\x{10a7}_
- 1: ABCD1234\x{6ca}\x{a6c}\x{10a7}
- 2: ABCD1234\x{6ca}\x{a6c}
- 3: ABCD1234\x{6ca}
- 4: ABCD1234
- 5: ABCD123
- 6: ABCD12
- 7: ABCD1
- 8: ABCD
- 9: ABC
-10: AB
-11: A
/^\p{Xwd}*/8
ABCD1234\x{6ca}\x{a6c}\x{10a7}_
0: ABCD1234\x{6ca}\x{a6c}\x{10a7}_
- 1: ABCD1234\x{6ca}\x{a6c}\x{10a7}
- 2: ABCD1234\x{6ca}\x{a6c}
- 3: ABCD1234\x{6ca}
- 4: ABCD1234
- 5: ABCD123
- 6: ABCD12
- 7: ABCD1
- 8: ABCD
- 9: ABC
-10: AB
-11: A
-12:
/^\p{Xwd}{2,9}/8
A_12\x{6ca}\x{a6c}\x{10a7}
0: A_12\x{6ca}\x{a6c}\x{10a7}
- 1: A_12\x{6ca}\x{a6c}
- 2: A_12\x{6ca}
- 3: A_12
- 4: A_1
- 5: A_
/^[\p{Xwd}]/8
ABCD1234_
@@ -1982,17 +1827,6 @@ No match
/^[\p{Xwd}]+/8
ABCD1234\x{6ca}\x{a6c}\x{10a7}_
0: ABCD1234\x{6ca}\x{a6c}\x{10a7}_
- 1: ABCD1234\x{6ca}\x{a6c}\x{10a7}
- 2: ABCD1234\x{6ca}\x{a6c}
- 3: ABCD1234\x{6ca}
- 4: ABCD1234
- 5: ABCD123
- 6: ABCD12
- 7: ABCD1
- 8: ABCD
- 9: ABC
-10: AB
-11: A
/-- Unicode properties for \b abd \B --/
@@ -2043,7 +1877,6 @@ No match
/[^\x{100}]+/8i
\x{100}\x{101}XX
0: XX
- 1: X
/^\X/8
A\P
@@ -2090,7 +1923,6 @@ Partial match: A\x{300}\x{301}A\x{300}\x{301}
/^\X+/8
AA\P
0: AA
- 1: A
AA\P\P
Partial match: AA
@@ -2271,435 +2103,299 @@ Partial match: AA
/\x{1e9e}+/8i
\x{1e9e}\x{00df}
0: \x{1e9e}\x{df}
- 1: \x{1e9e}
/[z\x{1e9e}]+/8i
\x{1e9e}\x{00df}
0: \x{1e9e}\x{df}
- 1: \x{1e9e}
/\x{00df}+/8i
\x{1e9e}\x{00df}
0: \x{1e9e}\x{df}
- 1: \x{1e9e}
/[z\x{00df}]+/8i
\x{1e9e}\x{00df}
0: \x{1e9e}\x{df}
- 1: \x{1e9e}
/\x{1f88}+/8i
\x{1f88}\x{1f80}
0: \x{1f88}\x{1f80}
- 1: \x{1f88}
/[z\x{1f88}]+/8i
\x{1f88}\x{1f80}
0: \x{1f88}\x{1f80}
- 1: \x{1f88}
/-- Perl matches these --/
/\x{00b5}+/8i
\x{00b5}\x{039c}\x{03bc}
0: \x{b5}\x{39c}\x{3bc}
- 1: \x{b5}\x{39c}
- 2: \x{b5}
/\x{039c}+/8i
\x{00b5}\x{039c}\x{03bc}
0: \x{b5}\x{39c}\x{3bc}
- 1: \x{b5}\x{39c}
- 2: \x{b5}
/\x{03bc}+/8i
\x{00b5}\x{039c}\x{03bc}
0: \x{b5}\x{39c}\x{3bc}
- 1: \x{b5}\x{39c}
- 2: \x{b5}
/\x{00c5}+/8i
\x{00c5}\x{00e5}\x{212b}
0: \x{c5}\x{e5}\x{212b}
- 1: \x{c5}\x{e5}
- 2: \x{c5}
/\x{00e5}+/8i
\x{00c5}\x{00e5}\x{212b}
0: \x{c5}\x{e5}\x{212b}
- 1: \x{c5}\x{e5}
- 2: \x{c5}
/\x{212b}+/8i
\x{00c5}\x{00e5}\x{212b}
0: \x{c5}\x{e5}\x{212b}
- 1: \x{c5}\x{e5}
- 2: \x{c5}
/\x{01c4}+/8i
\x{01c4}\x{01c5}\x{01c6}
0: \x{1c4}\x{1c5}\x{1c6}
- 1: \x{1c4}\x{1c5}
- 2: \x{1c4}
/\x{01c5}+/8i
\x{01c4}\x{01c5}\x{01c6}
0: \x{1c4}\x{1c5}\x{1c6}
- 1: \x{1c4}\x{1c5}
- 2: \x{1c4}
/\x{01c6}+/8i
\x{01c4}\x{01c5}\x{01c6}
0: \x{1c4}\x{1c5}\x{1c6}
- 1: \x{1c4}\x{1c5}
- 2: \x{1c4}
/\x{01c7}+/8i
\x{01c7}\x{01c8}\x{01c9}
0: \x{1c7}\x{1c8}\x{1c9}
- 1: \x{1c7}\x{1c8}
- 2: \x{1c7}
/\x{01c8}+/8i
\x{01c7}\x{01c8}\x{01c9}
0: \x{1c7}\x{1c8}\x{1c9}
- 1: \x{1c7}\x{1c8}
- 2: \x{1c7}
/\x{01c9}+/8i
\x{01c7}\x{01c8}\x{01c9}
0: \x{1c7}\x{1c8}\x{1c9}
- 1: \x{1c7}\x{1c8}
- 2: \x{1c7}
/\x{01ca}+/8i
\x{01ca}\x{01cb}\x{01cc}
0: \x{1ca}\x{1cb}\x{1cc}
- 1: \x{1ca}\x{1cb}
- 2: \x{1ca}
/\x{01cb}+/8i
\x{01ca}\x{01cb}\x{01cc}
0: \x{1ca}\x{1cb}\x{1cc}
- 1: \x{1ca}\x{1cb}
- 2: \x{1ca}
/\x{01cc}+/8i
\x{01ca}\x{01cb}\x{01cc}
0: \x{1ca}\x{1cb}\x{1cc}
- 1: \x{1ca}\x{1cb}
- 2: \x{1ca}
/\x{01f1}+/8i
\x{01f1}\x{01f2}\x{01f3}
0: \x{1f1}\x{1f2}\x{1f3}
- 1: \x{1f1}\x{1f2}
- 2: \x{1f1}
/\x{01f2}+/8i
\x{01f1}\x{01f2}\x{01f3}
0: \x{1f1}\x{1f2}\x{1f3}
- 1: \x{1f1}\x{1f2}
- 2: \x{1f1}
/\x{01f3}+/8i
\x{01f1}\x{01f2}\x{01f3}
0: \x{1f1}\x{1f2}\x{1f3}
- 1: \x{1f1}\x{1f2}
- 2: \x{1f1}
/\x{0345}+/8i
\x{0345}\x{0399}\x{03b9}\x{1fbe}
0: \x{345}\x{399}\x{3b9}\x{1fbe}
- 1: \x{345}\x{399}\x{3b9}
- 2: \x{345}\x{399}
- 3: \x{345}
/\x{0399}+/8i
\x{0345}\x{0399}\x{03b9}\x{1fbe}
0: \x{345}\x{399}\x{3b9}\x{1fbe}
- 1: \x{345}\x{399}\x{3b9}
- 2: \x{345}\x{399}
- 3: \x{345}
/\x{03b9}+/8i
\x{0345}\x{0399}\x{03b9}\x{1fbe}
0: \x{345}\x{399}\x{3b9}\x{1fbe}
- 1: \x{345}\x{399}\x{3b9}
- 2: \x{345}\x{399}
- 3: \x{345}
/\x{1fbe}+/8i
\x{0345}\x{0399}\x{03b9}\x{1fbe}
0: \x{345}\x{399}\x{3b9}\x{1fbe}
- 1: \x{345}\x{399}\x{3b9}
- 2: \x{345}\x{399}
- 3: \x{345}
/\x{0392}+/8i
\x{0392}\x{03b2}\x{03d0}
0: \x{392}\x{3b2}\x{3d0}
- 1: \x{392}\x{3b2}
- 2: \x{392}
/\x{03b2}+/8i
\x{0392}\x{03b2}\x{03d0}
0: \x{392}\x{3b2}\x{3d0}
- 1: \x{392}\x{3b2}
- 2: \x{392}
/\x{03d0}+/8i
\x{0392}\x{03b2}\x{03d0}
0: \x{392}\x{3b2}\x{3d0}
- 1: \x{392}\x{3b2}
- 2: \x{392}
/\x{0395}+/8i
\x{0395}\x{03b5}\x{03f5}
0: \x{395}\x{3b5}\x{3f5}
- 1: \x{395}\x{3b5}
- 2: \x{395}
/\x{03b5}+/8i
\x{0395}\x{03b5}\x{03f5}
0: \x{395}\x{3b5}\x{3f5}
- 1: \x{395}\x{3b5}
- 2: \x{395}
/\x{03f5}+/8i
\x{0395}\x{03b5}\x{03f5}
0: \x{395}\x{3b5}\x{3f5}
- 1: \x{395}\x{3b5}
- 2: \x{395}
/\x{0398}+/8i
\x{0398}\x{03b8}\x{03d1}\x{03f4}
0: \x{398}\x{3b8}\x{3d1}\x{3f4}
- 1: \x{398}\x{3b8}\x{3d1}
- 2: \x{398}\x{3b8}
- 3: \x{398}
/\x{03b8}+/8i
\x{0398}\x{03b8}\x{03d1}\x{03f4}
0: \x{398}\x{3b8}\x{3d1}\x{3f4}
- 1: \x{398}\x{3b8}\x{3d1}
- 2: \x{398}\x{3b8}
- 3: \x{398}
/\x{03d1}+/8i
\x{0398}\x{03b8}\x{03d1}\x{03f4}
0: \x{398}\x{3b8}\x{3d1}\x{3f4}
- 1: \x{398}\x{3b8}\x{3d1}
- 2: \x{398}\x{3b8}
- 3: \x{398}
/\x{03f4}+/8i
\x{0398}\x{03b8}\x{03d1}\x{03f4}
0: \x{398}\x{3b8}\x{3d1}\x{3f4}
- 1: \x{398}\x{3b8}\x{3d1}
- 2: \x{398}\x{3b8}
- 3: \x{398}
/\x{039a}+/8i
\x{039a}\x{03ba}\x{03f0}
0: \x{39a}\x{3ba}\x{3f0}
- 1: \x{39a}\x{3ba}
- 2: \x{39a}
/\x{03ba}+/8i
\x{039a}\x{03ba}\x{03f0}
0: \x{39a}\x{3ba}\x{3f0}
- 1: \x{39a}\x{3ba}
- 2: \x{39a}
/\x{03f0}+/8i
\x{039a}\x{03ba}\x{03f0}
0: \x{39a}\x{3ba}\x{3f0}
- 1: \x{39a}\x{3ba}
- 2: \x{39a}
/\x{03a0}+/8i
\x{03a0}\x{03c0}\x{03d6}
0: \x{3a0}\x{3c0}\x{3d6}
- 1: \x{3a0}\x{3c0}
- 2: \x{3a0}
/\x{03c0}+/8i
\x{03a0}\x{03c0}\x{03d6}
0: \x{3a0}\x{3c0}\x{3d6}
- 1: \x{3a0}\x{3c0}
- 2: \x{3a0}
/\x{03d6}+/8i
\x{03a0}\x{03c0}\x{03d6}
0: \x{3a0}\x{3c0}\x{3d6}
- 1: \x{3a0}\x{3c0}
- 2: \x{3a0}
/\x{03a1}+/8i
\x{03a1}\x{03c1}\x{03f1}
0: \x{3a1}\x{3c1}\x{3f1}
- 1: \x{3a1}\x{3c1}
- 2: \x{3a1}
/\x{03c1}+/8i
\x{03a1}\x{03c1}\x{03f1}
0: \x{3a1}\x{3c1}\x{3f1}
- 1: \x{3a1}\x{3c1}
- 2: \x{3a1}
/\x{03f1}+/8i
\x{03a1}\x{03c1}\x{03f1}
0: \x{3a1}\x{3c1}\x{3f1}
- 1: \x{3a1}\x{3c1}
- 2: \x{3a1}
/\x{03a3}+/8i
\x{03A3}\x{03C2}\x{03C3}
0: \x{3a3}\x{3c2}\x{3c3}
- 1: \x{3a3}\x{3c2}
- 2: \x{3a3}
/\x{03c2}+/8i
\x{03A3}\x{03C2}\x{03C3}
0: \x{3a3}\x{3c2}\x{3c3}
- 1: \x{3a3}\x{3c2}
- 2: \x{3a3}
/\x{03c3}+/8i
\x{03A3}\x{03C2}\x{03C3}
0: \x{3a3}\x{3c2}\x{3c3}
- 1: \x{3a3}\x{3c2}
- 2: \x{3a3}
/\x{03a6}+/8i
\x{03a6}\x{03c6}\x{03d5}
0: \x{3a6}\x{3c6}\x{3d5}
- 1: \x{3a6}\x{3c6}
- 2: \x{3a6}
/\x{03c6}+/8i
\x{03a6}\x{03c6}\x{03d5}
0: \x{3a6}\x{3c6}\x{3d5}
- 1: \x{3a6}\x{3c6}
- 2: \x{3a6}
/\x{03d5}+/8i
\x{03a6}\x{03c6}\x{03d5}
0: \x{3a6}\x{3c6}\x{3d5}
- 1: \x{3a6}\x{3c6}
- 2: \x{3a6}
/\x{03c9}+/8i
\x{03c9}\x{03a9}\x{2126}
0: \x{3c9}\x{3a9}\x{2126}
- 1: \x{3c9}\x{3a9}
- 2: \x{3c9}
/\x{03a9}+/8i
\x{03c9}\x{03a9}\x{2126}
0: \x{3c9}\x{3a9}\x{2126}
- 1: \x{3c9}\x{3a9}
- 2: \x{3c9}
/\x{2126}+/8i
\x{03c9}\x{03a9}\x{2126}
0: \x{3c9}\x{3a9}\x{2126}
- 1: \x{3c9}\x{3a9}
- 2: \x{3c9}
/\x{1e60}+/8i
\x{1e60}\x{1e61}\x{1e9b}
0: \x{1e60}\x{1e61}\x{1e9b}
- 1: \x{1e60}\x{1e61}
- 2: \x{1e60}
/\x{1e61}+/8i
\x{1e60}\x{1e61}\x{1e9b}
0: \x{1e60}\x{1e61}\x{1e9b}
- 1: \x{1e60}\x{1e61}
- 2: \x{1e60}
/\x{1e9b}+/8i
\x{1e60}\x{1e61}\x{1e9b}
0: \x{1e60}\x{1e61}\x{1e9b}
- 1: \x{1e60}\x{1e61}
- 2: \x{1e60}
/\x{1e9e}+/8i
\x{1e9e}\x{00df}
0: \x{1e9e}\x{df}
- 1: \x{1e9e}
/\x{00df}+/8i
\x{1e9e}\x{00df}
0: \x{1e9e}\x{df}
- 1: \x{1e9e}
/\x{1f88}+/8i
\x{1f88}\x{1f80}
0: \x{1f88}\x{1f80}
- 1: \x{1f88}
/\x{1f80}+/8i
\x{1f88}\x{1f80}
0: \x{1f88}\x{1f80}
- 1: \x{1f88}
/\x{004b}+/8i
\x{004b}\x{006b}\x{212a}
0: Kk\x{212a}
- 1: Kk
- 2: K
/\x{006b}+/8i
\x{004b}\x{006b}\x{212a}
0: Kk\x{212a}
- 1: Kk
- 2: K
/\x{212a}+/8i
\x{004b}\x{006b}\x{212a}
0: Kk\x{212a}
- 1: Kk
- 2: K
/\x{0053}+/8i
\x{0053}\x{0073}\x{017f}
0: Ss\x{17f}
- 1: Ss
- 2: S
/\x{0073}+/8i
\x{0053}\x{0073}\x{017f}
0: Ss\x{17f}
- 1: Ss
- 2: S
/\x{017f}+/8i
\x{0053}\x{0073}\x{017f}
0: Ss\x{17f}
- 1: Ss
- 2: S
/ist/8i
ikt
@@ -2740,11 +2436,6 @@ No match
/^\p{Xuc}+/8
$@`\x{a0}\x{1234}\x{e000}**
0: $@`\x{a0}\x{1234}\x{e000}
- 1: $@`\x{a0}\x{1234}
- 2: $@`\x{a0}
- 3: $@`
- 4: $@
- 5: $
** Failers
No match
\x{9f}
@@ -2782,8 +2473,6 @@ No match
/^\p{Xuc}{3,5}/8
$@`\x{a0}\x{1234}\x{e000}**
0: $@`\x{a0}\x{1234}
- 1: $@`\x{a0}
- 2: $@`
** Failers
No match
\x{9f}
@@ -2810,11 +2499,6 @@ No match
/^[\p{Xuc}]+/8
$@`\x{a0}\x{1234}\x{e000}**
0: $@`\x{a0}\x{1234}\x{e000}
- 1: $@`\x{a0}\x{1234}
- 2: $@`\x{a0}
- 3: $@`
- 4: $@
- 5: $
** Failers
No match
\x{9f}
@@ -2848,4 +2532,16 @@ No match
\x{1234}abc
No match
+/^A\s+Z/8W
+ A\x{2005}Z
+ 0: A\x{2005}Z
+ A\x{85}\x{180e}\x{2005}Z
+ 0: A\x{85}\x{180e}\x{2005}Z
+
+/^A[\s]+Z/8W
+ A\x{2005}Z
+ 0: A\x{2005}Z
+ A\x{85}\x{180e}\x{2005}Z
+ 0: A\x{85}\x{180e}\x{2005}Z
+
/-- End of testinput10 --/
diff --git a/pcre/testdata/testoutput11-16 b/pcre/testdata/testoutput11-16
index dff72b9477c..f1ad8887b4d 100644
--- a/pcre/testdata/testoutput11-16
+++ b/pcre/testdata/testoutput11-16
@@ -63,6 +63,7 @@ Memory allocation (code space): 10
4 End
------------------------------------------------------------------
Capturing subpattern count = 0
+May match empty string
Options: extended
No first char
No need char
@@ -99,15 +100,13 @@ Memory allocation (code space): 14
------------------------------------------------------------------
/x{1,3}+/BM
-Memory allocation (code space): 28
+Memory allocation (code space): 20
------------------------------------------------------------------
- 0 11 Bra
- 2 7 Once
- 4 x
- 6 x{0,2}
- 9 7 Ket
- 11 11 Ket
- 13 End
+ 0 7 Bra
+ 2 x
+ 4 x{0,2}+
+ 7 7 Ket
+ 9 End
------------------------------------------------------------------
/(x)*+/BM
@@ -138,7 +137,7 @@ Memory allocation (code space): 142
39 [bc]+
57 21 Ket
59 5 CBra 5
- 62 \w*
+ 62 \w*+
64 5 Ket
66 63 Ket
68 68 Ket
@@ -327,7 +326,7 @@ Memory allocation (code space): 16
------------------------------------------------------------------
/\x{110000}/8BM
-Failed: character value in \x{...} sequence is too large at offset 9
+Failed: character value in \x{} or \o{} is too large at offset 9
/[\x{ff}]/8BM
Memory allocation (code space): 14
@@ -503,7 +502,7 @@ Memory allocation (code space): 24
Memory allocation (code space): 58
------------------------------------------------------------------
0 26 Bra
- 2 [+\-\p{Nd}]+
+ 2 [+\-\p{Nd}]++
26 26 Ket
28 End
------------------------------------------------------------------
@@ -652,7 +651,7 @@ Memory allocation (code space): 14
/[[:^alpha:][:^cntrl:]]+/8WB
------------------------------------------------------------------
0 26 Bra
- 2 [ -~\x80-\xff\P{L}]+
+ 2 [ -~\x80-\xff\P{L}]++
26 26 Ket
28 End
------------------------------------------------------------------
@@ -660,7 +659,7 @@ Memory allocation (code space): 14
/[[:^cntrl:][:^alpha:]]+/8WB
------------------------------------------------------------------
0 26 Bra
- 2 [ -~\x80-\xff\P{L}]+
+ 2 [ -~\x80-\xff\P{L}]++
26 26 Ket
28 End
------------------------------------------------------------------
@@ -668,7 +667,7 @@ Memory allocation (code space): 14
/[[:alpha:]]+/8WB
------------------------------------------------------------------
0 10 Bra
- 2 [\p{L}]+
+ 2 [\p{L}]++
10 10 Ket
12 End
------------------------------------------------------------------
@@ -676,7 +675,7 @@ Memory allocation (code space): 14
/[[:^alpha:]\S]+/8WB
------------------------------------------------------------------
0 13 Bra
- 2 [\P{L}\P{Xsp}]+
+ 2 [\P{L}\P{Xsp}]++
13 13 Ket
15 End
------------------------------------------------------------------
diff --git a/pcre/testdata/testoutput11-32 b/pcre/testdata/testoutput11-32
index 8335fb82418..266e55d0672 100644
--- a/pcre/testdata/testoutput11-32
+++ b/pcre/testdata/testoutput11-32
@@ -63,6 +63,7 @@ Memory allocation (code space): 20
4 End
------------------------------------------------------------------
Capturing subpattern count = 0
+May match empty string
Options: extended
No first char
No need char
@@ -99,15 +100,13 @@ Memory allocation (code space): 28
------------------------------------------------------------------
/x{1,3}+/BM
-Memory allocation (code space): 56
+Memory allocation (code space): 40
------------------------------------------------------------------
- 0 11 Bra
- 2 7 Once
- 4 x
- 6 x{0,2}
- 9 7 Ket
- 11 11 Ket
- 13 End
+ 0 7 Bra
+ 2 x
+ 4 x{0,2}+
+ 7 7 Ket
+ 9 End
------------------------------------------------------------------
/(x)*+/BM
@@ -138,7 +137,7 @@ Memory allocation (code space): 220
31 [bc]+
41 13 Ket
43 5 CBra 5
- 46 \w*
+ 46 \w*+
48 5 Ket
50 47 Ket
52 52 Ket
@@ -327,7 +326,7 @@ Memory allocation (code space): 28
------------------------------------------------------------------
/\x{110000}/8BM
-Failed: character value in \x{...} sequence is too large at offset 9
+Failed: character value in \x{} or \o{} is too large at offset 9
/[\x{ff}]/8BM
Memory allocation (code space): 28
@@ -503,7 +502,7 @@ Memory allocation (code space): 48
Memory allocation (code space): 84
------------------------------------------------------------------
0 18 Bra
- 2 [+\-\p{Nd}]+
+ 2 [+\-\p{Nd}]++
18 18 Ket
20 End
------------------------------------------------------------------
@@ -652,7 +651,7 @@ Memory allocation (code space): 28
/[[:^alpha:][:^cntrl:]]+/8WB
------------------------------------------------------------------
0 18 Bra
- 2 [ -~\x80-\xff\P{L}]+
+ 2 [ -~\x80-\xff\P{L}]++
18 18 Ket
20 End
------------------------------------------------------------------
@@ -660,7 +659,7 @@ Memory allocation (code space): 28
/[[:^cntrl:][:^alpha:]]+/8WB
------------------------------------------------------------------
0 18 Bra
- 2 [ -~\x80-\xff\P{L}]+
+ 2 [ -~\x80-\xff\P{L}]++
18 18 Ket
20 End
------------------------------------------------------------------
@@ -668,7 +667,7 @@ Memory allocation (code space): 28
/[[:alpha:]]+/8WB
------------------------------------------------------------------
0 10 Bra
- 2 [\p{L}]+
+ 2 [\p{L}]++
10 10 Ket
12 End
------------------------------------------------------------------
@@ -676,7 +675,7 @@ Memory allocation (code space): 28
/[[:^alpha:]\S]+/8WB
------------------------------------------------------------------
0 13 Bra
- 2 [\P{L}\P{Xsp}]+
+ 2 [\P{L}\P{Xsp}]++
13 13 Ket
15 End
------------------------------------------------------------------
diff --git a/pcre/testdata/testoutput11-8 b/pcre/testdata/testoutput11-8
index c1c85f9a3b6..d4a21334e36 100644
--- a/pcre/testdata/testoutput11-8
+++ b/pcre/testdata/testoutput11-8
@@ -63,6 +63,7 @@ Memory allocation (code space): 7
6 End
------------------------------------------------------------------
Capturing subpattern count = 0
+May match empty string
Options: extended
No first char
No need char
@@ -99,15 +100,13 @@ Memory allocation (code space): 9
------------------------------------------------------------------
/x{1,3}+/BM
-Memory allocation (code space): 19
+Memory allocation (code space): 13
------------------------------------------------------------------
- 0 15 Bra
- 3 9 Once
- 6 x
- 8 x{0,2}
- 12 9 Ket
- 15 15 Ket
- 18 End
+ 0 9 Bra
+ 3 x
+ 5 x{0,2}+
+ 9 9 Ket
+ 12 End
------------------------------------------------------------------
/(x)*+/BM
@@ -138,7 +137,7 @@ Memory allocation (code space): 120
66 [bc]+
100 39 Ket
103 7 CBra 5
-108 \w*
+108 \w*+
110 7 Ket
113 109 Ket
116 116 Ket
@@ -327,7 +326,7 @@ Memory allocation (code space): 12
------------------------------------------------------------------
/\x{110000}/8BM
-Failed: character value in \x{...} sequence is too large at offset 9
+Failed: character value in \x{} or \o{} is too large at offset 9
/[\x{ff}]/8BM
Memory allocation (code space): 10
@@ -503,7 +502,7 @@ Memory allocation (code space): 15
Memory allocation (code space): 48
------------------------------------------------------------------
0 44 Bra
- 3 [+\-\p{Nd}]+
+ 3 [+\-\p{Nd}]++
44 44 Ket
47 End
------------------------------------------------------------------
@@ -652,7 +651,7 @@ Memory allocation (code space): 10
/[[:^alpha:][:^cntrl:]]+/8WB
------------------------------------------------------------------
0 44 Bra
- 3 [ -~\x80-\xff\P{L}]+
+ 3 [ -~\x80-\xff\P{L}]++
44 44 Ket
47 End
------------------------------------------------------------------
@@ -660,7 +659,7 @@ Memory allocation (code space): 10
/[[:^cntrl:][:^alpha:]]+/8WB
------------------------------------------------------------------
0 44 Bra
- 3 [ -~\x80-\xff\P{L}]+
+ 3 [ -~\x80-\xff\P{L}]++
44 44 Ket
47 End
------------------------------------------------------------------
@@ -668,7 +667,7 @@ Memory allocation (code space): 10
/[[:alpha:]]+/8WB
------------------------------------------------------------------
0 12 Bra
- 3 [\p{L}]+
+ 3 [\p{L}]++
12 12 Ket
15 End
------------------------------------------------------------------
@@ -676,7 +675,7 @@ Memory allocation (code space): 10
/[[:^alpha:]\S]+/8WB
------------------------------------------------------------------
0 15 Bra
- 3 [\P{L}\P{Xsp}]+
+ 3 [\P{L}\P{Xsp}]++
15 15 Ket
18 End
------------------------------------------------------------------
diff --git a/pcre/testdata/testoutput12 b/pcre/testdata/testoutput12
index 6c986d1185d..a76e2aef880 100644
--- a/pcre/testdata/testoutput12
+++ b/pcre/testdata/testoutput12
@@ -13,16 +13,18 @@ JIT study was successful
/(?(?C1)(?=a)a)/S+I
Capturing subpattern count = 0
+May match empty string
No options
-First char = 'a'
+No first char
No need char
Study returned NULL
JIT study was not successful
/(?(?C1)(?=a)a)/S!+I
Capturing subpattern count = 0
+May match empty string
No options
-First char = 'a'
+No first char
No need char
Subject length lower bound = -1
No set of starting bytes
@@ -47,6 +49,7 @@ Study data loaded from testsavedregex
/a*/SI
Capturing subpattern count = 0
+May match empty string
No options
No first char
No need char
diff --git a/pcre/testdata/testoutput13 b/pcre/testdata/testoutput13
index e9cbbcf0a2b..9f73c5000f6 100644
--- a/pcre/testdata/testoutput13
+++ b/pcre/testdata/testoutput13
@@ -13,6 +13,7 @@ JIT support is not available in this version of PCRE
/a*/SI
Capturing subpattern count = 0
+May match empty string
No options
No first char
No need char
diff --git a/pcre/testdata/testoutput14 b/pcre/testdata/testoutput14
index 5f05d77d24e..52680a8f9cd 100644
--- a/pcre/testdata/testoutput14
+++ b/pcre/testdata/testoutput14
@@ -1,6 +1,9 @@
-/-- This set of tests is run only with the 8-bit library. It starts with all
- the tests of the POSIX interface, because that is supported only with the
- 8-bit library. --/
+/-- This set of tests is run only with the 8-bit library. They do not require
+ UTF-8 or Unicode property support. The file starts with all the tests of
+ the POSIX interface, because that is supported only with the 8-bit library.
+ --/
+
+< forbid 8W
/abc/P
abc
@@ -147,9 +150,16 @@ No match
** Character \x{123} is greater than 255 and UTF-8 mode is not enabled.
** Truncation will probably give the wrong result.
No match
+ A\o{443}B
+** Character \x{123} is greater than 255 and UTF-8 mode is not enabled.
+** Truncation will probably give the wrong result.
+No match
/\x{100}/I
-Failed: character value in \x{...} sequence is too large at offset 6
+Failed: character value in \x{} or \o{} is too large at offset 6
+
+/\o{400}/I
+Failed: character value in \x{} or \o{} is too large at offset 6
/ (?: [\040\t] | \(
(?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
@@ -380,6 +390,14 @@ No need char
Subject length lower bound = 1
Starting byte set: \x09 \x20 \xa0
+/\H/SI
+Capturing subpattern count = 0
+No options
+No first char
+No need char
+Subject length lower bound = 1
+No set of starting bytes
+
/\v/SI
Capturing subpattern count = 0
No options
@@ -388,6 +406,14 @@ No need char
Subject length lower bound = 1
Starting byte set: \x0a \x0b \x0c \x0d \x85
+/\V/SI
+Capturing subpattern count = 0
+No options
+No first char
+No need char
+Subject length lower bound = 1
+No set of starting bytes
+
/\R/SI
Capturing subpattern count = 0
No options
@@ -409,7 +435,7 @@ Starting byte set: \x0a \x0b \x0c \x0d \x85
/[\h]+/BZ
------------------------------------------------------------------
Bra
- [\x09 \xa0]+
+ [\x09 \xa0]++
Ket
End
------------------------------------------------------------------
@@ -473,4 +499,32 @@ Failed: character value in \u.... sequence is too large at offset 5
/[\u0100-\u0200]/<JS>
Failed: character value in \u.... sequence is too large at offset 6
+/[^\x00-a]{12,}[^b-\xff]*/BZ
+------------------------------------------------------------------
+ Bra
+ [b-\xff] (neg){12,}+
+ [\x00-a] (neg)*+
+ Ket
+ End
+------------------------------------------------------------------
+
+/[^\s]*\s* [^\W]+\W+ [^\d]*?\d0 [^\d\w]{4,6}?\w*A/BZ
+------------------------------------------------------------------
+ Bra
+ [\x00-\x08\x0e-\x1f!-\xff] (neg)*+
+ \s*
+
+ [0-9A-Z_a-z]++
+ \W+
+
+ [\x00-/:-\xff] (neg)*+
+ \d
+ 0
+ [\x00-/:-@[-^`{-\xff] (neg){4,6}+
+ \w*
+ A
+ Ket
+ End
+------------------------------------------------------------------
+
/-- End of testinput14 --/
diff --git a/pcre/testdata/testoutput15 b/pcre/testdata/testoutput15
index 1541637de8d..5792be72df7 100644
--- a/pcre/testdata/testoutput15
+++ b/pcre/testdata/testoutput15
@@ -1,5 +1,7 @@
-/-- This set of tests is for UTF-8 support, and is relevant only to the 8-bit
- library. --/
+/-- This set of tests is for UTF-8 support but not Unicode property support,
+ and is relevant only to the 8-bit library. --/
+
+< forbid W
/X(\C{3})/8
X\x{1234}
@@ -72,7 +74,7 @@ Failed: invalid UTF-8 string at offset 0
/ÃÃÃxxx/8
Failed: invalid UTF-8 string at offset 0
-/ÃÃÃxxx/8?DZSS
+/ÃÃÃxxx/8?DZSSO
------------------------------------------------------------------
Bra
\X{c0}\X{c0}\X{c0}xxx
@@ -80,7 +82,7 @@ Failed: invalid UTF-8 string at offset 0
End
------------------------------------------------------------------
Capturing subpattern count = 0
-Options: utf no_utf_check
+Options: no_auto_possessify utf no_utf_check
First char = \x{c3}
Need char = 'x'
@@ -508,7 +510,7 @@ No match
------------------------------------------------------------------
Bra
\x{100}{3}
- \x{100}?
+ \x{100}?+
Ket
End
------------------------------------------------------------------
@@ -525,7 +527,7 @@ No set of starting bytes
------------------------------------------------------------------
Bra
CBra 1
- \x{100}+
+ \x{100}++
Alt
x
Ket
@@ -562,7 +564,7 @@ Starting byte set: a x \xc4
------------------------------------------------------------------
Bra
CBra 1
- \x{100}{0,2}
+ \x{100}{0,2}+
a
Alt
x
@@ -582,7 +584,7 @@ Starting byte set: a x \xc4
Bra
CBra 1
\x{100}
- \x{100}{0,1}
+ \x{100}{0,1}+
a
Alt
x
@@ -613,7 +615,7 @@ Need char = \x{80}
------------------------------------------------------------------
Bra
a\x{100}
- \x{101}*
+ \x{101}*+
Ket
End
------------------------------------------------------------------
@@ -626,7 +628,7 @@ Need char = \x{80}
------------------------------------------------------------------
Bra
a\x{100}
- \x{101}+
+ \x{101}++
Ket
End
------------------------------------------------------------------
@@ -861,7 +863,7 @@ Options: utf
No first char
Need char = 'x'
Subject length lower bound = 4
-Starting byte set: \x09 \x0a \x0c \x0d \x20 x
+Starting byte set: \x09 \x0a \x0b \x0c \x0d \x20 x
/\sxxx\s/I8ST1
Capturing subpattern count = 0
diff --git a/pcre/testdata/testoutput17 b/pcre/testdata/testoutput17
index ef82dc9d0d8..9a469c51ae1 100644
--- a/pcre/testdata/testoutput17
+++ b/pcre/testdata/testoutput17
@@ -1,6 +1,8 @@
/-- This set of tests is for the 16- and 32-bit library's basic (non-UTF-16
or -32) features that are not compatible with the 8-bit library, or which
give different output in 16- or 32-bit mode. --/
+
+< forbid 8W
/a\Cb/
aXb
@@ -243,7 +245,7 @@ Starting byte set: \x09 \x20 ! " # $ % & ' ( * + - / 0 1 2 3 4 5 6 7 8
/[\h]+/BZ
------------------------------------------------------------------
Bra
- [\x09 \xa0\x{1680}\x{180e}\x{2000}-\x{200a}\x{202f}\x{205f}\x{3000}]+
+ [\x09 \xa0\x{1680}\x{180e}\x{2000}-\x{200a}\x{202f}\x{205f}\x{3000}]++
Ket
End
------------------------------------------------------------------
@@ -281,7 +283,7 @@ Starting byte set: \x09 \x20 \xa0 \xff
/[\h\x{dc00}]+/BZSI
------------------------------------------------------------------
Bra
- [\x09 \xa0\x{1680}\x{180e}\x{2000}-\x{200a}\x{202f}\x{205f}\x{3000}\x{dc00}]+
+ [\x09 \xa0\x{1680}\x{180e}\x{2000}-\x{200a}\x{202f}\x{205f}\x{3000}\x{dc00}]++
Ket
End
------------------------------------------------------------------
@@ -337,7 +339,7 @@ Starting byte set: \x0a \x0b \x0c \x0d \x85 \xff
/[\v\x{dc00}]+/BZSI
------------------------------------------------------------------
Bra
- [\x0a-\x0d\x85\x{2028}-\x{2029}\x{dc00}]+
+ [\x0a-\x0d\x85\x{2028}-\x{2029}\x{dc00}]++
Ket
End
------------------------------------------------------------------
@@ -440,10 +442,8 @@ Need char = \x{dd00}
/i [^\x{8000}]*
/i [^\x{7fff}]{2}
/i [^\x{7fff}]{0,7}?
- Once
/i [^\x{100}]{5}
- /i [^\x{100}]?
- Ket
+ /i [^\x{100}]?+
Ket
End
------------------------------------------------------------------
@@ -502,4 +502,57 @@ MK: 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789AB
\x{ffff}
0: \x{ffff}
+/[^\x00-a]{12,}[^b-\xff]*/BZ
+------------------------------------------------------------------
+ Bra
+ [b-\xff] (neg){12,}
+ [\x00-a] (neg)*+
+ Ket
+ End
+------------------------------------------------------------------
+
+/[^\s]*\s* [^\W]+\W+ [^\d]*?\d0 [^\d\w]{4,6}?\w*A/BZ
+------------------------------------------------------------------
+ Bra
+ [\x00-\x08\x0e-\x1f!-\xff] (neg)*
+ \s*
+
+ [0-9A-Z_a-z]++
+ \W+
+
+ [\x00-/:-\xff] (neg)*?
+ \d
+ 0
+ [\x00-/:-@[-^`{-\xff] (neg){4,6}?
+ \w*
+ A
+ Ket
+ End
+------------------------------------------------------------------
+
+/a*[b-\x{200}]?a#a*[b-\x{200}]?b#[a-f]*[g-\x{200}]*#[g-\x{200}]*[a-c]*#[g-\x{200}]*[a-h]*/BZ
+------------------------------------------------------------------
+ Bra
+ a*
+ [b-\x{200}]?+
+ a#
+ a*+
+ [b-\x{200}]?
+ b#
+ [a-f]*
+ [g-\x{200}]*+
+ #
+ [g-\x{200}]*
+ [a-c]*+
+ #
+ [g-\x{200}]*
+ [a-h]*+
+ Ket
+ End
+------------------------------------------------------------------
+
+/^[\x{1234}\x{4321}]{2,4}?/
+ \x{1234}\x{1234}\x{1234}
+ 0: \x{1234}\x{1234}
+
/-- End of testinput17 --/
diff --git a/pcre/testdata/testoutput18-16 b/pcre/testdata/testoutput18-16
index 3414a661808..1ca9ee74018 100644
--- a/pcre/testdata/testoutput18-16
+++ b/pcre/testdata/testoutput18-16
@@ -1,5 +1,7 @@
-/-- This set of tests is for UTF-16 and UTF-32 support, and is relevant only to the
- 16- and 32-bit library. --/
+/-- This set of tests is for UTF-16 and UTF-32 support, and is relevant only to
+ the 16- and 32-bit libraries. --/
+
+< forbid W
/ÃÃÃxxx/8?DZSS
**Failed: invalid UTF-8 string cannot be converted to UTF-16
@@ -367,7 +369,7 @@ No match
------------------------------------------------------------------
Bra
\x{100}{3}
- \x{100}?
+ \x{100}?+
Ket
End
------------------------------------------------------------------
@@ -384,7 +386,7 @@ No set of starting bytes
------------------------------------------------------------------
Bra
CBra 1
- \x{100}+
+ \x{100}++
Alt
x
Ket
@@ -421,7 +423,7 @@ Starting byte set: a x \xff
------------------------------------------------------------------
Bra
CBra 1
- \x{100}{0,2}
+ \x{100}{0,2}+
a
Alt
x
@@ -441,7 +443,7 @@ Starting byte set: a x \xff
Bra
CBra 1
\x{100}
- \x{100}{0,1}
+ \x{100}{0,1}+
a
Alt
x
@@ -472,7 +474,7 @@ No need char
------------------------------------------------------------------
Bra
a\x{100}
- \x{101}*
+ \x{101}*+
Ket
End
------------------------------------------------------------------
@@ -485,7 +487,7 @@ Need char = \x{100}
------------------------------------------------------------------
Bra
a\x{100}
- \x{101}+
+ \x{101}++
Ket
End
------------------------------------------------------------------
@@ -742,7 +744,7 @@ Options: utf
No first char
Need char = 'x'
Subject length lower bound = 4
-Starting byte set: \x09 \x0a \x0c \x0d \x20 x
+Starting byte set: \x09 \x0a \x0b \x0c \x0d \x20 x
/\sxxx\s/I8ST1
Capturing subpattern count = 0
diff --git a/pcre/testdata/testoutput18-32 b/pcre/testdata/testoutput18-32
index e917e3baec4..89be3a4b051 100644
--- a/pcre/testdata/testoutput18-32
+++ b/pcre/testdata/testoutput18-32
@@ -1,5 +1,7 @@
-/-- This set of tests is for UTF-16 and UTF-32 support, and is relevant only to the
- 16- and 32-bit library. --/
+/-- This set of tests is for UTF-16 and UTF-32 support, and is relevant only to
+ the 16- and 32-bit libraries. --/
+
+< forbid W
/ÃÃÃxxx/8?DZSS
**Failed: invalid UTF-8 string cannot be converted to UTF-32
@@ -365,7 +367,7 @@ No match
------------------------------------------------------------------
Bra
\x{100}{3}
- \x{100}?
+ \x{100}?+
Ket
End
------------------------------------------------------------------
@@ -382,7 +384,7 @@ No set of starting bytes
------------------------------------------------------------------
Bra
CBra 1
- \x{100}+
+ \x{100}++
Alt
x
Ket
@@ -419,7 +421,7 @@ Starting byte set: a x \xff
------------------------------------------------------------------
Bra
CBra 1
- \x{100}{0,2}
+ \x{100}{0,2}+
a
Alt
x
@@ -439,7 +441,7 @@ Starting byte set: a x \xff
Bra
CBra 1
\x{100}
- \x{100}{0,1}
+ \x{100}{0,1}+
a
Alt
x
@@ -470,7 +472,7 @@ No need char
------------------------------------------------------------------
Bra
a\x{100}
- \x{101}*
+ \x{101}*+
Ket
End
------------------------------------------------------------------
@@ -483,7 +485,7 @@ Need char = \x{100}
------------------------------------------------------------------
Bra
a\x{100}
- \x{101}+
+ \x{101}++
Ket
End
------------------------------------------------------------------
@@ -739,7 +741,7 @@ Options: utf
No first char
Need char = 'x'
Subject length lower bound = 4
-Starting byte set: \x09 \x0a \x0c \x0d \x20 x
+Starting byte set: \x09 \x0a \x0b \x0c \x0d \x20 x
/\sxxx\s/I8ST1
Capturing subpattern count = 0
diff --git a/pcre/testdata/testoutput2 b/pcre/testdata/testoutput2
index fd958c2eb7e..844497abcdc 100644
--- a/pcre/testdata/testoutput2
+++ b/pcre/testdata/testoutput2
@@ -7,9 +7,12 @@
NOTE: This is a non-UTF set of tests. When UTF support is needed, use
test 5, and if Unicode Property Support is needed, use test 7. --/
+
+< forbid 8W
/(a)b|/I
Capturing subpattern count = 1
+May match empty string
No options
No first char
No need char
@@ -228,7 +231,7 @@ No options
No first char
No need char
Subject length lower bound = 1
-Starting byte set: \x09 \x0a \x0c \x0d \x20 a b
+Starting byte set: \x09 \x0a \x0b \x0c \x0d \x20 a b
/(ab\2)/
Failed: reference to non-existent subpattern at offset 6
@@ -498,6 +501,7 @@ No need char
/(?s).*/I
Capturing subpattern count = 0
+May match empty string
Options: anchored dotall
No first char
No need char
@@ -545,10 +549,10 @@ Failed: conditional group contains more than two branches at offset 13
Failed: conditional group contains more than two branches at offset 12
/(?(1a)/
-Failed: missing ) at offset 6
+Failed: malformed number or name after (?( at offset 4
/(?(1a))/
-Failed: reference to non-existent subpattern at offset 6
+Failed: malformed number or name after (?( at offset 4
/(?(?i))/
Failed: assertion expected after (?( at offset 3
@@ -762,6 +766,7 @@ No match
/(?<=ab(?i)x|y|z)/I
Capturing subpattern count = 0
Max lookbehind = 3
+May match empty string
No options
No first char
No need char
@@ -769,6 +774,7 @@ No need char
/(?>.*)(?<=(abcd)|(xyz))/I
Capturing subpattern count = 2
Max lookbehind = 4
+May match empty string
No options
No first char
No need char
@@ -1377,6 +1383,7 @@ Need char = 'c'
/a*/I
Capturing subpattern count = 0
+May match empty string
No options
No first char
No need char
@@ -1395,6 +1402,7 @@ Need char = 'a'
/a{0,3}/I
Capturing subpattern count = 0
+May match empty string
No options
No first char
No need char
@@ -1594,6 +1602,7 @@ Need char = 'e'
/a?b?/I
Capturing subpattern count = 0
+May match empty string
No options
No first char
No need char
@@ -1612,6 +1621,7 @@ No match
/|-/I
Capturing subpattern count = 0
+May match empty string
No options
No first char
No need char
@@ -2625,6 +2635,7 @@ Need char = '-'
End
------------------------------------------------------------------
Capturing subpattern count = 0
+May match empty string
Options: extended
No first char
No need char
@@ -2644,7 +2655,7 @@ No need char
/[\s]/DZ
------------------------------------------------------------------
Bra
- [\x09\x0a\x0c\x0d ]
+ [\x09-\x0d ]
Ket
End
------------------------------------------------------------------
@@ -2656,7 +2667,7 @@ No need char
/[\S]/DZ
------------------------------------------------------------------
Bra
- [\x00-\x08\x0b\x0e-\x1f!-\xff] (neg)
+ [\x00-\x08\x0e-\x1f!-\xff] (neg)
Ket
End
------------------------------------------------------------------
@@ -2767,6 +2778,7 @@ Need char = '0'
End
------------------------------------------------------------------
Capturing subpattern count = 0
+May match empty string
No options
No first char
No need char
@@ -2866,6 +2878,7 @@ No match
End
------------------------------------------------------------------
Capturing subpattern count = 0
+May match empty string
No options
No first char
No need char
@@ -2882,20 +2895,41 @@ No options
First char = 'x'
No need char
-/x{1,3}+/DZ
+/x{1,3}+/BZO
------------------------------------------------------------------
Bra
- Once
x
- x{0,2}
+ x{0,2}+
Ket
+ End
+------------------------------------------------------------------
+
+/x{1,3}+/BZOi
+------------------------------------------------------------------
+ Bra
+ /i x
+ /i x{0,2}+
+ Ket
+ End
+------------------------------------------------------------------
+
+/[^x]{1,3}+/BZO
+------------------------------------------------------------------
+ Bra
+ [^x]
+ [^x]{0,2}+
+ Ket
+ End
+------------------------------------------------------------------
+
+/[^x]{1,3}+/BZOi
+------------------------------------------------------------------
+ Bra
+ /i [^x]
+ /i [^x]{0,2}+
Ket
End
------------------------------------------------------------------
-Capturing subpattern count = 0
-No options
-First char = 'x'
-No need char
/(x)*+/DZ
------------------------------------------------------------------
@@ -2908,12 +2942,14 @@ No need char
End
------------------------------------------------------------------
Capturing subpattern count = 1
+May match empty string
No options
No first char
No need char
/^(\w++|\s++)*$/I
Capturing subpattern count = 1
+May match empty string
Options: anchored
No first char
No need char
@@ -3075,7 +3111,7 @@ Need char = 'b'
[bc]+
Ket
CBra 5
- \w*
+ \w*+
Ket
Ket
Ket
@@ -3154,7 +3190,7 @@ Failed: missing terminating ] for character class at offset 10
/[\s]/IDZ
------------------------------------------------------------------
Bra
- [\x09\x0a\x0c\x0d ]
+ [\x09-\x0d ]
Ket
End
------------------------------------------------------------------
@@ -3289,6 +3325,7 @@ Need char = 'b'
/(?=a).*/I
Capturing subpattern count = 0
+May match empty string
No options
First char = 'a'
No need char
@@ -3307,6 +3344,7 @@ Need char = 'z' (caseless)
/(?=a)(?=b)/I
Capturing subpattern count = 0
+May match empty string
No options
First char = 'a'
No need char
@@ -3373,6 +3411,7 @@ Need char = 'a'
/(a)*/I
Capturing subpattern count = 1
+May match empty string
No options
No first char
No need char
@@ -3601,6 +3640,7 @@ No match
/(?C0)(abc(?C1))*/I
Capturing subpattern count = 1
+May match empty string
No options
No first char
No need char
@@ -3634,6 +3674,7 @@ No need char
/(\d{3}(?C))*/I
Capturing subpattern count = 1
+May match empty string
No options
No first char
No need char
@@ -3770,20 +3811,6 @@ Need char = 'b'
--->abbbbbccc
1 ^ ^
Callout data = 1
- 1 ^ ^
-Callout data = 1
- 1 ^ ^
-Callout data = 1
- 1 ^ ^
-Callout data = 1
- 1 ^ ^
-Callout data = 1
- 1 ^ ^
-Callout data = 1
- 1 ^ ^
-Callout data = 1
- 1 ^ ^
-Callout data = 1
No match
/a(b+?)(c*?)(?C1)/I
@@ -3880,6 +3907,7 @@ Failed: recursive call could loop indefinitely at offset 16
/^([^()]|\((?1)*\))*$/I
Capturing subpattern count = 1
+May match empty string
Options: anchored
No first char
No need char
@@ -4159,6 +4187,7 @@ Named capturing subpatterns:
one 1
three 3
two 2
+May match empty string
Options: anchored caseless
No first char
No need char
@@ -4258,6 +4287,7 @@ Need char = 'z'
/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/Is
Capturing subpattern count = 31
+May match empty string
Options: anchored dotall
No first char
No need char
@@ -4265,6 +4295,7 @@ No need char
/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/Is
Capturing subpattern count = 31
Max back reference = 31
+May match empty string
Options: dotall
No first char
No need char
@@ -4272,6 +4303,7 @@ No need char
/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/Is
Capturing subpattern count = 32
Max back reference = 32
+May match empty string
Options: dotall
No first char
No need char
@@ -4423,6 +4455,7 @@ Capturing subpattern count = 2
Named capturing subpatterns:
Tes 1
Test 2
+May match empty string
No options
No first char
No need char
@@ -4441,6 +4474,7 @@ Capturing subpattern count = 2
Named capturing subpatterns:
Tes 2
Test 1
+May match empty string
No options
No first char
No need char
@@ -4518,6 +4552,7 @@ Need char = ']'
End
------------------------------------------------------------------
Capturing subpattern count = 2
+May match empty string
No options
No first char
No need char
@@ -4538,6 +4573,7 @@ No need char
End
------------------------------------------------------------------
Capturing subpattern count = 2
+May match empty string
No options
No first char
No need char
@@ -4569,6 +4605,7 @@ No need char
End
------------------------------------------------------------------
Capturing subpattern count = 2
+May match empty string
No options
No first char
No need char
@@ -4576,9 +4613,7 @@ No need char
/[ab]{1}+/DZ
------------------------------------------------------------------
Bra
- Once
- [ab]{1,1}
- Ket
+ [ab]{1,1}+
Ket
End
------------------------------------------------------------------
@@ -5290,7 +5325,7 @@ No match
Callout 255 0 21
CBra 1
Callout 255 1 9
- [ab]{1,4}
+ [ab]{1,4}+
Callout 255 10 1
c
Callout 255 11 0
@@ -5303,7 +5338,7 @@ No match
Ket
CBra 1
Callout 255 1 9
- [ab]{1,4}
+ [ab]{1,4}+
Callout 255 10 1
c
Callout 255 11 0
@@ -5316,7 +5351,7 @@ No match
Ket
CBra 1
Callout 255 1 9
- [ab]{1,4}
+ [ab]{1,4}+
Callout 255 10 1
c
Callout 255 11 0
@@ -5329,7 +5364,7 @@ No match
Ket
CBra 1
Callout 255 1 9
- [ab]{1,4}
+ [ab]{1,4}+
Callout 255 10 1
c
Callout 255 11 0
@@ -5343,7 +5378,7 @@ No match
Braminzero
CBra 1
Callout 255 1 9
- [ab]{1,4}
+ [ab]{1,4}+
Callout 255 10 1
c
Callout 255 11 0
@@ -5397,6 +5432,7 @@ Need char = '3'
/\b.*/I
Capturing subpattern count = 0
Max lookbehind = 1
+May match empty string
No options
No first char
No need char
@@ -5406,6 +5442,7 @@ No need char
/\b.*/Is
Capturing subpattern count = 0
Max lookbehind = 1
+May match empty string
Options: dotall
No first char
No need char
@@ -5414,6 +5451,7 @@ No need char
/(?!.bcd).*/I
Capturing subpattern count = 0
+May match empty string
No options
No first char
No need char
@@ -6002,6 +6040,7 @@ Matched, but too many substrings
/[^()]*(?:\((?R)\)[^()]*)*/I
Capturing subpattern count = 0
+May match empty string
No options
No first char
No need char
@@ -6014,6 +6053,7 @@ No need char
/[^()]*(?:\((?>(?R))\)[^()]*)*/I
Capturing subpattern count = 0
+May match empty string
No options
No first char
No need char
@@ -6024,6 +6064,7 @@ No need char
/[^()]*(?:\((?R)\))*[^()]*/I
Capturing subpattern count = 0
+May match empty string
No options
No first char
No need char
@@ -6034,6 +6075,7 @@ No need char
/(?:\((?R)\))*[^()]*/I
Capturing subpattern count = 0
+May match empty string
No options
No first char
No need char
@@ -6046,6 +6088,7 @@ No need char
/(?:\((?R)\))|[^()]*/I
Capturing subpattern count = 0
+May match empty string
No options
No first char
No need char
@@ -6095,6 +6138,17 @@ no parentheses with name "Z"
2: a1
copy substring Z failed -7
C a1 (2) A
+
+/(?|(?<a>)(?<b>)(?<a>)|(?<a>)(?<b>)(?<a>))/IJ
+Capturing subpattern count = 3
+Named capturing subpatterns:
+ a 1
+ a 3
+ b 2
+May match empty string
+Options: dupnames
+No first char
+No need char
/^(?P<A>a)(?P<A>b)/IJ
Capturing subpattern count = 2
@@ -6305,7 +6359,7 @@ Need char = 'X'
1: X
/(?:(?(2y)a|b)(X))+/I
-Failed: reference to non-existent subpattern at offset 9
+Failed: malformed number or name after (?( at offset 7
/(?:(?(ZA)a|b)(?P<ZZ>X))+/I
Failed: reference to non-existent subpattern at offset 9
@@ -6377,9 +6431,9 @@ No options
No first char
Need char = ','
Subject length lower bound = 1
-Starting byte set: \x09 \x0a \x0c \x0d \x20 ,
+Starting byte set: \x09 \x0a \x0b \x0c \x0d \x20 ,
\x0b,\x0b
- 0: ,
+ 0: \x0b,\x0b
\x0c,\x0d
0: \x0c,\x0d
@@ -6488,7 +6542,7 @@ No match
No match
/^abc/Im<bad>
-Unknown newline type at: <bad>
+Unknown modifier at: <bad>
/abc/I
@@ -6497,12 +6551,13 @@ No options
First char = 'a'
Need char = 'c'
xyz\rabc\<bad>
-Unknown newline type at: <bad>
+Unknown escape sequence at: <bad>
abc
0: abc
/.*/I<lf>
Capturing subpattern count = 0
+May match empty string
Options:
Forced newline sequence: LF
First char at start or follows newline
@@ -6544,6 +6599,7 @@ Need char = 'f'
+((?:\s|//.*\\n|/[*](?:\\n|.)*?[*]/)*)+I
Capturing subpattern count = 1
+May match empty string
No options
No first char
No need char
@@ -7467,7 +7523,7 @@ Matched, but too many substrings
/a*[^a]/BZ
------------------------------------------------------------------
Bra
- a*
+ a*+
[^a]
Ket
End
@@ -7609,7 +7665,7 @@ No match
------------------------------------------------------------------
Bra
^
- [a-z]+
+ [a-z]++
Ket
End
------------------------------------------------------------------
@@ -7650,7 +7706,7 @@ No match
^
CBra 1
Cond
- 2 Cond nref
+ 2 Cond ref
y
Ket
[()]
@@ -7710,6 +7766,7 @@ Named capturing subpatterns:
one 1
three 3
two 2
+May match empty string
Options: anchored caseless
No first char
No need char
@@ -7809,15 +7866,9 @@ Failed: reference to non-existent subpattern at offset 7
1: abcabc1Xabc2XabcX
2: abcabc1Xabc2XabcX
-/(?<A> (?'B' abc (?(R) (?(R&1)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x
+/(?<A> (?'B' abc (?(R) (?(R&C)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x
Failed: reference to non-existent subpattern at offset 29
-/(?<1> (?'B' abc (?(R) (?(R&1)1) (?(R&B)2) X | (?1) (?2) (?R) ))) /x
- abcabc1Xabc2XabcXabcabc
- 0: abcabc1Xabc2XabcX
- 1: abcabc1Xabc2XabcX
- 2: abcabc1Xabc2XabcX
-
/^(?(DEFINE) abc | xyz ) /x
Failed: DEFINE group contains more than one branch at offset 22
@@ -8041,7 +8092,7 @@ Failed: a numbered reference must not be zero at offset 8
/^(a)\g{3/
Failed: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number at offset 8
-/^(a)\g{4a}/
+/^(a)\g{aa}/
Failed: reference to non-existent subpattern at offset 9
/^a.b/<lf>
@@ -8546,7 +8597,7 @@ No match
\d
\v++
\w
- \v+
+ \v++
\S
\v++
\V
@@ -8644,27 +8695,18 @@ No match
+6 ^ ^ (*FAIL)
+6 ^ ^ (*FAIL)
+6 ^ ^ (*FAIL)
- +4 ^ ^ c+
- +2 ^ ^ b?
- +4 ^ ^ c+
- +2 ^^ b?
- +4 ^^ c+
+0 ^ a+
+2 ^ ^ b?
+4 ^ ^ c+
+6 ^ ^ (*FAIL)
+6 ^ ^ (*FAIL)
+6 ^ ^ (*FAIL)
- +4 ^ ^ c+
- +2 ^^ b?
- +4 ^^ c+
+0 ^ a+
+2 ^^ b?
+4 ^ ^ c+
+6 ^ ^ (*FAIL)
+6 ^ ^ (*FAIL)
+6 ^ ^ (*FAIL)
- +4 ^^ c+
No match
/a+b?(*PRUNE)c+(*FAIL)/C
@@ -9233,8 +9275,28 @@ No match
ab
No match
-/a(?!)+b/
-Failed: nothing to repeat at offset 5
+/a(?!)b/BZ
+------------------------------------------------------------------
+ Bra
+ a
+ *FAIL
+ b
+ Ket
+ End
+------------------------------------------------------------------
+
+/(?!)?a/BZ
+------------------------------------------------------------------
+ Bra
+ Brazero
+ Assert not
+ Ket
+ a
+ Ket
+ End
+------------------------------------------------------------------
+ ab
+ 0: a
/a(*FAIL)+b/
Failed: nothing to repeat at offset 8
@@ -9249,6 +9311,7 @@ Starting byte set: x y z
/(?(?=.*b)b|^)/CI
Capturing subpattern count = 0
+May match empty string
Options:
No first char
No need char
@@ -9353,7 +9416,7 @@ No match
No match
/(*NO_START_OPT)xyz/C
- abcxyz
+ abcxyz
--->abcxyz
+15 ^ x
+15 ^ x
@@ -9363,6 +9426,15 @@ No match
+17 ^ ^ z
+18 ^ ^
0: xyz
+
+/(*NO_AUTO_POSSESS)a+b/BZ
+------------------------------------------------------------------
+ Bra
+ a+
+ b
+ Ket
+ End
+------------------------------------------------------------------
/xyz/CY
abcxyz
@@ -10160,7 +10232,6 @@ No set of starting bytes
Capturing subpattern count = 1
Named capturing subpatterns:
a 1
- a 1
No options
No first char
No need char
@@ -10233,7 +10304,7 @@ No match
Ket
Ket
Cond
- 4 Cond nref
+ Cond ref <D>2
X
Alt
Y
@@ -10279,7 +10350,7 @@ No match
CBra 4
d
Cond
- Cond nrecurse 1
+ Cond recurse <A>2
$
Alt
Recurse
@@ -11036,12 +11107,14 @@ No need char
/(^ab|^)+/I
Capturing subpattern count = 1
+May match empty string
Options: anchored
No first char
No need char
/(^ab|^)++/I
Capturing subpattern count = 1
+May match empty string
Options: anchored
No first char
No need char
@@ -11060,12 +11133,14 @@ No need char
/(?:^ab|^)+/I
Capturing subpattern count = 0
+May match empty string
Options: anchored
No first char
No need char
/(?:^ab|^)++/I
Capturing subpattern count = 0
+May match empty string
Options: anchored
No first char
No need char
@@ -11084,12 +11159,14 @@ Need char = 'b'
/(.*ab|.*)+/I
Capturing subpattern count = 1
+May match empty string
No options
First char at start or follows newline
No need char
/(.*ab|.*)++/I
Capturing subpattern count = 1
+May match empty string
No options
First char at start or follows newline
No need char
@@ -11108,12 +11185,14 @@ Need char = 'b'
/(?:.*ab|.*)+/I
Capturing subpattern count = 0
+May match empty string
No options
First char at start or follows newline
No need char
/(?:.*ab|.*)++/I
Capturing subpattern count = 0
+May match empty string
No options
First char at start or follows newline
No need char
@@ -11519,7 +11598,7 @@ Matched, but too many substrings
Assert not
a
Ket
- \w+
+ \w++
Ket
End
------------------------------------------------------------------
@@ -11645,6 +11724,7 @@ Starting byte set: < o t u
/a(*SKIP)c|b(*ACCEPT)|/+S!I
Capturing subpattern count = 0
+May match empty string
No options
No first char
No need char
@@ -11715,11 +11795,11 @@ Minimum match() recursion limit = 45
Bra
^
Once_NC
- a+
+ a++
Ket
Once
CBra 1
- z+
+ z++
Ket
Ket
\w
@@ -11778,14 +11858,14 @@ No match
/^(?>a+)(?>b+)(?>c+)(?>d+)(?>e+)/
\Maabbccddee
-Minimum match() limit = 12
-Minimum match() recursion limit = 3
+Minimum match() limit = 7
+Minimum match() recursion limit = 2
0: aabbccddee
/^(?>(a+))(?>(b+))(?>(c+))(?>(d+))(?>(e+))/
\Maabbccddee
-Minimum match() limit = 22
-Minimum match() recursion limit = 21
+Minimum match() limit = 17
+Minimum match() recursion limit = 16
0: aabbccddee
1: aa
2: bb
@@ -11795,8 +11875,8 @@ Minimum match() recursion limit = 21
/^(?>(a+))(?>b+)(?>(c+))(?>d+)(?>(e+))/
\Maabbccddee
-Minimum match() limit = 18
-Minimum match() recursion limit = 13
+Minimum match() limit = 13
+Minimum match() recursion limit = 10
0: aabbccddee
1: aa
2: cc
@@ -11887,7 +11967,10 @@ No match
Failed: \N is not supported in a class at offset 3
/a[B-\Nc]/
-Failed: \N is not supported in a class at offset 5
+Failed: invalid range in character class at offset 5
+
+/a[B\Nc]/
+Failed: \N is not supported in a class at offset 4
/(a)(?2){0,1999}?(b)/
@@ -12293,6 +12376,7 @@ No need char
/(?>.*?)(?<=(abcd)|(wxyz))/I
Capturing subpattern count = 2
Max lookbehind = 4
+May match empty string
No options
No first char
No need char
@@ -12300,6 +12384,7 @@ No need char
/(?>.*)(?<=(abcd)|(wxyz))/I
Capturing subpattern count = 2
Max lookbehind = 4
+May match empty string
No options
No first char
No need char
@@ -12338,6 +12423,7 @@ Need char = 'c'
/.?/S-I
Capturing subpattern count = 0
+May match empty string
No options
No first char
No need char
@@ -12345,6 +12431,7 @@ Study returned NULL
/.?/S!I
Capturing subpattern count = 0
+May match empty string
No options
No first char
No need char
@@ -12665,4 +12752,1377 @@ No match
aaaaaaaaaaaaaz\Q10
Error -21 (recursion limit exceeded)
+/-- This test causes a segfault with Perl 5.18.0 --/
+
+/^(?=(a)){0}b(?1)/
+ backgammon
+ 0: ba
+
+/(?|(?<n>f)|(?<n>b))/JI
+Capturing subpattern count = 1
+Named capturing subpatterns:
+ n 1
+Options: dupnames
+No first char
+No need char
+
+/(?<a>abc)(?<a>z)\k<a>()/JDZS
+------------------------------------------------------------------
+ Bra
+ CBra 1
+ abc
+ Ket
+ CBra 2
+ z
+ Ket
+ \k<a>2
+ CBra 3
+ Ket
+ Ket
+ End
+------------------------------------------------------------------
+Capturing subpattern count = 3
+Max back reference = 2
+Named capturing subpatterns:
+ a 1
+ a 2
+Options: dupnames
+First char = 'a'
+Need char = 'z'
+Subject length lower bound = 5
+No set of starting bytes
+
+/a*[bcd]/BZ
+------------------------------------------------------------------
+ Bra
+ a*+
+ [b-d]
+ Ket
+ End
+------------------------------------------------------------------
+
+/[bcd]*a/BZ
+------------------------------------------------------------------
+ Bra
+ [b-d]*+
+ a
+ Ket
+ End
+------------------------------------------------------------------
+
+/-- A complete set of tests for auto-possessification of character types --/
+
+/\D+\D \D+\d \D+\S \D+\s \D+\W \D+\w \D+. \D+\C \D+\R \D+\H \D+\h \D+\V \D+\v \D+\Z \D+\z \D+$/BZx
+------------------------------------------------------------------
+ Bra
+ \D+
+ \D
+ \D++
+ \d
+ \D+
+ \S
+ \D+
+ \s
+ \D+
+ \W
+ \D+
+ \w
+ \D+
+ Any
+ \D+
+ AllAny
+ \D+
+ \R
+ \D+
+ \H
+ \D+
+ \h
+ \D+
+ \V
+ \D+
+ \v
+ \D+
+ \Z
+ \D++
+ \z
+ \D+
+ $
+ Ket
+ End
+------------------------------------------------------------------
+
+/\d+\D \d+\d \d+\S \d+\s \d+\W \d+\w \d+. \d+\C \d+\R \d+\H \d+\h \d+\V \d+\v \d+\Z \d+\z \d+$/BZx
+------------------------------------------------------------------
+ Bra
+ \d++
+ \D
+ \d+
+ \d
+ \d+
+ \S
+ \d++
+ \s
+ \d++
+ \W
+ \d+
+ \w
+ \d+
+ Any
+ \d+
+ AllAny
+ \d++
+ \R
+ \d+
+ \H
+ \d++
+ \h
+ \d+
+ \V
+ \d++
+ \v
+ \d++
+ \Z
+ \d++
+ \z
+ \d++
+ $
+ Ket
+ End
+------------------------------------------------------------------
+
+/\S+\D \S+\d \S+\S \S+\s \S+\W \S+\w \S+. \S+\C \S+\R \S+\H \S+\h \S+\V \S+\v \S+\Z \S+\z \S+$/BZx
+------------------------------------------------------------------
+ Bra
+ \S+
+ \D
+ \S+
+ \d
+ \S+
+ \S
+ \S++
+ \s
+ \S+
+ \W
+ \S+
+ \w
+ \S+
+ Any
+ \S+
+ AllAny
+ \S++
+ \R
+ \S+
+ \H
+ \S++
+ \h
+ \S+
+ \V
+ \S++
+ \v
+ \S++
+ \Z
+ \S++
+ \z
+ \S++
+ $
+ Ket
+ End
+------------------------------------------------------------------
+
+/\s+\D \s+\d \s+\S \s+\s \s+\W \s+\w \s+. \s+\C \s+\R \s+\H \s+\h \s+\V \s+\v \s+\Z \s+\z \s+$/BZx
+------------------------------------------------------------------
+ Bra
+ \s+
+ \D
+ \s++
+ \d
+ \s++
+ \S
+ \s+
+ \s
+ \s+
+ \W
+ \s++
+ \w
+ \s+
+ Any
+ \s+
+ AllAny
+ \s+
+ \R
+ \s+
+ \H
+ \s+
+ \h
+ \s+
+ \V
+ \s+
+ \v
+ \s+
+ \Z
+ \s++
+ \z
+ \s+
+ $
+ Ket
+ End
+------------------------------------------------------------------
+
+/\W+\D \W+\d \W+\S \W+\s \W+\W \W+\w \W+. \W+\C \W+\R \W+\H \W+\h \W+\V \W+\v \W+\Z \W+\z \W+$/BZx
+------------------------------------------------------------------
+ Bra
+ \W+
+ \D
+ \W++
+ \d
+ \W+
+ \S
+ \W+
+ \s
+ \W+
+ \W
+ \W++
+ \w
+ \W+
+ Any
+ \W+
+ AllAny
+ \W+
+ \R
+ \W+
+ \H
+ \W+
+ \h
+ \W+
+ \V
+ \W+
+ \v
+ \W+
+ \Z
+ \W++
+ \z
+ \W+
+ $
+ Ket
+ End
+------------------------------------------------------------------
+
+/\w+\D \w+\d \w+\S \w+\s \w+\W \w+\w \w+. \w+\C \w+\R \w+\H \w+\h \w+\V \w+\v \w+\Z \w+\z \w+$/BZx
+------------------------------------------------------------------
+ Bra
+ \w+
+ \D
+ \w+
+ \d
+ \w+
+ \S
+ \w++
+ \s
+ \w++
+ \W
+ \w+
+ \w
+ \w+
+ Any
+ \w+
+ AllAny
+ \w++
+ \R
+ \w+
+ \H
+ \w++
+ \h
+ \w+
+ \V
+ \w++
+ \v
+ \w++
+ \Z
+ \w++
+ \z
+ \w++
+ $
+ Ket
+ End
+------------------------------------------------------------------
+
+/\C+\D \C+\d \C+\S \C+\s \C+\W \C+\w \C+. \C+\C \C+\R \C+\H \C+\h \C+\V \C+\v \C+\Z \C+\z \C+$/BZx
+------------------------------------------------------------------
+ Bra
+ AllAny+
+ \D
+ AllAny+
+ \d
+ AllAny+
+ \S
+ AllAny+
+ \s
+ AllAny+
+ \W
+ AllAny+
+ \w
+ AllAny+
+ Any
+ AllAny+
+ AllAny
+ AllAny+
+ \R
+ AllAny+
+ \H
+ AllAny+
+ \h
+ AllAny+
+ \V
+ AllAny+
+ \v
+ AllAny+
+ \Z
+ AllAny++
+ \z
+ AllAny+
+ $
+ Ket
+ End
+------------------------------------------------------------------
+
+/\R+\D \R+\d \R+\S \R+\s \R+\W \R+\w \R+. \R+\C \R+\R \R+\H \R+\h \R+\V \R+\v \R+\Z \R+\z \R+$/BZx
+------------------------------------------------------------------
+ Bra
+ \R+
+ \D
+ \R++
+ \d
+ \R+
+ \S
+ \R++
+ \s
+ \R+
+ \W
+ \R++
+ \w
+ \R++
+ Any
+ \R+
+ AllAny
+ \R+
+ \R
+ \R+
+ \H
+ \R++
+ \h
+ \R+
+ \V
+ \R+
+ \v
+ \R+
+ \Z
+ \R++
+ \z
+ \R+
+ $
+ Ket
+ End
+------------------------------------------------------------------
+
+/\H+\D \H+\d \H+\S \H+\s \H+\W \H+\w \H+. \H+\C \H+\R \H+\H \H+\h \H+\V \H+\v \H+\Z \H+\z \H+$/BZx
+------------------------------------------------------------------
+ Bra
+ \H+
+ \D
+ \H+
+ \d
+ \H+
+ \S
+ \H+
+ \s
+ \H+
+ \W
+ \H+
+ \w
+ \H+
+ Any
+ \H+
+ AllAny
+ \H+
+ \R
+ \H+
+ \H
+ \H++
+ \h
+ \H+
+ \V
+ \H+
+ \v
+ \H+
+ \Z
+ \H++
+ \z
+ \H+
+ $
+ Ket
+ End
+------------------------------------------------------------------
+
+/\h+\D \h+\d \h+\S \h+\s \h+\W \h+\w \h+. \h+\C \h+\R \h+\H \h+\h \h+\V \h+\v \h+\Z \h+\z \h+$/BZx
+------------------------------------------------------------------
+ Bra
+ \h+
+ \D
+ \h++
+ \d
+ \h++
+ \S
+ \h+
+ \s
+ \h+
+ \W
+ \h++
+ \w
+ \h+
+ Any
+ \h+
+ AllAny
+ \h++
+ \R
+ \h++
+ \H
+ \h+
+ \h
+ \h+
+ \V
+ \h++
+ \v
+ \h+
+ \Z
+ \h++
+ \z
+ \h+
+ $
+ Ket
+ End
+------------------------------------------------------------------
+
+/\V+\D \V+\d \V+\S \V+\s \V+\W \V+\w \V+. \V+\C \V+\R \V+\H \V+\h \V+\V \V+\v \V+\Z \V+\z \V+$/BZx
+------------------------------------------------------------------
+ Bra
+ \V+
+ \D
+ \V+
+ \d
+ \V+
+ \S
+ \V+
+ \s
+ \V+
+ \W
+ \V+
+ \w
+ \V+
+ Any
+ \V+
+ AllAny
+ \V++
+ \R
+ \V+
+ \H
+ \V+
+ \h
+ \V+
+ \V
+ \V++
+ \v
+ \V+
+ \Z
+ \V++
+ \z
+ \V+
+ $
+ Ket
+ End
+------------------------------------------------------------------
+
+/\v+\D \v+\d \v+\S \v+\s \v+\W \v+\w \v+. \v+\C \v+\R \v+\H \v+\h \v+\V \v+\v \v+\Z \v+\z \v+$/BZx
+------------------------------------------------------------------
+ Bra
+ \v+
+ \D
+ \v++
+ \d
+ \v++
+ \S
+ \v+
+ \s
+ \v+
+ \W
+ \v++
+ \w
+ \v+
+ Any
+ \v+
+ AllAny
+ \v+
+ \R
+ \v+
+ \H
+ \v++
+ \h
+ \v++
+ \V
+ \v+
+ \v
+ \v+
+ \Z
+ \v++
+ \z
+ \v+
+ $
+ Ket
+ End
+------------------------------------------------------------------
+
+/ a+\D a+\d a+\S a+\s a+\W a+\w a+. a+\C a+\R a+\H a+\h a+\V a+\v a+\Z a+\z a+$/BZx
+------------------------------------------------------------------
+ Bra
+ a+
+ \D
+ a++
+ \d
+ a+
+ \S
+ a++
+ \s
+ a++
+ \W
+ a+
+ \w
+ a+
+ Any
+ a+
+ AllAny
+ a++
+ \R
+ a+
+ \H
+ a++
+ \h
+ a+
+ \V
+ a++
+ \v
+ a++
+ \Z
+ a++
+ \z
+ a++
+ $
+ Ket
+ End
+------------------------------------------------------------------
+
+/\n+\D \n+\d \n+\S \n+\s \n+\W \n+\w \n+. \n+\C \n+\R \n+\H \n+\h \n+\V \n+\v \n+\Z \n+\z \n+$/BZx
+------------------------------------------------------------------
+ Bra
+ \x0a+
+ \D
+ \x0a++
+ \d
+ \x0a++
+ \S
+ \x0a+
+ \s
+ \x0a+
+ \W
+ \x0a++
+ \w
+ \x0a+
+ Any
+ \x0a+
+ AllAny
+ \x0a+
+ \R
+ \x0a+
+ \H
+ \x0a++
+ \h
+ \x0a++
+ \V
+ \x0a+
+ \v
+ \x0a+
+ \Z
+ \x0a++
+ \z
+ \x0a+
+ $
+ Ket
+ End
+------------------------------------------------------------------
+
+/ .+\D .+\d .+\S .+\s .+\W .+\w .+. .+\C .+\R .+\H .+\h .+\V .+\v .+\Z .+\z .+$/BZx
+------------------------------------------------------------------
+ Bra
+ Any+
+ \D
+ Any+
+ \d
+ Any+
+ \S
+ Any+
+ \s
+ Any+
+ \W
+ Any+
+ \w
+ Any+
+ Any
+ Any+
+ AllAny
+ Any++
+ \R
+ Any+
+ \H
+ Any+
+ \h
+ Any+
+ \V
+ Any+
+ \v
+ Any+
+ \Z
+ Any++
+ \z
+ Any+
+ $
+ Ket
+ End
+------------------------------------------------------------------
+
+/ .+\D .+\d .+\S .+\s .+\W .+\w .+. .+\C .+\R .+\H .+\h .+\V .+\v .+\Z .+\z .+$/BZxs
+------------------------------------------------------------------
+ Bra
+ AllAny+
+ \D
+ AllAny+
+ \d
+ AllAny+
+ \S
+ AllAny+
+ \s
+ AllAny+
+ \W
+ AllAny+
+ \w
+ AllAny+
+ AllAny
+ AllAny+
+ AllAny
+ AllAny+
+ \R
+ AllAny+
+ \H
+ AllAny+
+ \h
+ AllAny+
+ \V
+ AllAny+
+ \v
+ AllAny+
+ \Z
+ AllAny++
+ \z
+ AllAny+
+ $
+ Ket
+ End
+------------------------------------------------------------------
+
+/\D+$ \d+$ \S+$ \s+$ \W+$ \w+$ \C+$ \R+$ \H+$ \h+$ \V+$ \v+$ a+$ \n+$ .+$ .+$/BZxm
+------------------------------------------------------------------
+ Bra
+ \D+
+ /m $
+ \d++
+ /m $
+ \S++
+ /m $
+ \s+
+ /m $
+ \W+
+ /m $
+ \w++
+ /m $
+ AllAny+
+ /m $
+ \R+
+ /m $
+ \H+
+ /m $
+ \h+
+ /m $
+ \V+
+ /m $
+ \v+
+ /m $
+ a+
+ /m $
+ \x0a+
+ /m $
+ Any+
+ /m $
+ Any+
+ /m $
+ Ket
+ End
+------------------------------------------------------------------
+
+/(?=a+)a(a+)++a/BZ
+------------------------------------------------------------------
+ Bra
+ Assert
+ a++
+ Ket
+ a
+ CBraPos 1
+ a++
+ KetRpos
+ a
+ Ket
+ End
+------------------------------------------------------------------
+
+/a+(bb|cc)a+(?:bb|cc)a+(?>bb|cc)a+(?:bb|cc)+a+(aa)a+(?:bb|aa)/BZ
+------------------------------------------------------------------
+ Bra
+ a++
+ CBra 1
+ bb
+ Alt
+ cc
+ Ket
+ a++
+ Bra
+ bb
+ Alt
+ cc
+ Ket
+ a++
+ Once_NC
+ bb
+ Alt
+ cc
+ Ket
+ a++
+ Bra
+ bb
+ Alt
+ cc
+ KetRmax
+ a+
+ CBra 2
+ aa
+ Ket
+ a+
+ Bra
+ bb
+ Alt
+ aa
+ Ket
+ Ket
+ End
+------------------------------------------------------------------
+
+/a+(bb|cc)?#a+(?:bb|cc)??#a+(?:bb|cc)?+#a+(?:bb|cc)*#a+(bb|cc)?a#a+(?:aa)?/BZ
+------------------------------------------------------------------
+ Bra
+ a++
+ Brazero
+ CBra 1
+ bb
+ Alt
+ cc
+ Ket
+ #
+ a++
+ Braminzero
+ Bra
+ bb
+ Alt
+ cc
+ Ket
+ #
+ a++
+ Once
+ Brazero
+ Bra
+ bb
+ Alt
+ cc
+ Ket
+ Ket
+ #
+ a++
+ Brazero
+ Bra
+ bb
+ Alt
+ cc
+ KetRmax
+ #
+ a+
+ Brazero
+ CBra 2
+ bb
+ Alt
+ cc
+ Ket
+ a#
+ a+
+ Brazero
+ Bra
+ aa
+ Ket
+ Ket
+ End
+------------------------------------------------------------------
+
+/a+(?:bb)?a#a+(?:|||)#a+(?:|b)a#a+(?:|||)?a/BZ
+------------------------------------------------------------------
+ Bra
+ a+
+ Brazero
+ Bra
+ bb
+ Ket
+ a#
+ a++
+ Bra
+ Alt
+ Alt
+ Alt
+ Ket
+ #
+ a+
+ Bra
+ Alt
+ b
+ Ket
+ a#
+ a+
+ Brazero
+ Bra
+ Alt
+ Alt
+ Alt
+ Ket
+ a
+ Ket
+ End
+------------------------------------------------------------------
+
+/[ab]*/BZ
+------------------------------------------------------------------
+ Bra
+ [ab]*+
+ Ket
+ End
+------------------------------------------------------------------
+ aaaa
+ 0: aaaa
+
+/[ab]*?/BZ
+------------------------------------------------------------------
+ Bra
+ [ab]*?
+ Ket
+ End
+------------------------------------------------------------------
+ aaaa
+ 0:
+
+/[ab]?/BZ
+------------------------------------------------------------------
+ Bra
+ [ab]?+
+ Ket
+ End
+------------------------------------------------------------------
+ aaaa
+ 0: a
+
+/[ab]??/BZ
+------------------------------------------------------------------
+ Bra
+ [ab]??
+ Ket
+ End
+------------------------------------------------------------------
+ aaaa
+ 0:
+
+/[ab]+/BZ
+------------------------------------------------------------------
+ Bra
+ [ab]++
+ Ket
+ End
+------------------------------------------------------------------
+ aaaa
+ 0: aaaa
+
+/[ab]+?/BZ
+------------------------------------------------------------------
+ Bra
+ [ab]+?
+ Ket
+ End
+------------------------------------------------------------------
+ aaaa
+ 0: a
+
+/[ab]{2,3}/BZ
+------------------------------------------------------------------
+ Bra
+ [ab]{2,3}+
+ Ket
+ End
+------------------------------------------------------------------
+ aaaa
+ 0: aaa
+
+/[ab]{2,3}?/BZ
+------------------------------------------------------------------
+ Bra
+ [ab]{2,3}?
+ Ket
+ End
+------------------------------------------------------------------
+ aaaa
+ 0: aa
+
+/[ab]{2,}/BZ
+------------------------------------------------------------------
+ Bra
+ [ab]{2,}+
+ Ket
+ End
+------------------------------------------------------------------
+ aaaa
+ 0: aaaa
+
+/[ab]{2,}?/BZ
+------------------------------------------------------------------
+ Bra
+ [ab]{2,}?
+ Ket
+ End
+------------------------------------------------------------------
+ aaaa
+ 0: aa
+
+/\d+\s{0,5}=\s*\S?=\w{0,4}\W*/BZ
+------------------------------------------------------------------
+ Bra
+ \d++
+ \s{0,5}+
+ =
+ \s*+
+ \S?
+ =
+ \w{0,4}+
+ \W*+
+ Ket
+ End
+------------------------------------------------------------------
+
+/[a-d]{5,12}[e-z0-9]*#[^a-z]+[b-y]*a[2-7]?[^0-9a-z]+/BZ
+------------------------------------------------------------------
+ Bra
+ [a-d]{5,12}+
+ [0-9e-z]*+
+ #
+ [\x00-`{-\xff] (neg)++
+ [b-y]*+
+ a
+ [2-7]?+
+ [\x00-/:-`{-\xff] (neg)++
+ Ket
+ End
+------------------------------------------------------------------
+
+/[a-z]*\s#[ \t]?\S#[a-c]*\S#[C-G]+?\d#[4-8]*\D#[4-9,]*\D#[!$]{0,5}\w#[M-Xf-l]+\W#[a-c,]?\W/BZ
+------------------------------------------------------------------
+ Bra
+ [a-z]*+
+ \s
+ #
+ [\x09 ]?+
+ \S
+ #
+ [a-c]*
+ \S
+ #
+ [C-G]++
+ \d
+ #
+ [4-8]*+
+ \D
+ #
+ [,4-9]*
+ \D
+ #
+ [!$]{0,5}+
+ \w
+ #
+ [M-Xf-l]++
+ \W
+ #
+ [,a-c]?
+ \W
+ Ket
+ End
+------------------------------------------------------------------
+
+/a+(aa|bb)*c#a*(bb|cc)*a#a?(bb|cc)*d#[a-f]*(g|hh)*f/BZ
+------------------------------------------------------------------
+ Bra
+ a+
+ Brazero
+ CBra 1
+ aa
+ Alt
+ bb
+ KetRmax
+ c#
+ a*
+ Brazero
+ CBra 2
+ bb
+ Alt
+ cc
+ KetRmax
+ a#
+ a?+
+ Brazero
+ CBra 3
+ bb
+ Alt
+ cc
+ KetRmax
+ d#
+ [a-f]*
+ Brazero
+ CBra 4
+ g
+ Alt
+ hh
+ KetRmax
+ f
+ Ket
+ End
+------------------------------------------------------------------
+
+/[a-f]*(g|hh|i)*i#[a-x]{4,}(y{0,6})*y#[a-k]+(ll|mm)+n/BZ
+------------------------------------------------------------------
+ Bra
+ [a-f]*+
+ Brazero
+ CBra 1
+ g
+ Alt
+ hh
+ Alt
+ i
+ KetRmax
+ i#
+ [a-x]{4,}
+ Brazero
+ SCBra 2
+ y{0,6}
+ KetRmax
+ y#
+ [a-k]++
+ CBra 3
+ ll
+ Alt
+ mm
+ KetRmax
+ n
+ Ket
+ End
+------------------------------------------------------------------
+
+/[a-f]*(?>gg|hh)+#[a-f]*(?>gg|hh)?#[a-f]*(?>gg|hh)*a#[a-f]*(?>gg|hh)*h/BZ
+------------------------------------------------------------------
+ Bra
+ [a-f]*+
+ Once_NC
+ gg
+ Alt
+ hh
+ KetRmax
+ #
+ [a-f]*+
+ Brazero
+ Once_NC
+ gg
+ Alt
+ hh
+ Ket
+ #
+ [a-f]*
+ Brazero
+ Once_NC
+ gg
+ Alt
+ hh
+ KetRmax
+ a#
+ [a-f]*+
+ Brazero
+ Once_NC
+ gg
+ Alt
+ hh
+ KetRmax
+ h
+ Ket
+ End
+------------------------------------------------------------------
+
+/[a-c]*d/DZS
+------------------------------------------------------------------
+ Bra
+ [a-c]*+
+ d
+ Ket
+ End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+No options
+No first char
+Need char = 'd'
+Subject length lower bound = 1
+Starting byte set: a b c d
+
+/[a-c]+d/DZS
+------------------------------------------------------------------
+ Bra
+ [a-c]++
+ d
+ Ket
+ End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+No options
+No first char
+Need char = 'd'
+Subject length lower bound = 2
+Starting byte set: a b c
+
+/[a-c]?d/DZS
+------------------------------------------------------------------
+ Bra
+ [a-c]?+
+ d
+ Ket
+ End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+No options
+No first char
+Need char = 'd'
+Subject length lower bound = 1
+Starting byte set: a b c d
+
+/[a-c]{4,6}d/DZS
+------------------------------------------------------------------
+ Bra
+ [a-c]{4,6}+
+ d
+ Ket
+ End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+No options
+No first char
+Need char = 'd'
+Subject length lower bound = 5
+Starting byte set: a b c
+
+/[a-c]{0,6}d/DZS
+------------------------------------------------------------------
+ Bra
+ [a-c]{0,6}+
+ d
+ Ket
+ End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+No options
+No first char
+Need char = 'd'
+Subject length lower bound = 1
+Starting byte set: a b c d
+
+/-- End of special auto-possessive tests --/
+
+/^A\o{1239}B/
+Failed: non-octal character in \o{} (closing brace missing?) at offset 8
+
+/^A\oB/
+Failed: missing opening brace after \o at offset 3
+
+/^A\x{zz}B/
+Failed: non-hex character in \x{} (closing brace missing?) at offset 5
+
+/^A\x{12Z/
+Failed: non-hex character in \x{} (closing brace missing?) at offset 7
+
+/^A\x{/
+Failed: non-hex character in \x{} (closing brace missing?) at offset 5
+
+/[ab]++/BZO
+------------------------------------------------------------------
+ Bra
+ [ab]++
+ Ket
+ End
+------------------------------------------------------------------
+
+/[^ab]*+/BZO
+------------------------------------------------------------------
+ Bra
+ [\x00-`c-\xff] (neg)*+
+ Ket
+ End
+------------------------------------------------------------------
+
+/a{4}+/BZO
+------------------------------------------------------------------
+ Bra
+ a{4}
+ Ket
+ End
+------------------------------------------------------------------
+
+/a{4}+/BZOi
+------------------------------------------------------------------
+ Bra
+ /i a{4}
+ Ket
+ End
+------------------------------------------------------------------
+
+/[a-[:digit:]]+/
+Failed: invalid range in character class at offset 3
+
+/[A-[:digit:]]+/
+Failed: invalid range in character class at offset 3
+
+/[a-[.xxx.]]+/
+Failed: invalid range in character class at offset 3
+
+/[a-[=xxx=]]+/
+Failed: invalid range in character class at offset 3
+
+/[a-[!xxx!]]+/
+Failed: range out of order in character class at offset 3
+
+/[A-[!xxx!]]+/
+ A]]]
+ 0: A]]]
+
+/[a-\d]+/
+Failed: invalid range in character class at offset 4
+
+/(?<0abc>xx)/
+Failed: group name must start with a non-digit at offset 3
+
+/(?&1abc)xx(?<1abc>y)/
+Failed: group name must start with a non-digit at offset 3
+
+/(?<ab-cd>xx)/
+Failed: syntax error in subpattern name (missing terminator) at offset 5
+
+/(?'0abc'xx)/
+Failed: group name must start with a non-digit at offset 3
+
+/(?P<0abc>xx)/
+Failed: group name must start with a non-digit at offset 4
+
+/\k<5ghj>/
+Failed: group name must start with a non-digit at offset 3
+
+/\k'5ghj'/
+Failed: group name must start with a non-digit at offset 3
+
+/\k{2fgh}/
+Failed: group name must start with a non-digit at offset 3
+
+/(?P=8yuki)/
+Failed: group name must start with a non-digit at offset 4
+
+/\g{4df}/
+Failed: group name must start with a non-digit at offset 3
+
+/(?&1abc)xx(?<1abc>y)/
+Failed: group name must start with a non-digit at offset 3
+
+/(?P>1abc)xx(?<1abc>y)/
+Failed: group name must start with a non-digit at offset 4
+
+/\g'3gh'/
+Failed: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number at offset 7
+
+/\g<5fg>/
+Failed: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number at offset 7
+
+/(?(<4gh>)abc)/
+Failed: group name must start with a non-digit at offset 4
+
+/(?('4gh')abc)/
+Failed: group name must start with a non-digit at offset 4
+
+/(?(4gh)abc)/
+Failed: malformed number or name after (?( at offset 4
+
+/(?(R&6yh)abc)/
+Failed: group name must start with a non-digit at offset 5
+
+/-- Test the ugly "start or end of word" compatibility syntax --/
+
+/[[:<:]]red[[:>:]]/BZ
+------------------------------------------------------------------
+ Bra
+ \b
+ Assert
+ \w
+ Ket
+ red
+ \b
+ AssertB
+ Reverse
+ \w
+ Ket
+ Ket
+ End
+------------------------------------------------------------------
+ little red riding hood
+ 0: red
+ a /red/ thing
+ 0: red
+ red is a colour
+ 0: red
+ put it all on red
+ 0: red
+ ** Failers
+No match
+ no reduction
+No match
+ Alfred Winifred
+No match
+
+/[a[:<:]] should give error/
+Failed: unknown POSIX class name at offset 4
+
/-- End of testinput2 --/
diff --git a/pcre/testdata/testoutput20 b/pcre/testdata/testoutput20
index 7753be2db6a..c1b20ee804a 100644
--- a/pcre/testdata/testoutput20
+++ b/pcre/testdata/testoutput20
@@ -8,12 +8,10 @@
/^\x{ffff}?/i
\x{ffff}
0: \x{ffff}
- 1:
/^\x{ffff}*/i
\x{ffff}
0: \x{ffff}
- 1:
/^\x{ffff}{3}/i
\x{ffff}\x{ffff}\x{ffff}
@@ -22,6 +20,5 @@
/^\x{ffff}{0,3}/i
\x{ffff}
0: \x{ffff}
- 1:
/-- End of testinput20 --/
diff --git a/pcre/testdata/testoutput21-16 b/pcre/testdata/testoutput21-16
index e831888a9e4..0e21350f891 100644
--- a/pcre/testdata/testoutput21-16
+++ b/pcre/testdata/testoutput21-16
@@ -8,7 +8,11 @@ No study data
Error -28 from pcre16_fullinfo(0)
Running in 16-bit mode but pattern was compiled in 8-bit mode
-%-- Generated from: ^[aL](?P<name>(?:[AaLl]+)[^xX-]*?)(?P<other>[\x{150}-\x{250}\x{300}]|[^\x{800}aAs-uS-U\x{d800}-\x{dfff}])++[^#\b\x{500}\x{1000}]{3,5}$
+%-- Generated from:
+ /^[aL](?P<name>(?:[AaLl]+)[^xX-]*?)(?P<other>[\x{150}-\x{250}\x{300}]|
+ [^\x{800}aAs-uS-U\x{d800}-\x{dfff}])++[^#\b\x{500}\x{1000}]{3,5}$
+ /x
+
In 16-bit mode with options: S>testdata/saved16LE-1
FS>testdata/saved16BE-1
In 32-bit mode with options: S>testdata/saved32LE-1
@@ -42,7 +46,7 @@ Capturing subpattern count = 2
Named capturing subpatterns:
name 1
other 2
-Options: anchored
+Options: anchored extended
No first char
No need char
Subject length lower bound = 6
@@ -75,7 +79,7 @@ Capturing subpattern count = 2
Named capturing subpatterns:
name 1
other 2
-Options: anchored
+Options: anchored extended
No first char
No need char
Subject length lower bound = 6
diff --git a/pcre/testdata/testoutput21-32 b/pcre/testdata/testoutput21-32
index c6e8f6ca0ca..183487aca13 100644
--- a/pcre/testdata/testoutput21-32
+++ b/pcre/testdata/testoutput21-32
@@ -8,7 +8,11 @@ No study data
Error -28 from pcre32_fullinfo(0)
Running in 32-bit mode but pattern was compiled in 8-bit mode
-%-- Generated from: ^[aL](?P<name>(?:[AaLl]+)[^xX-]*?)(?P<other>[\x{150}-\x{250}\x{300}]|[^\x{800}aAs-uS-U\x{d800}-\x{dfff}])++[^#\b\x{500}\x{1000}]{3,5}$
+%-- Generated from:
+ /^[aL](?P<name>(?:[AaLl]+)[^xX-]*?)(?P<other>[\x{150}-\x{250}\x{300}]|
+ [^\x{800}aAs-uS-U\x{d800}-\x{dfff}])++[^#\b\x{500}\x{1000}]{3,5}$
+ /x
+
In 16-bit mode with options: S>testdata/saved16LE-1
FS>testdata/saved16BE-1
In 32-bit mode with options: S>testdata/saved32LE-1
@@ -54,7 +58,7 @@ Capturing subpattern count = 2
Named capturing subpatterns:
name 1
other 2
-Options: anchored
+Options: anchored extended
No first char
No need char
Subject length lower bound = 6
@@ -87,7 +91,7 @@ Capturing subpattern count = 2
Named capturing subpatterns:
name 1
other 2
-Options: anchored
+Options: anchored extended
No first char
No need char
Subject length lower bound = 6
diff --git a/pcre/testdata/testoutput22-16 b/pcre/testdata/testoutput22-16
index b2c673d43a0..f896b13e18a 100644
--- a/pcre/testdata/testoutput22-16
+++ b/pcre/testdata/testoutput22-16
@@ -1,10 +1,15 @@
/-- Tests for reloading pre-compile patterns with UTF-16 or UTF-32 support. */
-%-- Generated from: (?P<cbra1>[aZ\x{400}-\x{10ffff}]{4,}[\x{f123}\x{10039}\x{20000}-\x{21234}]?|[A-Cx-z\x{100000}-\x{1000a7}\x{101234}])(?<cb2>[^az])
- In 16-bit mode with options: S8>testdata/saved16LE-1
- FS8>testdata/saved16BE-1
- In 32-bit mode with options: S8>testdata/saved32LE-1
- FS8testdata/saved32BE-1
+%-- Generated from:
+ /(?P<cbra1>[aZ\x{400}-\x{10ffff}]{4,}
+ [\x{f123}\x{10039}\x{20000}-\x{21234}]?|
+ [A-Cx-z\x{100000}-\x{1000a7}\x{101234}])
+ (?<cb2>[^az])/x
+
+ In 16-bit mode with options: S8>testdata/saved16LE-2
+ FS8>testdata/saved16BE-2
+ In 32-bit mode with options: S8>testdata/saved32LE-2
+ FS8>testdata/saved32BE-2
--%8x
<!testsaved16LE-2
@@ -28,7 +33,7 @@ Capturing subpattern count = 2
Named capturing subpatterns:
cb2 2
cbra1 1
-Options: utf
+Options: extended utf
No first char
No need char
Subject length lower bound = 2
@@ -55,7 +60,7 @@ Capturing subpattern count = 2
Named capturing subpatterns:
cb2 2
cbra1 1
-Options: utf
+Options: extended utf
No first char
No need char
Subject length lower bound = 2
diff --git a/pcre/testdata/testoutput22-32 b/pcre/testdata/testoutput22-32
index 5a1d0dac3ec..783926b8210 100644
--- a/pcre/testdata/testoutput22-32
+++ b/pcre/testdata/testoutput22-32
@@ -1,10 +1,15 @@
/-- Tests for reloading pre-compile patterns with UTF-16 or UTF-32 support. */
-%-- Generated from: (?P<cbra1>[aZ\x{400}-\x{10ffff}]{4,}[\x{f123}\x{10039}\x{20000}-\x{21234}]?|[A-Cx-z\x{100000}-\x{1000a7}\x{101234}])(?<cb2>[^az])
- In 16-bit mode with options: S8>testdata/saved16LE-1
- FS8>testdata/saved16BE-1
- In 32-bit mode with options: S8>testdata/saved32LE-1
- FS8testdata/saved32BE-1
+%-- Generated from:
+ /(?P<cbra1>[aZ\x{400}-\x{10ffff}]{4,}
+ [\x{f123}\x{10039}\x{20000}-\x{21234}]?|
+ [A-Cx-z\x{100000}-\x{1000a7}\x{101234}])
+ (?<cb2>[^az])/x
+
+ In 16-bit mode with options: S8>testdata/saved16LE-2
+ FS8>testdata/saved16BE-2
+ In 32-bit mode with options: S8>testdata/saved32LE-2
+ FS8>testdata/saved32BE-2
--%8x
<!testsaved16LE-2
@@ -40,7 +45,7 @@ Capturing subpattern count = 2
Named capturing subpatterns:
cb2 2
cbra1 1
-Options: utf
+Options: extended utf
No first char
No need char
Subject length lower bound = 2
@@ -67,7 +72,7 @@ Capturing subpattern count = 2
Named capturing subpatterns:
cb2 2
cbra1 1
-Options: utf
+Options: extended utf
No first char
No need char
Subject length lower bound = 2
diff --git a/pcre/testdata/testoutput23 b/pcre/testdata/testoutput23
index 7b3634ca8a9..6f5384c34e8 100644
--- a/pcre/testdata/testoutput23
+++ b/pcre/testdata/testoutput23
@@ -1,5 +1,7 @@
/-- Tests for the 16-bit library only */
+< forbid 8W
+
/-- Check maximum non-UTF character size --/
/\x{ffff}/
@@ -7,7 +9,9 @@
0: \x{ffff}
/\x{10000}/
-Failed: character value in \x{...} sequence is too large at offset 8
+Failed: character value in \x{} or \o{} is too large at offset 8
+
+/\o{20000}/
/-- Check character ranges --/
diff --git a/pcre/testdata/testoutput24 b/pcre/testdata/testoutput24
index 3f8cabe84c8..0714a0fe156 100644
--- a/pcre/testdata/testoutput24
+++ b/pcre/testdata/testoutput24
@@ -1,5 +1,7 @@
/-- Tests for the 16-bit library with UTF-16 support only */
+< forbid W
+
/bad/8
\x{d800}
Error -10 (bad UTF-16 string) offset=0 reason=1
diff --git a/pcre/testdata/testoutput25 b/pcre/testdata/testoutput25
index 2a4066dfc48..7ad3378368f 100644
--- a/pcre/testdata/testoutput25
+++ b/pcre/testdata/testoutput25
@@ -1,5 +1,7 @@
/-- Tests for the 32-bit library only */
+< forbid 8w
+
/-- Check maximum character size --/
/\x{110000}/
@@ -10,6 +12,18 @@
/\x{ffffffff}/
+/\x{100000000}/
+Failed: character value in \x{} or \o{} is too large at offset 12
+
+/\o{17777777777}/
+
+/\o{20000000000}/
+
+/\o{37777777777}/
+
+/\o{40000000000}/
+Failed: character value in \x{} or \o{} is too large at offset 14
+
/\x{7fffffff}\x{7fffffff}/I
Capturing subpattern count = 0
No options
diff --git a/pcre/testdata/testoutput26 b/pcre/testdata/testoutput26
index 0e6d0559fab..28f8d42a5ed 100644
--- a/pcre/testdata/testoutput26
+++ b/pcre/testdata/testoutput26
@@ -1,9 +1,14 @@
/-- Tests for the 32-bit library with UTF-32 support only */
+< forbid W
+
/-- Non-UTF characters --/
/\x{110000}/8
-Failed: character value in \x{...} sequence is too large at offset 9
+Failed: character value in \x{} or \o{} is too large at offset 9
+
+/\o{4200000}/8
+Failed: character value in \x{} or \o{} is too large at offset 10
/\C/8
\x{110000}
diff --git a/pcre/testdata/testoutput3 b/pcre/testdata/testoutput3
index 7b0a3e926e1..12ffc9911b6 100644
--- a/pcre/testdata/testoutput3
+++ b/pcre/testdata/testoutput3
@@ -1,6 +1,8 @@
/-- This set of tests checks local-specific features, using the fr_FR locale.
It is not Perl-compatible. There is different version called wintestinput3
f or use on Windows, where the locale is called "french". --/
+
+< forbid 8W
/^[\w]+/
*** Failers
diff --git a/pcre/testdata/testoutput4 b/pcre/testdata/testoutput4
index 6694111fb55..0dbec4eccab 100644
--- a/pcre/testdata/testoutput4
+++ b/pcre/testdata/testoutput4
@@ -1,6 +1,8 @@
/-- This set of tests is for UTF support, excluding Unicode properties. It is
compatible with all versions of Perl >= 5.10 and both the 8-bit and 16-bit
PCRE libraries. --/
+
+< forbid 9?=ABCDEFfGILMNPTUWXZ<
/a.b/8
acb
@@ -1257,4 +1259,8 @@ No match
\x{100}\x{100}\x{100}
No match
+/^a+[a\x{200}]/8
+ aa
+ 0: aa
+
/-- End of testinput4 --/
diff --git a/pcre/testdata/testoutput5 b/pcre/testdata/testoutput5
index d583119dd9b..3fa581052e6 100644
--- a/pcre/testdata/testoutput5
+++ b/pcre/testdata/testoutput5
@@ -1,26 +1,47 @@
/-- This set of tests checks the API, internals, and non-Perl stuff for UTF
support, excluding Unicode properties. However, tests that give different
results in 8-bit and 16-bit modes are excluded (see tests 16 and 17). --/
+
+< forbid W
/\x{110000}/8DZ
-Failed: character value in \x{...} sequence is too large at offset 9
+Failed: character value in \x{} or \o{} is too large at offset 9
+
+/\o{4200000}/8DZ
+Failed: character value in \x{} or \o{} is too large at offset 10
/\x{ffffffff}/8
-Failed: character value in \x{...} sequence is too large at offset 11
+Failed: character value in \x{} or \o{} is too large at offset 11
+
+/\o{37777777777}/8
+Failed: character value in \x{} or \o{} is too large at offset 14
/\x{100000000}/8
-Failed: character value in \x{...} sequence is too large at offset 12
+Failed: character value in \x{} or \o{} is too large at offset 12
+
+/\o{77777777777}/8
+Failed: character value in \x{} or \o{} is too large at offset 14
/\x{d800}/8
Failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 7
+/\o{154000}/8
+Failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 9
+
/\x{dfff}/8
Failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 7
+/\o{157777}/8
+Failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 9
+
/\x{d7ff}/8
+/\o{153777}/8
+
/\x{e000}/8
+/\o{170000}/8
+
/^\x{100}a\x{1234}/8
\x{100}a\x{1234}bcd
0: \x{100}a\x{1234}
@@ -146,11 +167,12 @@ No match
/\x{100}*/8DZ
------------------------------------------------------------------
Bra
- \x{100}*
+ \x{100}*+
Ket
End
------------------------------------------------------------------
Capturing subpattern count = 0
+May match empty string
Options: utf
No first char
No need char
@@ -159,7 +181,7 @@ No need char
------------------------------------------------------------------
Bra
a
- \x{100}*
+ \x{100}*+
Ket
End
------------------------------------------------------------------
@@ -172,7 +194,7 @@ No need char
------------------------------------------------------------------
Bra
ab
- \x{100}*
+ \x{100}*+
Ket
End
------------------------------------------------------------------
@@ -373,6 +395,7 @@ Need char = 'z'
End
------------------------------------------------------------------
Capturing subpattern count = 2
+May match empty string
Options: utf
No first char
No need char
@@ -404,6 +427,7 @@ No need char
End
------------------------------------------------------------------
Capturing subpattern count = 2
+May match empty string
Options: utf
No first char
No need char
@@ -424,6 +448,7 @@ No need char
End
------------------------------------------------------------------
Capturing subpattern count = 2
+May match empty string
Options: utf
No first char
No need char
@@ -455,6 +480,7 @@ No need char
End
------------------------------------------------------------------
Capturing subpattern count = 2
+May match empty string
Options: utf
No first char
No need char
@@ -768,7 +794,7 @@ No match
/[\h]{3,}/8BZ
------------------------------------------------------------------
Bra
- [\x09 \xa0\x{1680}\x{180e}\x{2000}-\x{200a}\x{202f}\x{205f}\x{3000}]{3,}
+ [\x09 \xa0\x{1680}\x{180e}\x{2000}-\x{200a}\x{202f}\x{205f}\x{3000}]{3,}+
Ket
End
------------------------------------------------------------------
@@ -1572,7 +1598,7 @@ Failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 7
/[\h\x{e000}]+/8BZ
------------------------------------------------------------------
Bra
- [\x09 \xa0\x{1680}\x{180e}\x{2000}-\x{200a}\x{202f}\x{205f}\x{3000}\x{e000}]+
+ [\x09 \xa0\x{1680}\x{180e}\x{2000}-\x{200a}\x{202f}\x{205f}\x{3000}\x{e000}]++
Ket
End
------------------------------------------------------------------
@@ -1594,7 +1620,7 @@ Failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 7
/[\H\x{d7ff}]+/8BZ
------------------------------------------------------------------
Bra
- [\x00-\x08\x0a-\x1f!-\x9f\x{a1}-\x{167f}\x{1681}-\x{180d}\x{180f}-\x{1fff}\x{200b}-\x{202e}\x{2030}-\x{205e}\x{2060}-\x{2fff}\x{3001}-\x{10ffff}\x{d7ff}]+
+ [\x00-\x08\x0a-\x1f!-\x9f\x{a1}-\x{167f}\x{1681}-\x{180d}\x{180f}-\x{1fff}\x{200b}-\x{202e}\x{2030}-\x{205e}\x{2060}-\x{2fff}\x{3001}-\x{10ffff}\x{d7ff}]++
Ket
End
------------------------------------------------------------------
@@ -1616,7 +1642,7 @@ Failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 7
/[\v\x{e000}]+/8BZ
------------------------------------------------------------------
Bra
- [\x0a-\x0d\x85\x{2028}-\x{2029}\x{e000}]+
+ [\x0a-\x0d\x85\x{2028}-\x{2029}\x{e000}]++
Ket
End
------------------------------------------------------------------
@@ -1634,7 +1660,7 @@ Failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 7
/[\V\x{d7ff}]+/8BZ
------------------------------------------------------------------
Bra
- [\x00-\x09\x0e-\x84\x{86}-\x{2027}\x{202a}-\x{10ffff}\x{d7ff}]+
+ [\x00-\x09\x0e-\x84\x{86}-\x{2027}\x{202a}-\x{10ffff}\x{d7ff}]++
Ket
End
------------------------------------------------------------------
@@ -1808,10 +1834,8 @@ Partial match: \x{0d}\x{0d}
/i [^\x{8000}]*
/i [^\x{7fff}]{2}
/i [^\x{7fff}]{0,7}?
- Once
/i [^\x{fffff}]{5}
- /i [^\x{fffff}]?
- Ket
+ /i [^\x{fffff}]?+
Ket
End
------------------------------------------------------------------
@@ -1846,4 +1870,16 @@ No match
/\ud800/<JS>8
Failed: disallowed Unicode code point (>= 0xd800 && <= 0xdfff) at offset 5
+/^a+[a\x{200}]/8BZ
+------------------------------------------------------------------
+ Bra
+ ^
+ a+
+ [a\x{200}]
+ Ket
+ End
+------------------------------------------------------------------
+ aa
+ 0: aa
+
/-- End of testinput5 --/
diff --git a/pcre/testdata/testoutput6 b/pcre/testdata/testoutput6
index b1d45799261..6c42fce1a5b 100644
--- a/pcre/testdata/testoutput6
+++ b/pcre/testdata/testoutput6
@@ -1,5 +1,7 @@
/-- This set of tests is for Unicode property support. It is compatible with
Perl >= 5.15. --/
+
+< forbid 9?=ABCDEFfGILMNPTUXZ<
/^\pC\pL\pM\pN\pP\pS\pZ</8
\x7f\x{c0}\x{30f}\x{660}\x{66c}\x{f01}\x{1680}<
@@ -543,16 +545,6 @@ No match
abc
No match
-/\p{Lu}/8i
- A
- 0: A
- aZ
- 0: Z
- ** Failers
- 0: F
- abc
-No match
-
/\p{Ll}/8
a
0: a
@@ -727,6 +719,8 @@ No match
0: \x{6e9}
\x{060b}
0: \x{60b}
+ \x{061c}
+ 0: \x{61c}
** Failers
No match
X\x{06e9}
@@ -1310,7 +1304,7 @@ No match
/^>\s+/8W
>\x{20}\x{a0}\x{1680}\x{2028}\x{2029}\x{202f}\x{9}\x{b}
- 0: > \x{a0}\x{1680}\x{2028}\x{2029}\x{202f}\x{09}
+ 0: > \x{a0}\x{1680}\x{2028}\x{2029}\x{202f}\x{09}\x{0b}
/^>\pZ+/8W
>\x{20}\x{a0}\x{1680}\x{2028}\x{2029}\x{202f}\x{9}\x{b}
@@ -1338,15 +1332,15 @@ No match
/^[[:graph:]]*/8W
A\x{a1}\x{a0}
- 0: A
+ 0: A\x{a1}
/^[[:print:]]*/8W
A z\x{a0}\x{a1}
- 0: A z
+ 0: A z\x{a0}\x{a1}
/^[[:punct:]]*/8W
.+\x{a1}\x{a0}
- 0: .+
+ 0: .+\x{a1}
/\p{Zs}*?\R/
** Failers
@@ -1548,6 +1542,19 @@ No match
0: \x{1111}\x{ae4c}\x{1111}\x{ae4c}\x{1111}\x{ae4c}\x{1111}\x{ae4c}X
0+
+/\X*Z/8Y
+ A\x{300}
+No match
+
+/\X*(.)/8Y
+ A\x{1111}\x{ae4c}\x{1169}
+ 0: A\x{1111}
+ 1: \x{1111}
+
+/\X?abc/8Y
+\xff\x7f\x00\x00\x03\x00\x41\xcc\x80\x41\x{300}\x61\x62\x63\x00\>06\?
+ 0: A\x{300}abc
+
/-- --/
/\x{1e9e}+/8i
@@ -2139,11 +2146,303 @@ No match
0: 1234
123
No match
-
+
/^\X*\w{4}/8
1234
0: 1234
123
No match
-
+
+/^A\s+Z/8W
+ A\x{2005}Z
+ 0: A\x{2005}Z
+ A\x{85}\x{180e}\x{2005}Z
+ 0: A\x{85}\x{180e}\x{2005}Z
+
+/^A[\s]+Z/8W
+ A\x{2005}Z
+ 0: A\x{2005}Z
+ A\x{85}\x{180e}\x{2005}Z
+ 0: A\x{85}\x{180e}\x{2005}Z
+
+/^[[:graph:]]+$/8W
+ Letter:ABC
+ 0: Letter:ABC
+ Mark:\x{300}\x{1d172}\x{1d17b}
+ 0: Mark:\x{300}\x{1d172}\x{1d17b}
+ Number:9\x{660}
+ 0: Number:9\x{660}
+ Punctuation:\x{66a},;
+ 0: Punctuation:\x{66a},;
+ Symbol:\x{6de}<>\x{fffc}
+ 0: Symbol:\x{6de}<>\x{fffc}
+ Cf-property:\x{ad}\x{600}\x{601}\x{602}\x{603}\x{604}\x{6dd}\x{70f}
+ 0: Cf-property:\x{ad}\x{600}\x{601}\x{602}\x{603}\x{604}\x{6dd}\x{70f}
+ \x{200b}\x{200c}\x{200d}\x{200e}\x{200f}
+ 0: \x{200b}\x{200c}\x{200d}\x{200e}\x{200f}
+ \x{202a}\x{202b}\x{202c}\x{202d}\x{202e}
+ 0: \x{202a}\x{202b}\x{202c}\x{202d}\x{202e}
+ \x{2060}\x{2061}\x{2062}\x{2063}\x{2064}
+ 0: \x{2060}\x{2061}\x{2062}\x{2063}\x{2064}
+ \x{206a}\x{206b}\x{206c}\x{206d}\x{206e}\x{206f}
+ 0: \x{206a}\x{206b}\x{206c}\x{206d}\x{206e}\x{206f}
+ \x{feff}
+ 0: \x{feff}
+ \x{fff9}\x{fffa}\x{fffb}
+ 0: \x{fff9}\x{fffa}\x{fffb}
+ \x{110bd}
+ 0: \x{110bd}
+ \x{1d173}\x{1d174}\x{1d175}\x{1d176}\x{1d177}\x{1d178}\x{1d179}\x{1d17a}
+ 0: \x{1d173}\x{1d174}\x{1d175}\x{1d176}\x{1d177}\x{1d178}\x{1d179}\x{1d17a}
+ \x{e0001}
+ 0: \x{e0001}
+ \x{e0020}\x{e0030}\x{e0040}\x{e0050}\x{e0060}\x{e0070}\x{e007f}
+ 0: \x{e0020}\x{e0030}\x{e0040}\x{e0050}\x{e0060}\x{e0070}\x{e007f}
+ ** Failers
+No match
+ \x{09}
+No match
+ \x{0a}
+No match
+ \x{1D}
+No match
+ \x{20}
+No match
+ \x{85}
+No match
+ \x{a0}
+No match
+ \x{61c}
+No match
+ \x{1680}
+No match
+ \x{180e}
+No match
+ \x{2028}
+No match
+ \x{2029}
+No match
+ \x{202f}
+No match
+ \x{2065}
+No match
+ \x{2066}
+No match
+ \x{2067}
+No match
+ \x{2068}
+No match
+ \x{2069}
+No match
+ \x{3000}
+No match
+ \x{e0002}
+No match
+ \x{e001f}
+No match
+ \x{e0080}
+No match
+
+/^[[:print:]]+$/8W
+ Space: \x{a0}
+ 0: Space: \x{a0}
+ \x{1680}\x{2000}\x{2001}\x{2002}\x{2003}\x{2004}\x{2005}
+ 0: \x{1680}\x{2000}\x{2001}\x{2002}\x{2003}\x{2004}\x{2005}
+ \x{2006}\x{2007}\x{2008}\x{2009}\x{200a}
+ 0: \x{2006}\x{2007}\x{2008}\x{2009}\x{200a}
+ \x{202f}\x{205f}
+ 0: \x{202f}\x{205f}
+ \x{3000}
+ 0: \x{3000}
+ Letter:ABC
+ 0: Letter:ABC
+ Mark:\x{300}\x{1d172}\x{1d17b}
+ 0: Mark:\x{300}\x{1d172}\x{1d17b}
+ Number:9\x{660}
+ 0: Number:9\x{660}
+ Punctuation:\x{66a},;
+ 0: Punctuation:\x{66a},;
+ Symbol:\x{6de}<>\x{fffc}
+ 0: Symbol:\x{6de}<>\x{fffc}
+ Cf-property:\x{ad}\x{600}\x{601}\x{602}\x{603}\x{604}\x{6dd}\x{70f}
+ 0: Cf-property:\x{ad}\x{600}\x{601}\x{602}\x{603}\x{604}\x{6dd}\x{70f}
+ \x{180e}
+ 0: \x{180e}
+ \x{200b}\x{200c}\x{200d}\x{200e}\x{200f}
+ 0: \x{200b}\x{200c}\x{200d}\x{200e}\x{200f}
+ \x{202a}\x{202b}\x{202c}\x{202d}\x{202e}
+ 0: \x{202a}\x{202b}\x{202c}\x{202d}\x{202e}
+ \x{202f}
+ 0: \x{202f}
+ \x{2060}\x{2061}\x{2062}\x{2063}\x{2064}
+ 0: \x{2060}\x{2061}\x{2062}\x{2063}\x{2064}
+ \x{206a}\x{206b}\x{206c}\x{206d}\x{206e}\x{206f}
+ 0: \x{206a}\x{206b}\x{206c}\x{206d}\x{206e}\x{206f}
+ \x{feff}
+ 0: \x{feff}
+ \x{fff9}\x{fffa}\x{fffb}
+ 0: \x{fff9}\x{fffa}\x{fffb}
+ \x{110bd}
+ 0: \x{110bd}
+ \x{1d173}\x{1d174}\x{1d175}\x{1d176}\x{1d177}\x{1d178}\x{1d179}\x{1d17a}
+ 0: \x{1d173}\x{1d174}\x{1d175}\x{1d176}\x{1d177}\x{1d178}\x{1d179}\x{1d17a}
+ \x{e0001}
+ 0: \x{e0001}
+ \x{e0020}\x{e0030}\x{e0040}\x{e0050}\x{e0060}\x{e0070}\x{e007f}
+ 0: \x{e0020}\x{e0030}\x{e0040}\x{e0050}\x{e0060}\x{e0070}\x{e007f}
+ ** Failers
+ 0: ** Failers
+ \x{09}
+No match
+ \x{1D}
+No match
+ \x{85}
+No match
+ \x{61c}
+No match
+ \x{2028}
+No match
+ \x{2029}
+No match
+ \x{2065}
+No match
+ \x{2066}
+No match
+ \x{2067}
+No match
+ \x{2068}
+No match
+ \x{2069}
+No match
+ \x{e0002}
+No match
+ \x{e001f}
+No match
+ \x{e0080}
+No match
+
+/^[[:punct:]]+$/8W
+ \$+<=>^`|~
+ 0: $+<=>^`|~
+ !\"#%&'()*,-./:;?@[\\]_{}
+ 0: !"#%&'()*,-./:;?@[\]_{}
+ \x{a1}\x{a7}
+ 0: \x{a1}\x{a7}
+ \x{37e}
+ 0: \x{37e}
+ ** Failers
+No match
+ abcde
+No match
+
+/^[[:^graph:]]+$/8W
+ \x{09}\x{0a}\x{1D}\x{20}\x{85}\x{a0}\x{61c}\x{1680}\x{180e}
+ 0: \x{09}\x{0a}\x{1d} \x{85}\x{a0}\x{61c}\x{1680}\x{180e}
+ \x{2028}\x{2029}\x{202f}\x{2065}\x{2066}\x{2067}\x{2068}\x{2069}
+ 0: \x{2028}\x{2029}\x{202f}\x{2065}\x{2066}\x{2067}\x{2068}\x{2069}
+ \x{3000}\x{e0002}\x{e001f}\x{e0080}
+ 0: \x{3000}\x{e0002}\x{e001f}\x{e0080}
+ ** Failers
+No match
+ Letter:ABC
+No match
+ Mark:\x{300}\x{1d172}\x{1d17b}
+No match
+ Number:9\x{660}
+No match
+ Punctuation:\x{66a},;
+No match
+ Symbol:\x{6de}<>\x{fffc}
+No match
+ Cf-property:\x{ad}\x{600}\x{601}\x{602}\x{603}\x{604}\x{6dd}\x{70f}
+No match
+ \x{200b}\x{200c}\x{200d}\x{200e}\x{200f}
+No match
+ \x{202a}\x{202b}\x{202c}\x{202d}\x{202e}
+No match
+ \x{2060}\x{2061}\x{2062}\x{2063}\x{2064}
+No match
+ \x{206a}\x{206b}\x{206c}\x{206d}\x{206e}\x{206f}
+No match
+ \x{feff}
+No match
+ \x{fff9}\x{fffa}\x{fffb}
+No match
+ \x{110bd}
+No match
+ \x{1d173}\x{1d174}\x{1d175}\x{1d176}\x{1d177}\x{1d178}\x{1d179}\x{1d17a}
+No match
+ \x{e0001}
+No match
+ \x{e0020}\x{e0030}\x{e0040}\x{e0050}\x{e0060}\x{e0070}\x{e007f}
+No match
+
+/^[[:^print:]]+$/8W
+ \x{09}\x{1D}\x{85}\x{61c}\x{2028}\x{2029}\x{2065}\x{2066}\x{2067}
+ 0: \x{09}\x{1d}\x{85}\x{61c}\x{2028}\x{2029}\x{2065}\x{2066}\x{2067}
+ \x{2068}\x{2069}\x{e0002}\x{e001f}\x{e0080}
+ 0: \x{2068}\x{2069}\x{e0002}\x{e001f}\x{e0080}
+ ** Failers
+No match
+ Space: \x{a0}
+No match
+ \x{1680}\x{2000}\x{2001}\x{2002}\x{2003}\x{2004}\x{2005}
+No match
+ \x{2006}\x{2007}\x{2008}\x{2009}\x{200a}
+No match
+ \x{202f}\x{205f}
+No match
+ \x{3000}
+No match
+ Letter:ABC
+No match
+ Mark:\x{300}\x{1d172}\x{1d17b}
+No match
+ Number:9\x{660}
+No match
+ Punctuation:\x{66a},;
+No match
+ Symbol:\x{6de}<>\x{fffc}
+No match
+ Cf-property:\x{ad}\x{600}\x{601}\x{602}\x{603}\x{604}\x{6dd}\x{70f}
+No match
+ \x{180e}
+No match
+ \x{200b}\x{200c}\x{200d}\x{200e}\x{200f}
+No match
+ \x{202a}\x{202b}\x{202c}\x{202d}\x{202e}
+No match
+ \x{202f}
+No match
+ \x{2060}\x{2061}\x{2062}\x{2063}\x{2064}
+No match
+ \x{206a}\x{206b}\x{206c}\x{206d}\x{206e}\x{206f}
+No match
+ \x{feff}
+No match
+ \x{fff9}\x{fffa}\x{fffb}
+No match
+ \x{110bd}
+No match
+ \x{1d173}\x{1d174}\x{1d175}\x{1d176}\x{1d177}\x{1d178}\x{1d179}\x{1d17a}
+No match
+ \x{e0001}
+No match
+ \x{e0020}\x{e0030}\x{e0040}\x{e0050}\x{e0060}\x{e0070}\x{e007f}
+No match
+
+/^[[:^punct:]]+$/8W
+ abcde
+ 0: abcde
+ ** Failers
+No match
+ \$+<=>^`|~
+No match
+ !\"#%&'()*,-./:;?@[\\]_{}
+No match
+ \x{a1}\x{a7}
+No match
+ \x{37e}
+No match
+
/-- End of testinput6 --/
diff --git a/pcre/testdata/testoutput7 b/pcre/testdata/testoutput7
index ddd96fc2edc..45ac72fd8d4 100644
--- a/pcre/testdata/testoutput7
+++ b/pcre/testdata/testoutput7
@@ -78,7 +78,7 @@ No need char
/[\p{Nd}+-]+/8DZ
------------------------------------------------------------------
Bra
- [+\-\p{Nd}]+
+ [+\-\p{Nd}]++
Ket
End
------------------------------------------------------------------
@@ -270,6 +270,20 @@ No need char
End
------------------------------------------------------------------
+/^\p{Cf}/8
+ \x{180e}
+ 0: \x{180e}
+ \x{061c}
+ 0: \x{61c}
+ \x{2066}
+ 0: \x{2066}
+ \x{2067}
+ 0: \x{2067}
+ \x{2068}
+ 0: \x{2068}
+ \x{2069}
+ 0: \x{2069}
+
/^\p{Cs}/8
\?\x{dfff}
0: \x{dfff}
@@ -278,6 +292,22 @@ No match
\x{09f}
No match
+/^\p{Mn}/8
+ \x{1a1b}
+ 0: \x{1a1b}
+
+/^\p{Pe}/8
+ \x{2309}
+ 0: \x{2309}
+ \x{230b}
+ 0: \x{230b}
+
+/^\p{Ps}/8
+ \x{2308}
+ 0: \x{2308}
+ \x{230a}
+ 0: \x{230a}
+
/^\p{Sc}+/8
$\x{a2}\x{a3}\x{a4}\x{a5}\x{a6}
0: $\x{a2}\x{a3}\x{a4}\x{a5}
@@ -297,8 +327,6 @@ No match
0: \x{a0}
\x{1680}
0: \x{1680}
- \x{180e}
- 0: \x{180e}
\x{2000}
0: \x{2000}
\x{2001}
@@ -310,8 +338,9 @@ No match
\x{200d}
No match
-/-- These four are here rather than in test 6 because Perl has problems with
- the negative versions of the properties. --/
+/-- These are here rather than in test 6 because Perl has problems with
+ the negative versions of the properties and behaves has changed how
+ it behaves for caseless matching. --/
/\p{^Lu}/8i
1234
@@ -351,6 +380,16 @@ No match
\x{1d00}
No match
+/\p{Lu}/8i
+ A
+ 0: A
+ aZ
+ 0: Z
+ ** Failers
+ 0: F
+ abc
+No match
+
/[\x{c0}\x{391}]/8i
\x{c0}
0: \x{c0}
@@ -501,7 +540,7 @@ No match
/^>\p{Xsp}+/8
> \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
- 0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}
+ 0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
/^>\p{Xsp}+?/8
>\x{1680}\x{2028}\x{0b}
@@ -509,11 +548,11 @@ No match
/^>\p{Xsp}*/8
> \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
- 0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}
+ 0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
/^>\p{Xsp}{2,9}/8
> \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
- 0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}
+ 0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
/^>\p{Xsp}{2,9}?/8
> \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
@@ -525,7 +564,7 @@ No match
/^>[\p{Xsp}]+/8
> \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
- 0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}
+ 0: > \x{09}\x{0a}\x{0c}\x{0d}\x{a0}\x{1680}\x{2028}\x{0b}
/^>\p{Xps}/8
>\x{1680}\x{2028}\x{0b}
@@ -820,7 +859,7 @@ No match
/[[:graph:]]/WBZ
------------------------------------------------------------------
Bra
- [!-~]
+ [[:graph:]]
Ket
End
------------------------------------------------------------------
@@ -828,7 +867,7 @@ No match
/[[:print:]]/WBZ
------------------------------------------------------------------
Bra
- [ -~]
+ [[:print:]]
Ket
End
------------------------------------------------------------------
@@ -836,7 +875,7 @@ No match
/[[:punct:]]/WBZ
------------------------------------------------------------------
Bra
- [!-/:-@[-`{-~]
+ [[:punct:]]
Ket
End
------------------------------------------------------------------
@@ -910,7 +949,7 @@ No match
/[[:^alpha:][:^cntrl:]]+/8WBZ
------------------------------------------------------------------
Bra
- [ -~\x80-\xff\P{L}]+
+ [ -~\x80-\xff\P{L}]++
Ket
End
------------------------------------------------------------------
@@ -922,7 +961,7 @@ No match
/[[:^cntrl:][:^alpha:]]+/8WBZ
------------------------------------------------------------------
Bra
- [ -~\x80-\xff\P{L}]+
+ [ -~\x80-\xff\P{L}]++
Ket
End
------------------------------------------------------------------
@@ -934,7 +973,7 @@ No match
/[[:alpha:]]+/8WBZ
------------------------------------------------------------------
Bra
- [\p{L}]+
+ [\p{L}]++
Ket
End
------------------------------------------------------------------
@@ -944,7 +983,7 @@ No match
/[[:^alpha:]\S]+/8WBZ
------------------------------------------------------------------
Bra
- [\P{L}\P{Xsp}]+
+ [\P{L}\P{Xsp}]++
Ket
End
------------------------------------------------------------------
@@ -956,7 +995,7 @@ No match
/[^\d]+/8WBZ
------------------------------------------------------------------
Bra
- [^\p{Nd}]+
+ [^\p{Nd}]++
Ket
End
------------------------------------------------------------------
@@ -1070,8 +1109,8 @@ No match
prop Nd
B+
prop N *+
- B+
- prop Nd *
+ B++
+ prop Nd *+
Ket
End
------------------------------------------------------------------
@@ -1347,7 +1386,7 @@ Need char = 'B' (caseless)
/[\x{3a3}]+/8iBZ
------------------------------------------------------------------
Bra
- clist 03a3 03c2 03c3 +
+ clist 03a3 03c2 03c3 ++
Ket
End
------------------------------------------------------------------
@@ -1355,7 +1394,7 @@ Need char = 'B' (caseless)
/[^\x{3a3}]+/8iBZ
------------------------------------------------------------------
Bra
- not clist 03a3 03c2 03c3 +
+ not clist 03a3 03c2 03c3 ++
Ket
End
------------------------------------------------------------------
@@ -1577,5 +1616,651 @@ No match
No match
\x{1234}abc
No match
+
+/-- Some auto-possessification tests --/
+
+/\pN+\z/BZ
+------------------------------------------------------------------
+ Bra
+ prop N ++
+ \z
+ Ket
+ End
+------------------------------------------------------------------
+
+/\PN+\z/BZ
+------------------------------------------------------------------
+ Bra
+ notprop N ++
+ \z
+ Ket
+ End
+------------------------------------------------------------------
+
+/\pN+/BZ
+------------------------------------------------------------------
+ Bra
+ prop N ++
+ Ket
+ End
+------------------------------------------------------------------
+
+/\PN+/BZ
+------------------------------------------------------------------
+ Bra
+ notprop N ++
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{Any}+\p{Any} \p{Any}+\P{Any} \p{Any}+\p{L&} \p{Any}+\p{L} \p{Any}+\p{Lu} \p{Any}+\p{Han} \p{Any}+\p{Xan} \p{Any}+\p{Xsp} \p{Any}+\p{Xps} \p{Xwd}+\p{Any} \p{Any}+\p{Xuc}/BWZx
+------------------------------------------------------------------
+ Bra
+ prop Any +
+ prop Any
+ prop Any +
+ notprop Any
+ prop Any +
+ prop L&
+ prop Any +
+ prop L
+ prop Any +
+ prop Lu
+ prop Any +
+ prop Han
+ prop Any +
+ prop Xan
+ prop Any +
+ prop Xsp
+ prop Any +
+ prop Xps
+ prop Xwd +
+ prop Any
+ prop Any +
+ prop Xuc
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{L&}+\p{Any} \p{L&}+\p{L&} \P{L&}+\p{L&} \p{L&}+\p{L} \p{L&}+\p{Lu} \p{L&}+\p{Han} \p{L&}+\p{Xan} \p{L&}+\P{Xan} \p{L&}+\p{Xsp} \p{L&}+\p{Xps} \p{Xwd}+\p{L&} \p{L&}+\p{Xuc}/BWZx
+------------------------------------------------------------------
+ Bra
+ prop L& +
+ prop Any
+ prop L& +
+ prop L&
+ notprop L& ++
+ prop L&
+ prop L& +
+ prop L
+ prop L& +
+ prop Lu
+ prop L& +
+ prop Han
+ prop L& +
+ prop Xan
+ prop L& ++
+ notprop Xan
+ prop L& ++
+ prop Xsp
+ prop L& ++
+ prop Xps
+ prop Xwd +
+ prop L&
+ prop L& +
+ prop Xuc
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{N}+\p{Any} \p{N}+\p{L&} \p{N}+\p{L} \p{N}+\P{L} \p{N}+\P{N} \p{N}+\p{Lu} \p{N}+\p{Han} \p{N}+\p{Xan} \p{N}+\p{Xsp} \p{N}+\p{Xps} \p{Xwd}+\p{N} \p{N}+\p{Xuc}/BWZx
+------------------------------------------------------------------
+ Bra
+ prop N +
+ prop Any
+ prop N +
+ prop L&
+ prop N ++
+ prop L
+ prop N +
+ notprop L
+ prop N ++
+ notprop N
+ prop N ++
+ prop Lu
+ prop N +
+ prop Han
+ prop N +
+ prop Xan
+ prop N ++
+ prop Xsp
+ prop N ++
+ prop Xps
+ prop Xwd +
+ prop N
+ prop N +
+ prop Xuc
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{Lu}+\p{Any} \p{Lu}+\p{L&} \p{Lu}+\p{L} \p{Lu}+\p{Lu} \P{Lu}+\p{Lu} \p{Lu}+\p{Nd} \p{Lu}+\P{Nd} \p{Lu}+\p{Han} \p{Lu}+\p{Xan} \p{Lu}+\p{Xsp} \p{Lu}+\p{Xps} \p{Xwd}+\p{Lu} \p{Lu}+\p{Xuc}/BWZx
+------------------------------------------------------------------
+ Bra
+ prop Lu +
+ prop Any
+ prop Lu +
+ prop L&
+ prop Lu +
+ prop L
+ prop Lu +
+ prop Lu
+ notprop Lu ++
+ prop Lu
+ prop Lu ++
+ prop Nd
+ prop Lu +
+ notprop Nd
+ prop Lu +
+ prop Han
+ prop Lu +
+ prop Xan
+ prop Lu ++
+ prop Xsp
+ prop Lu ++
+ prop Xps
+ prop Xwd +
+ prop Lu
+ prop Lu +
+ prop Xuc
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{Han}+\p{Lu} \p{Han}+\p{L&} \p{Han}+\p{L} \p{Han}+\p{Lu} \p{Han}+\p{Arabic} \p{Arabic}+\p{Arabic} \p{Han}+\p{Xan} \p{Han}+\p{Xsp} \p{Han}+\p{Xps} \p{Xwd}+\p{Han} \p{Han}+\p{Xuc}/BWZx
+------------------------------------------------------------------
+ Bra
+ prop Han +
+ prop Lu
+ prop Han +
+ prop L&
+ prop Han +
+ prop L
+ prop Han +
+ prop Lu
+ prop Han ++
+ prop Arabic
+ prop Arabic +
+ prop Arabic
+ prop Han +
+ prop Xan
+ prop Han +
+ prop Xsp
+ prop Han +
+ prop Xps
+ prop Xwd +
+ prop Han
+ prop Han +
+ prop Xuc
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{Xan}+\p{Any} \p{Xan}+\p{L&} \P{Xan}+\p{L&} \p{Xan}+\p{L} \p{Xan}+\p{Lu} \p{Xan}+\p{Han} \p{Xan}+\p{Xan} \p{Xan}+\P{Xan} \p{Xan}+\p{Xsp} \p{Xan}+\p{Xps} \p{Xwd}+\p{Xan} \p{Xan}+\p{Xuc}/BWZx
+------------------------------------------------------------------
+ Bra
+ prop Xan +
+ prop Any
+ prop Xan +
+ prop L&
+ notprop Xan ++
+ prop L&
+ prop Xan +
+ prop L
+ prop Xan +
+ prop Lu
+ prop Xan +
+ prop Han
+ prop Xan +
+ prop Xan
+ prop Xan ++
+ notprop Xan
+ prop Xan ++
+ prop Xsp
+ prop Xan ++
+ prop Xps
+ prop Xwd +
+ prop Xan
+ prop Xan +
+ prop Xuc
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{Xsp}+\p{Any} \p{Xsp}+\p{L&} \p{Xsp}+\p{L} \p{Xsp}+\p{Lu} \p{Xsp}+\p{Han} \p{Xsp}+\p{Xan} \p{Xsp}+\p{Xsp} \P{Xsp}+\p{Xsp} \p{Xsp}+\p{Xps} \p{Xwd}+\p{Xsp} \p{Xsp}+\p{Xuc}/BWZx
+------------------------------------------------------------------
+ Bra
+ prop Xsp +
+ prop Any
+ prop Xsp ++
+ prop L&
+ prop Xsp ++
+ prop L
+ prop Xsp ++
+ prop Lu
+ prop Xsp +
+ prop Han
+ prop Xsp ++
+ prop Xan
+ prop Xsp +
+ prop Xsp
+ notprop Xsp ++
+ prop Xsp
+ prop Xsp +
+ prop Xps
+ prop Xwd ++
+ prop Xsp
+ prop Xsp +
+ prop Xuc
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{Xwd}+\p{Any} \p{Xwd}+\p{L&} \p{Xwd}+\p{L} \p{Xwd}+\p{Lu} \p{Xwd}+\p{Han} \p{Xwd}+\p{Xan} \p{Xwd}+\p{Xsp} \p{Xwd}+\p{Xps} \p{Xwd}+\p{Xwd} \p{Xwd}+\P{Xwd} \p{Xwd}+\p{Xuc}/BWZx
+------------------------------------------------------------------
+ Bra
+ prop Xwd +
+ prop Any
+ prop Xwd +
+ prop L&
+ prop Xwd +
+ prop L
+ prop Xwd +
+ prop Lu
+ prop Xwd +
+ prop Han
+ prop Xwd +
+ prop Xan
+ prop Xwd ++
+ prop Xsp
+ prop Xwd ++
+ prop Xps
+ prop Xwd +
+ prop Xwd
+ prop Xwd ++
+ notprop Xwd
+ prop Xwd +
+ prop Xuc
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{Xuc}+\p{Any} \p{Xuc}+\p{L&} \p{Xuc}+\p{L} \p{Xuc}+\p{Lu} \p{Xuc}+\p{Han} \p{Xuc}+\p{Xan} \p{Xuc}+\p{Xsp} \p{Xuc}+\p{Xps} \p{Xwd}+\p{Xuc} \p{Xuc}+\p{Xuc} \p{Xuc}+\P{Xuc}/BWZx
+------------------------------------------------------------------
+ Bra
+ prop Xuc +
+ prop Any
+ prop Xuc +
+ prop L&
+ prop Xuc +
+ prop L
+ prop Xuc +
+ prop Lu
+ prop Xuc +
+ prop Han
+ prop Xuc +
+ prop Xan
+ prop Xuc +
+ prop Xsp
+ prop Xuc +
+ prop Xps
+ prop Xwd +
+ prop Xuc
+ prop Xuc +
+ prop Xuc
+ prop Xuc ++
+ notprop Xuc
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{N}+\p{Ll} \p{N}+\p{Nd} \p{N}+\P{Nd}/BWZx
+------------------------------------------------------------------
+ Bra
+ prop N ++
+ prop Ll
+ prop N +
+ prop Nd
+ prop N +
+ notprop Nd
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{Xan}+\p{L} \p{Xan}+\p{N} \p{Xan}+\p{C} \p{Xan}+\P{L} \P{Xan}+\p{N} \p{Xan}+\P{C}/BWZx
+------------------------------------------------------------------
+ Bra
+ prop Xan +
+ prop L
+ prop Xan +
+ prop N
+ prop Xan ++
+ prop C
+ prop Xan +
+ notprop L
+ notprop Xan ++
+ prop N
+ prop Xan +
+ notprop C
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{L}+\p{Xan} \p{N}+\p{Xan} \p{C}+\p{Xan} \P{L}+\p{Xan} \p{N}+\p{Xan} \P{C}+\p{Xan} \p{L}+\P{Xan}/BWZx
+------------------------------------------------------------------
+ Bra
+ prop L +
+ prop Xan
+ prop N +
+ prop Xan
+ prop C ++
+ prop Xan
+ notprop L +
+ prop Xan
+ prop N +
+ prop Xan
+ notprop C +
+ prop Xan
+ prop L ++
+ notprop Xan
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{Xan}+\p{Lu} \p{Xan}+\p{Nd} \p{Xan}+\p{Cc} \p{Xan}+\P{Ll} \P{Xan}+\p{No} \p{Xan}+\P{Cf}/BWZx
+------------------------------------------------------------------
+ Bra
+ prop Xan +
+ prop Lu
+ prop Xan +
+ prop Nd
+ prop Xan ++
+ prop Cc
+ prop Xan +
+ notprop Ll
+ notprop Xan ++
+ prop No
+ prop Xan +
+ notprop Cf
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{Lu}+\p{Xan} \p{Nd}+\p{Xan} \p{Cs}+\p{Xan} \P{Lt}+\p{Xan} \p{Nl}+\p{Xan} \P{Cc}+\p{Xan} \p{Lt}+\P{Xan}/BWZx
+------------------------------------------------------------------
+ Bra
+ prop Lu +
+ prop Xan
+ prop Nd +
+ prop Xan
+ prop Cs ++
+ prop Xan
+ notprop Lt +
+ prop Xan
+ prop Nl +
+ prop Xan
+ notprop Cc +
+ prop Xan
+ prop Lt ++
+ notprop Xan
+ Ket
+ End
+------------------------------------------------------------------
+
+/\w+\p{P} \w+\p{Po} \w+\s \p{Xan}+\s \s+\p{Xan} \s+\w/BWZx
+------------------------------------------------------------------
+ Bra
+ prop Xwd +
+ prop P
+ prop Xwd +
+ prop Po
+ prop Xwd ++
+ prop Xsp
+ prop Xan ++
+ prop Xsp
+ prop Xsp ++
+ prop Xan
+ prop Xsp ++
+ prop Xwd
+ Ket
+ End
+------------------------------------------------------------------
+
+/\w+\P{P} \W+\p{Po} \w+\S \P{Xan}+\s \s+\P{Xan} \s+\W/BWZx
+------------------------------------------------------------------
+ Bra
+ prop Xwd +
+ notprop P
+ notprop Xwd +
+ prop Po
+ prop Xwd +
+ notprop Xsp
+ notprop Xan +
+ prop Xsp
+ prop Xsp +
+ notprop Xan
+ prop Xsp +
+ notprop Xwd
+ Ket
+ End
+------------------------------------------------------------------
+
+/\w+\p{Po} \w+\p{Pc} \W+\p{Po} \W+\p{Pc} \w+\P{Po} \w+\P{Pc}/BWZx
+------------------------------------------------------------------
+ Bra
+ prop Xwd +
+ prop Po
+ prop Xwd ++
+ prop Pc
+ notprop Xwd +
+ prop Po
+ notprop Xwd +
+ prop Pc
+ prop Xwd +
+ notprop Po
+ prop Xwd +
+ notprop Pc
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{Nl}+\p{Xan} \P{Nl}+\p{Xan} \p{Nl}+\P{Xan} \P{Nl}+\P{Xan}/BWZx
+------------------------------------------------------------------
+ Bra
+ prop Nl +
+ prop Xan
+ notprop Nl +
+ prop Xan
+ prop Nl ++
+ notprop Xan
+ notprop Nl +
+ notprop Xan
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{Xan}+\p{Nl} \P{Xan}+\p{Nl} \p{Xan}+\P{Nl} \P{Xan}+\P{Nl}/BWZx
+------------------------------------------------------------------
+ Bra
+ prop Xan +
+ prop Nl
+ notprop Xan ++
+ prop Nl
+ prop Xan +
+ notprop Nl
+ notprop Xan +
+ notprop Nl
+ Ket
+ End
+------------------------------------------------------------------
+
+/\p{Xan}+\p{Nd} \P{Xan}+\p{Nd} \p{Xan}+\P{Nd} \P{Xan}+\P{Nd}/BWZx
+------------------------------------------------------------------
+ Bra
+ prop Xan +
+ prop Nd
+ notprop Xan ++
+ prop Nd
+ prop Xan +
+ notprop Nd
+ notprop Xan +
+ notprop Nd
+ Ket
+ End
+------------------------------------------------------------------
+
+/-- End auto-possessification tests --/
+
+/\w+/8CWBZ
+------------------------------------------------------------------
+ Bra
+ Callout 255 0 3
+ prop Xwd ++
+ Callout 255 3 0
+ Ket
+ End
+------------------------------------------------------------------
+ abcd
+--->abcd
+ +0 ^ \w+
+ +3 ^ ^
+ 0: abcd
+
+/[\p{N}]?+/BZO
+------------------------------------------------------------------
+ Bra
+ [\p{N}]?+
+ Ket
+ End
+------------------------------------------------------------------
+
+/[\p{L}ab]{2,3}+/BZO
+------------------------------------------------------------------
+ Bra
+ [ab\p{L}]{2,3}+
+ Ket
+ End
+------------------------------------------------------------------
+
+/\D+\X \d+\X \S+\X \s+\X \W+\X \w+\X \C+\X \R+\X \H+\X \h+\X \V+\X \v+\X a+\X \n+\X .+\X/BZx
+------------------------------------------------------------------
+ Bra
+ \D+
+ extuni
+ \d+
+ extuni
+ \S+
+ extuni
+ \s+
+ extuni
+ \W+
+ extuni
+ \w+
+ extuni
+ AllAny+
+ extuni
+ \R+
+ extuni
+ \H+
+ extuni
+ \h+
+ extuni
+ \V+
+ extuni
+ \v+
+ extuni
+ a+
+ extuni
+ \x0a+
+ extuni
+ Any+
+ extuni
+ Ket
+ End
+------------------------------------------------------------------
+
+/.+\X/BZxs
+------------------------------------------------------------------
+ Bra
+ AllAny+
+ extuni
+ Ket
+ End
+------------------------------------------------------------------
+
+/\X+$/BZxm
+------------------------------------------------------------------
+ Bra
+ extuni+
+ /m $
+ Ket
+ End
+------------------------------------------------------------------
+
+/\X+\D \X+\d \X+\S \X+\s \X+\W \X+\w \X+. \X+\C \X+\R \X+\H \X+\h \X+\V \X+\v \X+\X \X+\Z \X+\z \X+$/BZx
+------------------------------------------------------------------
+ Bra
+ extuni+
+ \D
+ extuni+
+ \d
+ extuni+
+ \S
+ extuni+
+ \s
+ extuni+
+ \W
+ extuni+
+ \w
+ extuni+
+ Any
+ extuni+
+ AllAny
+ extuni+
+ \R
+ extuni+
+ \H
+ extuni+
+ \h
+ extuni+
+ \V
+ extuni+
+ \v
+ extuni+
+ extuni
+ extuni+
+ \Z
+ extuni++
+ \z
+ extuni+
+ $
+ Ket
+ End
+------------------------------------------------------------------
+
+/\d+\s{0,5}=\s*\S?=\w{0,4}\W*/8WBZ
+------------------------------------------------------------------
+ Bra
+ prop Nd ++
+ prop Xsp {0,5}+
+ =
+ prop Xsp *+
+ notprop Xsp ?
+ =
+ prop Xwd {0,4}+
+ notprop Xwd *+
+ Ket
+ End
+------------------------------------------------------------------
/-- End of testinput7 --/
diff --git a/pcre/testdata/testoutput8 b/pcre/testdata/testoutput8
index 75affbe2d4c..bb68d3e6452 100644
--- a/pcre/testdata/testoutput8
+++ b/pcre/testdata/testoutput8
@@ -1,5 +1,8 @@
-/-- This set of tests check the DFA matching functionality of pcre_dfa_exec().
- The -dfa flag must be used with pcretest when running it. --/
+/-- This set of tests check the DFA matching functionality of pcre_dfa_exec(),
+ excluding UTF and Unicode property support. The -dfa flag must be used with
+ pcretest when running it. --/
+
+< forbid 8W
/abc/
abc
@@ -25,7 +28,7 @@ No match
ab
No match
-/a*/
+/a*/O
a
0: a
1:
@@ -341,7 +344,7 @@ No match
axyzq
No match
-/[^a]+/
+/[^a]+/O
bac
0: b
bcdefax
@@ -359,7 +362,7 @@ No match
aaaaa
No match
-/[^a]*/
+/[^a]*/O
bac
0: b
1:
@@ -380,7 +383,7 @@ No match
aaaaa
0:
-/[^a]{3,5}/
+/[^a]{3,5}/O
xyz
0: xyz
awxyza
@@ -408,29 +411,18 @@ No match
/\d*/
1234b567
0: 1234
- 1: 123
- 2: 12
- 3: 1
- 4:
xyz
0:
/\D*/
a1234b567
0: a
- 1:
xyz
0: xyz
- 1: xy
- 2: x
- 3:
/\d+/
ab1234c56
0: 1234
- 1: 123
- 2: 12
- 3: 1
*** Failers
No match
xyz
@@ -439,19 +431,8 @@ No match
/\D+/
ab123c56
0: ab
- 1: a
*** Failers
0: *** Failers
- 1: *** Failer
- 2: *** Faile
- 3: *** Fail
- 4: *** Fai
- 5: *** Fa
- 6: *** F
- 7: ***
- 8: ***
- 9: **
-10: *
789
No match
@@ -478,9 +459,6 @@ No match
/a+/
aaaa
0: aaaa
- 1: aaa
- 2: aa
- 3: a
/^.*xyz/
xyz
@@ -886,9 +864,6 @@ No match
0:
aaabcd
0: aaa
- 1: aa
- 2: a
- 3:
xyz
0: xyz
1:
@@ -1577,18 +1552,6 @@ No match
/^[.^$|()*+?{,}]+/
.^\$(*+)|{?,?}
0: .^$(*+)|{?,?}
- 1: .^$(*+)|{?,?
- 2: .^$(*+)|{?,
- 3: .^$(*+)|{?
- 4: .^$(*+)|{
- 5: .^$(*+)|
- 6: .^$(*+)
- 7: .^$(*+
- 8: .^$(*
- 9: .^$(
-10: .^$
-11: .^
-12: .
/^a*\w/
z
@@ -1744,38 +1707,16 @@ No match
/foo(?!bar)(.*)/
foobar is foolish see?
0: foolish see?
- 1: foolish see
- 2: foolish se
- 3: foolish s
- 4: foolish
- 5: foolish
- 6: foolis
- 7: fooli
- 8: fool
- 9: foo
/(?:(?!foo)...|^.{0,2})bar(.*)/
foobar crowbar etc
0: rowbar etc
- 1: rowbar et
- 2: rowbar e
- 3: rowbar
- 4: rowbar
barrel
0: barrel
- 1: barre
- 2: barr
- 3: bar
2barrel
0: 2barrel
- 1: 2barre
- 2: 2barr
- 3: 2bar
A barrel
0: A barrel
- 1: A barre
- 2: A barr
- 3: A bar
/^(\D*)(?=\d)(?!123)/
abc456
@@ -1820,7 +1761,7 @@ No match
the abc
No match
-/^[ab]{1,3}(ab*|b)/
+/^[ab]{1,3}(ab*|b)/O
aabbbbb
0: aabbbbb
1: aabbbb
@@ -1829,7 +1770,7 @@ No match
4: aab
5: aa
-/^[ab]{1,3}?(ab*|b)/
+/^[ab]{1,3}?(ab*|b)/O
aabbbbb
0: aabbbbb
1: aabbbb
@@ -1838,7 +1779,7 @@ No match
4: aab
5: aa
-/^[ab]{1,3}?(ab*?|b)/
+/^[ab]{1,3}?(ab*?|b)/O
aabbbbb
0: aabbbbb
1: aabbbb
@@ -1847,7 +1788,7 @@ No match
4: aab
5: aa
-/^[ab]{1,3}(ab*?|b)/
+/^[ab]{1,3}(ab*?|b)/O
aabbbbb
0: aabbbbb
1: aabbbb
@@ -2705,10 +2646,6 @@ No match
/\0*/
\0\0\0\0
0: \x00\x00\x00\x00
- 1: \x00\x00\x00
- 2: \x00\x00
- 3: \x00
- 4:
/A\x0{2,3}Z/
The A\x0\x0Z
@@ -2760,56 +2697,14 @@ No match
/([^.]*)\.([^:]*):[T ]+(.*)/
track1.title:TBlah blah blah
0: track1.title:TBlah blah blah
- 1: track1.title:TBlah blah bla
- 2: track1.title:TBlah blah bl
- 3: track1.title:TBlah blah b
- 4: track1.title:TBlah blah
- 5: track1.title:TBlah blah
- 6: track1.title:TBlah bla
- 7: track1.title:TBlah bl
- 8: track1.title:TBlah b
- 9: track1.title:TBlah
-10: track1.title:TBlah
-11: track1.title:TBla
-12: track1.title:TBl
-13: track1.title:TB
-14: track1.title:T
/([^.]*)\.([^:]*):[T ]+(.*)/i
track1.title:TBlah blah blah
0: track1.title:TBlah blah blah
- 1: track1.title:TBlah blah bla
- 2: track1.title:TBlah blah bl
- 3: track1.title:TBlah blah b
- 4: track1.title:TBlah blah
- 5: track1.title:TBlah blah
- 6: track1.title:TBlah bla
- 7: track1.title:TBlah bl
- 8: track1.title:TBlah b
- 9: track1.title:TBlah
-10: track1.title:TBlah
-11: track1.title:TBla
-12: track1.title:TBl
-13: track1.title:TB
-14: track1.title:T
/([^.]*)\.([^:]*):[t ]+(.*)/i
track1.title:TBlah blah blah
0: track1.title:TBlah blah blah
- 1: track1.title:TBlah blah bla
- 2: track1.title:TBlah blah bl
- 3: track1.title:TBlah blah b
- 4: track1.title:TBlah blah
- 5: track1.title:TBlah blah
- 6: track1.title:TBlah bla
- 7: track1.title:TBlah bl
- 8: track1.title:TBlah b
- 9: track1.title:TBlah
-10: track1.title:TBlah
-11: track1.title:TBla
-12: track1.title:TBl
-13: track1.title:TB
-14: track1.title:T
/^[W-c]+$/
WXY_^abc
@@ -2882,13 +2777,10 @@ No match
0: b
c::b
0: ::
- 1: :
/[-az]+/
az-
0: az-
- 1: az
- 2: a
*** Failers
0: a
b
@@ -2897,8 +2789,6 @@ No match
/[az-]+/
za-
0: za-
- 1: za
- 2: z
*** Failers
0: a
b
@@ -2907,8 +2797,6 @@ No match
/[a\-z]+/
a-z
0: a-z
- 1: a-
- 2: a
*** Failers
0: a
b
@@ -2917,20 +2805,10 @@ No match
/[a-z]+/
abcdxyz
0: abcdxyz
- 1: abcdxy
- 2: abcdx
- 3: abcd
- 4: abc
- 5: ab
- 6: a
/[\d-]+/
12-34
0: 12-34
- 1: 12-3
- 2: 12-
- 3: 12
- 4: 1
*** Failers
No match
aaa
@@ -2939,11 +2817,6 @@ No match
/[\d-z]+/
12-34z
0: 12-34z
- 1: 12-34
- 2: 12-3
- 3: 12-
- 4: 12
- 5: 1
*** Failers
No match
aaa
@@ -3027,18 +2900,22 @@ No match
abc\100\60
0: abc@0
-/abc\81/
- abc\081
- 0: abc\x0081
- abc\0\x38\x31
- 0: abc\x0081
-
-/abc\91/
- abc\091
- 0: abc\x0091
- abc\0\x39\x31
- 0: abc\x0091
-
+/^A\8B\9C$/
+ A8B9C
+ 0: A8B9C
+ *** Failers
+No match
+ A\08B\09C
+No match
+
+/^[A\8B\9C]+$/
+ A8B9C
+ 0: A8B9C
+ *** Failers
+No match
+ A8B9C\x00
+No match
+
/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
abcdefghijk\12S
0: abcdefghijk\x0aS
@@ -3077,16 +2954,13 @@ No match
1: baNOTccc
2: baNOTcc
3: baNOTc
- 4: baNOT
baNOTcccd
0: baNOTccc
1: baNOTcc
2: baNOTc
- 3: baNOT
baNOTccd
0: baNOTcc
1: baNOTc
- 2: baNOT
bacccd
0: baccc
*** Failers
@@ -3096,7 +2970,6 @@ No match
3: *** Fail
4: *** Fai
5: *** Fa
- 6: *** F
anything
No match
b\bc
@@ -3115,23 +2988,14 @@ No match
/[^a]+/
AAAaAbc
0: AAA
- 1: AA
- 2: A
/[^a]+/i
AAAaAbc
0: bc
- 1: b
/[^a]+/
bbb\nccc
0: bbb\x0accc
- 1: bbb\x0acc
- 2: bbb\x0ac
- 3: bbb\x0a
- 4: bbb
- 5: bb
- 6: b
/[^k]$/
abc
@@ -3208,20 +3072,8 @@ No match
/(\.\d\d[1-9]?)\d+/
1.230003938
0: .230003938
- 1: .23000393
- 2: .2300039
- 3: .230003
- 4: .23000
- 5: .2300
- 6: .230
1.875000282
0: .875000282
- 1: .87500028
- 2: .8750002
- 3: .875000
- 4: .87500
- 5: .8750
- 6: .875
1.235
0: .235
@@ -3243,10 +3095,6 @@ No match
/\b(foo)\s+(\w+)/i
Food is on the foo table
0: foo table
- 1: foo tabl
- 2: foo tab
- 3: foo ta
- 4: foo t
/foo(.*)bar/
The food is under the bar in the barn.
@@ -3258,7 +3106,7 @@ No match
0: food is under the bar in the bar
1: food is under the bar
-/(.*)(\d*)/
+/(.*)(\d*)/O
I have 2 numbers: 53147
Matched, but offsets vector is too small to show all matches
0: I have 2 numbers: 53147
@@ -3287,13 +3135,9 @@ Matched, but offsets vector is too small to show all matches
/(.*)(\d+)/
I have 2 numbers: 53147
0: I have 2 numbers: 53147
- 1: I have 2 numbers: 5314
- 2: I have 2 numbers: 531
- 3: I have 2 numbers: 53
- 4: I have 2 numbers: 5
- 5: I have 2
+ 1: I have 2
-/(.*?)(\d*)/
+/(.*?)(\d*)/O
I have 2 numbers: 53147
Matched, but offsets vector is too small to show all matches
0: I have 2 numbers: 53147
@@ -3322,11 +3166,7 @@ Matched, but offsets vector is too small to show all matches
/(.*?)(\d+)/
I have 2 numbers: 53147
0: I have 2 numbers: 53147
- 1: I have 2 numbers: 5314
- 2: I have 2 numbers: 531
- 3: I have 2 numbers: 53
- 4: I have 2 numbers: 5
- 5: I have 2
+ 1: I have 2
/(.*)(\d+)$/
I have 2 numbers: 53147
@@ -3738,13 +3578,8 @@ No match
0: a
ab
0: ab
- 1: a
abbbb
0: abbbb
- 1: abbb
- 2: abb
- 3: ab
- 4: a
*** Failers
0: a
bbbbb
@@ -3930,19 +3765,8 @@ No match
/(?>(\.\d\d[1-9]?))\d+/
1.230003938
0: .230003938
- 1: .23000393
- 2: .2300039
- 3: .230003
- 4: .23000
- 5: .2300
- 6: .230
1.875000282
0: .875000282
- 1: .87500028
- 2: .8750002
- 3: .875000
- 4: .87500
- 5: .8750
*** Failers
No match
1.235
@@ -4561,7 +4385,6 @@ No match
/.{3,4}/
abbbbc
0: abbb
- 1: abb
/ab{0,}bc/
abbbbc
@@ -4929,9 +4752,6 @@ No match
/[^ab]*/
cde
0: cde
- 1: cd
- 2: c
- 3:
/abc/
*** Failers
@@ -4966,7 +4786,6 @@ No match
/ab*/
xabyabbbz
0: ab
- 1: a
xayabbbz
0: a
@@ -4995,8 +4814,7 @@ No match
/a([bc]*)c*/
abc
0: abc
- 1: ab
- 2: a
+ 1: a
/a([bc]*)(c*d)/
abcd
@@ -5033,10 +4851,6 @@ No match
/[a-zA-Z_][a-zA-Z0-9_]*/
alpha
0: alpha
- 1: alph
- 2: alp
- 3: al
- 4: a
/^a(bc+|b[eh])g|.h$/
abh
@@ -5079,8 +4893,6 @@ No match
/(.*)c(.*)/
abcde
0: abcde
- 1: abcd
- 2: abc
/\((.*), (.*)\)/
(a, b)
@@ -5395,9 +5207,6 @@ No match
/[^ab]*/i
CDE
0: CDE
- 1: CD
- 2: C
- 3:
/abc/i
@@ -5427,7 +5236,6 @@ No match
/ab*/i
XABYABBBZ
0: AB
- 1: A
XAYABBBZ
0: A
@@ -5458,8 +5266,7 @@ No match
/a([bc]*)c*/i
ABC
0: ABC
- 1: AB
- 2: A
+ 1: A
/a([bc]*)(c*d)/i
ABCD
@@ -5490,10 +5297,6 @@ No match
/[a-zA-Z_][a-zA-Z0-9_]*/i
ALPHA
0: ALPHA
- 1: ALPH
- 2: ALP
- 3: AL
- 4: A
/^a(bc+|b[eh])g|.h$/i
ABH
@@ -5546,8 +5349,6 @@ No match
/(.*)c(.*)/i
ABCDE
0: ABCDE
- 1: ABCD
- 2: ABC
/\((.*), (.*)\)/i
(A, B)
@@ -6052,17 +5853,14 @@ No match
/([[:]+)/
a:[b]:
0: :[
- 1: :
/([[=]+)/
a=[b]=
0: =[
- 1: =
/([[.]+)/
a.[b].
0: .[
- 1: .
/((?>a+)b)/
aaab
@@ -6196,26 +5994,12 @@ No match
/a*/g
abbab
0: a
- 1:
0:
0:
0: a
- 1:
0:
0:
-/^[a-\d]/
- abcde
- 0: a
- -things
- 0: -
- 0digit
- 0: 0
- *** Failers
-No match
- bcdef
-No match
-
/^[\d-a]/
abcde
0: a
@@ -6231,36 +6015,22 @@ No match
/[[:space:]]+/
> \x09\x0a\x0c\x0d\x0b<
0: \x09\x0a\x0c\x0d\x0b
- 1: \x09\x0a\x0c\x0d
- 2: \x09\x0a\x0c
- 3: \x09\x0a
- 4: \x09
- 5:
/[[:blank:]]+/
> \x09\x0a\x0c\x0d\x0b<
0: \x09
- 1:
/[\s]+/
> \x09\x0a\x0c\x0d\x0b<
- 0: \x09\x0a\x0c\x0d
- 1: \x09\x0a\x0c
- 2: \x09\x0a
- 3: \x09
- 4:
+ 0: \x09\x0a\x0c\x0d\x0b
/\s+/
> \x09\x0a\x0c\x0d\x0b<
- 0: \x09\x0a\x0c\x0d
- 1: \x09\x0a\x0c
- 2: \x09\x0a
- 3: \x09
- 4:
+ 0: \x09\x0a\x0c\x0d\x0b
/a b/x
ab
-No match
+ 0: ab
/(?!\A)x/m
a\nxb\n
@@ -6563,8 +6333,6 @@ Partial match: 123
/Content-Type\x3A[^\r\n]{6,}/
Content-Type:xxxxxyyy
0: Content-Type:xxxxxyyy
- 1: Content-Type:xxxxxyy
- 2: Content-Type:xxxxxy
/Content-Type\x3A[^\r\n]{6,}z/
Content-Type:xxxxxyyyz
@@ -6661,66 +6429,22 @@ No match
/.*/<lf>
abc\ndef
0: abc
- 1: ab
- 2: a
- 3:
abc\rdef
0: abc\x0ddef
- 1: abc\x0dde
- 2: abc\x0dd
- 3: abc\x0d
- 4: abc
- 5: ab
- 6: a
- 7:
abc\r\ndef
0: abc\x0d
- 1: abc
- 2: ab
- 3: a
- 4:
\<cr>abc\ndef
0: abc\x0adef
- 1: abc\x0ade
- 2: abc\x0ad
- 3: abc\x0a
- 4: abc
- 5: ab
- 6: a
- 7:
\<cr>abc\rdef
0: abc
- 1: ab
- 2: a
- 3:
\<cr>abc\r\ndef
0: abc
- 1: ab
- 2: a
- 3:
\<crlf>abc\ndef
0: abc\x0adef
- 1: abc\x0ade
- 2: abc\x0ad
- 3: abc\x0a
- 4: abc
- 5: ab
- 6: a
- 7:
\<crlf>abc\rdef
0: abc\x0ddef
- 1: abc\x0dde
- 2: abc\x0dd
- 3: abc\x0d
- 4: abc
- 5: ab
- 6: a
- 7:
\<crlf>abc\r\ndef
0: abc
- 1: ab
- 2: a
- 3:
/\w+(.)(.)?def/s
abc\ndef
@@ -7033,10 +6757,8 @@ No match
/\H*\h+\V?\v{3,4}/
\x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
0: \x09 \xa0X\x0a\x0b\x0c\x0d
- 1: \x09 \xa0X\x0a\x0b\x0c
\x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
0: \x09 \xa0\x0a\x0b\x0c\x0d
- 1: \x09 \xa0\x0a\x0b\x0c
\x09\x20\xa0\x0a\x0b\x0c
0: \x09 \xa0\x0a\x0b\x0c
** Failers
@@ -7047,7 +6769,6 @@ No match
/\H{3,4}/
XY ABCDE
0: ABCD
- 1: ABC
XY PQR ST
0: PQR
@@ -7531,15 +7252,11 @@ No match
xxxxabcd\P
0: abcd
0+
- 1: abc
xxxxabcd\P\P
Partial match: abcd
dddxxx\R
0: ddd
0+ xxx
- 1: dd
- 2: d
- 3:
xxxxabcd\P\P
Partial match: abcd
xxx\R
@@ -7549,27 +7266,22 @@ Partial match: abcd
/abcd*/i
xxxxabcd\P
0: abcd
- 1: abc
xxxxabcd\P\P
Partial match: abcd
XXXXABCD\P
0: ABCD
- 1: ABC
XXXXABCD\P\P
Partial match: ABCD
/abc\d*/
xxxxabc1\P
0: abc1
- 1: abc
xxxxabc1\P\P
Partial match: abc1
/abc[de]*/
xxxxabcde\P
0: abcde
- 1: abcd
- 2: abc
xxxxabcde\P\P
Partial match: abcde
@@ -7684,11 +7396,8 @@ Partial match: abc
/.+/
abc\>0
0: abc
- 1: ab
- 2: a
abc\>1
0: bc
- 1: b
abc\>2
0: c
abc\>3
@@ -7811,10 +7520,6 @@ No match
/^(?!a){0}\w+/
aaaaa
0: aaaaa
- 1: aaaa
- 2: aaa
- 3: aa
- 4: a
/(?<=(abc))?xyz/
abcxyz
@@ -7846,7 +7551,7 @@ Error -17 (backreference condition or recursion test not supported for DFA match
aaaabcde
Error -26 (nested recursion at the same subject position)
-/(a+)/
+/(a+)/O
\O6aaaa
Matched, but offsets vector is too small to show all matches
0: aaaa
@@ -7971,7 +7676,6 @@ Partial match: \x0d
Partial match: \x0d\x0d
\r\r\r\P
0: \x0d\x0d\x0d
- 1: \x0d\x0d
\r\r\r\P\P
Partial match: \x0d\x0d\x0d
@@ -8020,4 +7724,57 @@ Error -30 (invalid data in workspace for DFA restart)
abcd\O0
Matched, but offsets vector is too small to show all matches
+/-- These tests show up auto-possessification --/
+
+/[ab]*/
+ aaaa
+ 0: aaaa
+
+/[ab]*?/
+ aaaa
+ 0: aaaa
+ 1: aaa
+ 2: aa
+ 3: a
+ 4:
+
+/[ab]?/
+ aaaa
+ 0: a
+
+/[ab]??/
+ aaaa
+ 0: a
+ 1:
+
+/[ab]+/
+ aaaa
+ 0: aaaa
+
+/[ab]+?/
+ aaaa
+ 0: aaaa
+ 1: aaa
+ 2: aa
+ 3: a
+
+/[ab]{2,3}/
+ aaaa
+ 0: aaa
+
+/[ab]{2,3}?/
+ aaaa
+ 0: aaa
+ 1: aa
+
+/[ab]{2,}/
+ aaaa
+ 0: aaaa
+
+/[ab]{2,}?/
+ aaaa
+ 0: aaaa
+ 1: aaa
+ 2: aa
+
/-- End of testinput8 --/
diff --git a/pcre/testdata/testoutput9 b/pcre/testdata/testoutput9
index 0bb101ad614..efbbf180106 100644
--- a/pcre/testdata/testoutput9
+++ b/pcre/testdata/testoutput9
@@ -1,6 +1,8 @@
/-- This set of tests checks UTF-8 support with the DFA matching functionality
- of pcre_dfa_exec(). The -dfa flag must be used with pcretest when running
- it. --/
+ of pcre_dfa_exec(), excluding Unicode property support. The -dfa flag must
+ be used with pcretest when running it. --/
+
+< forbid W
/\x{100}ab/8
\x{100}ab
@@ -313,13 +315,9 @@ No match
/[^a]+/8g
bcd
0: bcd
- 1: bc
- 2: b
\x{100}aY\x{256}Z
0: \x{100}
0: Y\x{256}Z
- 1: Y\x{256}
- 2: Y
/^[^a]{2}/8
\x{100}bc
@@ -328,8 +326,6 @@ No match
/^[^a]{2,}/8
\x{100}bcAa
0: \x{100}bcA
- 1: \x{100}bc
- 2: \x{100}b
/^[^a]{2,}?/8
\x{100}bca
@@ -339,13 +335,9 @@ No match
/[^a]+/8ig
bcd
0: bcd
- 1: bc
- 2: b
\x{100}aY\x{256}Z
0: \x{100}
0: Y\x{256}Z
- 1: Y\x{256}
- 2: Y
/^[^a]{2}/8i
\x{100}bc
@@ -354,7 +346,6 @@ No match
/^[^a]{2,}/8i
\x{100}bcAa
0: \x{100}bc
- 1: \x{100}b
/^[^a]{2,}?/8i
\x{100}bca
@@ -370,28 +361,18 @@ No match
0:
\x{100}\x{100}
0: \x{100}
- 1:
/\x{100}{0,3}/8
\x{100}\x{100}
0: \x{100}\x{100}
- 1: \x{100}
- 2:
\x{100}\x{100}\x{100}\x{100}
0: \x{100}\x{100}\x{100}
- 1: \x{100}\x{100}
- 2: \x{100}
- 3:
/\x{100}*/8
abce
0:
\x{100}\x{100}\x{100}\x{100}
0: \x{100}\x{100}\x{100}\x{100}
- 1: \x{100}\x{100}\x{100}
- 2: \x{100}\x{100}
- 3: \x{100}
- 4:
/\x{100}{1,1}/8
abcd\x{100}\x{100}\x{100}\x{100}
@@ -400,15 +381,10 @@ No match
/\x{100}{1,3}/8
abcd\x{100}\x{100}\x{100}\x{100}
0: \x{100}\x{100}\x{100}
- 1: \x{100}\x{100}
- 2: \x{100}
/\x{100}+/8
abcd\x{100}\x{100}\x{100}\x{100}
0: \x{100}\x{100}\x{100}\x{100}
- 1: \x{100}\x{100}\x{100}
- 2: \x{100}\x{100}
- 3: \x{100}
/\x{100}{3}/8
abcd\x{100}\x{100}\x{100}XX
@@ -417,10 +393,8 @@ No match
/\x{100}{3,5}/8
abcd\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}XX
0: \x{100}\x{100}\x{100}\x{100}\x{100}
- 1: \x{100}\x{100}\x{100}\x{100}
- 2: \x{100}\x{100}\x{100}
-/\x{100}{3,}/8
+/\x{100}{3,}/8O
abcd\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}XX
0: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
1: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
@@ -432,7 +406,7 @@ No match
Xyyya\x{100}\x{100}bXzzz
0: X
-/\D*/8
+/\D*/8O
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Matched, but offsets vector is too small to show all matches
0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -458,7 +432,7 @@ Matched, but offsets vector is too small to show all matches
20: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
21: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-/\D*/8
+/\D*/8O
\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
Matched, but offsets vector is too small to show all matches
0: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
@@ -507,33 +481,18 @@ Matched, but offsets vector is too small to show all matches
/\D+/8
12abcd34
0: abcd
- 1: abc
- 2: ab
- 3: a
*** Failers
0: *** Failers
- 1: *** Failer
- 2: *** Faile
- 3: *** Fail
- 4: *** Fai
- 5: *** Fa
- 6: *** F
- 7: ***
- 8: ***
- 9: **
-10: *
1234
No match
/\D{2,3}/8
12abcd34
0: abc
- 1: ab
12ab34
0: ab
*** Failers
0: ***
- 1: **
1234
No match
12a34
@@ -556,7 +515,6 @@ No match
/\d+/8
12abcd34
0: 12
- 1: 1
*** Failers
No match
@@ -565,7 +523,6 @@ No match
0: 12
1234abcd
0: 123
- 1: 12
*** Failers
No match
1.4
@@ -585,30 +542,18 @@ No match
/\S+/8
12abcd34
0: 12abcd34
- 1: 12abcd3
- 2: 12abcd
- 3: 12abc
- 4: 12ab
- 5: 12a
- 6: 12
- 7: 1
*** Failers
0: ***
- 1: **
- 2: *
\ \
No match
/\S{2,3}/8
12abcd34
0: 12a
- 1: 12
1234abcd
0: 123
- 1: 12
*** Failers
0: ***
- 1: **
\ \
No match
@@ -654,15 +599,8 @@ No match
/\w+/8
12 34
0: 12
- 1: 1
*** Failers
0: Failers
- 1: Failer
- 2: Faile
- 3: Fail
- 4: Fai
- 5: Fa
- 6: F
+++=*!
No match
@@ -671,10 +609,8 @@ No match
0: ab
abcd ce
0: abc
- 1: ab
*** Failers
0: Fai
- 1: Fa
a.b.c
No match
@@ -693,26 +629,18 @@ No match
/\W+/8
12====34
0: ====
- 1: ===
- 2: ==
- 3: =
*** Failers
0: ***
- 1: ***
- 2: **
- 3: *
abcd
No match
/\W{2,3}/8
ab====cd
0: ===
- 1: ==
ab==cd
0: ==
*** Failers
0: ***
- 1: **
a.b.c
No match
@@ -825,8 +753,6 @@ No match
0: \x{200}
ab\x{200}\x{100}\x{200}\x{100}cd
0: \x{200}\x{100}\x{200}
- 1: \x{200}\x{100}
- 2: \x{200}
*** Failers
No match
@@ -849,8 +775,6 @@ No match
0: \x{200}
ab\x{200}\x{100}\x{200}\x{100}cd
0: \x{200}\x{100}\x{200}
- 1: \x{200}\x{100}
- 2: \x{200}
*** Failers
No match
@@ -1126,21 +1050,21 @@ No match
a\r
No match
-/\h+\V?\v{3,4}/8
+/\h+\V?\v{3,4}/8O
\x09\x20\x{a0}X\x0a\x0b\x0c\x0d\x0a
0: \x{09} \x{a0}X\x{0a}\x{0b}\x{0c}\x{0d}
1: \x{09} \x{a0}X\x{0a}\x{0b}\x{0c}
-/\V?\v{3,4}/8
+/\V?\v{3,4}/8O
\x20\x{a0}X\x0a\x0b\x0c\x0d\x0a
0: X\x{0a}\x{0b}\x{0c}\x{0d}
1: X\x{0a}\x{0b}\x{0c}
-/\h+\V?\v{3,4}/8
+/\h+\V?\v{3,4}/8O
>\x09\x20\x{a0}X\x0a\x0a\x0a<
0: \x{09} \x{a0}X\x{0a}\x{0a}\x{0a}
-/\V?\v{3,4}/8
+/\V?\v{3,4}/8O
>\x09\x20\x{a0}X\x0a\x0a\x0a<
0: X\x{0a}\x{0a}\x{0a}
@@ -1154,7 +1078,7 @@ No match
\x{a0} X\x0a
No match
-/\H*\h+\V?\v{3,4}/8
+/\H*\h+\V?\v{3,4}/8O
\x09\x20\x{a0}X\x0a\x0b\x0c\x0d\x0a
0: \x{09} \x{a0}X\x{0a}\x{0b}\x{0c}\x{0d}
1: \x{09} \x{a0}X\x{0a}\x{0b}\x{0c}
@@ -1178,7 +1102,7 @@ No match
\x{2009} X\x0a
No match
-/\H*\h+\V?\v{3,4}/8
+/\H*\h+\V?\v{3,4}/8O
\x{1680}\x{180e}\x{2007}X\x{2028}\x{2029}\x0c\x0d\x0a
0: \x{1680}\x{180e}\x{2007}X\x{2028}\x{2029}\x{0c}\x{0d}
1: \x{1680}\x{180e}\x{2007}X\x{2028}\x{2029}\x{0c}
@@ -1279,34 +1203,28 @@ No match
/abcd*/8
xxxxabcd\P
0: abcd
- 1: abc
xxxxabcd\P\P
Partial match: abcd
/abcd*/i8
xxxxabcd\P
0: abcd
- 1: abc
xxxxabcd\P\P
Partial match: abcd
XXXXABCD\P
0: ABCD
- 1: ABC
XXXXABCD\P\P
Partial match: ABCD
/abc\d*/8
xxxxabc1\P
0: abc1
- 1: abc
xxxxabc1\P\P
Partial match: abc1
/abc[de]*/8
xxxxabcde\P
0: abcde
- 1: abcd
- 2: abc
xxxxabcde\P\P
Partial match: abcde
@@ -1340,7 +1258,6 @@ Partial match: \x{0d}
Partial match: \x{0d}\x{0d}
\r\r\r\P
0: \x{0d}\x{0d}\x{0d}
- 1: \x{0d}\x{0d}
\r\r\r\P\P
Partial match: \x{0d}\x{0d}\x{0d}
@@ -1366,6 +1283,5 @@ Partial match: \x{0d}\x{0d}\x{0d}
/[^\x{100}]+/8
\x{100}\x{101}X
0: \x{101}X
- 1: \x{101}
/-- End of testinput9 --/
diff --git a/pcre/ucp.h b/pcre/ucp.h
index 21039106e58..d8b34bfcc5b 100644
--- a/pcre/ucp.h
+++ b/pcre/ucp.h
@@ -11,7 +11,10 @@ should always be at the end of each enum, for backwards compatibility.
IMPORTANT: Note also that the specific numeric values of the enums have to be
the same as the values that are generated by the maint/MultiStage2.py script,
-where the equivalent property descriptive names are listed in vectors. */
+where the equivalent property descriptive names are listed in vectors.
+
+ALSO: The specific values of the first two enums are assumed for the table
+called catposstab in pcre_compile.c. */
/* These are the general character categories. */