]> granicus.if.org Git - php/commitdiff
Upgrade to PCRE version 6.2.
authorAndrei Zmievski <andrei@php.net>
Mon, 8 Aug 2005 23:59:04 +0000 (23:59 +0000)
committerAndrei Zmievski <andrei@php.net>
Mon, 8 Aug 2005 23:59:04 +0000 (23:59 +0000)
# Don't worry, upgrade for other branches is coming

74 files changed:
ext/pcre/config.m4
ext/pcre/config0.m4
ext/pcre/pcrelib/AUTHORS
ext/pcre/pcrelib/COPYING
ext/pcre/pcrelib/ChangeLog
ext/pcre/pcrelib/LICENCE
ext/pcre/pcrelib/NEWS
ext/pcre/pcrelib/NON-UNIX-USE
ext/pcre/pcrelib/README
ext/pcre/pcrelib/dftables.c
ext/pcre/pcrelib/doc/Tech.Notes
ext/pcre/pcrelib/doc/pcre.txt
ext/pcre/pcrelib/libpcre.def
ext/pcre/pcrelib/libpcreposix.def
ext/pcre/pcrelib/pcre.def
ext/pcre/pcrelib/pcre.h
ext/pcre/pcrelib/pcre_chartables.c [moved from ext/pcre/pcrelib/chartables.c with 96% similarity]
ext/pcre/pcrelib/pcre_compile.c [moved from ext/pcre/pcrelib/pcre.c with 52% similarity]
ext/pcre/pcrelib/pcre_config.c [new file with mode: 0644]
ext/pcre/pcrelib/pcre_dfa_exec.c [new file with mode: 0644]
ext/pcre/pcrelib/pcre_exec.c [new file with mode: 0644]
ext/pcre/pcrelib/pcre_fullinfo.c [new file with mode: 0644]
ext/pcre/pcrelib/pcre_get.c [moved from ext/pcre/pcrelib/get.c with 96% similarity]
ext/pcre/pcrelib/pcre_globals.c [new file with mode: 0644]
ext/pcre/pcrelib/pcre_info.c [new file with mode: 0644]
ext/pcre/pcrelib/pcre_internal.h [new file with mode: 0644]
ext/pcre/pcrelib/pcre_maketables.c [moved from ext/pcre/pcrelib/maketables.c with 89% similarity]
ext/pcre/pcrelib/pcre_ord2utf8.c [new file with mode: 0644]
ext/pcre/pcrelib/pcre_printint.c [new file with mode: 0644]
ext/pcre/pcrelib/pcre_refcount.c [new file with mode: 0644]
ext/pcre/pcrelib/pcre_scanner.cc [new file with mode: 0644]
ext/pcre/pcrelib/pcre_scanner.h [new file with mode: 0644]
ext/pcre/pcrelib/pcre_scanner_unittest.cc [new file with mode: 0644]
ext/pcre/pcrelib/pcre_stringpiece.cc [new file with mode: 0644]
ext/pcre/pcrelib/pcre_stringpiece.h [new file with mode: 0644]
ext/pcre/pcrelib/pcre_stringpiece_unittest.cc [new file with mode: 0644]
ext/pcre/pcrelib/pcre_study.c [moved from ext/pcre/pcrelib/study.c with 97% similarity]
ext/pcre/pcrelib/pcre_tables.c [moved from ext/pcre/pcrelib/ucptypetable.c with 58% similarity]
ext/pcre/pcrelib/pcre_try_flipped.c [new file with mode: 0644]
ext/pcre/pcrelib/pcre_ucp_findchar.c [new file with mode: 0644]
ext/pcre/pcrelib/pcre_valid_utf8.c [new file with mode: 0644]
ext/pcre/pcrelib/pcre_version.c [new file with mode: 0644]
ext/pcre/pcrelib/pcre_xclass.c [new file with mode: 0644]
ext/pcre/pcrelib/pcrecpp.cc [new file with mode: 0644]
ext/pcre/pcrelib/pcrecpp.h [new file with mode: 0644]
ext/pcre/pcrelib/pcrecpp_unittest.cc [new file with mode: 0644]
ext/pcre/pcrelib/pcregrep.c
ext/pcre/pcrelib/pcreposix.c
ext/pcre/pcrelib/pcreposix.h
ext/pcre/pcrelib/pcretest.c
ext/pcre/pcrelib/testdata/grepinput [new file with mode: 0644]
ext/pcre/pcrelib/testdata/grepinputx [new file with mode: 0644]
ext/pcre/pcrelib/testdata/greplist [new file with mode: 0644]
ext/pcre/pcrelib/testdata/grepoutput [new file with mode: 0644]
ext/pcre/pcrelib/testdata/testinput1
ext/pcre/pcrelib/testdata/testinput2
ext/pcre/pcrelib/testdata/testinput3
ext/pcre/pcrelib/testdata/testinput4
ext/pcre/pcrelib/testdata/testinput5
ext/pcre/pcrelib/testdata/testinput6
ext/pcre/pcrelib/testdata/testinput7 [new file with mode: 0644]
ext/pcre/pcrelib/testdata/testinput8 [new file with mode: 0644]
ext/pcre/pcrelib/testdata/testinput9 [new file with mode: 0644]
ext/pcre/pcrelib/testdata/testoutput1
ext/pcre/pcrelib/testdata/testoutput2
ext/pcre/pcrelib/testdata/testoutput3
ext/pcre/pcrelib/testdata/testoutput4
ext/pcre/pcrelib/testdata/testoutput5
ext/pcre/pcrelib/testdata/testoutput6
ext/pcre/pcrelib/testdata/testoutput7 [new file with mode: 0644]
ext/pcre/pcrelib/testdata/testoutput8 [new file with mode: 0644]
ext/pcre/pcrelib/testdata/testoutput9 [new file with mode: 0644]
ext/pcre/pcrelib/ucp.h
ext/pcre/pcrelib/ucp_findchar.c [moved from ext/pcre/pcrelib/ucp.c with 89% similarity]

index 2585426f81c98ca1427541c2429aa1931b013d90..d3309f3e40043dc3500798c6a038d09b2275cdf0 100644 (file)
@@ -13,7 +13,7 @@ PHP_ARG_WITH(pcre-regex,for PCRE support,
 
 if test "$PHP_PCRE_REGEX" != "no"; then
   if test "$PHP_PCRE_REGEX" = "yes"; then
-    PHP_NEW_EXTENSION(pcre, pcrelib/maketables.c pcrelib/get.c pcrelib/study.c pcrelib/pcre.c php_pcre.c, $ext_shared,,-DSUPPORT_UTF8 -DSUPPORT_UCP -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -DMATCH_LIMIT=10000000 -I@ext_srcdir@/pcrelib)
+    PHP_NEW_EXTENSION(pcre, pcrelib/pcre_chartables.c pcrelib/pcre_compile.c pcrelib/pcre_config.c pcrelib/pcre_dfa_exec.c pcrelib/pcre_exec.c pcrelib/pcre_fullinfo.c pcrelib/pcre_get.c pcrelib/pcre_globals.c pcrelib/pcre_info.c pcrelib/pcre_maketables.c pcrelib/pcre_ord2utf8.c pcrelib/pcre_printint.c pcrelib/pcre_refcount.c pcrelib/pcre_study.c pcrelib/pcre_tables.c pcrelib/pcre_try_flipped.c pcrelib/pcre_ucp_findchar.c pcrelib/pcre_valid_utf8.c pcrelib/pcre_version.c pcrelib/pcre_xclass.c php_pcre.c, $ext_shared,,-DEXPORT= -DNEWLINE=10 -DSUPPORT_UTF8 -DSUPPORT_UCP -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -DMATCH_LIMIT=10000000 -I@ext_srcdir@/pcrelib)
     PHP_ADD_BUILD_DIR($ext_builddir/pcrelib)
     AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
   else
@@ -50,7 +50,7 @@ if test "$PHP_PCRE_REGEX" != "no"; then
     
     AC_DEFINE(HAVE_PCRE, 1, [ ])
     PHP_ADD_INCLUDE($PCRE_INCDIR)
-    PHP_NEW_EXTENSION(pcre, php_pcre.c, $ext_shared,,-DSUPPORT_UTF8 -DSUPPORT_UCP -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -DMATCH_LIMIT=10000000)
+    PHP_NEW_EXTENSION(pcre, php_pcre.c, $ext_shared,,-DEXPORT= -DNEWLINE=10 -DSUPPORT_UTF8 -DSUPPORT_UCP -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -DMATCH_LIMIT=10000000)
   fi
   PHP_SUBST(PCRE_SHARED_LIBADD)
 fi
index 2585426f81c98ca1427541c2429aa1931b013d90..d3309f3e40043dc3500798c6a038d09b2275cdf0 100644 (file)
@@ -13,7 +13,7 @@ PHP_ARG_WITH(pcre-regex,for PCRE support,
 
 if test "$PHP_PCRE_REGEX" != "no"; then
   if test "$PHP_PCRE_REGEX" = "yes"; then
-    PHP_NEW_EXTENSION(pcre, pcrelib/maketables.c pcrelib/get.c pcrelib/study.c pcrelib/pcre.c php_pcre.c, $ext_shared,,-DSUPPORT_UTF8 -DSUPPORT_UCP -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -DMATCH_LIMIT=10000000 -I@ext_srcdir@/pcrelib)
+    PHP_NEW_EXTENSION(pcre, pcrelib/pcre_chartables.c pcrelib/pcre_compile.c pcrelib/pcre_config.c pcrelib/pcre_dfa_exec.c pcrelib/pcre_exec.c pcrelib/pcre_fullinfo.c pcrelib/pcre_get.c pcrelib/pcre_globals.c pcrelib/pcre_info.c pcrelib/pcre_maketables.c pcrelib/pcre_ord2utf8.c pcrelib/pcre_printint.c pcrelib/pcre_refcount.c pcrelib/pcre_study.c pcrelib/pcre_tables.c pcrelib/pcre_try_flipped.c pcrelib/pcre_ucp_findchar.c pcrelib/pcre_valid_utf8.c pcrelib/pcre_version.c pcrelib/pcre_xclass.c php_pcre.c, $ext_shared,,-DEXPORT= -DNEWLINE=10 -DSUPPORT_UTF8 -DSUPPORT_UCP -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -DMATCH_LIMIT=10000000 -I@ext_srcdir@/pcrelib)
     PHP_ADD_BUILD_DIR($ext_builddir/pcrelib)
     AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
   else
@@ -50,7 +50,7 @@ if test "$PHP_PCRE_REGEX" != "no"; then
     
     AC_DEFINE(HAVE_PCRE, 1, [ ])
     PHP_ADD_INCLUDE($PCRE_INCDIR)
-    PHP_NEW_EXTENSION(pcre, php_pcre.c, $ext_shared,,-DSUPPORT_UTF8 -DSUPPORT_UCP -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -DMATCH_LIMIT=10000000)
+    PHP_NEW_EXTENSION(pcre, php_pcre.c, $ext_shared,,-DEXPORT= -DNEWLINE=10 -DSUPPORT_UTF8 -DSUPPORT_UCP -DLINK_SIZE=2 -DPOSIX_MALLOC_THRESHOLD=10 -DMATCH_LIMIT=10000000)
   fi
   PHP_SUBST(PCRE_SHARED_LIBADD)
 fi
index 00bd1d0642c43510e1595426551e0e6d50b4a189..33df90f8df3e5db4e40284bc8ec55ba8add6aaf7 100644 (file)
@@ -1,6 +1,23 @@
-Written by: Philip Hazel <ph10@cam.ac.uk>
+THE MAIN PCRE LIBRARY
+---------------------
+
+Written by:       Philip Hazel
+Email local part: ph10
+Email domain:     cam.ac.uk
 
 University of Cambridge Computing Service,
 Cambridge, England. Phone: +44 1223 334714.
 
-Copyright (c) 1997-2004 University of Cambridge
+Copyright (c) 1997-2005 University of Cambridge
+All rights reserved
+
+
+THE C++ WRAPPER LIBRARY
+-----------------------
+
+Written by:       Google Inc.
+
+Copyright (c) 2005 Google Inc
+All rights reserved
+
+####
index 1573583b6c095d444954816242be287e64be3d71..e8eb0d9370321dca0b8b0ee34223ab38826592f6 100644 (file)
@@ -4,18 +4,40 @@ PCRE LICENCE
 PCRE is a library of functions to support regular expressions whose syntax
 and semantics are as close as possible to those of the Perl 5 language.
 
-Release 5 of PCRE is distributed under the terms of the "BSD" licence, as
+Release 6 of PCRE is distributed under the terms of the "BSD" licence, as
 specified below. The documentation for PCRE, supplied in the "doc"
 directory, is distributed under the same terms as the software itself.
 
-Written by: Philip Hazel <ph10@cam.ac.uk>
+The basic library functions are written in C and are freestanding. Also
+included in the distribution is a set of C++ wrapper functions.
+
+
+THE BASIC LIBRARY FUNCTIONS
+---------------------------
+
+Written by:       Philip Hazel
+Email local part: ph10
+Email domain:     cam.ac.uk
 
 University of Cambridge Computing Service,
 Cambridge, England. Phone: +44 1223 334714.
 
-Copyright (c) 1997-2004 University of Cambridge
+Copyright (c) 1997-2005 University of Cambridge
+All rights reserved.
+
+
+THE C++ WRAPPER FUNCTIONS
+-------------------------
+
+Contributed by:   Google Inc.
+
+Copyright (c) 2005, Google Inc.
 All rights reserved.
 
+
+THE "BSD" LICENCE
+-----------------
+
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
 
@@ -26,9 +48,10 @@ modification, are permitted provided that the following conditions are met:
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.
 
-    * Neither the name of the University of Cambridge nor the names of its
-      contributors may be used to endorse or promote products derived from
-      this software without specific prior written permission.
+    * Neither the name of the University of Cambridge nor the name of Google
+      Inc. nor the names of their contributors may be used to endorse or
+      promote products derived from this software without specific prior
+      written permission.
 
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
index 59aa955bd3650a14a53f9f13a76f3c2ec3875cb3..b9d74d393f71b59c01b4dcccac63ec3aa9ffdd66 100644 (file)
@@ -1,6 +1,221 @@
 ChangeLog for PCRE
 ------------------
 
+Version 6.2 01-Aug-05
+---------------------
+
+ 1. There was no test for integer overflow of quantifier values. A construction
+    such as {1111111111111111} would give undefined results. What is worse, if
+    a minimum quantifier for a parenthesized subpattern overflowed and became
+    negative, the calculation of the memory size went wrong. This could have
+    led to memory overwriting.
+
+ 2. Building PCRE using VPATH was broken. Hopefully it is now fixed.
+
+ 3. Added "b" to the 2nd argument of fopen() in dftables.c, for non-Unix-like
+    operating environments where this matters.
+
+ 4. Applied Giuseppe Maxia's patch to add additional features for controlling
+    PCRE options from within the C++ wrapper.
+
+ 5. Named capturing subpatterns were not being correctly counted when a pattern
+    was compiled. This caused two problems: (a) If there were more than 100
+    such subpatterns, the calculation of the memory needed for the whole
+    compiled pattern went wrong, leading to an overflow error. (b) Numerical
+    back references of the form \12, where the number was greater than 9, were
+    not recognized as back references, even though there were sufficient
+    previous subpatterns.
+
+ 6. Two minor patches to pcrecpp.cc in order to allow it to compile on older
+    versions of gcc, e.g. 2.95.4.
+
+
+Version 6.1 21-Jun-05
+---------------------
+
+ 1. There was one reference to the variable "posix" in pcretest.c that was not
+    surrounded by "#if !defined NOPOSIX".
+
+ 2. Make it possible to compile pcretest without DFA support, UTF8 support, or
+    the cross-check on the old pcre_info() function, for the benefit of the
+    cut-down version of PCRE that is currently imported into Exim.
+
+ 3. A (silly) pattern starting with (?i)(?-i) caused an internal space
+    allocation error. I've done the easy fix, which wastes 2 bytes for sensible
+    patterns that start (?i) but I don't think that matters. The use of (?i) is
+    just an example; this all applies to the other options as well.
+
+ 4. Since libtool seems to echo the compile commands it is issuing, the output
+    from "make" can be reduced a bit by putting "@" in front of each libtool
+    compile command.
+
+ 5. Patch from the folks at Google for configure.in to be a bit more thorough
+    in checking for a suitable C++ installation before trying to compile the
+    C++ stuff. This should fix a reported problem when a compiler was present,
+    but no suitable headers.
+
+ 6. The man pages all had just "PCRE" as their title. I have changed them to
+    be the relevant file name. I have also arranged that these names are
+    retained in the file doc/pcre.txt, which is a concatenation in text format
+    of all the man pages except the little individual ones for each function.
+
+ 7. The NON-UNIX-USE file had not been updated for the different set of source
+    files that come with release 6. I also added a few comments about the C++
+    wrapper.
+
+
+Version 6.0 07-Jun-05
+---------------------
+
+ 1. Some minor internal re-organization to help with my DFA experiments.
+
+ 2. Some missing #ifdef SUPPORT_UCP conditionals in pcretest and printint that
+    didn't matter for the library itself when fully configured, but did matter
+    when compiling without UCP support, or within Exim, where the ucp files are
+    not imported.
+
+ 3. Refactoring of the library code to split up the various functions into
+    different source modules. The addition of the new DFA matching code (see
+    below) to a single monolithic source would have made it really too
+    unwieldy, quite apart from causing all the code to be include in a
+    statically linked application, when only some functions are used. This is
+    relevant even without the DFA addition now that patterns can be compiled in
+    one application and matched in another.
+
+    The downside of splitting up is that there have to be some external
+    functions and data tables that are used internally in different modules of
+    the library but which are not part of the API. These have all had their
+    names changed to start with "_pcre_" so that they are unlikely to clash
+    with other external names.
+
+ 4. Added an alternate matching function, pcre_dfa_exec(), which matches using
+    a different (DFA) algorithm. Although it is slower than the original
+    function, it does have some advantages for certain types of matching
+    problem.
+
+ 5. Upgrades to pcretest in order to test the features of pcre_dfa_exec(),
+    including restarting after a partial match.
+
+ 6. A patch for pcregrep that defines INVALID_FILE_ATTRIBUTES if it is not
+    defined when compiling for Windows was sent to me. I have put it into the
+    code, though I have no means of testing or verifying it.
+
+ 7. Added the pcre_refcount() auxiliary function.
+
+ 8. Added the PCRE_FIRSTLINE option. This constrains an unanchored pattern to
+    match before or at the first newline in the subject string. In pcretest,
+    the /f option on a pattern can be used to set this.
+
+ 9. A repeated \w when used in UTF-8 mode with characters greater than 256
+    would behave wrongly. This has been present in PCRE since release 4.0.
+
+10. A number of changes to the pcregrep command:
+
+    (a) Refactored how -x works; insert ^(...)$ instead of setting
+        PCRE_ANCHORED and checking the length, in preparation for adding
+        something similar for -w.
+
+    (b) Added the -w (match as a word) option.
+
+    (c) Refactored the way lines are read and buffered so as to have more
+        than one at a time available.
+
+    (d) Implemented a pcregrep test script.
+
+    (e) Added the -M (multiline match) option. This allows patterns to match
+        over several lines of the subject. The buffering ensures that at least
+        8K, or the rest of the document (whichever is the shorter) is available
+        for matching (and similarly the previous 8K for lookbehind assertions).
+
+    (f) Changed the --help output so that it now says
+
+          -w, --word-regex(p)
+
+        instead of two lines, one with "regex" and the other with "regexp"
+        because that confused at least one person since the short forms are the
+        same. (This required a bit of code, as the output is generated
+        automatically from a table. It wasn't just a text change.)
+
+    (g) -- can be used to terminate pcregrep options if the next thing isn't an
+        option but starts with a hyphen. Could be a pattern or a path name
+        starting with a hyphen, for instance.
+
+    (h) "-" can be given as a file name to represent stdin.
+
+    (i) When file names are being printed, "(standard input)" is used for
+        the standard input, for compatibility with GNU grep. Previously
+        "<stdin>" was used.
+
+    (j) The option --label=xxx can be used to supply a name to be used for
+        stdin when file names are being printed. There is no short form.
+
+    (k) Re-factored the options decoding logic because we are going to add
+        two more options that take data. Such options can now be given in four
+        different ways, e.g. "-fname", "-f name", "--file=name", "--file name".
+
+    (l) Added the -A, -B, and -C options for requesting that lines of context
+        around matches be printed.
+
+    (m) Added the -L option to print the names of files that do not contain
+        any matching lines, that is, the complement of -l.
+
+    (n) The return code is 2 if any file cannot be opened, but pcregrep does
+        continue to scan other files.
+
+    (o) The -s option was incorrectly implemented. For compatibility with other
+        greps, it now suppresses the error message for a non-existent or non-
+        accessible file (but not the return code). There is a new option called
+        -q that suppresses the output of matching lines, which was what -s was
+        previously doing.
+
+    (p) Added --include and --exclude options to specify files for inclusion
+        and exclusion when recursing.
+
+11. The Makefile was not using the Autoconf-supported LDFLAGS macro properly.
+    Hopefully, it now does.
+
+12. Missing cast in pcre_study().
+
+13. Added an "uninstall" target to the makefile.
+
+14. Replaced "extern" in the function prototypes in Makefile.in with
+    "PCRE_DATA_SCOPE", which defaults to 'extern' or 'extern "C"' in the Unix
+    world, but is set differently for Windows.
+
+15. Added a second compiling function called pcre_compile2(). The only
+    difference is that it has an extra argument, which is a pointer to an
+    integer error code. When there is a compile-time failure, this is set
+    non-zero, in addition to the error test pointer being set to point to an
+    error message. The new argument may be NULL if no error number is required
+    (but then you may as well call pcre_compile(), which is now just a
+    wrapper). This facility is provided because some applications need a
+    numeric error indication, but it has also enabled me to tidy up the way
+    compile-time errors are handled in the POSIX wrapper.
+
+16. Added VPATH=.libs to the makefile; this should help when building with one
+    prefix path and installing with another. (Or so I'm told by someone who
+    knows more about this stuff than I do.)
+
+17. Added a new option, REG_DOTALL, to the POSIX function regcomp(). This
+    passes PCRE_DOTALL to the pcre_compile() function, making the "." character
+    match everything, including newlines. This is not POSIX-compatible, but
+    somebody wanted the feature. From pcretest it can be activated by using
+    both the P and the s flags.
+
+18. AC_PROG_LIBTOOL appeared twice in Makefile.in. Removed one.
+
+19. libpcre.pc was being incorrectly installed as executable.
+
+20. A couple of places in pcretest check for end-of-line by looking for '\n';
+    it now also looks for '\r' so that it will work unmodified on Windows.
+
+21. Added Google's contributed C++ wrapper to the distribution.
+
+22. Added some untidy missing memory free() calls in pcretest, to keep
+    Electric Fence happy when testing.
+
+
+
 Version 5.0 13-Sep-04
 ---------------------
 
index 1573583b6c095d444954816242be287e64be3d71..e8eb0d9370321dca0b8b0ee34223ab38826592f6 100644 (file)
@@ -4,18 +4,40 @@ PCRE LICENCE
 PCRE is a library of functions to support regular expressions whose syntax
 and semantics are as close as possible to those of the Perl 5 language.
 
-Release 5 of PCRE is distributed under the terms of the "BSD" licence, as
+Release 6 of PCRE is distributed under the terms of the "BSD" licence, as
 specified below. The documentation for PCRE, supplied in the "doc"
 directory, is distributed under the same terms as the software itself.
 
-Written by: Philip Hazel <ph10@cam.ac.uk>
+The basic library functions are written in C and are freestanding. Also
+included in the distribution is a set of C++ wrapper functions.
+
+
+THE BASIC LIBRARY FUNCTIONS
+---------------------------
+
+Written by:       Philip Hazel
+Email local part: ph10
+Email domain:     cam.ac.uk
 
 University of Cambridge Computing Service,
 Cambridge, England. Phone: +44 1223 334714.
 
-Copyright (c) 1997-2004 University of Cambridge
+Copyright (c) 1997-2005 University of Cambridge
+All rights reserved.
+
+
+THE C++ WRAPPER FUNCTIONS
+-------------------------
+
+Contributed by:   Google Inc.
+
+Copyright (c) 2005, Google Inc.
 All rights reserved.
 
+
+THE "BSD" LICENCE
+-----------------
+
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
 
@@ -26,9 +48,10 @@ modification, are permitted provided that the following conditions are met:
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.
 
-    * Neither the name of the University of Cambridge nor the names of its
-      contributors may be used to endorse or promote products derived from
-      this software without specific prior written permission.
+    * Neither the name of the University of Cambridge nor the name of Google
+      Inc. nor the names of their contributors may be used to endorse or
+      promote products derived from this software without specific prior
+      written permission.
 
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
index e9a5cf255e3aee8fab35e49523460527cb80b387..a6113e08996af4ebece32aa2d4b9048ae3009a9f 100644 (file)
@@ -1,6 +1,38 @@
 News about PCRE releases
 ------------------------
 
+Release 6.0 07-Jun-05
+---------------------
+
+The release number has been increased to 6.0 because of the addition of several
+major new pieces of functionality.
+
+A new function, pcre_dfa_exec(), which implements pattern matching using a DFA
+algorithm, has been added. This has a number of advantages for certain cases,
+though it does run more slowly, and lacks the ability to capture substrings. On
+the other hand, it does find all matches, not just the first, and it works
+better for partial matching. The pcrematching man page discusses the
+differences.
+
+The pcretest program has been enhanced so that it can make use of the new
+pcre_dfa_exec() matching function and the extra features it provides.
+
+The distribution now includes a C++ wrapper library. This is built
+automatically if a C++ compiler is found. The pcrecpp man page discusses this
+interface.
+
+The code itself has been re-organized into many more files, one for each
+function, so it no longer requires everything to be linked in when static
+linkage is used. As a consequence, some internal functions have had to have
+their names exposed. These functions all have names starting with _pcre_. They
+are undocumented, and are not intended for use by outside callers.
+
+The pcregrep program has been enhanced with new functionality such as
+multiline-matching and options for output more matching context. See the
+ChangeLog for a complete list of changes to the library and the utility
+programs.
+
+
 Release 5.0 13-Sep-04
 ---------------------
 
index f6280af6f694e18573cbeea15fa67ad0a3eaba6a..b7fe4301a6ded621a3282dd3624575c99002cc4c 100644 (file)
@@ -15,7 +15,7 @@ PCRE consists entirely of code written in Standard C, and so should compile
 successfully on any system that has a Standard C compiler and library.
 
 
-GENERIC INSTRUCTIONS
+GENERIC INSTRUCTIONS FOR THE C LIBRARY
 
 The following are generic comments about building PCRE. The interspersed
 indented commands are suggestions from Mark Tetrode as to which commands you
@@ -51,18 +51,41 @@ character tables and writes them to that file.
 
   rem Mark Tetrode's commands
   rem Compile & run
-  cl -DSUPPORT_UTF8 dftables.c
-  dftables.exe > chartables.c
-
-(4) Compile maketables.c, get.c, study.c and pcre.c and link them all
-together into an object library in whichever form your system keeps such
-libraries. This is the pcre library (chartables.c is included by means of an
-#include directive). If your system has static and shared libraries, you may
-have to do this once for each type.
-
+  cl -DSUPPORT_UTF8 -DSUPPORT_UCP dftables.c
+  dftables.exe chartables.c
+
+(4) Compile the following source files:
+
+  pcre_chartables.c
+  pcre_compile.c
+  pcre_config.c
+  pcre_dfa_exec.c
+  pcre_exec.c
+  pcre_fullinfo.c
+  pcre_get.c
+  pcre_globals.c
+  pcre_info.c
+  pcre_maketables.c
+  pcre_ord2utf8.c
+  pcre_printint.c
+  pcre_refcount.c
+  pcre_study.c
+  pcre_tables.c
+  pcre_try_flipped.c
+  pcre_ucp_findchar.c
+  pcre_valid_utf8.c
+  pcre_version.c
+  pcre_xclass.c
+
+and link them all together into an object library in whichever form your system
+keeps such libraries. This is the pcre C library. If your system has static and
+shared libraries, you may have to do this once for each type.
+
+  rem These comments are out-of-date, referring to a previous release which
+  rem had fewer source files. Replace with the file names from above.
   rem Mark Tetrode's commands, for a static library
   rem Compile & lib
-  cl -DSUPPORT_UTF8 -DPOSIX_MALLOC_THRESHOLD=10 /c maketables.c get.c study.c pcre.c
+  cl -DSUPPORT_UTF8 -DSUPPORT_UCP -DPOSIX_MALLOC_THRESHOLD=10 /c maketables.c get.c study.c pcre.c
   lib /OUT:pcre.lib maketables.obj get.obj study.obj pcre.obj
 
 (5) Similarly, compile pcreposix.c and link it (on its own) as the pcreposix
@@ -70,7 +93,7 @@ library.
 
   rem Mark Tetrode's commands, for a static library
   rem Compile & lib
-  cl -DSUPPORT_UTF8 -DPOSIX_MALLOC_THRESHOLD=10 /c pcreposix.c
+  cl -DSUPPORT_UTF8 -DSUPPORT_UCP -DPOSIX_MALLOC_THRESHOLD=10 /c pcreposix.c
   lib /OUT:pcreposix.lib pcreposix.obj
 
 (6) Compile the test program pcretest.c. This needs the functions in the
@@ -78,7 +101,7 @@ pcre and pcreposix libraries when linking.
 
   rem Mark Tetrode's commands
   rem compile & link
-  cl pcretest.c pcre.lib pcreposix.lib
+  cl /F0x400000 pcretest.c pcre.lib pcreposix.lib
 
 (7) Run pcretest on the testinput files in the testdata directory, and check
 that the output matches the corresponding testoutput files. You must use the
@@ -87,13 +110,6 @@ format, with just LF characters as line terminators. You may need to edit them
 to change this if your system uses a different convention.
 
   rem Mark Tetrode's commands
-  rem Make a change, i.e. space, backspace, and save again - do this for all
-  rem to change UNIX to Win, \n to \n\r
-  write testoutput1
-  write testoutput2
-  write testoutput3
-  write testoutput4
-  write testoutput5
   pcretest testdata\testinput1 testdata\myoutput1
   windiff testdata\testoutput1 testdata\myoutput1
   pcretest -i testdata\testinput2 testdata\myoutput2
@@ -104,6 +120,21 @@ to change this if your system uses a different convention.
   windiff testdata\testoutput4 testdata\myoutput4
   pcretest testdata\testinput5 testdata\myoutput5
   windiff testdata\testoutput5 testdata\myoutput5
+  pcretest testdata\testinput6 testdata\myoutput6
+  windiff testdata\testoutput6 testdata\myoutput6
+
+Note that there are now three more tests (7, 8, 9) that did not exist when Mark
+wrote those comments. The test the new pcre_dfa_exec() function.
+
+
+THE C++ WRAPPER FUNCTIONS
+
+The PCRE distribution now contains some C++ wrapper functions and tests,
+contributed by Google Inc. On a system that can use "configure" and "make",
+the functions are automatically built into a library called pcrecpp. It should
+be straightforward to compile the .cc files manually on other systems. The
+files called xxx_unittest.cc are test programs for each of the corresponding
+xxx.cc files.
 
 
 FURTHER REMARKS
@@ -181,7 +212,9 @@ void  (*pcre_free)(void *) = free;
 
 BUILDING PCRE ON OPENVMS
 
-Dan Mooney sent the following comments about building PCRE on OpenVMS:
+Dan Mooney sent the following comments about building PCRE on OpenVMS. They
+relate to an older version of PCRE that used fewer source files, so the exact
+commands will need changing. See the current list of source files above.
 
 "It was quite easy to compile and link the library. I don't have a formal
 make file but the attached file [reproduced below] contains the OpenVMS DCL
index fc5397ecce7c693eee33ee50e2430fd5c5724d54..f8d63bbd34c9525adf0ec5763390cb2ad31835dc 100644 (file)
@@ -7,14 +7,22 @@ The latest release of PCRE is always available from
 
 Please read the NEWS file if you are upgrading from a previous release.
 
-PCRE has its own native API, but a set of "wrapper" functions that are based on
-the POSIX API are also supplied in the library libpcreposix. Note that this
-just provides a POSIX calling interface to PCRE: the regular expressions
-themselves still follow Perl syntax and semantics. The header file
-for the POSIX-style functions is called pcreposix.h. The official POSIX name is
-regex.h, but I didn't want to risk possible problems with existing files of
-that name by distributing it that way. To use it with an existing program that
-uses the POSIX API, it will have to be renamed or pointed at by a link.
+
+The PCRE APIs
+-------------
+
+PCRE is written in C, and it has its own API. The distribution now includes a
+set of C++ wrapper functions, courtesy of Google Inc. (see the pcrecpp man page
+for details).
+
+Also included are a set of C wrapper functions that are based on the POSIX
+API. These end up in the library called libpcreposix. Note that this just
+provides a POSIX calling interface to PCRE: the regular expressions themselves
+still follow Perl syntax and semantics. The header file for the POSIX-style
+functions is called pcreposix.h. The official POSIX name is regex.h, but I
+didn't want to risk possible problems with existing files of that name by
+distributing it that way. To use it with an existing program that uses the
+POSIX API, it will have to be renamed or pointed at by a link.
 
 If you are using the POSIX interface to PCRE and there is already a POSIX regex
 library installed on your system, you must take care when linking programs to
@@ -112,7 +120,7 @@ library. You can read more about them in the pcrebuild man page.
 
   on the "configure" command.
 
-. PCRE has a counter which can be set to limit the amount of resources it uses.
+. 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,
 
@@ -130,31 +138,56 @@ library. You can read more about them in the pcrebuild man page.
   is a representation of the compiled pattern, and this changes with the link
   size.
 
-. You can build PCRE so that its match() function does not call itself
-  recursively. Instead, it uses blocks of data from the heap via special
-  functions pcre_stack_malloc() and pcre_stack_free() to save data that would
-  otherwise be saved on the stack. To build PCRE like this, use
+. You can build PCRE so that its internal match() function that is called from
+  pcre_exec() does not call itself recursively. Instead, it uses blocks of data
+  from the heap via special functions pcre_stack_malloc() and pcre_stack_free()
+  to save data that would otherwise be saved on the stack. To build PCRE like
+  this, use
 
   --disable-stack-for-recursion
 
   on the "configure" command. PCRE runs more slowly in this mode, but it may be
-  necessary in environments with limited stack sizes.
+  necessary in environments with limited stack sizes. This applies only to the
+  pcre_exec() function; it does not apply to pcre_dfa_exec(), which does not
+  use deeply nested recursion.
 
-The "configure" script builds seven files:
+The "configure" script builds eight files for the basic C library:
 
-. pcre.h is build by copying pcre.in and making substitutions
-. Makefile is built by copying Makefile.in and making substitutions.
-. config.h is built by copying config.in and making substitutions.
-. pcre-config is built by copying pcre-config.in and making substitutions.
-. libpcre.pc is data for the pkg-config command, built from libpcre.pc.in
+. pcre.h is the header file for C programs that call PCRE
+. Makefile is the makefile that builds the library
+. config.h contains build-time configuration options for the library
+. pcre-config is a script that shows the settings of "configure" options
+. libpcre.pc is data for the pkg-config command
 . libtool is a script that builds shared and/or static libraries
-. RunTest is a script for running tests
+. RunTest is a script for running tests on the library
+. RunGrepTest is a script for running tests on the pcregrep command
+
+In addition, if a C++ compiler is found, the following are also built:
 
-Once "configure" has run, you can run "make". It builds two libraries called
+. pcrecpp.h is the header file for programs that call PCRE via the C++ wrapper
+. pcre_stringpiece.h is the header for the C++ "stringpiece" functions
+
+The "configure" script also creates config.status, which is an executable
+script that can be run to recreate the configuration, and config.log, which
+contains compiler output from tests that "configure" runs.
+
+Once "configure" has run, you can run "make". It builds two libraries, called
 libpcre and libpcreposix, a test program called pcretest, and the pcregrep
-command. You can use "make install" to copy these, the public header files
-pcre.h and pcreposix.h, and the man pages to appropriate live directories on
-your system, in the normal way.
+command. If a C++ compiler was found on your system, it also builds the C++
+wrapper library, which is called libpcrecpp, and some test programs called
+pcrecpp_unittest, pcre_scanner_unittest, and pcre_stringpiece_unittest.
+
+The command "make test" runs all the appropriate tests. Details of the PCRE
+tests are given in a separate section of this document, below.
+
+You can use "make install" to copy the libraries, the public header files
+pcre.h, pcreposix.h, pcrecpp.h, and pcre_stringpiece.h (the last two only if
+the C++ wrapper was built), and the man pages to appropriate live directories
+on your system, in the normal way.
+
+If you want to remove PCRE from your system, you can run "make uninstall".
+This removes all the files that "make install" installed. However, it does not
+remove any directories, because these are often shared with other programs.
 
 
 Retrieving configuration information on Unix-like systems
@@ -187,9 +220,9 @@ pkgconfig.
 Shared libraries on Unix-like systems
 -------------------------------------
 
-The default distribution builds PCRE as two shared libraries and two static
-libraries, as long as the operating system supports shared libraries. Shared
-library support relies on the "libtool" script which is built as part of the
+The default distribution builds PCRE as shared libraries and static libraries,
+as long as the operating system supports shared libraries. Shared library
+support relies on the "libtool" script which is built as part of the
 "configure" process.
 
 The libtool script is used to compile and link both shared and static
@@ -218,7 +251,8 @@ order to cross-compile PCRE for some other host. However, during the building
 process, the dftables.c source file is compiled *and run* on the local host, in
 order to generate the default character tables (the chartables.c file). It
 therefore needs to be compiled with the local compiler, not the cross compiler.
-You can do this by specifying CC_FOR_BUILD (and if necessary CFLAGS_FOR_BUILD)
+You can do this by specifying CC_FOR_BUILD (and if necessary CFLAGS_FOR_BUILD;
+there are also CXX_FOR_BUILD and CXXFLAGS_FOR_BUILD for the C++ wrapper)
 when calling the "configure" command. If they are not specified, they default
 to the values of CC and CFLAGS.
 
@@ -240,13 +274,19 @@ Testing PCRE
 ------------
 
 To test PCRE on a Unix system, run the RunTest script that is created by the
-configuring process. (This can also be run by "make runtest", "make check", or
-"make test".) For other systems, see the instructions in NON-UNIX-USE.
-
-The script runs the pcretest test program (which is documented in its own man
-page) on each of the testinput files (in the testdata directory) in turn,
-and compares the output with the contents of the corresponding testoutput file.
-A file called testtry is used to hold the main output from pcretest
+configuring process. There is also a script called RunGrepTest that tests the
+options of the pcregrep command. If the C++ wrapper library is build, three
+test programs called pcrecpp_unittest, pcre_scanner_unittest, and
+pcre_stringpiece_unittest are provided.
+
+Both the scripts and all the program tests are run if you obey "make runtest",
+"make check", or "make test". For other systems, see the instructions in
+NON-UNIX-USE.
+
+The RunTest script runs the pcretest test program (which is documented in its
+own man page) on each of the testinput files (in the testdata directory) in
+turn, and compares the output with the contents of the corresponding testoutput
+file. A file called testtry is used to hold the main output from pcretest
 (testsavedregex is also used as a working file). To run pcretest on just one of
 the test files, give its number as an argument to RunTest, for example:
 
@@ -294,9 +334,14 @@ commented in the script, can be be used.)
 The fifth test checks error handling with UTF-8 encoding, and internal UTF-8
 features of PCRE that are not relevant to Perl.
 
-The sixth and final test checks the support for Unicode character properties.
-It it not run automatically unless PCRE is built with Unicode property support.
-To to this you must set --enable-unicode-properties when running "configure".
+The sixth and test checks the support for Unicode character properties. It it
+not run automatically unless PCRE is built with Unicode property support. To to
+this you must set --enable-unicode-properties when running "configure".
+
+The seventh, eighth, and ninth tests check the pcre_dfa_exec() alternative
+matching function, in non-UTF-8 mode, UTF-8 mode, and UTF-8 mode with Unicode
+property support, respectively. The eighth and ninth tests are not run
+automatically unless PCRE is build with the relevant support.
 
 
 Character tables
@@ -348,14 +393,27 @@ The distribution should contain the following files:
 
   dftables.c            auxiliary program for building chartables.c
 
-  get.c                 )
-  maketables.c          )
-  study.c               ) source of the functions
-  pcre.c                )   in the library
   pcreposix.c           )
-  printint.c            )
-
-  ucp.c                 )
+  pcre_compile.c        )
+  pcre_config.c         )
+  pcre_dfa_exec.c       )
+  pcre_exec.c           )
+  pcre_fullinfo.c       )
+  pcre_get.c            ) sources for the functions in the library,
+  pcre_globals.c        )   and some internal functions that they use
+  pcre_info.c           )
+  pcre_maketables.c     )
+  pcre_ord2utf8.c       )
+  pcre_printint.c       )
+  pcre_study.c          )
+  pcre_tables.c         )
+  pcre_try_flipped.c    )
+  pcre_ucp_findchar.c   )
+  pcre_valid_utf8.c     )
+  pcre_version.c        )
+  pcre_xclass.c         )
+
+  ucp_findchar.c        )
   ucp.h                 ) source for the code that is used for
   ucpinternal.h         )   Unicode property handling
   ucptable.c            )
@@ -364,9 +422,17 @@ The distribution should contain the following files:
   pcre.in               "source" for the header for the external API; pcre.h
                           is built from this by "configure"
   pcreposix.h           header for the external POSIX wrapper API
-  internal.h            header for internal use
+  pcre_internal.h       header for internal use
   config.in             template for config.h, which is built by configure
 
+  pcrecpp.h.in          "source" for the header file for the C++ wrapper
+  pcrecpp.cc            )
+  pcre_scanner.cc       ) source for the C++ wrapper library
+
+  pcre_stringpiece.h.in "source" for pcre_stringpiece.h, the header for the
+                          C++ stringpiece functions
+  pcre_stringpiece.cc   source for the C++ stringpiece functions
+
 (B) Auxiliary files:
 
   AUTHORS               information about the author of PCRE
@@ -379,6 +445,7 @@ The distribution should contain the following files:
   NON-UNIX-USE          notes on building PCRE on non-Unix systems
   README                this file
   RunTest.in            template for a Unix shell script for running tests
+  RunGrepTest.in        template for a Unix shell script for pcregrep tests
   config.guess          ) files used by libtool,
   config.sub            )   used only when building a shared library
   configure             a configuring shell script (built by autoconf)
@@ -399,22 +466,15 @@ The distribution should contain the following files:
   perltest              Perl test program
   pcregrep.c            source of a grep utility that uses PCRE
   pcre-config.in        source of script which retains PCRE information
-  testdata/testinput1   test data, compatible with Perl
-  testdata/testinput2   test data for error messages and non-Perl things
-  testdata/testinput3   test data for locale-specific tests
-  testdata/testinput4   test data for UTF-8 tests compatible with Perl
-  testdata/testinput5   test data for other UTF-8 tests
-  testdata/testinput6   test data for Unicode property support tests
-  testdata/testoutput1  test results corresponding to testinput1
-  testdata/testoutput2  test results corresponding to testinput2
-  testdata/testoutput3  test results corresponding to testinput3
-  testdata/testoutput4  test results corresponding to testinput4
-  testdata/testoutput5  test results corresponding to testinput5
-  testdata/testoutput6  test results corresponding to testinput6
+  pcrecpp_unittest.c           )
+  pcre_scanner_unittest.c      ) test programs for the C++ wrapper
+  pcre_stringpiece_unittest.c  )
+  testdata/testinput*   test data for main library tests
+  testdata/testoutput*  expected test results
+  testdata/grep*        input and output for pcregrep tests
 
 (C) Auxiliary files for Win32 DLL
 
-  dll.mk
   libpcre.def
   libpcreposix.def
   pcre.def
@@ -423,5 +483,7 @@ The distribution should contain the following files:
 
   makevp.bat
 
-Philip Hazel <ph10@cam.ac.uk>
-September 2004
+Philip Hazel
+Email local part: ph10
+Email domain: cam.ac.uk
+June 2005
index 8458c60f1c5251e409b36f91e554b0e736ab480a..480753887ed51ae9dfe780fa466805a5b33fcbaf 100644 (file)
@@ -2,13 +2,11 @@
 *      Perl-Compatible Regular Expressions       *
 *************************************************/
 
-/*
-PCRE is a library of functions to support regular expressions whose syntax
+/* PCRE is a library of functions to support regular expressions whose syntax
 and semantics are as close as possible to those of the Perl 5 language.
 
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
-           Copyright (c) 1997-2004 University of Cambridge
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -40,20 +38,19 @@ POSSIBILITY OF SUCH DAMAGE.
 */
 
 
-/* This is a support program to generate the file chartables.c, containing
-character tables of various kinds. They are built according to the default C
-locale and used as the default tables by PCRE. Now that pcre_maketables is
-a function visible to the outside world, we make use of its code from here in
-order to be consistent. */
+/* This is a freestanding support program to generate a file containing default
+character tables for PCRE. The tables are built according to the default C
+locale. Now that pcre_maketables is a function visible to the outside world, we
+make use of its code from here in order to be consistent. */
 
 #include <ctype.h>
 #include <stdio.h>
 #include <string.h>
 
-#include "internal.h"
+#include "pcre_internal.h"
 
-#define DFTABLES          /* maketables.c notices this */
-#include "maketables.c"
+#define DFTABLES          /* pcre_maketables.c notices this */
+#include "pcre_maketables.c"
 
 
 int main(int argc, char **argv)
@@ -61,6 +58,7 @@ int main(int argc, char **argv)
 int i;
 FILE *f;
 const unsigned char *tables = pcre_maketables();
+const unsigned char *base_of_tables = tables;
 
 if (argc != 2)
   {
@@ -68,7 +66,7 @@ if (argc != 2)
   return 1;
   }
 
-f = fopen(argv[1], "w");
+f = fopen(argv[1], "wb");
 if (f == NULL)
   {
   fprintf(stderr, "dftables: failed to open %s for writing\n", argv[1]);
@@ -86,10 +84,10 @@ fprintf(f,
   "program. If you edit it by hand, you might like to edit the Makefile to \n"
   "prevent its ever being regenerated.\n\n");
 fprintf(f,
-  "This file is #included in the compilation of pcre.c to build the default\n"
-  "character tables which are used when no tables are passed to the compile\n"
-  "function. */\n\n"
-  "static unsigned char pcre_default_tables[] = {\n\n"
+  "This file contains the default tables for characters with codes less than\n"
+  "128 (ASCII characters). These tables are used when no external tables are\n"
+  "passed to PCRE. */\n\n"
+  "const unsigned char _pcre_default_tables[] = {\n\n"
   "/* This table is a lower casing table. */\n\n");
 
 fprintf(f, "  ");
@@ -167,6 +165,7 @@ if (isprint(i-1)) fprintf(f, " %c ", i-1);
 fprintf(f, " */\n\n/* End of chartables.c */\n");
 
 fclose(f);
+free((void *)base_of_tables);
 return 0;
 }
 
index 18eb72bce70a90c3c53850d029762f44704d0ee3..322cc2de131e633362a4b6d75e4ed44d24c0cae4 100644 (file)
@@ -32,18 +32,42 @@ terminology.
 OK, here's the real stuff
 -------------------------
 
-For the set of functions that forms PCRE (which are unrelated to those
-mentioned above), I tried at first to invent an algorithm that used an amount
-of store bounded by a multiple of the number of characters in the pattern, to
-save on compiling time. However, because of the greater complexity in Perl
-regular expressions, I couldn't do this. In any case, a first pass through the
-pattern is needed, for a number of reasons. PCRE works by running a very
-degenerate first pass to calculate a maximum store size, and then a second pass
-to do the real compile - which may use a bit less than the predicted amount of
-store. The idea is that this is going to turn out faster because the first pass
-is degenerate and the second pass can just store stuff straight into the
-vector. It does make the compiling functions bigger, of course, but they have
-got quite big anyway to handle all the Perl stuff.
+For the set of functions that form the "basic" PCRE library (which are
+unrelated to those mentioned above), I tried at first to invent an algorithm
+that used an amount of store bounded by a multiple of the number of characters
+in the pattern, to save on compiling time. However, because of the greater
+complexity in Perl regular expressions, I couldn't do this. In any case, a
+first pass through the pattern is needed, for a number of reasons. PCRE works
+by running a very degenerate first pass to calculate a maximum store size, and
+then a second pass to do the real compile - which may use a bit less than the
+predicted amount of store. The idea is that this is going to turn out faster
+because the first pass is degenerate and the second pass can just store stuff
+straight into the vector, which it knows is big enough. It does make the
+compiling functions bigger, of course, but they have got quite big anyway to
+handle all the Perl stuff.
+
+Traditional matching function
+-----------------------------
+
+The "traditional", and original, matching function is called pcre_exec(), and 
+it implements an NFA algorithm, similar to the original Henry Spencer algorithm 
+and the way that Perl works. Not surprising, since it is intended to be as 
+compatible with Perl as possible. This is the function most users of PCRE will 
+use most of the time.
+
+Supplementary matching function
+-------------------------------
+
+From PCRE 6.0, there is also a supplementary matching function called 
+pcre_dfa_exec(). This implements a DFA matching algorithm that searches 
+simultaneously for all possible matches that start at one point in the subject 
+string. (Going back to my roots: see Historical Note 1 above.) This function 
+intreprets the same compiled pattern data as pcre_exec(); however, not all the 
+facilities are available, and those that are don't always work in quite the 
+same way. See the user documentation for details.
+
+Format of compiled patterns
+---------------------------
 
 The compiled form of a pattern is a vector of bytes, containing items of
 variable length. The first byte in an item is an opcode, and the length of the
@@ -223,14 +247,14 @@ number. This opcode is ignored while matching, but is fished out when handling
 the bracket itself. (They could have all been done like this, but I was making
 minimal changes.)
 
-A bracket opcode is followed by two 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 two bytes giving the offset to the next one,
-or to the OP_KET opcode.
+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.
 
 OP_KET is used for subpatterns that do not repeat indefinitely, while
 OP_KETRMIN and OP_KETRMAX are used for indefinite repetitions, minimally or
-maximally respectively. All three are followed by two bytes giving (as a
+maximally respectively. All three are followed by LINK_SIZE bytes giving (as a
 positive number) the offset back to the matching OP_BRA opcode.
 
 If a subpattern is quantified such that it is permitted to match zero times, it
@@ -312,4 +336,4 @@ at compile time, and so does not cause anything to be put into the compiled
 data.
 
 Philip Hazel
-September 2004
+March 2005
index fdf0d6ff6707887c72a3b1c9575f9c6cc732ab9e..801bde279b9b247928942fa257765098810ba5b4 100644 (file)
@@ -6,26 +6,35 @@ synopses of each function in the library have not been included. There are
 separate text files for the pcregrep and pcretest commands.
 -----------------------------------------------------------------------------
 
-PCRE(3)                                                                PCRE(3)
 
+PCRE(3)                                                                PCRE(3)
 
 
 NAME
        PCRE - Perl-compatible regular expressions
 
+
 INTRODUCTION
 
        The  PCRE  library is a set of functions that implement regular expres-
        sion pattern matching using the same syntax and semantics as Perl, with
        just  a  few  differences.  The current implementation of PCRE (release
-       5.x) corresponds approximately with Perl  5.8,  including  support  for
+       6.x) corresponds approximately with Perl  5.8,  including  support  for
        UTF-8 encoded strings and Unicode general category properties. However,
        this support has to be explicitly enabled; it is not the default.
 
+       In addition to the Perl-compatible matching function,  PCRE  also  con-
+       tains  an  alternative matching function that matches the same compiled
+       patterns in a different way. In certain circumstances, the  alternative
+       function  has  some  advantages.  For  a discussion of the two matching
+       algorithms, see the pcrematching page.
+
        PCRE is written in C and released as a C library. A  number  of  people
-       have  written  wrappers and interfaces of various kinds. A C++ class is
-       included in these contributions, which can  be  found  in  the  Contrib
-       directory at the primary FTP site, which is:
+       have  written  wrappers and interfaces of various kinds. In particular,
+       Google Inc.  have provided a comprehensive C++  wrapper.  This  is  now
+       included as part of the PCRE distribution. The pcrecpp page has details
+       of this interface. Other people's contributions can  be  found  in  the
+       Contrib directory at the primary FTP site, which is:
 
        ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre
 
@@ -40,6 +49,12 @@ INTRODUCTION
        ing  PCRE for various operating systems can be found in the README file
        in the source distribution.
 
+       The library contains a number of undocumented  internal  functions  and
+       data  tables  that  are  used by more than one of the exported external
+       functions, but which are not intended  for  use  by  external  callers.
+       Their  names  all begin with "_pcre_", which hopefully will not provoke
+       any name clashes.
+
 
 USER DOCUMENTATION
 
@@ -50,22 +65,24 @@ USER DOCUMENTATION
        of searching. The sections are as follows:
 
          pcre              this document
-         pcreapi           details of PCRE's native API
+         pcreapi           details of PCRE's native API
          pcrebuild         options for building PCRE
          pcrecallout       details of the callout feature
          pcrecompat        discussion of Perl compatibility
+         pcrecpp           details of the C++ wrapper
          pcregrep          description of the pcregrep command
+         pcrematching      discussion of the two matching algorithms
          pcrepartial       details of the partial matching facility
          pcrepattern       syntax and semantics of supported
                              regular expressions
          pcreperform       discussion of performance issues
-         pcreposix         the POSIX-compatible API
+         pcreposix         the POSIX-compatible API
          pcreprecompile    details of saving and re-using precompiled patterns
          pcresample        discussion of the sample program
          pcretest          description of the pcretest testing command
 
        In  addition,  in the "man" and HTML formats, there is a short page for
-       each library function, listing its arguments and results.
+       each library function, listing its arguments and results.
 
 
 LIMITATIONS
@@ -90,70 +107,71 @@ LIMITATIONS
        tern, is 200.
 
        The  maximum  length of a subject string is the largest positive number
-       that an integer variable can hold. However, PCRE uses recursion to han-
-       dle  subpatterns  and indefinite repetition. This means that the avail-
-       able stack space may limit the size of a subject  string  that  can  be
-       processed by certain patterns.
+       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
+       the size of a subject string that can be processed by certain patterns.
 
 
 UTF-8 AND UNICODE PROPERTY SUPPORT
 
-       From  release  3.3,  PCRE  has  had  some support for character strings
-       encoded in the UTF-8 format. For release 4.0 this was greatly  extended
-       to  cover  most common requirements, and in release 5.0 additional sup-
+       From release 3.3, PCRE has  had  some  support  for  character  strings
+       encoded  in the UTF-8 format. For release 4.0 this was greatly extended
+       to cover most common requirements, and in release 5.0  additional  sup-
        port for Unicode general category properties was added.
 
-       In order process UTF-8 strings, you must build PCRE  to  include  UTF-8
-       support  in  the  code,  and, in addition, you must call pcre_compile()
-       with the PCRE_UTF8 option flag. When you do this, both the pattern  and
-       any  subject  strings  that are matched against it are treated as UTF-8
+       In  order  process  UTF-8 strings, you must build PCRE to include UTF-8
+       support in the code, and, in addition,  you  must  call  pcre_compile()
+       with  the PCRE_UTF8 option flag. When you do this, both the pattern and
+       any subject strings that are matched against it are  treated  as  UTF-8
        strings instead of just strings of bytes.
 
-       If you compile PCRE with UTF-8 support, but do not use it at run  time,
-       the  library will be a bit bigger, but the additional run time overhead
-       is limited to testing the PCRE_UTF8 flag in several places,  so  should
+       If  you compile PCRE with UTF-8 support, but do not use it at run time,
+       the library will be a bit bigger, but the additional run time  overhead
+       is  limited  to testing the PCRE_UTF8 flag in several places, so should
        not be very large.
 
        If PCRE is built with Unicode character property support (which implies
-       UTF-8 support), the escape sequences \p{..}, \P{..}, and  \X  are  sup-
+       UTF-8  support),  the  escape sequences \p{..}, \P{..}, and \X are sup-
        ported.  The available properties that can be tested are limited to the
-       general category properties such as Lu for an upper case letter  or  Nd
-       for  a decimal number. A full list is given in the pcrepattern documen-
+       general  category  properties such as Lu for an upper case letter or Nd
+       for a decimal number. A full list is given in the pcrepattern  documen-
        tation. The PCRE library is increased in size by about 90K when Unicode
        property support is included.
 
        The following comments apply when PCRE is running in UTF-8 mode:
 
-       1.  When you set the PCRE_UTF8 flag, the strings passed as patterns and
-       subjects are checked for validity on entry to the  relevant  functions.
+       1. When you set the PCRE_UTF8 flag, the strings passed as patterns  and
+       subjects  are  checked for validity on entry to the relevant functions.
        If an invalid UTF-8 string is passed, an error return is given. In some
-       situations, you may already know  that  your  strings  are  valid,  and
+       situations,  you  may  already  know  that  your strings are valid, and
        therefore want to skip these checks in order to improve performance. If
-       you set the PCRE_NO_UTF8_CHECK flag at compile time  or  at  run  time,
-       PCRE  assumes  that  the  pattern or subject it is given (respectively)
-       contains only valid UTF-8 codes. In this case, it does not diagnose  an
-       invalid  UTF-8 string. If you pass an invalid UTF-8 string to PCRE when
-       PCRE_NO_UTF8_CHECK is set, the results are undefined. Your program  may
+       you  set  the  PCRE_NO_UTF8_CHECK  flag at compile time or at run time,
+       PCRE assumes that the pattern or subject  it  is  given  (respectively)
+       contains  only valid UTF-8 codes. In this case, it does not diagnose an
+       invalid UTF-8 string. If you pass an invalid UTF-8 string to PCRE  when
+       PCRE_NO_UTF8_CHECK  is set, the results are undefined. Your program may
        crash.
 
        2. In a pattern, the escape sequence \x{...}, where the contents of the
-       braces is a string of hexadecimal digits, is  interpreted  as  a  UTF-8
-       character  whose code number is the given hexadecimal number, for exam-
-       ple: \x{1234}. If a non-hexadecimal digit appears between  the  braces,
+       braces  is  a  string  of hexadecimal digits, is interpreted as a UTF-8
+       character whose code number is the given hexadecimal number, for  exam-
+       ple:  \x{1234}.  If a non-hexadecimal digit appears between the braces,
        the item is not recognized.  This escape sequence can be used either as
        a literal, or within a character class.
 
-       3. The original hexadecimal escape sequence, \xhh, matches  a  two-byte
+       3.  The  original hexadecimal escape sequence, \xhh, matches a two-byte
        UTF-8 character if the value is greater than 127.
 
-       4.  Repeat quantifiers apply to complete UTF-8 characters, not to indi-
+       4. Repeat quantifiers apply to complete UTF-8 characters, not to  indi-
        vidual bytes, for example: \x{100}{3}.
 
-       5. The dot metacharacter matches one UTF-8 character instead of a  sin-
+       5.  The dot metacharacter matches one UTF-8 character instead of a sin-
        gle byte.
 
-       6.  The  escape sequence \C can be used to match a single byte in UTF-8
-       mode, but its use can lead to some strange effects.
+       6. The escape sequence \C can be used to match a single byte  in  UTF-8
+       mode,  but  its  use can lead to some strange effects. This facility is
+       not available in the alternative matching function, pcre_dfa_exec().
 
        7. The character escapes \b, \B, \d, \D, \s, \S, \w, and  \W  correctly
        test  characters of any code value, but the characters that PCRE recog-
@@ -177,22 +195,26 @@ UTF-8 AND UNICODE PROPERTY SUPPORT
 
 AUTHOR
 
-       Philip Hazel <ph10@cam.ac.uk>
+       Philip Hazel
        University Computing Service,
        Cambridge CB2 3QG, England.
-       Phone: +44 1223 334714
 
-Last updated: 09 September 2004
-Copyright (c) 1997-2004 University of Cambridge.
------------------------------------------------------------------------------
+       Putting  an actual email address here seems to have been a spam magnet,
+       so I've taken it away. If you want to email me, use my initial and sur-
+       name, separated by a dot, at the domain ucs.cam.ac.uk.
+
+Last updated: 07 March 2005
+Copyright (c) 1997-2005 University of Cambridge.
+------------------------------------------------------------------------------
 
-PCRE(3)                                                                PCRE(3)
 
+PCREBUILD(3)                                                      PCREBUILD(3)
 
 
 NAME
        PCRE - Perl-compatible regular expressions
 
+
 PCRE BUILD-TIME OPTIONS
 
        This  document  describes  the  optional  features  of PCRE that can be
@@ -287,16 +309,18 @@ POSIX MALLOC USAGE
 LIMITING PCRE RESOURCE USAGE
 
        Internally,  PCRE has a function called match(), which it calls repeat-
-       edly (possibly recursively) when matching a pattern. By controlling the
-       maximum  number  of  times  this function may be called during a single
-       matching operation, a limit can be placed on the resources  used  by  a
-       single  call  to  pcre_exec(). The limit can be changed at run time, as
-       described in the pcreapi documentation. The default is 10 million,  but
-       this can be changed by adding a setting such as
+       edly  (possibly  recursively)  when  matching  a   pattern   with   the
+       pcre_exec()  function.  By controlling the maximum number of times this
+       function may be called during a single matching operation, a limit  can
+       be  placed  on  the resources used by a single call to pcre_exec(). The
+       limit can be changed at run time, as described in the pcreapi  documen-
+       tation.  The default is 10 million, but this can be changed by adding a
+       setting such as
 
          --with-match-limit=500000
 
-       to the configure command.
+       to  the  configure  command.  This  setting  has  no  effect   on   the
+       pcre_dfa_exec() matching function.
 
 
 HANDLING VERY LARGE PATTERNS
@@ -324,14 +348,14 @@ HANDLING VERY LARGE PATTERNS
 
 AVOIDING EXCESSIVE STACK USAGE
 
-       PCRE  implements  backtracking while matching by making recursive calls
-       to an internal function called match(). In environments where the  size
-       of the stack is limited, this can severely limit PCRE's operation. (The
-       Unix environment does not usually suffer from this problem.) An  alter-
-       native  approach  that  uses  memory  from  the  heap to remember data,
-       instead of using recursive function calls, has been implemented to work
-       round  this  problem. If you want to build a version of PCRE that works
-       this way, add
+       When matching with the pcre_exec() function, PCRE implements backtrack-
+       ing by making recursive calls to an internal function  called  match().
+       In  environments  where  the size of the stack is limited, this can se-
+       verely limit PCRE's operation. (The Unix environment does  not  usually
+       suffer  from  this  problem.)  An alternative approach that uses memory
+       from the heap to remember data, instead  of  using  recursive  function
+       calls,  has been implemented to work round this problem. If you want to
+       build a version of PCRE that works this way, add
 
          --disable-stack-for-recursion
 
@@ -342,31 +366,201 @@ AVOIDING EXCESSIVE STACK USAGE
        the blocks are always freed in reverse order. A calling  program  might
        be  able  to implement optimized functions that perform better than the
        standard malloc() and  free()  functions.  PCRE  runs  noticeably  more
-       slowly when built in this way.
+       slowly when built in this way. This option affects only the pcre_exec()
+       function; it is not relevant for the the pcre_dfa_exec() function.
 
 
 USING EBCDIC CODE
 
-       PCRE  assumes  by  default that it will run in an environment where the
-       character code is ASCII (or Unicode, which is  a  superset  of  ASCII).
-       PCRE  can,  however,  be  compiled  to  run in an EBCDIC environment by
+       PCRE assumes by default that it will run in an  environment  where  the
+       character  code  is  ASCII  (or Unicode, which is a superset of ASCII).
+       PCRE can, however, be compiled to  run  in  an  EBCDIC  environment  by
        adding
 
          --enable-ebcdic
 
        to the configure command.
 
-Last updated: 09 September 2004
-Copyright (c) 1997-2004 University of Cambridge.
------------------------------------------------------------------------------
+Last updated: 28 February 2005
+Copyright (c) 1997-2005 University of Cambridge.
+------------------------------------------------------------------------------
 
-PCRE(3)                                                                PCRE(3)
 
+PCREMATCHING(3)                                                PCREMATCHING(3)
 
 
 NAME
        PCRE - Perl-compatible regular expressions
 
+
+PCRE MATCHING ALGORITHMS
+
+       This document describes the two different algorithms that are available
+       in PCRE for matching a compiled regular expression against a given sub-
+       ject  string.  The  "standard"  algorithm  is  the  one provided by the
+       pcre_exec() function.  This works in the same was  as  Perl's  matching
+       function, and provides a Perl-compatible matching operation.
+
+       An  alternative  algorithm is provided by the pcre_dfa_exec() function;
+       this operates in a different way, and is not  Perl-compatible.  It  has
+       advantages  and disadvantages compared with the standard algorithm, and
+       these are described below.
+
+       When there is only one possible way in which a given subject string can
+       match  a pattern, the two algorithms give the same answer. A difference
+       arises, however, when there are multiple possibilities. For example, if
+       the pattern
+
+         ^<.*>
+
+       is matched against the string
+
+         <something> <something else> <something further>
+
+       there are three possible answers. The standard algorithm finds only one
+       of them, whereas the DFA algorithm finds all three.
+
+
+REGULAR EXPRESSIONS AS TREES
+
+       The set of strings that are matched by a regular expression can be rep-
+       resented  as  a  tree structure. An unlimited repetition in the pattern
+       makes the tree of infinite size, but it is still a tree.  Matching  the
+       pattern  to a given subject string (from a given starting point) can be
+       thought of as a search of the tree.  There are  two  standard  ways  to
+       search  a  tree: depth-first and breadth-first, and these correspond to
+       the two matching algorithms provided by PCRE.
+
+
+THE STANDARD MATCHING ALGORITHM
+
+       In the terminology of Jeffrey Friedl's book Mastering  Regular  Expres-
+       sions,  the  standard  algorithm  is  an "NFA algorithm". It conducts a
+       depth-first search of the pattern tree. That is, it  proceeds  along  a
+       single path through the tree, checking that the subject matches what is
+       required. When there is a mismatch, the algorithm  tries  any  alterna-
+       tives  at  the  current point, and if they all fail, it backs up to the
+       previous branch point in the  tree,  and  tries  the  next  alternative
+       branch  at  that  level.  This often involves backing up (moving to the
+       left) in the subject string as well.  The  order  in  which  repetition
+       branches  are  tried  is controlled by the greedy or ungreedy nature of
+       the quantifier.
+
+       If a leaf node is reached, a matching string has  been  found,  and  at
+       that  point the algorithm stops. Thus, if there is more than one possi-
+       ble match, this algorithm returns the first one that it finds.  Whether
+       this  is the shortest, the longest, or some intermediate length depends
+       on the way the greedy and ungreedy repetition quantifiers are specified
+       in the pattern.
+
+       Because  it  ends  up  with a single path through the tree, it is rela-
+       tively straightforward for this algorithm to keep  track  of  the  sub-
+       strings  that  are  matched  by portions of the pattern in parentheses.
+       This provides support for capturing parentheses and back references.
+
+
+THE DFA MATCHING ALGORITHM
+
+       DFA stands for "deterministic finite automaton", but you do not need to
+       understand the origins of that name. This algorithm conducts a breadth-
+       first search of the tree. Starting from the first matching point in the
+       subject,  it scans the subject string from left to right, once, charac-
+       ter by character, and as it does  this,  it  remembers  all  the  paths
+       through the tree that represent valid matches.
+
+       The  scan  continues until either the end of the subject is reached, or
+       there are no more unterminated paths. At this point,  terminated  paths
+       represent  the different matching possibilities (if there are none, the
+       match has failed).  Thus, if there is more  than  one  possible  match,
+       this algorithm finds all of them, and in particular, it finds the long-
+       est. In PCRE, there is an option to stop the algorithm after the  first
+       match (which is necessarily the shortest) has been found.
+
+       Note that all the matches that are found start at the same point in the
+       subject. If the pattern
+
+         cat(er(pillar)?)
+
+       is matched against the string "the caterpillar catchment",  the  result
+       will  be the three strings "cat", "cater", and "caterpillar" that start
+       at the fourth character of the subject. The algorithm does not automat-
+       ically move on to find matches that start at later positions.
+
+       There are a number of features of PCRE regular expressions that are not
+       supported by the DFA 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
+       ungreedy quantifiers are treated in exactly the same way.
+
+       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
+       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-
+       tern are not supported, and cause errors if encountered.
+
+       4.  For  the same reason, conditional expressions that use a backrefer-
+       ence as the condition are not supported.
+
+       5. 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.
+
+       6.  The \C escape sequence, which (in the standard algorithm) matches a
+       single byte, even in UTF-8 mode, is not supported because the DFA algo-
+       rithm moves through the subject string one character at a time, for all
+       active paths through the tree.
+
+
+ADVANTAGES OF THE DFA ALGORITHM
+
+       Using the DFA matching algorithm provides the following advantages:
+
+       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
+       more than one match using the standard algorithm, you have to do kludgy
+       things with callouts.
+
+       2.  There is much better support for partial matching. The restrictions
+       on the content of the pattern that apply when using the standard  algo-
+       rithm  for partial matching do not apply to the DFA algorithm. For non-
+       anchored patterns, the starting position of a partial match  is  avail-
+       able.
+
+       3.  Because  the  DFA algorithm scans the subject string just once, and
+       never needs to backtrack, it is possible  to  pass  very  long  subject
+       strings  to  the matching function in several pieces, checking for par-
+       tial matching each time.
+
+
+DISADVANTAGES OF THE DFA ALGORITHM
+
+       The DFA 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
+       because it is less susceptible to optimization.
+
+       2. Capturing parentheses and back references are not supported.
+
+       3. The "atomic group" feature of PCRE regular expressions is supported,
+       but  does not provide the advantage that it does for the standard algo-
+       rithm.
+
+Last updated: 28 February 2005
+Copyright (c) 1997-2005 University of Cambridge.
+------------------------------------------------------------------------------
+
+
+PCREAPI(3)                                                          PCREAPI(3)
+
+
+NAME
+       PCRE - Perl-compatible regular expressions
+
+
 PCRE NATIVE API
 
        #include <pcre.h>
@@ -375,6 +569,11 @@ PCRE NATIVE API
             const char **errptr, int *erroffset,
             const unsigned char *tableptr);
 
+       pcre *pcre_compile2(const char *pattern, int options,
+            int *errorcodeptr,
+            const char **errptr, int *erroffset,
+            const unsigned char *tableptr);
+
        pcre_extra *pcre_study(const pcre *code, int options,
             const char **errptr);
 
@@ -382,6 +581,11 @@ PCRE NATIVE API
             const char *subject, int length, int startoffset,
             int options, int *ovector, int ovecsize);
 
+       int pcre_dfa_exec(const pcre *code, const pcre_extra *extra,
+            const char *subject, int length, int startoffset,
+            int options, int *ovector, int ovecsize,
+            int *workspace, int wscount);
+
        int pcre_copy_named_substring(const pcre *code,
             const char *subject, int *ovector,
             int stringcount, const char *stringname,
@@ -417,6 +621,8 @@ PCRE NATIVE API
 
        int pcre_info(const pcre *code, int *optptr, int *firstcharptr);
 
+       int pcre_refcount(pcre *code, int adjust);
+
        int pcre_config(int what, void *where);
 
        char *pcre_version(void);
@@ -436,25 +642,36 @@ PCRE API OVERVIEW
 
        PCRE has its own native API, which is described in this document. There
        is also a set of wrapper functions that correspond to the POSIX regular
-       expression API.  These are described in the pcreposix documentation.
+       expression  API.  These  are  described in the pcreposix documentation.
+       Both of these APIs define a set of C function calls. A C++  wrapper  is
+       distributed with PCRE. It is documented in the pcrecpp page.
 
-       The  native  API  function  prototypes  are  defined in the header file
-       pcre.h, and on Unix systems the library itself is  called  libpcre.  It
+       The  native  API  C  function prototypes are defined in the header file
+       pcre.h, and on Unix systems the library itself is called  libpcre.   It
        can normally be accessed by adding -lpcre to the command for linking an
        application  that  uses  PCRE.  The  header  file  defines  the  macros
        PCRE_MAJOR  and  PCRE_MINOR to contain the major and minor release num-
        bers for the library.  Applications can use these  to  include  support
        for different releases of PCRE.
 
-       The  functions  pcre_compile(),  pcre_study(), and pcre_exec() are used
-       for compiling and matching regular expressions. A sample  program  that
-       demonstrates  the  simplest  way  of using them is provided in the file
-       called pcredemo.c in the source distribution. The pcresample documenta-
-       tion describes how to run it.
-
-       In  addition  to  the  main compiling and matching functions, there are
-       convenience functions for extracting captured substrings from a matched
-       subject string.  They are:
+       The   functions   pcre_compile(),  pcre_compile2(),  pcre_study(),  and
+       pcre_exec() are used for compiling and matching regular expressions  in
+       a  Perl-compatible  manner. A sample program that demonstrates the sim-
+       plest way of using them is provided in the file  called  pcredemo.c  in
+       the  source distribution. The pcresample documentation describes how to
+       run it.
+
+       A second matching function, pcre_dfa_exec(), which is not Perl-compati-
+       ble,  is  also provided. This uses a different algorithm for the match-
+       ing. This allows it to find all possible matches (at a given  point  in
+       the  subject),  not  just  one. However, this algorithm does not return
+       captured substrings. A description of the two matching  algorithms  and
+       their  advantages  and disadvantages is given in the pcrematching docu-
+       mentation.
+
+       In addition to the main compiling and  matching  functions,  there  are
+       convenience functions for extracting captured substrings from a subject
+       string that is matched by pcre_exec(). They are:
 
          pcre_copy_substring()
          pcre_copy_named_substring()
@@ -466,11 +683,12 @@ PCRE API OVERVIEW
        pcre_free_substring() and pcre_free_substring_list() are also provided,
        to free the memory used for extracted strings.
 
-       The function pcre_maketables() is used to  build  a  set  of  character
-       tables   in  the  current  locale  for  passing  to  pcre_compile()  or
-       pcre_exec().  This is an optional facility that is  provided  for  spe-
-       cialist use. Most commonly, no special tables are passed, in which case
-       internal tables that are generated when PCRE is built are used.
+       The  function  pcre_maketables()  is  used  to build a set of character
+       tables  in  the  current  locale   for   passing   to   pcre_compile(),
+       pcre_exec(),  or  pcre_dfa_exec(). This is an optional facility that is
+       provided for specialist use.  Most  commonly,  no  special  tables  are
+       passed,  in  which case internal tables that are generated when PCRE is
+       built are used.
 
        The function pcre_fullinfo() is used to find out  information  about  a
        compiled  pattern; pcre_info() is an obsolete version that returns only
@@ -478,6 +696,10 @@ PCRE API OVERVIEW
        patibility.   The function pcre_version() returns a pointer to a string
        containing the version of PCRE and its date of release.
 
+       The function pcre_refcount() maintains a  reference  count  in  a  data
+       block  containing  a compiled pattern. This is provided for the benefit
+       of object-oriented applications.
+
        The global variables pcre_malloc and pcre_free  initially  contain  the
        entry  points  of  the  standard malloc() and free() functions, respec-
        tively. PCRE calls the memory management functions via these variables,
@@ -487,28 +709,28 @@ PCRE API OVERVIEW
        The global variables pcre_stack_malloc  and  pcre_stack_free  are  also
        indirections  to  memory  management functions. These special functions
        are used only when PCRE is compiled to use  the  heap  for  remembering
-       data,  instead  of recursive function calls. This is a non-standard way
-       of building PCRE, for use in environments  that  have  limited  stacks.
-       Because  of  the greater use of memory management, it runs more slowly.
-       Separate functions are provided so that special-purpose  external  code
-       can be used for this case. When used, these functions are always called
-       in a stack-like manner (last obtained, first  freed),  and  always  for
-       memory blocks of the same size.
+       data, instead of recursive function calls, when running the pcre_exec()
+       function. This is a non-standard way of building PCRE, for use in envi-
+       ronments that have limited stacks. Because of the greater use of memory
+       management, it runs more slowly.  Separate functions  are  provided  so
+       that  special-purpose  external  code  can  be used for this case. When
+       used, these functions are always called in a  stack-like  manner  (last
+       obtained,  first freed), and always for memory blocks of the same size.
 
        The global variable pcre_callout initially contains NULL. It can be set
-       by the caller to a "callout" function, which PCRE  will  then  call  at
-       specified  points during a matching operation. Details are given in the
+       by  the  caller  to  a "callout" function, which PCRE will then call at
+       specified points during a matching operation. Details are given in  the
        pcrecallout documentation.
 
 
 MULTITHREADING
 
-       The PCRE functions can be used in  multi-threading  applications,  with
+       The  PCRE  functions  can be used in multi-threading applications, with
        the  proviso  that  the  memory  management  functions  pointed  to  by
        pcre_malloc, pcre_free, pcre_stack_malloc, and pcre_stack_free, and the
        callout function pointed to by pcre_callout, are shared by all threads.
 
-       The compiled form of a regular expression is not altered during  match-
+       The  compiled form of a regular expression is not altered during match-
        ing, so the same compiled pattern can safely be used by several threads
        at once.
 
@@ -516,8 +738,8 @@ MULTITHREADING
 SAVING PRECOMPILED PATTERNS FOR LATER USE
 
        The compiled form of a regular expression can be saved and re-used at a
-       later  time,  possibly by a different program, and even on a host other
-       than the one on which  it  was  compiled.  Details  are  given  in  the
+       later time, possibly by a different program, and even on a  host  other
+       than  the  one  on  which  it  was  compiled.  Details are given in the
        pcreprecompile documentation.
 
 
@@ -525,63 +747,63 @@ CHECKING BUILD-TIME OPTIONS
 
        int pcre_config(int what, void *where);
 
-       The  function pcre_config() makes it possible for a PCRE client to dis-
+       The function pcre_config() makes it possible for a PCRE client to  dis-
        cover which optional features have been compiled into the PCRE library.
-       The  pcrebuild documentation has more details about these optional fea-
+       The pcrebuild documentation has more details about these optional  fea-
        tures.
 
-       The first argument for pcre_config() is an  integer,  specifying  which
+       The  first  argument  for pcre_config() is an integer, specifying which
        information is required; the second argument is a pointer to a variable
-       into which the information is  placed.  The  following  information  is
+       into  which  the  information  is  placed. The following information is
        available:
 
          PCRE_CONFIG_UTF8
 
-       The  output is an integer that is set to one if UTF-8 support is avail-
+       The output is an integer that is set to one if UTF-8 support is  avail-
        able; otherwise it is set to zero.
 
          PCRE_CONFIG_UNICODE_PROPERTIES
 
-       The output is an integer that is set to  one  if  support  for  Unicode
+       The  output  is  an  integer  that is set to one if support for Unicode
        character properties is available; otherwise it is set to zero.
 
          PCRE_CONFIG_NEWLINE
 
-       The  output  is an integer that is set to the value of the code that is
-       used for the newline character. It is either linefeed (10) or  carriage
-       return  (13),  and  should  normally be the standard character for your
+       The output is an integer that is set to the value of the code  that  is
+       used  for the newline character. It is either linefeed (10) or carriage
+       return (13), and should normally be the  standard  character  for  your
        operating system.
 
          PCRE_CONFIG_LINK_SIZE
 
-       The output is an integer that contains the number  of  bytes  used  for
+       The  output  is  an  integer that contains the number of bytes used for
        internal linkage in compiled regular expressions. The value is 2, 3, or
-       4. Larger values allow larger regular expressions to  be  compiled,  at
-       the  expense  of  slower matching. The default value of 2 is sufficient
-       for all but the most massive patterns, since  it  allows  the  compiled
+       4.  Larger  values  allow larger regular expressions to be compiled, at
+       the expense of slower matching. The default value of  2  is  sufficient
+       for  all  but  the  most massive patterns, since it allows the compiled
        pattern to be up to 64K in size.
 
          PCRE_CONFIG_POSIX_MALLOC_THRESHOLD
 
-       The  output  is  an integer that contains the threshold above which the
-       POSIX interface uses malloc() for output vectors. Further  details  are
+       The output is an integer that contains the threshold  above  which  the
+       POSIX  interface  uses malloc() for output vectors. Further details are
        given in the pcreposix documentation.
 
          PCRE_CONFIG_MATCH_LIMIT
 
        The output is an integer that gives the default limit for the number of
-       internal matching function calls in a  pcre_exec()  execution.  Further
+       internal  matching  function  calls 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 is
-       implemented by recursive function calls that use 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 blocks on  the  heap,  thus
-       avoiding the use of the stack.
+       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
+       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
+       blocks on the heap, thus avoiding the use of the stack.
 
 
 COMPILING A PATTERN
@@ -590,38 +812,52 @@ COMPILING A PATTERN
             const char **errptr, int *erroffset,
             const unsigned char *tableptr);
 
-       The  function  pcre_compile()  is  called  to compile a pattern into an
-       internal form. 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  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 when
-       it is no longer required.
+       pcre *pcre_compile2(const char *pattern, int options,
+            int *errorcodeptr,
+            const char **errptr, int *erroffset,
+            const unsigned char *tableptr);
 
-       Although the compiled code of a PCRE regex is relocatable, that is,  it
+       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.
+
+       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
+       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  when  it  is  no  longer
+       required.
+
+       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 independent bits that affect the compila-
-       tion. 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, can also be set and  unset  from  within  the
-       pattern  (see  the  detailed  description in the pcrepattern documenta-
-       tion). For these options, the contents of the options  argument  speci-
-       fies  their initial settings at the start of compilation and execution.
-       The PCRE_ANCHORED option can be set at the time of matching as well  as
+       tion.  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,  can also be set and unset from within the
+       pattern (see the detailed description  in  the  pcrepattern  documenta-
+       tion).  For  these options, the contents of the options argument speci-
+       fies their initial settings at the start of compilation and  execution.
+       The  PCRE_ANCHORED option 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. The offset from the start of the pattern to the  character  where
-       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
+       sage.  The  offset from the start of the pattern to the character where
+       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.
 
+       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
@@ -664,139 +900,206 @@ COMPILING A PATTERN
 
        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. When running in
-       UTF-8 mode, case support for high-valued characters is  available  only
-       when PCRE is built with Unicode character property support.
+       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 the final character if it is a newline (but
-       not before any  other  newlines).  The  PCRE_DOLLAR_ENDONLY  option  is
+       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 the final character if it is a newline  (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 metacharater in the pattern matches all char-
-       acters,  including  newlines.  Without  it, newlines are excluded. 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 such as [^a]
-       always matches a newline character, independent of the setting of  this
+       acters, including newlines. Without it,  newlines  are  excluded.  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  such  as  [^a]
+       always  matches a newline character, independent of the setting of this
        option.
 
          PCRE_EXTENDED
 
-       If  this  bit  is  set,  whitespace  data characters in the pattern are
-       totally ignored except  when  escaped  or  inside  a  character  class.
-       Whitespace  does  not  include the VT character (code 11). In addition,
-       characters between an unescaped # outside a  character  class  and  the
-       next newline character, inclusive, are also ignored. This is equivalent
-       to Perl's /x option, and it can be changed within a pattern by  a  (?x)
+       If this bit is set, whitespace  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 character, 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.
 
-       This  option  makes  it possible to include comments inside complicated
-       patterns.  Note, however, that this applies only  to  data  characters.
-       Whitespace   characters  may  never  appear  within  special  character
-       sequences in a pattern, for  example  within  the  sequence  (?(  which
+       This option makes it possible to include  comments  inside  complicated
+       patterns.   Note,  however,  that this applies only to data characters.
+       Whitespace  characters  may  never  appear  within  special   character
+       sequences  in  a  pattern,  for  example  within the sequence (?( which
        introduces 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
-       literal.  There  are  at  present  no other features controlled by this
+       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. 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 character in the subject string,  though
+       the matched text may continue over the newline.
+
          PCRE_MULTILINE
 
-       By default, PCRE treats the subject string as consisting  of  a  single
-       line  of characters (even if it actually contains newlines). The "start
-       of line" metacharacter (^) matches only at the  start  of  the  string,
-       while  the  "end  of line" metacharacter ($) matches only at the end of
+       By  default,  PCRE  treats the subject string as consisting of a single
+       line of characters (even if it actually contains newlines). The  "start
+       of  line"  metacharacter  (^)  matches only at the start of the string,
+       while the "end of line" metacharacter ($) matches only at  the  end  of
        the string, or before a terminating newline (unless PCRE_DOLLAR_ENDONLY
        is set). This 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  any  new-
-       line  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
+       When PCRE_MULTILINE it is set, the "start of line" and  "end  of  line"
+       constructs  match  immediately following or immediately before any new-
+       line 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 "\n" charac-
-       ters in a subject string, or no occurrences of ^ or  $  in  a  pattern,
+       ters  in  a  subject  string, or no occurrences of ^ or $ in a pattern,
        setting PCRE_MULTILINE has no effect.
 
          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_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
-       strings  of  UTF-8 characters instead of single-byte character strings.
-       However, it is available only when PCRE is built to include UTF-8  sup-
-       port.  If not, the use of this option provokes an error. Details of how
-       this option changes the behaviour of PCRE are given in the  section  on
+       This  option  causes PCRE to regard both the pattern and the subject as
+       strings of UTF-8 characters instead of single-byte  character  strings.
+       However,  it is available only when PCRE is built to include UTF-8 sup-
+       port. If not, the use of this option provokes an error. Details of  how
+       this  option  changes the behaviour of PCRE are given in the section on
        UTF-8 support in the main pcre page.
 
          PCRE_NO_UTF8_CHECK
 
        When PCRE_UTF8 is set, the validity of the pattern as a UTF-8 string is
-       automatically checked. If an invalid UTF-8 sequence of bytes 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 reasons,  you
-       can  set  the  PCRE_NO_UTF8_CHECK option. When it is set, the effect of
+       automatically  checked. If an invalid UTF-8 sequence of bytes 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 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
-       pcre_exec(),  to  suppress  the  UTF-8  validity  checking  of  subject
-       strings.
+       your program to crash.  Note that this option can  also  be  passed  to
+       pcre_exec()  and pcre_dfa_exec(), to suppress the UTF-8 validity check-
+       ing of subject strings.
+
+
+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.
+
+          0  no error
+          1  \ at end of pattern
+          2  \c at end of pattern
+          3  unrecognized character follows \
+          4  numbers out of order in {} quantifier
+          5  number too big in {} quantifier
+          6  missing terminating ] for character class
+          7  invalid escape sequence in character class
+          8  range out of order in character class
+          9  nothing to repeat
+         10  operand of unlimited repeat could match the empty string
+         11  internal error: unexpected repeat
+         12  unrecognized character after (?
+         13  POSIX named classes are supported only within a class
+         14  missing )
+         15  reference to non-existent subpattern
+         16  erroffset passed as NULL
+         17  unknown option bit(s) set
+         18  missing ) after comment
+         19  parentheses nested too deeply
+         20  regular expression too large
+         21  failed to get memory
+         22  unmatched parentheses
+         23  internal error: code overflow
+         24  unrecognized character after (?<
+         25  lookbehind assertion is not fixed length
+         26  malformed number after (?(
+         27  conditional group contains more than two branches
+         28  assertion expected after (?(
+         29  (?R or (?digits must be followed by )
+         30  unknown POSIX class name
+         31  POSIX collating elements are not supported
+         32  this version of PCRE is not compiled with PCRE_UTF8 support
+         33  spare error
+         34  character value in \x{...} sequence is too large
+         35  invalid condition (?(0)
+         36  \C not allowed in lookbehind assertion
+         37  PCRE does not support \L, \l, \N, \U, or \u
+         38  number after (?C is > 255
+         39  closing ) for (?C expected
+         40  recursive call could loop indefinitely
+         41  unrecognized character after (?P
+         42  syntax error after (?P
+         43  two named groups have the same name
+         44  invalid UTF-8 string
+         45  support for \P, \p, and \X has not been compiled
+         46  malformed \P or \p sequence
+         47  unknown property name after \P or \p
 
 
 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(). However, a pcre_extra block  also  contains  other  fields
-       that  can  be  set  by the caller before the block is passed; these are
+       pcre_exec().  However,  a  pcre_extra  block also contains 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  additional  information,
+       If  studying  the  pattern  does not produce any additional information
        pcre_study() returns NULL. In that circumstance, if the calling program
-       wants to pass any of the other fields to pcre_exec(), it  must  set  up
+       wants  to  pass  any of the other fields to pcre_exec(), it must set up
        its own pcre_extra block.
 
-       The  second  argument of pcre_study() contains option bits. At present,
+       The second argument of pcre_study() contains option bits.  At  present,
        no options are defined, and this argument should always be zero.
 
-       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 points to a textual  error  mes-
-       sage.  You should therefore test the error pointer for NULL after call-
+       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 points to a textual error mes-
+       sage. You should therefore test the error pointer for NULL after  call-
        ing pcre_study(), to be sure that it has run successfully.
 
        This is a typical call to pcre_study():
@@ -808,51 +1111,51 @@ STUDYING A PATTERN
            &error);        /* set to NULL or points to a message */
 
        At present, studying a pattern is useful only for non-anchored patterns
-       that  do not have a single fixed starting character. A bitmap of possi-
+       that do not have a single fixed starting character. A bitmap of  possi-
        ble starting bytes is created.
 
 
 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. Higher-valued codes never match
-       escapes such as \w or \d, but can be tested with \p if  PCRE  is  built
-       with Unicode character property support.)
-
-       An  internal set of tables is created in the default C locale when PCRE
-       is built. This is used when the final  argument  of  pcre_compile()  is
-       NULL,  and  is  sufficient for many applications. An alternative set of
-       tables can, however, be supplied. These may be created in  a  different
-       locale  from the default. As more and more applications change to using
+       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. Higher-valued  codes  never  match
+       escapes  such  as  \w or \d, but can be tested with \p if PCRE is built
+       with Unicode character property support.
+
+       An internal set of tables is created in the default C locale when  PCRE
+       is  built.  This  is  used when the final argument of pcre_compile() is
+       NULL, and is sufficient for many applications. An  alternative  set  of
+       tables  can,  however, be supplied. These may be created in a different
+       locale from the default. As more and more applications change to  using
        Unicode, the need for this locale support is expected to die away.
 
-       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
+       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:
 
          setlocale(LC_CTYPE, "fr_FR");
          tables = pcre_maketables();
          re = pcre_compile(..., tables);
 
-       When  pcre_maketables()  runs,  the  tables are built in memory that is
-       obtained via pcre_malloc. It is the caller's responsibility  to  ensure
-       that  the memory containing the tables remains available for as long as
+       When pcre_maketables() runs, the tables are built  in  memory  that  is
+       obtained  via  pcre_malloc. It is the caller's responsibility to ensure
+       that the memory containing the tables remains available for as long  as
        it is needed.
 
        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()
+       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-
        tern, compilation, studying and matching all happen in the same locale,
        but different patterns can be compiled 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
+       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.
 
@@ -862,15 +1165,15 @@ INFORMATION ABOUT A PATTERN
        int pcre_fullinfo(const pcre *code, const pcre_extra *extra,
             int what, void *where);
 
-       The pcre_fullinfo() function returns information about a compiled  pat-
+       The  pcre_fullinfo() function returns information about a compiled pat-
        tern. It replaces the obsolete pcre_info() function, which is neverthe-
        less retained for backwards compability (and is documented below).
 
-       The first argument for pcre_fullinfo() is a  pointer  to  the  compiled
-       pattern.  The second argument is the result of pcre_study(), or NULL if
-       the pattern was not studied. The third argument specifies  which  piece
-       of  information  is required, and the fourth argument is a pointer to a
-       variable to receive the data. The yield of the  function  is  zero  for
+       The  first  argument  for  pcre_fullinfo() is a pointer to the compiled
+       pattern. The second argument is the result of pcre_study(), or NULL  if
+       the  pattern  was not studied. The third argument specifies which piece
+       of information is required, and the fourth argument is a pointer  to  a
+       variable  to  receive  the  data. The yield of the function is zero for
        success, or one of the following negative numbers:
 
          PCRE_ERROR_NULL       the argument code was NULL
@@ -878,9 +1181,9 @@ INFORMATION ABOUT A PATTERN
          PCRE_ERROR_BADMAGIC   the "magic number" was not found
          PCRE_ERROR_BADOPTION  the value of what was invalid
 
-       The  "magic  number" is placed at the start of each compiled pattern as
-       an simple check against passing an arbitrary memory pointer. Here is  a
-       typical  call  of pcre_fullinfo(), to obtain the length of the compiled
+       The "magic number" is placed at the start of each compiled  pattern  as
+       an  simple check against passing an arbitrary memory pointer. Here is a
+       typical call of pcre_fullinfo(), to obtain the length of  the  compiled
        pattern:
 
          int rc;
@@ -891,64 +1194,64 @@ INFORMATION ABOUT A PATTERN
            PCRE_INFO_SIZE,   /* what is required */
            &length);         /* where to put the data */
 
-       The possible values for the third argument are defined in  pcre.h,  and
+       The  possible  values for the third argument are defined in pcre.h, and
        are as follows:
 
          PCRE_INFO_BACKREFMAX
 
-       Return  the  number  of  the highest back reference in the pattern. The
-       fourth argument should point to an int variable. Zero  is  returned  if
+       Return the number of the highest back reference  in  the  pattern.  The
+       fourth  argument  should  point to an int variable. Zero is returned if
        there are no back references.
 
          PCRE_INFO_CAPTURECOUNT
 
-       Return  the  number of capturing subpatterns in the pattern. The fourth
+       Return the number of capturing subpatterns in the pattern.  The  fourth
        argument should point to an int variable.
 
-         PCRE_INFO_DEFAULTTABLES
+         PCRE_INFO_DEFAULT_TABLES
 
-       Return a pointer to the internal default character tables within  PCRE.
-       The  fourth  argument should point to an unsigned char * variable. This
+       Return  a pointer to the internal default character tables within PCRE.
+       The fourth argument should point to an unsigned char *  variable.  This
        information call is provided for internal use by the pcre_study() func-
-       tion.  External  callers  can  cause PCRE to use its internal tables by
+       tion. External callers can cause PCRE to use  its  internal  tables  by
        passing a NULL table pointer.
 
          PCRE_INFO_FIRSTBYTE
 
-       Return information about the first byte of any matched  string,  for  a
-       non-anchored    pattern.    (This    option    used    to   be   called
-       PCRE_INFO_FIRSTCHAR; the old name is  still  recognized  for  backwards
+       Return  information  about  the first byte of any matched string, for a
+       non-anchored   pattern.   (This    option    used    to    be    called
+       PCRE_INFO_FIRSTCHAR;  the  old  name  is still recognized for backwards
        compatibility.)
 
-       If  there  is  a  fixed first byte, for example, from a pattern such as
-       (cat|cow|coyote), it is returned in the integer pointed  to  by  where.
+       If there is a fixed first byte, for example, from  a  pattern  such  as
+       (cat|cow|coyote),  it  is  returned in the integer pointed to by where.
        Otherwise, if either
 
-       (a)  the pattern was compiled with the PCRE_MULTILINE option, and every
+       (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
+       -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_FIRSTTABLE
 
-       If  the pattern was studied, and this resulted in the construction of a
+       If the pattern was studied, and this resulted in the construction of  a
        256-bit table indicating a fixed set of bytes for the first byte in any
-       matching  string, a pointer to the table is returned. Otherwise NULL is
-       returned. The fourth argument should point to an unsigned char *  vari-
+       matching string, a pointer to the table is returned. Otherwise NULL  is
+       returned.  The fourth argument should point to an unsigned char * vari-
        able.
 
          PCRE_INFO_LASTLITERAL
 
-       Return  the  value of the rightmost literal byte that must exist in any
-       matched string, other than at its  start,  if  such  a  byte  has  been
+       Return the value of the rightmost literal byte that must exist  in  any
+       matched  string,  other  than  at  its  start,  if such a byte has been
        recorded. The fourth argument should point to an int variable. If there
-       is no such byte, -1 is returned. For anchored patterns, a last  literal
-       byte  is  recorded only if it follows something of variable length. For
+       is  no such byte, -1 is returned. For anchored patterns, a last literal
+       byte is recorded only if it follows something of variable  length.  For
        example, for the pattern /^a\d+z\d+/ the returned value is "z", but for
        /^a\dz\d/ the returned value is -1.
 
@@ -956,32 +1259,32 @@ INFORMATION ABOUT A PATTERN
          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.  A  convenience  function  called
-       pcre_get_named_substring() is provided  for  extracting  an  individual
-       captured  substring  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,
+       pcre_get_named_substring()  is  provided  for  extracting an individual
+       captured substring 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 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
-       a  pointer  to  the  first  entry of the table (a pointer to char). The
+       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  (a  pointer  to  char).  The
        first two bytes of each entry are the number of the capturing parenthe-
-       sis,  most  significant byte first. The rest of the entry is the corre-
-       sponding name, zero terminated. The names are  in  alphabetical  order.
-       For  example,  consider  the following pattern (assume PCRE_EXTENDED is
+       sis, most significant byte first. The rest of the entry is  the  corre-
+       sponding  name,  zero  terminated. The names are in alphabetical order.
+       For example, consider the following pattern  (assume  PCRE_EXTENDED  is
        set, so white space - including newlines - is ignored):
 
          (?P<date> (?P<year>(\d\d)?\d\d) -
          (?P<month>\d\d) - (?P<day>\d\d) )
 
-       There are four named subpatterns, so the table has  four  entries,  and
-       each  entry  in the table is eight bytes long. The table is as follows,
+       There  are  four  named subpatterns, so the table has four entries, and
+       each entry in the table is eight bytes long. The table is  as  follows,
        with non-printing bytes shows in hexadecimal, and undefined bytes shown
        as ??:
 
@@ -990,18 +1293,18 @@ INFORMATION ABOUT A PATTERN
          00 04 m  o  n  t  h  00
          00 02 y  e  a  r  00 ??
 
-       When  writing  code  to  extract  data from named subpatterns using the
+       When writing code to extract data  from  named  subpatterns  using  the
        name-to-number map, remember that the length of each entry is likely to
        be different for each compiled pattern.
 
          PCRE_INFO_OPTIONS
 
-       Return  a  copy of the options with which the pattern was compiled. The
-       fourth argument should point to an unsigned long  int  variable.  These
+       Return a copy of the options with which the pattern was  compiled.  The
+       fourth  argument  should  point to an unsigned long int variable. These
        option bits are those specified in the call to pcre_compile(), modified
        by any top-level option settings within the pattern itself.
 
-       A pattern is automatically anchored by PCRE if  all  of  its  top-level
+       A  pattern  is  automatically  anchored by PCRE if all of its top-level
        alternatives begin with one of the following:
 
          ^     unless PCRE_MULTILINE is set
@@ -1015,7 +1318,7 @@ INFORMATION ABOUT A PATTERN
 
          PCRE_INFO_SIZE
 
-       Return the size of the compiled pattern, that is, the  value  that  was
+       Return  the  size  of the compiled pattern, that is, the value that was
        passed as the argument to pcre_malloc() when PCRE was getting memory in
        which to place the compiled data. The fourth argument should point to a
        size_t variable.
@@ -1023,9 +1326,9 @@ INFORMATION ABOUT A PATTERN
          PCRE_INFO_STUDYSIZE
 
        Return the size of the data block pointed to by the study_data field in
-       a pcre_extra block. That is,  it  is  the  value  that  was  passed  to
+       a  pcre_extra  block.  That  is,  it  is  the  value that was passed to
        pcre_malloc() when PCRE was getting memory into which to place the data
-       created by pcre_study(). The fourth argument should point to  a  size_t
+       created  by  pcre_study(). The fourth argument should point to a size_t
        variable.
 
 
@@ -1033,34 +1336,59 @@ OBSOLETE INFO FUNCTION
 
        int pcre_info(const pcre *code, int *optptr, int *firstcharptr);
 
-       The  pcre_info()  function is now obsolete because its interface is too
-       restrictive to return all the available data about a compiled  pattern.
-       New   programs   should  use  pcre_fullinfo()  instead.  The  yield  of
-       pcre_info() is the number of capturing subpatterns, or one of the  fol-
+       The pcre_info() function is now obsolete because its interface  is  too
+       restrictive  to return all the available data about a compiled pattern.
+       New  programs  should  use  pcre_fullinfo()  instead.  The   yield   of
+       pcre_info()  is the number of capturing subpatterns, or one of the fol-
        lowing negative numbers:
 
          PCRE_ERROR_NULL       the argument code was NULL
          PCRE_ERROR_BADMAGIC   the "magic number" was not found
 
-       If  the  optptr  argument is not NULL, a copy of the options with which
-       the pattern was compiled is placed in the integer  it  points  to  (see
+       If the optptr argument is not NULL, a copy of the  options  with  which
+       the  pattern  was  compiled  is placed in the integer it points to (see
        PCRE_INFO_OPTIONS above).
 
-       If  the  pattern  is  not anchored and the firstcharptr argument is not
-       NULL, it is used to pass back information about the first character  of
+       If the pattern is not anchored and the  firstcharptr  argument  is  not
+       NULL,  it is used to pass back information about the first character of
        any matched string (see PCRE_INFO_FIRSTBYTE above).
 
 
-MATCHING A PATTERN
+REFERENCE COUNTS
+
+       int pcre_refcount(pcre *code, int adjust);
+
+       The pcre_refcount() function is used to maintain a reference  count  in
+       the data block that contains a compiled pattern. It is provided for the
+       benefit of applications that  operate  in  an  object-oriented  manner,
+       where different parts of the application may be using the same compiled
+       pattern, but you want to free the block when they are all done.
+
+       When a pattern is compiled, the reference count field is initialized to
+       zero.   It is changed only by calling this function, whose action is to
+       add the adjust value (which may be positive or  negative)  to  it.  The
+       yield of the function is the new value. However, the value of the count
+       is constrained to lie between 0 and 65535, inclusive. If the new  value
+       is outside these limits, it is forced to the appropriate limit value.
+
+       Except  when it is zero, the reference count is not correctly preserved
+       if a pattern is compiled on one host and then  transferred  to  a  host
+       whose byte-order is different. (This seems a highly unlikely scenario.)
+
+
+MATCHING A PATTERN: THE TRADITIONAL FUNCTION
 
        int pcre_exec(const pcre *code, const pcre_extra *extra,
             const char *subject, int length, int startoffset,
             int options, int *ovector, int ovecsize);
 
-       The  function pcre_exec() is called to match a subject string against a
-       compiled pattern, which is passed in the code argument. If the  pattern
+       The function pcre_exec() is called to match a subject string against  a
+       compiled  pattern, which is passed in the code argument. If the pattern
        has been studied, the result of the study should be passed in the extra
-       argument.
+       argument.  This  function is the main matching facility of the library,
+       and it operates in a Perl-like manner. For specialist use there is also
+       an  alternative matching function, which is described below in the sec-
+       tion about the pcre_dfa_exec() function.
 
        In most applications, the pattern will have been compiled (and  option-
        ally  studied)  in the same process that calls pcre_exec(). However, it
@@ -1080,15 +1408,14 @@ MATCHING A PATTERN
            0,              /* start at offset 0 in the subject */
            0,              /* default options */
            ovector,        /* vector of integers for substring information */
-           30);            /* number of elements in the vector  (NOT  size  in
-       bytes) */
+           30);            /* number of elements (NOT size in bytes) */
 
    Extra data for pcre_exec()
 
-       If  the  extra argument is not NULL, it must point to a pcre_extra data
-       block. The pcre_study() function returns such a block (when it  doesn't
-       return  NULL), but you can also create one for yourself, and pass addi-
-       tional information in it. The fields in a pcre_extra block are as  fol-
+       If the extra argument is not NULL, it must point to a  pcre_extra  data
+       block.  The pcre_study() function returns such a block (when it doesn't
+       return NULL), but you can also create one for yourself, and pass  addi-
+       tional  information in it. The fields in a pcre_extra block are as fol-
        lows:
 
          unsigned long int flags;
@@ -1097,7 +1424,7 @@ MATCHING A PATTERN
          void *callout_data;
          const unsigned char *tables;
 
-       The  flags  field  is a bitmap that specifies which of the other fields
+       The flags field is a bitmap that specifies which of  the  other  fields
        are set. The flag bits are:
 
          PCRE_EXTRA_STUDY_DATA
@@ -1105,229 +1432,229 @@ MATCHING A PATTERN
          PCRE_EXTRA_CALLOUT_DATA
          PCRE_EXTRA_TABLES
 
-       Other flag bits should be set to zero. The study_data field is  set  in
-       the  pcre_extra  block  that is returned by pcre_study(), together with
+       Other  flag  bits should be set to zero. The study_data field is set in
+       the pcre_extra block that is returned by  pcre_study(),  together  with
        the appropriate flag bit. You should not set this yourself, but you may
-       add  to  the  block by setting the other fields and their corresponding
+       add to the block by setting the other fields  and  their  corresponding
        flag bits.
 
        The match_limit field provides a means of preventing PCRE from using up
-       a  vast amount of resources when running patterns that are not going to
-       match, but which have a very large number  of  possibilities  in  their
-       search  trees.  The  classic  example  is  the  use of nested unlimited
+       a vast amount of resources when running patterns that are not going  to
+       match,  but  which  have  a very large number of possibilities in their
+       search trees. The classic  example  is  the  use  of  nested  unlimited
        repeats.
 
-       Internally, PCRE uses a function called match() which it calls  repeat-
-       edly  (sometimes  recursively).  The  limit is imposed on the number of
-       times this function is called during a match, which has the  effect  of
-       limiting  the amount of recursion and backtracking that can take place.
+       Internally,  PCRE uses a function called match() which it calls repeat-
+       edly (sometimes recursively). The limit is imposed  on  the  number  of
+       times  this  function is called during a match, which has the effect of
+       limiting the amount of recursion and backtracking that can take  place.
        For patterns that are not anchored, the count starts from zero for each
        position in the subject string.
 
-       The  default  limit  for the library can be set when PCRE is built; the
-       default default is 10 million, which handles all but the  most  extreme
-       cases.  You  can  reduce  the  default  by  suppling pcre_exec() with a
-       pcre_extra block in which match_limit is set to a  smaller  value,  and
-       PCRE_EXTRA_MATCH_LIMIT  is  set  in  the  flags  field. If the limit is
+       The default limit for the library can be set when PCRE  is  built;  the
+       default  default  is 10 million, which handles all but the most extreme
+       cases. You can reduce  the  default  by  suppling  pcre_exec()  with  a
+       pcre_extra  block  in  which match_limit is set to a smaller value, and
+       PCRE_EXTRA_MATCH_LIMIT is set in the  flags  field.  If  the  limit  is
        exceeded, pcre_exec() returns PCRE_ERROR_MATCHLIMIT.
 
-       The pcre_callout field is used in conjunction with the  "callout"  fea-
+       The  pcre_callout  field is used in conjunction with the "callout" fea-
        ture, which 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-
+       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-
+       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.
 
    Option bits for pcre_exec()
 
-       The unused bits of the options argument for pcre_exec() must  be  zero.
-       The   only  bits  that  may  be  set  are  PCRE_ANCHORED,  PCRE_NOTBOL,
+       The  unused  bits of the options argument for pcre_exec() must be zero.
+       The  only  bits  that  may  be  set  are  PCRE_ANCHORED,   PCRE_NOTBOL,
        PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NO_UTF8_CHECK and PCRE_PARTIAL.
 
          PCRE_ANCHORED
 
-       The PCRE_ANCHORED option limits pcre_exec() to matching  at  the  first
-       matching  position.  If  a  pattern was compiled with PCRE_ANCHORED, or
-       turned out to be anchored by virtue of its contents, it cannot be  made
+       The  PCRE_ANCHORED  option  limits pcre_exec() to matching at the first
+       matching position. If a pattern was  compiled  with  PCRE_ANCHORED,  or
+       turned  out to be anchored by virtue of its contents, it cannot be made
        unachored at matching time.
 
          PCRE_NOTBOL
 
        This option specifies that first character of the subject string is not
-       the beginning of a line, so the  circumflex  metacharacter  should  not
-       match  before it. Setting this without PCRE_MULTILINE (at compile time)
-       causes  circumflex  never  to  match.  This  option  affects  only  the
-       behaviour of the circumflex metacharacter. It does not affect \A.
+       the  beginning  of  a  line, so the circumflex metacharacter should not
+       match before it. Setting this without PCRE_MULTILINE (at compile  time)
+       causes  circumflex  never to match. This option affects only the behav-
+       iour of the circumflex metacharacter. It does not affect \A.
 
          PCRE_NOTEOL
 
        This option specifies that the end of the subject string is not the end
-       of a line, so the dollar metacharacter should not match it nor  (except
-       in  multiline mode) a newline immediately before it. Setting this with-
+       of  a line, so the dollar metacharacter should not match it nor (except
+       in multiline mode) a newline immediately before it. Setting this  with-
        out PCRE_MULTILINE (at compile time) causes dollar never to match. This
-       option  affects only the behaviour of the dollar metacharacter. It does
+       option affects only the behaviour of the dollar metacharacter. It  does
        not affect \Z or \z.
 
          PCRE_NOTEMPTY
 
        An empty string is not considered to be a valid match if this option is
-       set.  If  there are alternatives in the pattern, they are tried. If all
-       the alternatives match the empty string, the entire  match  fails.  For
+       set. If there are alternatives in the pattern, they are tried.  If  all
+       the  alternatives  match  the empty string, the entire match fails. For
        example, if the pattern
 
          a?b?
 
-       is  applied  to  a string not beginning with "a" or "b", it matches the
-       empty string at the start of the subject. With PCRE_NOTEMPTY set,  this
+       is applied to a string not beginning with "a" or "b",  it  matches  the
+       empty  string at the start of the subject. With PCRE_NOTEMPTY set, this
        match is not valid, so PCRE searches further into the string for occur-
        rences of "a" or "b".
 
        Perl has no direct equivalent of PCRE_NOTEMPTY, but it does make a spe-
-       cial  case  of  a  pattern match of the empty string within its split()
-       function, and when using the /g modifier. It  is  possible  to  emulate
+       cial case of a pattern match of the empty  string  within  its  split()
+       function,  and  when  using  the /g modifier. It is possible to emulate
        Perl's behaviour after matching a null string by first trying the match
        again at the same offset with PCRE_NOTEMPTY and PCRE_ANCHORED, and then
-       if  that  fails by advancing the starting offset (see below) and trying
+       if that fails by advancing the starting offset (see below)  and  trying
        an ordinary match again. There is some code that demonstrates how to do
        this in the pcredemo.c sample program.
 
          PCRE_NO_UTF8_CHECK
 
        When PCRE_UTF8 is set at compile time, the validity of the subject as a
-       UTF-8 string is automatically checked when pcre_exec() is  subsequently
-       called.   The  value  of  startoffset is also checked to ensure that it
-       points to the start of a UTF-8 character. If an invalid UTF-8  sequence
+       UTF-8  string is automatically checked when pcre_exec() is subsequently
+       called.  The value of startoffset is also checked  to  ensure  that  it
+       points  to the start of a UTF-8 character. If an invalid UTF-8 sequence
        of bytes is found, pcre_exec() returns the error PCRE_ERROR_BADUTF8. If
-       startoffset contains an  invalid  value,  PCRE_ERROR_BADUTF8_OFFSET  is
+       startoffset  contains  an  invalid  value, PCRE_ERROR_BADUTF8_OFFSET is
        returned.
 
-       If  you  already  know that your subject is valid, and you want to skip
-       these   checks   for   performance   reasons,   you   can    set    the
-       PCRE_NO_UTF8_CHECK  option  when calling pcre_exec(). You might want to
-       do this for the second and subsequent calls to pcre_exec() if  you  are
-       making  repeated  calls  to  find  all  the matches in a single subject
-       string. However, you should be  sure  that  the  value  of  startoffset
-       points  to  the  start of a UTF-8 character. When PCRE_NO_UTF8_CHECK is
-       set, the effect of passing an invalid UTF-8 string as a subject,  or  a
-       value  of startoffset that does not point to the start of a UTF-8 char-
+       If you already know that your subject is valid, and you  want  to  skip
+       these    checks    for   performance   reasons,   you   can   set   the
+       PCRE_NO_UTF8_CHECK option when calling pcre_exec(). You might  want  to
+       do  this  for the second and subsequent calls to pcre_exec() if you are
+       making repeated calls to find all  the  matches  in  a  single  subject
+       string.  However,  you  should  be  sure  that the value of startoffset
+       points to the start of a UTF-8 character.  When  PCRE_NO_UTF8_CHECK  is
+       set,  the  effect of passing an invalid UTF-8 string as a subject, or a
+       value of startoffset that does not point to the start of a UTF-8  char-
        acter, is undefined. Your program may crash.
 
          PCRE_PARTIAL
 
-       This option turns on the  partial  matching  feature.  If  the  subject
-       string  fails to match the pattern, but at some point during the match-
-       ing process the end of the subject was reached (that  is,  the  subject
-       partially  matches  the  pattern and the failure to match occurred only
-       because there were not enough subject characters), pcre_exec()  returns
-       PCRE_ERROR_PARTIAL  instead of PCRE_ERROR_NOMATCH. When PCRE_PARTIAL is
-       used, there are restrictions on what may appear in the  pattern.  These
+       This  option  turns  on  the  partial  matching feature. If the subject
+       string fails to match the pattern, but at some point during the  match-
+       ing  process  the  end of the subject was reached (that is, the subject
+       partially matches the pattern and the failure to  match  occurred  only
+       because  there were not enough subject characters), pcre_exec() returns
+       PCRE_ERROR_PARTIAL instead of PCRE_ERROR_NOMATCH. When PCRE_PARTIAL  is
+       used,  there  are restrictions on what may appear in the pattern. These
        are discussed in the pcrepartial documentation.
 
    The string to be matched by pcre_exec()
 
-       The  subject string is passed to pcre_exec() as a pointer in subject, a
-       length in length, and a starting byte offset in startoffset.  In  UTF-8
-       mode,  the  byte  offset  must point to the start of a UTF-8 character.
-       Unlike the pattern string, the subject may contain binary  zero  bytes.
-       When  the starting offset is zero, the search for a match starts at the
+       The subject string is passed to pcre_exec() as a pointer in subject,  a
+       length  in  length, and a starting byte offset in startoffset. In UTF-8
+       mode, the byte offset must point to the start  of  a  UTF-8  character.
+       Unlike  the  pattern string, the subject may contain binary zero bytes.
+       When the starting offset is zero, the search for a match starts at  the
        beginning of the subject, and this is by far the most common case.
 
-       A non-zero starting offset is useful when searching for  another  match
-       in  the same subject by calling pcre_exec() again after a previous suc-
-       cess.  Setting startoffset differs from just passing over  a  shortened
-       string  and  setting  PCRE_NOTBOL  in the case of a pattern that begins
+       A  non-zero  starting offset is useful when searching for another match
+       in the same subject by calling pcre_exec() again after a previous  suc-
+       cess.   Setting  startoffset differs from just passing over a shortened
+       string and setting PCRE_NOTBOL in the case of  a  pattern  that  begins
        with any kind of lookbehind. For example, consider the pattern
 
          \Biss\B
 
-       which finds occurrences of "iss" in the middle of  words.  (\B  matches
-       only  if  the  current position in the subject is not a word boundary.)
-       When applied to the string "Mississipi" the first call  to  pcre_exec()
-       finds  the  first  occurrence. If pcre_exec() is called again with just
-       the remainder of the subject,  namely  "issipi",  it  does  not  match,
+       which  finds  occurrences  of "iss" in the middle of words. (\B matches
+       only if the current position in the subject is not  a  word  boundary.)
+       When  applied  to the string "Mississipi" the first call to pcre_exec()
+       finds the first occurrence. If pcre_exec() is called  again  with  just
+       the  remainder  of  the  subject,  namely  "issipi", it does not match,
        because \B is always false at the start of the subject, which is deemed
-       to be a word boundary. However, if pcre_exec()  is  passed  the  entire
+       to  be  a  word  boundary. However, if pcre_exec() is passed the entire
        string again, but with startoffset set to 4, it finds the second occur-
-       rence of "iss" because it is able to look behind the starting point  to
+       rence  of "iss" because it is able to look behind the starting point to
        discover that it is preceded by a letter.
 
-       If  a  non-zero starting offset is passed when the pattern is anchored,
+       If a non-zero starting offset is passed when the pattern  is  anchored,
        one attempt to match at the given offset is made. This can only succeed
-       if  the  pattern  does  not require the match to be at the start of the
+       if the pattern does not require the match to be at  the  start  of  the
        subject.
 
    How pcre_exec() returns captured substrings
 
-       In general, a pattern matches a certain portion of the subject, and  in
-       addition,  further  substrings  from  the  subject may be picked out by
-       parts of the pattern. Following the usage  in  Jeffrey  Friedl's  book,
-       this  is  called "capturing" in what follows, and the phrase "capturing
-       subpattern" is used for a fragment of a pattern that picks out  a  sub-
-       string.  PCRE  supports several other kinds of parenthesized subpattern
+       In  general, a pattern matches a certain portion of the subject, and in
+       addition, further substrings from the subject  may  be  picked  out  by
+       parts  of  the  pattern.  Following the usage in Jeffrey Friedl's book,
+       this is called "capturing" in what follows, and the  phrase  "capturing
+       subpattern"  is  used for a fragment of a pattern that picks out a sub-
+       string. PCRE supports several other kinds of  parenthesized  subpattern
        that do not cause substrings to be captured.
 
-       Captured substrings are returned to the caller via a vector of  integer
-       offsets  whose  address is passed in ovector. The number of elements in
-       the vector is passed in ovecsize, which must be a non-negative  number.
+       Captured  substrings are returned to the caller via a vector of integer
+       offsets whose address is passed in ovector. The number of  elements  in
+       the  vector is passed in ovecsize, which must be a non-negative number.
        Note: this argument is NOT the size of ovector in bytes.
 
-       The  first  two-thirds of the vector is used to pass back captured sub-
-       strings, each substring using a pair of integers. The  remaining  third
-       of  the  vector is used as workspace by pcre_exec() while matching cap-
-       turing subpatterns, and is not available for passing back  information.
-       The  length passed in ovecsize should always be a multiple of three. If
+       The first two-thirds of the vector is used to pass back  captured  sub-
+       strings,  each  substring using a pair of integers. The remaining third
+       of the vector is used as workspace by pcre_exec() while  matching  cap-
+       turing  subpatterns, and is not available for passing back information.
+       The length passed in ovecsize should always be a multiple of three.  If
        it is not, it is rounded down.
 
-       When a match is successful, information about  captured  substrings  is
-       returned  in  pairs  of integers, starting at the beginning of ovector,
-       and continuing up to two-thirds of its length at the  most.  The  first
+       When  a  match  is successful, information about captured substrings is
+       returned in pairs of integers, starting at the  beginning  of  ovector,
+       and  continuing  up  to two-thirds of its length at the most. The first
        element of a pair is set to the offset of the first character in a sub-
-       string, and the second is set to the  offset  of  the  first  character
-       after  the  end  of  a  substring. The first pair, ovector[0] and ovec-
-       tor[1], identify the portion of  the  subject  string  matched  by  the
-       entire  pattern.  The next pair is used for the first capturing subpat-
-       tern, and so on. The value returned by pcre_exec()  is  the  number  of
-       pairs  that  have  been set. If there are no capturing subpatterns, the
-       return value from a successful match is 1,  indicating  that  just  the
+       string,  and  the  second  is  set to the offset of the first character
+       after the end of a substring. The  first  pair,  ovector[0]  and  ovec-
+       tor[1],  identify  the  portion  of  the  subject string matched by the
+       entire pattern. The next pair is used for the first  capturing  subpat-
+       tern,  and  so  on.  The value returned by pcre_exec() is the number of
+       pairs that have been set. If there are no  capturing  subpatterns,  the
+       return  value  from  a  successful match is 1, indicating that just the
        first pair of offsets has been set.
 
-       Some  convenience  functions  are  provided for extracting the captured
-       substrings as separate strings. These are described  in  the  following
+       Some convenience functions are provided  for  extracting  the  captured
+       substrings  as  separate  strings. These are described in the following
        section.
 
-       It  is  possible  for  an capturing subpattern number n+1 to match some
-       part of the subject when subpattern n has not been  used  at  all.  For
+       It is possible for an capturing subpattern number  n+1  to  match  some
+       part  of  the  subject  when subpattern n has not been used at all. For
        example, if the string "abc" is matched against the pattern (a|(z))(bc)
-       subpatterns 1 and 3 are matched, but 2 is not. When this happens,  both
+       subpatterns  1 and 3 are matched, but 2 is not. When this happens, both
        offset values corresponding to the unused subpattern are set to -1.
 
        If a capturing subpattern is matched repeatedly, it is the last portion
        of the string that it matched that is returned.
 
-       If the vector is too small to hold all the captured substring  offsets,
+       If  the vector is too small to hold all the captured substring offsets,
        it is used as far as possible (up to two-thirds of its length), and the
-       function returns a value of zero. In particular, if the substring  off-
+       function  returns a value of zero. In particular, if the substring off-
        sets are not of interest, pcre_exec() may be called with ovector passed
-       as NULL and ovecsize as zero. However, if  the  pattern  contains  back
-       references  and  the  ovector is not big enough to remember the related
-       substrings, PCRE has to get additional memory for use during  matching.
+       as  NULL  and  ovecsize  as zero. However, if the pattern contains back
+       references and the ovector is not big enough to  remember  the  related
+       substrings,  PCRE has to get additional memory for use during matching.
        Thus it is usually advisable to supply an ovector.
 
-       Note  that  pcre_info() can be used to find out how many capturing sub-
+       Note that pcre_info() can be used to find out how many  capturing  sub-
        patterns there are in a compiled pattern. The smallest size for ovector
-       that  will  allow for n captured substrings, in addition to the offsets
+       that will allow for n captured substrings, in addition to  the  offsets
        of the substring matched by the whole pattern, is (n+1)*3.
 
    Return values from pcre_exec()
 
-       If pcre_exec() fails, it returns a negative number. The  following  are
+       If  pcre_exec()  fails, it returns a negative number. The following are
        defined in the header file:
 
          PCRE_ERROR_NOMATCH        (-1)
@@ -1336,7 +1663,7 @@ MATCHING A PATTERN
 
          PCRE_ERROR_NULL           (-2)
 
-       Either  code  or  subject  was  passed as NULL, or ovector was NULL and
+       Either code or subject was passed as NULL,  or  ovector  was  NULL  and
        ovecsize was not zero.
 
          PCRE_ERROR_BADOPTION      (-3)
@@ -1345,74 +1672,74 @@ MATCHING A PATTERN
 
          PCRE_ERROR_BADMAGIC       (-4)
 
-       PCRE stores a 4-byte "magic number" at the start of the compiled  code,
+       PCRE  stores a 4-byte "magic number" at the start of the compiled code,
        to catch the case when it is passed a junk pointer and to detect when a
        pattern that was compiled in an environment of one endianness is run in
-       an  environment  with the other endianness. This is the error that PCRE
+       an environment with the other endianness. This is the error  that  PCRE
        gives when the magic number is not present.
 
          PCRE_ERROR_UNKNOWN_NODE   (-5)
 
        While running the pattern match, an unknown item was encountered in the
-       compiled  pattern.  This  error  could be caused by a bug in PCRE or by
+       compiled pattern. This error could be caused by a bug  in  PCRE  or  by
        overwriting of the compiled pattern.
 
          PCRE_ERROR_NOMEMORY       (-6)
 
-       If a pattern contains back references, but the ovector that  is  passed
+       If  a  pattern contains back references, but the ovector that is passed
        to pcre_exec() is not big enough to remember the referenced substrings,
-       PCRE gets a block of memory at the start of matching to  use  for  this
-       purpose.  If the call via pcre_malloc() fails, this error is given. The
+       PCRE  gets  a  block of memory at the start of matching to use for this
+       purpose. If the call via pcre_malloc() fails, this error is given.  The
        memory is automatically freed at the end of matching.
 
          PCRE_ERROR_NOSUBSTRING    (-7)
 
-       This error is used by the pcre_copy_substring(),  pcre_get_substring(),
+       This  error is used by the pcre_copy_substring(), pcre_get_substring(),
        and  pcre_get_substring_list()  functions  (see  below).  It  is  never
        returned by pcre_exec().
 
          PCRE_ERROR_MATCHLIMIT     (-8)
 
-       The recursion and backtracking limit, as specified by  the  match_limit
-       field  in  a  pcre_extra  structure (or defaulted) was reached. See the
+       The  recursion  and backtracking limit, as specified by the match_limit
+       field in a pcre_extra structure (or defaulted)  was  reached.  See  the
        description above.
 
          PCRE_ERROR_CALLOUT        (-9)
 
        This error is never generated by pcre_exec() itself. It is provided for
-       use  by  callout functions that want to yield a distinctive error code.
+       use by callout functions that want to yield a distinctive  error  code.
        See the pcrecallout documentation for details.
 
          PCRE_ERROR_BADUTF8        (-10)
 
-       A string that contains an invalid UTF-8 byte sequence was passed  as  a
+       A  string  that contains an invalid UTF-8 byte sequence was passed as a
        subject.
 
          PCRE_ERROR_BADUTF8_OFFSET (-11)
 
        The UTF-8 byte sequence that was passed as a subject was valid, but the
-       value of startoffset did not point to the beginning of a UTF-8  charac-
+       value  of startoffset did not point to the beginning of a UTF-8 charac-
        ter.
 
-         PCRE_ERROR_PARTIAL (-12)
+         PCRE_ERROR_PARTIAL        (-12)
 
-       The  subject  string did not match, but it did match partially. See the
+       The subject string did not match, but it did match partially.  See  the
        pcrepartial documentation for details of partial matching.
 
-         PCRE_ERROR_BAD_PARTIAL (-13)
+         PCRE_ERROR_BADPARTIAL     (-13)
 
-       The PCRE_PARTIAL option was used with  a  compiled  pattern  containing
-       items  that are not supported for partial matching. See the pcrepartial
+       The  PCRE_PARTIAL  option  was  used with a compiled pattern containing
+       items that are not supported for partial matching. See the  pcrepartial
        documentation for details of partial matching.
 
-         PCRE_ERROR_INTERNAL (-14)
+         PCRE_ERROR_INTERNAL       (-14)
 
-       An unexpected internal error has occurred. This error could  be  caused
+       An  unexpected  internal error has occurred. This error could be caused
        by a bug in PCRE or by overwriting of the compiled pattern.
 
-         PCRE_ERROR_BADCOUNT (-15)
+         PCRE_ERROR_BADCOUNT       (-15)
 
-       This  error is given if the value of the ovecsize argument is negative.
+       This error is given if the value of the ovecsize argument is  negative.
 
 
 EXTRACTING CAPTURED SUBSTRINGS BY NUMBER
@@ -1428,72 +1755,72 @@ EXTRACTING CAPTURED SUBSTRINGS BY NUMBER
        int pcre_get_substring_list(const char *subject,
             int *ovector, int stringcount, const char ***listptr);
 
-       Captured substrings can be  accessed  directly  by  using  the  offsets
-       returned  by  pcre_exec()  in  ovector.  For convenience, the functions
+       Captured  substrings  can  be  accessed  directly  by using the offsets
+       returned by pcre_exec() in  ovector.  For  convenience,  the  functions
        pcre_copy_substring(),    pcre_get_substring(),    and    pcre_get_sub-
-       string_list()  are  provided for extracting captured substrings as new,
-       separate, zero-terminated strings. These functions identify  substrings
-       by  number.  The  next section describes functions for extracting named
-       substrings. A substring  that  contains  a  binary  zero  is  correctly
-       extracted  and  has  a further zero added on the end, but the result is
+       string_list() are provided for extracting captured substrings  as  new,
+       separate,  zero-terminated strings. These functions identify substrings
+       by number. The next section describes functions  for  extracting  named
+       substrings.  A  substring  that  contains  a  binary  zero is correctly
+       extracted and has a further zero added on the end, but  the  result  is
        not, of course, a C string.
 
-       The first three arguments are the same for all  three  of  these  func-
-       tions:  subject  is  the subject string that has just been successfully
+       The  first  three  arguments  are the same for all three of these func-
+       tions: subject is the subject string that has  just  been  successfully
        matched, ovector is a pointer to the vector of integer offsets that was
        passed to pcre_exec(), and stringcount is the number of substrings that
-       were captured by the match, including the substring  that  matched  the
+       were  captured  by  the match, including the substring that matched the
        entire regular expression. This is the value returned by pcre_exec() if
-       it is greater than zero. If pcre_exec() returned zero, indicating  that
-       it  ran out of space in ovector, the value passed as stringcount should
+       it  is greater than zero. If pcre_exec() returned zero, indicating that
+       it ran out of space in ovector, the value passed as stringcount  should
        be the number of elements in the vector divided by three.
 
-       The functions pcre_copy_substring() and pcre_get_substring() extract  a
-       single  substring,  whose  number  is given as stringnumber. A value of
-       zero extracts the substring that matched the  entire  pattern,  whereas
-       higher  values  extract  the  captured  substrings.  For pcre_copy_sub-
-       string(), the string is placed in buffer,  whose  length  is  given  by
-       buffersize,  while  for  pcre_get_substring()  a new block of memory is
-       obtained via pcre_malloc, and its address is  returned  via  stringptr.
-       The  yield  of  the function is the length of the string, not including
+       The  functions pcre_copy_substring() and pcre_get_substring() extract a
+       single substring, whose number is given as  stringnumber.  A  value  of
+       zero  extracts  the  substring that matched the entire pattern, whereas
+       higher values  extract  the  captured  substrings.  For  pcre_copy_sub-
+       string(),  the  string  is  placed  in buffer, whose length is given by
+       buffersize, while for pcre_get_substring() a new  block  of  memory  is
+       obtained  via  pcre_malloc,  and its address is returned via stringptr.
+       The yield of the function is the length of the  string,  not  including
        the terminating zero, or one of
 
          PCRE_ERROR_NOMEMORY       (-6)
 
-       The buffer was too small for pcre_copy_substring(), or the  attempt  to
+       The  buffer  was too small for pcre_copy_substring(), or the attempt to
        get memory failed for pcre_get_substring().
 
          PCRE_ERROR_NOSUBSTRING    (-7)
 
        There is no substring whose number is stringnumber.
 
-       The  pcre_get_substring_list()  function  extracts  all  available sub-
-       strings and builds a list of pointers to them. All this is  done  in  a
+       The pcre_get_substring_list()  function  extracts  all  available  sub-
+       strings  and  builds  a list of pointers to them. All this is done in a
        single block of memory that is obtained via pcre_malloc. The address of
-       the memory block is returned via listptr, which is also  the  start  of
-       the  list  of  string pointers. The end of the list is marked by a NULL
+       the  memory  block  is returned via listptr, which is also the start of
+       the list of string pointers. The end of the list is marked  by  a  NULL
        pointer. The yield of the function is zero if all went well, or
 
          PCRE_ERROR_NOMEMORY       (-6)
 
        if the attempt to get the memory block failed.
 
-       When any of these functions encounter a substring that is unset,  which
-       can  happen  when  capturing subpattern number n+1 matches some part of
-       the subject, but subpattern n has not been used at all, they return  an
+       When  any of these functions encounter a substring that is unset, which
+       can happen when capturing subpattern number n+1 matches  some  part  of
+       the  subject, but subpattern n has not been used at all, they return an
        empty string. This can be distinguished from a genuine zero-length sub-
-       string by inspecting the appropriate offset in ovector, which is  nega-
+       string  by inspecting the appropriate offset in ovector, which is nega-
        tive for unset substrings.
 
-       The  two convenience functions pcre_free_substring() and pcre_free_sub-
-       string_list() can be used to free the memory  returned  by  a  previous
+       The two convenience functions pcre_free_substring() and  pcre_free_sub-
+       string_list()  can  be  used  to free the memory returned by a previous
        call  of  pcre_get_substring()  or  pcre_get_substring_list(),  respec-
-       tively. They do nothing more than  call  the  function  pointed  to  by
-       pcre_free,  which  of course could be called directly from a C program.
-       However, PCRE is used in some situations where it is linked via a  spe-
+       tively.  They  do  nothing  more  than  call the function pointed to by
+       pcre_free, which of course could be called directly from a  C  program.
+       However,  PCRE is used in some situations where it is linked via a spe-
        cial  interface  to  another  programming  language  which  cannot  use
-       pcre_free directly; it is  for  these  cases  that  the  functions  are
-       provided.
+       pcre_free  directly;  it is for these cases that the functions are pro-
+       vided.
 
 
 EXTRACTING CAPTURED SUBSTRINGS BY NAME
@@ -1511,47 +1838,219 @@ EXTRACTING CAPTURED SUBSTRINGS BY NAME
             int stringcount, const char *stringname,
             const char **stringptr);
 
-       To  extract a substring by name, you first have to find associated num-
+       To extract a substring by name, you first have to find associated  num-
        ber.  For example, for this pattern
 
-         (a+)b(?<xxx>\d+)...
+         (a+)b(?P<xxx>\d+)...
 
        the number of the subpattern called "xxx" is 2. You can find the number
        from the name by calling pcre_get_stringnumber(). The first argument is
-       the compiled pattern, and the second is the  name.  The  yield  of  the
-       function  is  the  subpattern number, or PCRE_ERROR_NOSUBSTRING (-7) if
+       the  compiled  pattern,  and  the  second is the name. The yield of the
+       function is the subpattern number, or  PCRE_ERROR_NOSUBSTRING  (-7)  if
        there is no subpattern of that name.
 
        Given the number, you can extract the substring directly, or use one of
        the functions described in the previous section. For convenience, there
        are also two functions that do the whole job.
 
-       Most   of   the   arguments    of    pcre_copy_named_substring()    and
-       pcre_get_named_substring()  are  the  same  as  those for the similarly
-       named functions that extract by number. As these are described  in  the
-       previous  section,  they  are not re-described here. There are just two
+       Most    of    the    arguments   of   pcre_copy_named_substring()   and
+       pcre_get_named_substring() are the same  as  those  for  the  similarly
+       named  functions  that extract by number. As these are described in the
+       previous section, they are not re-described here. There  are  just  two
        differences:
 
-       First, instead of a substring number, a substring name is  given.  Sec-
+       First,  instead  of a substring number, a substring name is given. Sec-
        ond, there is an extra argument, given at the start, which is a pointer
-       to the compiled pattern. This is needed in order to gain access to  the
+       to  the compiled pattern. This is needed in order to gain access to the
        name-to-number translation table.
 
-       These  functions call pcre_get_stringnumber(), and if it succeeds, they
-       then call pcre_copy_substring() or pcre_get_substring(),  as  appropri-
+       These functions call pcre_get_stringnumber(), and if it succeeds,  they
+       then  call  pcre_copy_substring() or pcre_get_substring(), as appropri-
        ate.
 
-Last updated: 09 September 2004
-Copyright (c) 1997-2004 University of Cambridge.
------------------------------------------------------------------------------
 
-PCRE(3)                                                                PCRE(3)
+FINDING ALL POSSIBLE MATCHES
+
+       The traditional matching function uses a  similar  algorithm  to  Perl,
+       which stops when it finds the first match, starting at a given point in
+       the subject. If you want to find all possible matches, or  the  longest
+       possible  match,  consider using the alternative matching function (see
+       below) instead. If you cannot use the alternative function,  but  still
+       need  to  find all possible matches, you can kludge it up by making use
+       of the callout facility, which is described in the pcrecallout documen-
+       tation.
+
+       What you have to do is to insert a callout right at the end of the pat-
+       tern.  When your callout function is called, extract and save the  cur-
+       rent  matched  substring.  Then  return  1, which forces pcre_exec() to
+       backtrack and try other alternatives. Ultimately, when it runs  out  of
+       matches, pcre_exec() will yield PCRE_ERROR_NOMATCH.
+
+
+MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
+
+       int pcre_dfa_exec(const pcre *code, const pcre_extra *extra,
+            const char *subject, int length, int startoffset,
+            int options, int *ovector, int ovecsize,
+            int *workspace, int wscount);
+
+       The  function  pcre_dfa_exec()  is  called  to  match  a subject string
+       against a compiled pattern, using a "DFA" matching algorithm. This  has
+       different  characteristics to the normal algorithm, and is not compati-
+       ble with Perl. Some of the features of PCRE patterns are not supported.
+       Nevertheless, there are times when this kind of matching can be useful.
+       For a discussion of the two matching algorithms, see  the  pcrematching
+       documentation.
+
+       The  arguments  for  the  pcre_dfa_exec()  function are the same as for
+       pcre_exec(), plus two extras. The ovector argument is used in a differ-
+       ent  way,  and  this is described below. The other common arguments are
+       used in the same way as for pcre_exec(), so their  description  is  not
+       repeated here.
+
+       The  two  additional  arguments provide workspace for the function. The
+       workspace vector should contain at least 20 elements. It  is  used  for
+       keeping  track  of  multiple  paths  through  the  pattern  tree.  More
+       workspace will be needed for patterns and subjects where  there  are  a
+       lot of possible matches.
+
+       Here is an example of a simple call to pcre_exec():
+
+         int rc;
+         int ovector[10];
+         int wspace[20];
+         rc = pcre_exec(
+           re,             /* result of pcre_compile() */
+           NULL,           /* we didn't study the pattern */
+           "some string",  /* the subject string */
+           11,             /* the length of the subject string */
+           0,              /* start at offset 0 in the subject */
+           0,              /* default options */
+           ovector,        /* vector of integers for substring information */
+           10,             /* number of elements (NOT size in bytes) */
+           wspace,         /* working space vector */
+           20);            /* number of elements (NOT size in bytes) */
+
+   Option bits for pcre_dfa_exec()
+
+       The  unused  bits  of  the options argument for pcre_dfa_exec() must be
+       zero. The only bits that may be  set  are  PCRE_ANCHORED,  PCRE_NOTBOL,
+       PCRE_NOTEOL,     PCRE_NOTEMPTY,    PCRE_NO_UTF8_CHECK,    PCRE_PARTIAL,
+       PCRE_DFA_SHORTEST, and PCRE_DFA_RESTART. All  but  the  last  three  of
+       these  are  the  same  as  for pcre_exec(), so their description is not
+       repeated here.
+
+         PCRE_PARTIAL
+
+       This has the same general effect as it does for  pcre_exec(),  but  the
+       details   are   slightly   different.  When  PCRE_PARTIAL  is  set  for
+       pcre_dfa_exec(), the return code PCRE_ERROR_NOMATCH is  converted  into
+       PCRE_ERROR_PARTIAL  if  the  end  of the subject is reached, there have
+       been no complete matches, but there is still at least one matching pos-
+       sibility.  The portion of the string that provided the partial match is
+       set as the first matching string.
+
+         PCRE_DFA_SHORTEST
+
+       Setting the PCRE_DFA_SHORTEST option causes the matching  algorithm  to
+       stop  as  soon  as  it  has found one match. Because of the way the DFA
+       algorithm works, this is necessarily the shortest possible match at the
+       first possible matching point in the subject string.
+
+         PCRE_DFA_RESTART
+
+       When  pcre_dfa_exec()  is  called  with  the  PCRE_PARTIAL  option, and
+       returns a partial match, it is possible to call it  again,  with  addi-
+       tional  subject  characters,  and have it continue with the same match.
+       The PCRE_DFA_RESTART option requests this action; when it is  set,  the
+       workspace  and wscount options must reference the same vector as before
+       because data about the match so far is left in  them  after  a  partial
+       match.  There  is  more  discussion of this facility in the pcrepartial
+       documentation.
+
+   Successful returns from pcre_dfa_exec()
+
+       When pcre_dfa_exec() succeeds, it may have matched more than  one  sub-
+       string in the subject. Note, however, that all the matches from one run
+       of the function start at the same point in  the  subject.  The  shorter
+       matches  are all initial substrings of the longer matches. For example,
+       if the pattern
+
+         <.*>
+
+       is matched against the string
+
+         This is <something> <something else> <something further> no more
+
+       the three matched strings are
+
+         <something>
+         <something> <something else>
+         <something> <something else> <something further>
+
+       On success, the yield of the function is a number  greater  than  zero,
+       which  is  the  number of matched substrings. The substrings themselves
+       are returned in ovector. Each string uses two elements;  the  first  is
+       the  offset  to the start, and the second is the offset to the end. All
+       the strings have the same start offset. (Space could have been saved by
+       giving  this only once, but it was decided to retain some compatibility
+       with the way pcre_exec() returns data, even though the meaning  of  the
+       strings is different.)
+
+       The strings are returned in reverse order of length; that is, the long-
+       est matching string is given first. If there were too many  matches  to
+       fit  into ovector, the yield of the function is zero, and the vector is
+       filled with the longest matches.
+
+   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
+       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
+       reference.
+
+         PCRE_ERROR_DFA_UCOND      (-17)
+
+       This  return is given if pcre_dfa_exec() encounters a condition item in
+       a pattern that uses a back reference for the  condition.  This  is  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 field. This is not supported
+       (it is meaningless).
+
+         PCRE_ERROR_DFA_WSSIZE     (-19)
+
+       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
+       should be extremely rare, as a vector of size 1000 is used.
+
+Last updated: 16 May 2005
+Copyright (c) 1997-2005 University of Cambridge.
+------------------------------------------------------------------------------
+
 
+PCRECALLOUT(3)                                                  PCRECALLOUT(3)
 
 
 NAME
        PCRE - Perl-compatible regular expressions
 
+
 PCRE CALLOUTS
 
        int (*pcre_callout)(pcre_callout_block *);
@@ -1606,9 +2105,10 @@ MISSING CALLOUTS
 THE CALLOUT INTERFACE
 
        During matching, when PCRE reaches a callout point, the external  func-
-       tion  defined  by pcre_callout is called (if it is set). The only argu-
-       ment is a pointer to a pcre_callout block. This structure contains  the
-       following fields:
+       tion  defined by pcre_callout is called (if it is set). This applies to
+       both the pcre_exec() and the pcre_dfa_exec()  matching  functions.  The
+       only  argument  to  the callout function is a pointer to a pcre_callout
+       block. This structure contains the following fields:
 
          int          version;
          int          callout_number;
@@ -1623,87 +2123,93 @@ THE CALLOUT INTERFACE
          int          pattern_position;
          int          next_item_length;
 
-       The  version  field  is an integer containing the version number of the
-       block format. The initial version was 0; the current version is 1.  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 1. 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 pcre_exec(). 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.
+       The offset_vector field is a pointer to the vector of offsets that  was
+       passed   by   the   caller  to  pcre_exec()  or  pcre_dfa_exec().  When
+       pcre_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  pcre_dfa_exec()
+       this field is not useful.
 
        The subject and subject_length fields contain copies of the values that
        were passed to pcre_exec().
 
-       The  start_match  field contains the offset within the subject at which
-       the current match attempt started. If the pattern is not anchored,  the
+       The start_match field contains the offset within the subject  at  which
+       the  current match attempt started. 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.
 
-       The  capture_top field contains one more than the number of the highest
-       numbered captured substring so far. If no  substrings  have  been  cap-
-       tured, the value of capture_top is one.
-
-       The  capture_last  field  contains the number of the most recently cap-
-       tured substring. If no substrings have been captured, its value is  -1.
-
-       The  callout_data  field contains a value that is passed to pcre_exec()
-       by the caller specifically so that it can be passed back  in  callouts.
-       It  is  passed  in the pcre_callout field of the pcre_extra data struc-
-       ture. If no such data was  passed,  the  value  of  callout_data  in  a
-       pcre_callout  block  is  NULL. There is a description of the pcre_extra
+       When the pcre_exec() function is used, the capture_top  field  contains
+       one  more than the number of the highest numbered captured substring so
+       far. If no substrings have been captured, the value of  capture_top  is
+       one.  This  is always the case when pcre_dfa_exec() is used, because it
+       does not support captured substrings.
+
+       The capture_last field contains the number of the  most  recently  cap-
+       tured  substring. If no substrings have been captured, its value is -1.
+       This is always the case when pcre_dfa_exec() is used.
+
+       The callout_data field contains a value that is passed  to  pcre_exec()
+       or  pcre_dfa_exec() specifically so that it can be passed back in call-
+       outs. It is passed in the pcre_callout field  of  the  pcre_extra  data
+       structure.  If  no such data was passed, the value of callout_data in a
+       pcre_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  pcre_call-
+       The  pattern_position field is present from version 1 of the pcre_call-
        out 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  pcre_call-
+       The  next_item_length field is present from version 1 of the pcre_call-
        out structure. It contains the length of the next item to be matched in
-       the pattern string. When the callout immediately precedes  an  alterna-
-       tion  bar, a closing parenthesis, or the end of the pattern, the length
-       is zero. When the callout precedes an opening parenthesis,  the  length
+       the  pattern  string. When the callout immediately precedes an alterna-
+       tion 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.
 
 
 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 backtracking to test
-       other matching possibilities goes ahead, just as if a lookahead  asser-
-       tion  had  failed.  If  the value is less than zero, the match is aban-
-       doned, and pcre_exec() returns the negative value.
+       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,  and
+       pcre_exec() (or pcre_dfa_exec()) 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.
 
-Last updated: 09 September 2004
-Copyright (c) 1997-2004 University of Cambridge.
------------------------------------------------------------------------------
+Last updated: 28 February 2005
+Copyright (c) 1997-2005 University of Cambridge.
+------------------------------------------------------------------------------
 
-PCRE(3)                                                                PCRE(3)
 
+PCRECOMPAT(3)                                                    PCRECOMPAT(3)
 
 
 NAME
        PCRE - Perl-compatible regular expressions
 
+
 DIFFERENCES BETWEEN PCRE AND PERL
 
        This  document describes the differences in the ways that PCRE and Perl
@@ -1808,17 +2314,21 @@ DIFFERENCES BETWEEN PCRE AND PERL
        (m) Patterns compiled by PCRE can be saved and re-used at a later time,
        even on different hosts that have the other endianness.
 
-Last updated: 09 September 2004
-Copyright (c) 1997-2004 University of Cambridge.
------------------------------------------------------------------------------
+       (n)  The  alternative  matching function (pcre_dfa_exec()) matches in a
+       different way and is not Perl-compatible.
+
+Last updated: 28 February 2005
+Copyright (c) 1997-2005 University of Cambridge.
+------------------------------------------------------------------------------
 
-PCRE(3)                                                                PCRE(3)
 
+PCREPATTERN(3)                                                  PCREPATTERN(3)
 
 
 NAME
        PCRE - Perl-compatible regular expressions
 
+
 PCRE REGULAR EXPRESSION DETAILS
 
        The  syntax  and semantics of the regular expressions supported by PCRE
@@ -1836,6 +2346,14 @@ PCRE REGULAR EXPRESSION DETAILS
        of  UTF-8  features  in  the  section on UTF-8 support in the main pcre
        page.
 
+       The remainder of this document discusses the  patterns  that  are  sup-
+       ported  by  PCRE when its main matching function, pcre_exec(), is used.
+       From  release  6.0,   PCRE   offers   a   second   matching   function,
+       pcre_dfa_exec(),  which matches using a different algorithm that is not
+       Perl-compatible. The advantages and disadvantages  of  the  alternative
+       function, and how it differs from the normal function, are discussed in
+       the pcrematching page.
+
        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
@@ -1843,15 +2361,24 @@ PCRE REGULAR EXPRESSION DETAILS
 
          The quick brown fox
 
-       matches  a portion of a subject string that is identical to itself. The
-       power of regular expressions comes from the ability to include alterna-
-       tives  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  in square brackets. Outside square brackets, the
+       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 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 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-8 support.
+
+       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 in square brackets. Outside  square  brackets,  the
        metacharacters are as follows:
 
          \      general escape character with several uses
@@ -1870,7 +2397,7 @@ PCRE REGULAR EXPRESSION DETAILS
                 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
@@ -1880,33 +2407,33 @@ PCRE REGULAR EXPRESSION DETAILS
                   syntax)
          ]      terminates the character class
 
-       The  following sections describe the use of each of the metacharacters.
+       The following sections describe the use of each of the  metacharacters.
 
 
 BACKSLASH
 
        The backslash character has several uses. Firstly, if it is followed by
-       a  non-alphanumeric  character,  it takes away any special meaning that
-       character may have. This  use  of  backslash  as  an  escape  character
+       a non-alphanumeric character, it takes away any  special  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 \\.
 
-       If a pattern is compiled with the PCRE_EXTENDED option,  whitespace  in
-       the  pattern (other than in a character class) and characters between a
+       If  a  pattern is compiled with the PCRE_EXTENDED option, whitespace in
+       the pattern (other than in a character class) and characters between  a
        # outside a character class and the next newline character are ignored.
-       An  escaping backslash can be used to include a whitespace or # charac-
+       An escaping backslash can be used to include a whitespace or #  charac-
        ter 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
@@ -1916,16 +2443,16 @@ 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
+       The  \Q...\E  sequence  is recognized both inside and outside character
        classes.
 
    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  usually  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 usually easier  to  use  one  of  the  following  escape
        sequences than the binary character it represents:
 
          \a        alarm, that is, the BEL character (hex 07)
@@ -1939,44 +2466,44 @@ BACKSLASH
          \xhh      character with hex code hh
          \x{hhh..} character with hex code hhh... (UTF-8 mode only)
 
-       The precise effect of \cx 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 \cz becomes hex 1A, but \c{ becomes hex 3B,  while  \c;
+       The  precise  effect of \cx 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  \cz becomes hex 1A, but \c{ becomes hex 3B, while \c;
        becomes hex 7B.
 
-       After  \x, from zero to two hexadecimal digits are read (letters can be
-       in upper or lower case). In UTF-8 mode, any number of hexadecimal  dig-
-       its  may  appear between \x{ and }, but the value of the character code
-       must be less than 2**31 (that is,  the  maximum  hexadecimal  value  is
-       7FFFFFFF).  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 hex-
-       adecimal escape, with no following digits,  giving  a  character  whose
+       After \x, from zero to two hexadecimal digits are read (letters can  be
+       in  upper or lower case). In UTF-8 mode, any number of hexadecimal dig-
+       its may appear between \x{ and }, but the value of the  character  code
+       must  be  less  than  2**31  (that is, the maximum hexadecimal value is
+       7FFFFFFF). 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.
 
        Characters whose value is less than 256 can be defined by either of the
-       two syntaxes for \x when PCRE is in UTF-8 mode. There is no  difference
-       in  the  way they are handled. For example, \xdc is exactly the same as
+       two  syntaxes for \x when PCRE is in UTF-8 mode. There is no difference
+       in the way they are handled. For example, \xdc is exactly the  same  as
        \x{dc}.
 
-       After \0 up to two further octal digits are read.  In  both  cases,  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 if the pattern character that follows is itself  an  octal
+       After  \0  up  to  two further octal digits are read. In both cases, 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  if the pattern character that follows is itself an octal
        digit.
 
        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
+       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
+       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 generates a sin-
+       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 generates a  sin-
        gle byte from the least significant 8 bits of the value. Any subsequent
        digits stand for themselves.  For example:
 
@@ -1995,19 +2522,19 @@ BACKSLASH
          \81    is either a back reference, or a binary zero
                    followed by the two characters "8" and "1"
 
-       Note  that  octal  values of 100 or greater must not be introduced by a
+       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.
 
-       All the sequences that define a single byte value  or  a  single  UTF-8
+       All  the  sequences  that  define a single byte value or a single UTF-8
        character (in UTF-8 mode) can be used both inside and outside character
-       classes. In addition, inside a character  class,  the  sequence  \b  is
+       classes.  In  addition,  inside  a  character class, the sequence \b is
        interpreted as the backspace character (hex 08), and the sequence \X is
-       interpreted as the character "X".  Outside  a  character  class,  these
+       interpreted  as  the  character  "X".  Outside a character class, these
        sequences have different meanings (see below).
 
    Generic character types
 
-       The  third  use of backslash is for specifying generic character types.
+       The third use of backslash is for specifying generic  character  types.
        The following are always recognized:
 
          \d     any decimal digit
@@ -2018,48 +2545,48 @@ BACKSLASH
          \W     any "non-word" character
 
        Each pair of escape sequences partitions the complete set of characters
-       into  two disjoint sets. Any given character matches one, and only one,
+       into two disjoint sets. Any given character matches one, and only  one,
        of each pair.
 
        These character type sequences can appear both inside and outside char-
-       acter  classes.  They each match one character of the appropriate type.
-       If the current matching point is at the end of the subject string,  all
+       acter 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, since 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
+       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).
 
        A "word" character is an underscore or any character less than 256 that
-       is a letter or digit. 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  the  "fr_FR" (French) locale, some character
-       codes greater than 128 are used for accented  letters,  and  these  are
+       is  a  letter  or  digit.  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 the  "fr_FR"  (French)  locale,  some  character
+       codes  greater  than  128  are used for accented letters, and these are
        matched by \w.
 
-       In  UTF-8 mode, characters with values greater than 128 never match \d,
+       In UTF-8 mode, characters with values greater than 128 never match  \d,
        \s, or \w, and always match \D, \S, and \W. This is true even when Uni-
        code character property support is available.
 
    Unicode character properties
 
        When PCRE is built with Unicode character property support, three addi-
-       tional escape sequences to match generic character types are  available
+       tional  escape sequences to match generic character types are available
        when UTF-8 mode is selected. They are:
 
         \p{xx}   a character with the xx property
         \P{xx}   a character without the xx property
         \X       an extended Unicode sequence
 
-       The  property  names represented by xx above are limited to the Unicode
-       general category properties. Each character has exactly one such  prop-
-       erty,  specified  by  a two-letter abbreviation. For compatibility with
-       Perl, negation can be specified by including a circumflex  between  the
-       opening  brace  and the property name. For example, \p{^Lu} is the same
+       The property names represented by xx above are limited to  the  Unicode
+       general  category properties. Each character has exactly one such prop-
+       erty, specified by a two-letter abbreviation.  For  compatibility  with
+       Perl,  negation  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
+       If  only  one  letter  is  specified with \p or \P, it includes all the
        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:
@@ -2113,33 +2640,33 @@ BACKSLASH
          Zp    Paragraph separator
          Zs    Space separator
 
-       Extended  properties such as "Greek" or "InMusicalSymbols" are not sup-
+       Extended properties such as "Greek" or "InMusicalSymbols" are not  sup-
        ported by PCRE.
 
-       Specifying caseless matching does not affect  these  escape  sequences.
+       Specifying  caseless  matching  does not affect these escape sequences.
        For example, \p{Lu} always matches only upper case letters.
 
-       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 Unicode sequence. \X is equivalent to
 
          (?>\PM\pM*)
 
-       That is, it matches a character without the "mark"  property,  followed
-       by  zero  or  more  characters with the "mark" property, and treats the
-       sequence as an atomic group (see below).  Characters  with  the  "mark"
+       That  is,  it matches a character without the "mark" property, followed
+       by zero or more characters with the "mark"  property,  and  treats  the
+       sequence  as  an  atomic group (see below).  Characters with the "mark"
        property are typically accents that affect the preceding character.
 
-       Matching  characters  by Unicode property is not fast, because PCRE has
-       to search a structure that contains  data  for  over  fifteen  thousand
+       Matching characters by Unicode property is not fast, because  PCRE  has
+       to  search  a  structure  that  contains data for over fifteen thousand
        characters. That is why the traditional escape sequences such as \d and
        \w do not use Unicode properties in PCRE.
 
    Simple assertions
 
        The fourth use of backslash is for certain simple assertions. An asser-
-       tion  specifies a condition that has to be met at a particular point in
-       a match, without consuming any characters from the subject string.  The
-       use  of subpatterns for more complicated assertions is described below.
+       tion specifies a condition that has to be met at a particular point  in
+       a  match, without consuming any characters from the subject string. The
+       use of subpatterns for more complicated assertions is described  below.
        The backslashed assertions are:
 
          \b     matches at a word boundary
@@ -2149,42 +2676,42 @@ BACKSLASH
          \z     matches at end of subject
          \G     matches at first matching position in subject
 
-       These assertions may not appear in character classes (but note that  \b
+       These  assertions may not appear in character classes (but note that \b
        has a different meaning, namely the backspace character, inside a char-
        acter class).
 
-       A word boundary is a position in the subject string where  the  current
-       character  and  the previous character do not both match \w or \W (i.e.
-       one matches \w and the other matches \W), or the start or  end  of  the
+       A  word  boundary is a position in the subject string where the current
+       character and the previous character do not both match \w or  \W  (i.e.
+       one  matches  \w  and the other matches \W), or the start or end of the
        string if the first or last character matches \w, respectively.
 
-       The  \A,  \Z,  and \z assertions differ from the traditional circumflex
+       The \A, \Z, and \z assertions differ from  the  traditional  circumflex
        and dollar (described in the next section) in that they only ever match
-       at  the  very start and end of the subject string, whatever options are
-       set. Thus, they are independent of multiline mode. These  three  asser-
+       at the very start and end of the subject string, whatever  options  are
+       set.  Thus,  they are independent of multiline mode. These three asser-
        tions are not affected by the PCRE_NOTBOL or PCRE_NOTEOL options, which
-       affect only the behaviour of the circumflex and dollar  metacharacters.
-       However,  if the startoffset argument of pcre_exec() is non-zero, indi-
+       affect  only the behaviour of the circumflex and dollar metacharacters.
+       However, if the startoffset argument of pcre_exec() is non-zero,  indi-
        cating that matching is to start at a point other than the beginning of
-       the  subject,  \A  can never match. The difference between \Z and \z is
-       that \Z matches before a newline that is  the  last  character  of  the
-       string  as well as at the end of the string, whereas \z matches only at
+       the subject, \A can never match. The difference between \Z  and  \z  is
+       that  \Z  matches  before  a  newline that is the last character of the
+       string as well as at the end of the string, whereas \z matches only  at
        the end.
 
-       The \G assertion is true only when the current matching position is  at
-       the  start point of the match, as specified by the startoffset argument
-       of pcre_exec(). It differs from \A when the  value  of  startoffset  is
-       non-zero.  By calling pcre_exec() multiple times with appropriate argu-
+       The  \G assertion is true only when the current matching position is at
+       the start point of the match, as specified by the startoffset  argument
+       of  pcre_exec().  It  differs  from \A when the value of startoffset is
+       non-zero. By calling pcre_exec() multiple times with appropriate  argu-
        ments, you can mimic Perl's /g option, and it is in this kind of imple-
        mentation where \G can be useful.
 
-       Note,  however,  that  PCRE's interpretation of \G, as the start of the
+       Note, however, that PCRE's interpretation of \G, as the  start  of  the
        current match, is subtly different from Perl's, which defines it as the
-       end  of  the  previous  match. In Perl, these can be different when the
-       previously matched string was empty. Because PCRE does just  one  match
+       end of the previous match. In Perl, these can  be  different  when  the
+       previously  matched  string was empty. Because PCRE does just one match
        at a time, it cannot reproduce this behaviour.
 
-       If  all  the alternatives of a pattern begin with \G, the expression is
+       If all the alternatives of a pattern begin with \G, the  expression  is
        anchored to the starting match position, and the "anchored" flag is set
        in the compiled regular expression.
 
@@ -2192,73 +2719,73 @@ BACKSLASH
 CIRCUMFLEX AND DOLLAR
 
        Outside a character class, in the default matching mode, the circumflex
-       character is an assertion that is true only  if  the  current  matching
-       point  is  at the start of the subject string. If the startoffset argu-
-       ment of pcre_exec() is non-zero, circumflex  can  never  match  if  the
-       PCRE_MULTILINE  option  is  unset. Inside a character class, circumflex
+       character  is  an  assertion  that is true only if the current matching
+       point is at the start of the subject string. If the  startoffset  argu-
+       ment  of  pcre_exec()  is  non-zero,  circumflex can never match if the
+       PCRE_MULTILINE option is unset. Inside a  character  class,  circumflex
        has an entirely different meaning (see below).
 
-       Circumflex need not be the first character of the pattern if  a  number
-       of  alternatives are involved, but it should be the first thing in each
-       alternative in which it appears if the pattern is ever  to  match  that
-       branch.  If all possible alternatives start with a circumflex, that is,
-       if the pattern is constrained to match only at the start  of  the  sub-
-       ject,  it  is  said  to be an "anchored" pattern. (There are also other
+       Circumflex  need  not be the first character of the pattern if a number
+       of alternatives are involved, but it should be the first thing in  each
+       alternative  in  which  it appears if the pattern is ever to match that
+       branch. If all possible alternatives start with a circumflex, that  is,
+       if  the  pattern  is constrained to match only at the start of the sub-
+       ject, it is said to be an "anchored" pattern.  (There  are  also  other
        constructs that can cause a pattern to be anchored.)
 
-       A dollar character is an assertion that is true  only  if  the  current
-       matching  point  is  at  the  end of the subject string, or immediately
+       A  dollar  character  is  an assertion that is true only if the current
+       matching point is at the end of  the  subject  string,  or  immediately
        before a newline character that is the last character in the string (by
-       default).  Dollar  need  not  be the last character of the pattern if a
-       number of alternatives are involved, but it should be the last item  in
-       any  branch  in  which  it appears.  Dollar has no special meaning in a
+       default). Dollar need not be the last character of  the  pattern  if  a
+       number  of alternatives are involved, but it should be the last item in
+       any branch in which it appears.  Dollar has no  special  meaning  in  a
        character class.
 
-       The meaning of dollar can be changed so that it  matches  only  at  the
-       very  end  of  the string, by setting the PCRE_DOLLAR_ENDONLY option at
+       The  meaning  of  dollar  can be changed so that it matches only at the
+       very end of the string, by setting the  PCRE_DOLLAR_ENDONLY  option  at
        compile time. This does not affect the \Z assertion.
 
        The meanings of the circumflex and dollar characters are changed if the
        PCRE_MULTILINE option is set. When this is the case, they match immedi-
-       ately after and  immediately  before  an  internal  newline  character,
-       respectively,  in addition to matching at the start and end of the sub-
-       ject string. For example,  the  pattern  /^abc$/  matches  the  subject
-       string  "def\nabc"  (where \n represents a newline character) in multi-
+       ately  after  and  immediately  before  an  internal newline character,
+       respectively, in addition to matching at the start and end of the  sub-
+       ject  string.  For  example,  the  pattern  /^abc$/ matches the subject
+       string "def\nabc" (where \n represents a newline character)  in  multi-
        line mode, but not otherwise.  Consequently, patterns that are anchored
-       in  single line mode because all branches start with ^ are not anchored
-       in multiline mode, and a match for  circumflex  is  possible  when  the
-       startoffset   argument   of  pcre_exec()  is  non-zero.  The  PCRE_DOL-
+       in single line mode because all branches start with ^ are not  anchored
+       in  multiline  mode,  and  a  match for circumflex is possible when the
+       startoffset  argument  of  pcre_exec()  is  non-zero.   The   PCRE_DOL-
        LAR_ENDONLY option is ignored if PCRE_MULTILINE is set.
 
-       Note that the sequences \A, \Z, and \z can be used to match  the  start
-       and  end of the subject in both modes, and if all branches of a pattern
-       start with \A it is always anchored, whether PCRE_MULTILINE is  set  or
+       Note  that  the sequences \A, \Z, and \z can be used to match the start
+       and end of the subject in both modes, and if all branches of a  pattern
+       start  with  \A it is always anchored, whether PCRE_MULTILINE is set or
        not.
 
 
 FULL STOP (PERIOD, DOT)
 
        Outside a character class, a dot in the pattern matches any one charac-
-       ter in the subject, including a non-printing  character,  but  not  (by
-       default)  newline.   In  UTF-8 mode, a dot matches any UTF-8 character,
+       ter  in  the  subject,  including a non-printing character, but not (by
+       default) newline.  In UTF-8 mode, a dot matches  any  UTF-8  character,
        which might be more than one byte long, except (by default) newline. If
-       the  PCRE_DOTALL  option  is set, dots match newlines as well. The han-
-       dling of dot is entirely independent of the handling of circumflex  and
-       dollar,  the  only  relationship  being  that they both involve newline
+       the PCRE_DOTALL option is set, dots match newlines as  well.  The  han-
+       dling  of dot is entirely independent of the handling of circumflex and
+       dollar, the only relationship being  that  they  both  involve  newline
        characters. Dot has no special meaning in a character class.
 
 
 MATCHING A SINGLE BYTE
 
        Outside a character class, the escape sequence \C matches any one byte,
-       both  in  and  out of UTF-8 mode. Unlike a dot, it can match a newline.
-       The feature is provided in Perl in order to match individual  bytes  in
-       UTF-8  mode.  Because  it  breaks  up  UTF-8 characters into individual
-       bytes, what remains in the string may be a malformed UTF-8 string.  For
+       both in and out of UTF-8 mode. Unlike a dot, it can  match  a  newline.
+       The  feature  is provided in Perl in order to match individual bytes in
+       UTF-8 mode. Because it  breaks  up  UTF-8  characters  into  individual
+       bytes,  what remains in the string may be a malformed UTF-8 string. For
        this reason, the \C escape sequence is best avoided.
 
-       PCRE  does  not  allow \C to appear in lookbehind assertions (described
-       below), because in UTF-8 mode this would make it impossible  to  calcu-
+       PCRE does not allow \C to appear in  lookbehind  assertions  (described
+       below),  because  in UTF-8 mode this would make it impossible to calcu-
        late the length of the lookbehind.
 
 
@@ -2267,35 +2794,40 @@ SQUARE BRACKETS AND CHARACTER CLASSES
        An opening square bracket introduces a character class, terminated by a
        closing square bracket. A closing square bracket on its own is not spe-
        cial. If a closing square bracket is required as a member of the class,
-       it should be the first data character in the class  (after  an  initial
+       it  should  be  the first data character in the class (after an initial
        circumflex, if present) or escaped with a backslash.
 
-       A  character  class matches a single character in the subject. In UTF-8
-       mode, the character may occupy more than one byte. A matched  character
+       A character class matches a single character in the subject.  In  UTF-8
+       mode,  the character may occupy more than one byte. A matched character
        must be in the set of characters defined by the class, unless the first
-       character in the class definition is a circumflex, in  which  case  the
-       subject  character  must  not  be in the set defined by the class. If a
-       circumflex is actually required as a member of the class, ensure it  is
+       character  in  the  class definition is a circumflex, in which case the
+       subject character must not be in the set defined by  the  class.  If  a
+       circumflex  is actually required as a member of the class, ensure it is
        not the first character, or escape it with a backslash.
 
-       For  example, the character class [aeiou] matches any lower case vowel,
-       while [^aeiou] matches any character that is not a  lower  case  vowel.
+       For example, the character class [aeiou] matches any lower case  vowel,
+       while  [^aeiou]  matches  any character that is not a lower case vowel.
        Note that a circumflex is just a convenient notation for specifying the
-       characters that are in the class by enumerating those that are  not.  A
-       class  that starts with a circumflex is not an assertion: it still con-
-       sumes a character from the subject string, and therefore  it  fails  if
+       characters  that  are in the class by enumerating those that are not. A
+       class that starts with a circumflex is not an assertion: it still  con-
+       sumes  a  character  from the subject string, and therefore it fails if
        the current pointer is at the end of the string.
 
-       In  UTF-8 mode, characters with values greater than 255 can be included
-       in a class as a literal string of bytes, or by using the  \x{  escaping
+       In UTF-8 mode, characters with values greater than 255 can be  included
+       in  a  class as a literal string of bytes, or by using the \x{ escaping
        mechanism.
 
-       When  caseless  matching  is set, any letters in a class represent both
-       their upper case and lower case versions, so for  example,  a  caseless
-       [aeiou]  matches  "A"  as well as "a", and a caseless [^aeiou] does not
-       match "A", whereas a caseful version would. When running in UTF-8 mode,
-       PCRE  supports  the  concept of case for characters with values greater
-       than 128 only when it is compiled with Unicode property support.
+       When caseless matching is set, any letters in a  class  represent  both
+       their  upper  case  and lower case versions, so for example, a caseless
+       [aeiou] matches "A" as well as "a", and a caseless  [^aeiou]  does  not
+       match  "A", whereas a caseful version would. 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  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-8
+       support.
 
        The newline character is never treated in any special way in  character
        classes,  whatever  the  setting  of  the PCRE_DOTALL or PCRE_MULTILINE
@@ -3215,24 +3747,25 @@ CALLOUTS
        gether. A complete description of the interface to the callout function
        is given in the pcrecallout documentation.
 
-Last updated: 09 September 2004
-Copyright (c) 1997-2004 University of Cambridge.
------------------------------------------------------------------------------
+Last updated: 28 February 2005
+Copyright (c) 1997-2005 University of Cambridge.
+------------------------------------------------------------------------------
 
-PCRE(3)                                                                PCRE(3)
 
+PCREPARTIAL(3)                                                  PCREPARTIAL(3)
 
 
 NAME
        PCRE - Perl-compatible regular expressions
 
+
 PARTIAL MATCHING IN PCRE
 
        In  normal  use  of  PCRE,  if  the  subject  string  that is passed to
-       pcre_exec() matches as far as it goes, but is too short  to  match  the
-       entire pattern, PCRE_ERROR_NOMATCH is returned. There are circumstances
-       where it might be helpful to distinguish this case from other cases  in
-       which there is no match.
+       pcre_exec() or pcre_dfa_exec() matches as far as it goes,  but  is  too
+       short  to  match  the  entire  pattern, PCRE_ERROR_NOMATCH is returned.
+       There are circumstances where it might be helpful to  distinguish  this
+       case from other cases in which there is no match.
 
        Consider, for example, an application where a human is required to type
        in data for a field with specific formatting requirements.  An  example
@@ -3248,11 +3781,19 @@ PARTIAL MATCHING IN PCRE
        until the entire string has been entered.
 
        PCRE supports the concept of partial matching by means of the PCRE_PAR-
-       TIAL  option,  which  can be set when calling pcre_exec(). When this is
-       done,  the   return   code   PCRE_ERROR_NOMATCH   is   converted   into
-       PCRE_ERROR_PARTIAL  if  at  any  time  during  the matching process the
-       entire subject string matched part of the pattern. No captured data  is
-       set when this occurs.
+       TIAL   option,   which   can   be   set  when  calling  pcre_exec()  or
+       pcre_dfa_exec(). When this flag is set for pcre_exec(), the return code
+       PCRE_ERROR_NOMATCH  is converted into PCRE_ERROR_PARTIAL if at any time
+       during the matching process the last part of the subject string matched
+       part  of  the  pattern. Unfortunately, for non-anchored matching, it is
+       not possible to obtain the position of the start of the partial  match.
+       No captured data is set when PCRE_ERROR_PARTIAL is returned.
+
+       When   PCRE_PARTIAL   is  set  for  pcre_dfa_exec(),  the  return  code
+       PCRE_ERROR_NOMATCH is converted into PCRE_ERROR_PARTIAL if the  end  of
+       the  subject is reached, there have been no complete matches, but there
+       is still at least one matching possibility. The portion of  the  string
+       that provided the partial match is set as the first matching string.
 
        Using PCRE_PARTIAL disables one of PCRE's optimizations. PCRE remembers
        the last literal byte in a pattern, and abandons  matching  immediately
@@ -3263,8 +3804,9 @@ PARTIAL MATCHING IN PCRE
 RESTRICTED PATTERNS FOR PCRE_PARTIAL
 
        Because of the way certain internal optimizations  are  implemented  in
-       PCRE,  the  PCRE_PARTIAL  option  cannot  be  used  with  all patterns.
-       Repeated single characters such as
+       the  pcre_exec()  function, the PCRE_PARTIAL option cannot be used with
+       all patterns. These restrictions do not apply when  pcre_dfa_exec()  is
+       used.  For pcre_exec(), repeated single characters such as
 
          a{2,4}
 
@@ -3272,26 +3814,26 @@ RESTRICTED PATTERNS FOR PCRE_PARTIAL
 
          \d+
 
-       are not permitted if the maximum number of occurrences is greater  than
+       are  not permitted if the maximum number of occurrences is greater than
        one.  Optional items such as \d? (where the maximum is one) are permit-
-       ted.  Quantifiers with any values are permitted after  parentheses,  so
+       ted.   Quantifiers  with any values are permitted after parentheses, so
        the invalid examples above can be coded thus:
 
          (a){2,4}
          (\d)+
 
-       These  constructions  run more slowly, but for the kinds of application
-       that are envisaged for this facility, this is not felt to  be  a  major
+       These constructions run more slowly, but for the kinds  of  application
+       that  are  envisaged  for this facility, this is not felt to be a major
        restriction.
 
-       If  PCRE_PARTIAL  is  set  for  a  pattern that does not conform to the
-       restrictions, pcre_exec() returns the error code  PCRE_ERROR_BADPARTIAL
+       If PCRE_PARTIAL is set for a pattern  that  does  not  conform  to  the
+       restrictions,  pcre_exec() returns the error code PCRE_ERROR_BADPARTIAL
        (-13).
 
 
 EXAMPLE OF PARTIAL MATCHING USING PCRETEST
 
-       If  the  escape  sequence  \P  is  present in a pcretest data line, the
+       If the escape sequence \P is present  in  a  pcretest  data  line,  the
        PCRE_PARTIAL flag is used for the match. Here is a run of pcretest that
        uses the date example quoted above:
 
@@ -3308,21 +3850,105 @@ EXAMPLE OF PARTIAL MATCHING USING PCRETEST
          data> jP
          No match
 
-       The  first  data  string  is  matched completely, so pcretest shows the
-       matched substrings. The remaining four strings do not  match  the  com-
-       plete pattern, but the first two are partial matches.
+       The first data string is matched  completely,  so  pcretest  shows  the
+       matched  substrings.  The  remaining four strings do not match the com-
+       plete pattern, but the first two are partial matches.  The  same  test,
+       using  DFA  matching (by means of the \D escape sequence), produces the
+       following output:
 
-Last updated: 08 September 2004
-Copyright (c) 1997-2004 University of Cambridge.
------------------------------------------------------------------------------
+           re> /^?(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)$/
+         data> 25jun04\P\D
+          0: 25jun04
+         data> 23dec3\P\D
+         Partial match: 23dec3
+         data> 3ju\P\D
+         Partial match: 3ju
+         data> 3juj\P\D
+         No match
+         data> j\P\D
+         No match
 
-PCRE(3)                                                                PCRE(3)
+       Notice that in this case the portion of the string that was matched  is
+       made available.
+
+
+MULTI-SEGMENT MATCHING WITH pcre_dfa_exec()
+
+       When a partial match has been found using pcre_dfa_exec(), it is possi-
+       ble to continue the match by  providing  additional  subject  data  and
+       calling  pcre_dfa_exec() again with the PCRE_DFA_RESTART option and the
+       same working space (where details of the  previous  partial  match  are
+       stored).  Here  is  an  example  using  pcretest,  where  the \R escape
+       sequence sets the PCRE_DFA_RESTART option and the  \D  escape  sequence
+       requests the use of pcre_dfa_exec():
+
+           re> /^?(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)$/
+         data> 23ja\P\D
+         Partial match: 23ja
+         data> n05\R\D
+          0: n05
+
+       The  first  call has "23ja" as the subject, and requests partial match-
+       ing; the second call  has  "n05"  as  the  subject  for  the  continued
+       (restarted)  match.   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.
+
+       This facility can  be  used  to  pass  very  long  subject  strings  to
+       pcre_dfa_exec(). However, some care is needed for certain types of pat-
+       tern.
+
+       1. If the pattern contains tests for the beginning or end  of  a  line,
+       you  need  to pass the PCRE_NOTBOL or PCRE_NOTEOL options, as appropri-
+       ate, when the subject string for any call does not contain  the  begin-
+       ning or end of a line.
+
+       2.  If  the  pattern contains backward assertions (including \b or \B),
+       you need to arrange for some overlap in the subject  strings  to  allow
+       for  this.  For example, you could pass the subject in chunks that were
+       500 bytes long, but in a buffer of 700 bytes, with the starting  offset
+       set to 200 and the previous 200 bytes at the start of the buffer.
+
+       3.  Matching a subject string that is split into multiple segments does
+       not always produce exactly the same result as matching over one  single
+       long  string.   The  difference arises when there are multiple matching
+       possibilities, because a partial match result is given only when  there
+       are  no  completed  matches  in a call to fBpcre_dfa_exec(). This means
+       that as soon as the shortest match has been found,  continuation  to  a
+       new  subject  segment  is  no  longer possible.  Consider this pcretest
+       example:
+
+           re> /dog(sbody)?/
+         data> do\P\D
+         Partial match: do
+         data> gsb\R\P\D
+          0: g
+         data> dogsbody\D
+          0: dogsbody
+          1: dog
+
+       The pattern matches the words "dog" or "dogsbody". When the subject  is
+       presented  in  several  parts  ("do" and "gsb" being the first two) the
+       match stops when "dog" has been found, and it is not possible  to  con-
+       tinue.  On  the  other  hand,  if  "dogsbody"  is presented as a single
+       string, both matches are found.
+
+       Because of this phenomenon, it does not usually make  sense  to  end  a
+       pattern that is going to be matched in this way with a variable repeat.
+
+Last updated: 28 February 2005
+Copyright (c) 1997-2005 University of Cambridge.
+------------------------------------------------------------------------------
 
 
+PCREPRECOMPILE(3)                                            PCREPRECOMPILE(3)
+
 
 NAME
        PCRE - Perl-compatible regular expressions
 
+
 SAVING AND RE-USING PRECOMPILED PCRE PATTERNS
 
        If  you  are running an application that uses a large number of regular
@@ -3391,16 +4017,18 @@ SAVING A COMPILED PATTERN
 RE-USING A PRECOMPILED PATTERN
 
        Re-using a precompiled pattern is straightforward. Having  reloaded  it
-       into main memory, you pass its pointer to pcre_exec() in the usual way.
-       This should work even on another host, and even if that  host  has  the
-       opposite endianness to the one where the pattern was compiled.
-
-       However,  if  you  passed a pointer to custom character tables when the
-       pattern was compiled (the tableptr  argument  of  pcre_compile()),  you
-       must now pass a similar pointer to pcre_exec(), because the value saved
-       with the compiled pattern will obviously be  nonsense.  A  field  in  a
-       pcre_extra()  block is used to pass this data, as described in the sec-
-       tion on matching a pattern in the pcreapi documentation.
+       into   main   memory,   you   pass   its   pointer  to  pcre_exec()  or
+       pcre_dfa_exec() in the usual way. This  should  work  even  on  another
+       host,  and  even  if  that  host has the opposite endianness to the one
+       where the pattern was compiled.
+
+       However, if you passed a pointer to custom character  tables  when  the
+       pattern  was  compiled  (the  tableptr argument of pcre_compile()), you
+       must now pass a similar  pointer  to  pcre_exec()  or  pcre_dfa_exec(),
+       because  the  value  saved  with the compiled pattern will obviously be
+       nonsense. A field in a pcre_extra() block is used to pass this data, as
+       described  in the section on matching a pattern in the pcreapi documen-
+       tation.
 
        If you did not provide custom character tables  when  the  pattern  was
        compiled,  the  pointer  in  the compiled pattern is NULL, which causes
@@ -3411,29 +4039,31 @@ RE-USING A PRECOMPILED PATTERN
        your own pcre_extra data block and set the study_data field to point to
        the  reloaded  study  data. You must also set the PCRE_EXTRA_STUDY_DATA
        bit in the flags field to indicate that study  data  is  present.  Then
-       pass the pcre_extra block to pcre_exec() in the usual way.
+       pass  the  pcre_extra  block  to  pcre_exec() or pcre_dfa_exec() in the
+       usual way.
 
 
 COMPATIBILITY WITH DIFFERENT PCRE RELEASES
 
-       The  layout  of the control block that is at the start of the data that
-       makes up a compiled pattern was changed for release 5.0.  If  you  have
-       any  saved  patterns  that  were compiled with previous releases (not a
-       facility that was previously advertised), you will  have  to  recompile
-       them  for  release  5.0. However, from now on, it should be possible to
-       make changes in a compabible manner.
+       The layout of the control block that is at the start of the  data  that
+       makes  up  a  compiled pattern was changed for release 5.0. If you have
+       any saved patterns that were compiled with  previous  releases  (not  a
+       facility  that  was  previously advertised), you will have to recompile
+       them for release 5.0. However, from now on, it should  be  possible  to
+       make changes in a compatible manner.
 
-Last updated: 10 September 2004
-Copyright (c) 1997-2004 University of Cambridge.
------------------------------------------------------------------------------
+Last updated: 28 February 2005
+Copyright (c) 1997-2005 University of Cambridge.
+------------------------------------------------------------------------------
 
-PCRE(3)                                                                PCRE(3)
 
+PCREPERFORM(3)                                                  PCREPERFORM(3)
 
 
 NAME
        PCRE - Perl-compatible regular expressions
 
+
 PCRE PERFORMANCE
 
        Certain  items  that may appear in regular expression patterns are more
@@ -3469,9 +4099,9 @@ PCRE PERFORMANCE
 
        If you are using such a pattern with subject strings that do  not  con-
        tain newlines, the best performance is obtained by setting PCRE_DOTALL,
-       or starting the pattern with ^.* to indicate explicit  anchoring.  That
-       saves  PCRE from having to scan along the subject looking for a newline
-       to restart at.
+       or starting the pattern with ^.* or ^.*? to indicate  explicit  anchor-
+       ing.  That saves PCRE from having to scan along the subject looking for
+       a newline to restart at.
 
        Beware of patterns that contain nested indefinite  repeats.  These  can
        take  a  long time to run when applied to a string that does not match.
@@ -3492,9 +4122,9 @@ PCRE PERFORMANCE
          (a+)*b
 
        where a literal character follows. Before  embarking  on  the  standard
-       matching  procedure,  PCRE  checks  that  there  is  a "b" later in the
-       subject string, and if there is not, it fails  the  match  immediately.
-       However, when there is no following literal this optimization cannot be
+       matching  procedure,  PCRE checks that there is a "b" later in the sub-
+       ject string, and if there is not, it fails the match immediately.  How-
+       ever,  when  there  is no following literal this optimization cannot be
        used. You can see the difference by comparing the behaviour of
 
          (a+)*\d
@@ -3506,17 +4136,18 @@ PCRE PERFORMANCE
        In many cases, the solution to this kind of performance issue is to use
        an atomic group or a possessive quantifier.
 
-Last updated: 09 September 2004
-Copyright (c) 1997-2004 University of Cambridge.
------------------------------------------------------------------------------
+Last updated: 28 February 2005
+Copyright (c) 1997-2005 University of Cambridge.
+------------------------------------------------------------------------------
 
-PCRE(3)                                                                PCRE(3)
 
+PCREPOSIX(3)                                                      PCREPOSIX(3)
 
 
 NAME
        PCRE - Perl-compatible regular expressions.
 
+
 SYNOPSIS OF POSIX API
 
        #include <pcreposix.h>
@@ -3537,7 +4168,7 @@ DESCRIPTION
 
        This  set  of  functions provides a POSIX-style API to the PCRE regular
        expression package. See the pcreapi documentation for a description  of
-       PCRE's native API, which contains additional functionality.
+       PCRE's native API, which contains much additional functionality.
 
        The functions described here are just wrapper functions that ultimately
        call  the  PCRE  native  API.  Their  prototypes  are  defined  in  the
@@ -3581,6 +4212,12 @@ COMPILING A PATTERN
        The argument cflags is either zero, or contains one or more of the bits
        defined by the following macros:
 
+         REG_DOTALL
+
+       The PCRE_DOTALL option is set when the expression is passed for  compi-
+       lation  to the native function. Note that REG_DOTALL is not part of the
+       POSIX standard.
+
          REG_ICASE
 
        The PCRE_CASELESS option is set when the expression is passed for  com-
@@ -3692,21 +4329,326 @@ MEMORY USAGE
 
 AUTHOR
 
-       Philip Hazel <ph10@cam.ac.uk>
+       Philip Hazel
        University Computing Service,
        Cambridge CB2 3QG, England.
 
-Last updated: 07 September 2004
-Copyright (c) 1997-2004 University of Cambridge.
------------------------------------------------------------------------------
+Last updated: 28 February 2005
+Copyright (c) 1997-2005 University of Cambridge.
+------------------------------------------------------------------------------
 
-PCRE(3)                                                                PCRE(3)
 
+PCRECPP(3)                                                          PCRECPP(3)
+
+
+NAME
+       PCRE - Perl-compatible regular expressions.
+
+
+SYNOPSIS OF C++ WRAPPER
+
+       #include <pcrecpp.h>
+
+
+DESCRIPTION
+
+       The  C++  wrapper  for PCRE was provided by Google Inc. Some additional
+       functionality was added by Giuseppe Maxia. This brief man page was con-
+       structed  from  the  notes  in the pcrecpp.h file, which should be con-
+       sulted for further details.
+
+
+MATCHING INTERFACE
+
+       The "FullMatch" operation checks that supplied text matches a  supplied
+       pattern  exactly.  If pointer arguments are supplied, it copies matched
+       sub-strings that match sub-patterns into them.
+
+         Example: successful match
+            pcrecpp::RE re("h.*o");
+            re.FullMatch("hello");
+
+         Example: unsuccessful match (requires full match):
+            pcrecpp::RE re("e");
+            !re.FullMatch("hello");
+
+         Example: creating a temporary RE object:
+            pcrecpp::RE("h.*o").FullMatch("hello");
+
+       You can pass in a "const char*" or a "string" for "text". The  examples
+       below  tend to use a const char*. You can, as in the different examples
+       above, store the RE object explicitly in a variable or use a  temporary
+       RE  object.  The  examples below use one mode or the other arbitrarily.
+       Either could correctly be used for any of these examples.
+
+       You must supply extra pointer arguments to extract matched subpieces.
+
+         Example: extracts "ruby" into "s" and 1234 into "i"
+            int i;
+            string s;
+            pcrecpp::RE re("(\\w+):(\\d+)");
+            re.FullMatch("ruby:1234", &s, &i);
+
+         Example: does not try to extract any extra sub-patterns
+            re.FullMatch("ruby:1234", &s);
+
+         Example: does not try to extract into NULL
+            re.FullMatch("ruby:1234", NULL, &i);
+
+         Example: integer overflow causes failure
+            !re.FullMatch("ruby:1234567891234", NULL, &i);
+
+         Example: fails because there aren't enough sub-patterns:
+            !pcrecpp::RE("\\w+:\\d+").FullMatch("ruby:1234", &s);
+
+         Example: fails because string cannot be stored in integer
+            !pcrecpp::RE("(.*)").FullMatch("ruby", &i);
+
+       The provided pointer arguments can be pointers to  any  scalar  numeric
+       type, or one of:
+
+          string        (matched piece is copied to string)
+          StringPiece   (StringPiece is mutated to point to matched piece)
+          T             (where "bool T::ParseFrom(const char*, int)" exists)
+          NULL          (the corresponding matched sub-pattern is not copied)
+
+       The  function returns true iff all of the following conditions are sat-
+       isfied:
+
+         a. "text" matches "pattern" exactly;
+
+         b. The number of matched sub-patterns is >= number of supplied
+            pointers;
+
+         c. The "i"th argument has a suitable type for holding the
+            string captured as the "i"th sub-pattern. If you pass in
+            NULL for the "i"th argument, or pass fewer arguments than
+            number of sub-patterns, "i"th captured sub-pattern is
+            ignored.
+
+       The matching interface supports at most 16 arguments per call.  If  you
+       need    more,    consider    using    the    more   general   interface
+       pcrecpp::RE::DoMatch. See pcrecpp.h for the signature for DoMatch.
+
+
+PARTIAL MATCHES
+
+       You can use the "PartialMatch" operation when you want the  pattern  to
+       match any substring of the text.
+
+         Example: simple search for a string:
+            pcrecpp::RE("ell").PartialMatch("hello");
+
+         Example: find first number in a string:
+            int number;
+            pcrecpp::RE re("(\\d+)");
+            re.PartialMatch("x*100 + 20", &number);
+            assert(number == 100);
+
+
+UTF-8 AND THE MATCHING INTERFACE
+
+       By  default,  pattern  and text are plain text, one byte per character.
+       The UTF8 flag, passed to  the  constructor,  causes  both  pattern  and
+       string to be treated as UTF-8 text, still a byte stream but potentially
+       multiple bytes per character. In practice, the text is likelier  to  be
+       UTF-8  than  the pattern, but the match returned may depend on the UTF8
+       flag, so always use it when matching UTF8 text. For example,  "."  will
+       match  one  byte normally but with UTF8 set may match up to three bytes
+       of a multi-byte character.
+
+         Example:
+            pcrecpp::RE_Options options;
+            options.set_utf8();
+            pcrecpp::RE re(utf8_pattern, options);
+            re.FullMatch(utf8_string);
+
+         Example: using the convenience function UTF8():
+            pcrecpp::RE re(utf8_pattern, pcrecpp::UTF8());
+            re.FullMatch(utf8_string);
+
+       NOTE: The UTF8 flag is ignored if pcre was not configured with the
+             --enable-utf8 flag.
+
+
+PASSING MODIFIERS TO THE REGULAR EXPRESSION ENGINE
+
+       PCRE defines some modifiers to  change  the  behavior  of  the  regular
+       expression   engine.  The  C++  wrapper  defines  an  auxiliary  class,
+       RE_Options, as a vehicle to pass such modifiers to  a  RE  class.  Cur-
+       rently, the following modifiers are supported:
+
+          modifier              description               Perl corresponding
+
+          PCRE_CASELESS         case insensitive match      /i
+          PCRE_MULTILINE        multiple lines match        /m
+          PCRE_DOTALL           dot matches newlines        /s
+          PCRE_DOLLAR_ENDONLY   $ matches only at end       N/A
+          PCRE_EXTRA            strict escape parsing       N/A
+          PCRE_EXTENDED         ignore whitespaces          /x
+          PCRE_UTF8             handles UTF8 chars          built-in
+          PCRE_UNGREEDY         reverses * and *?           N/A
+          PCRE_NO_AUTO_CAPTURE  disables capturing parens   N/A (*)
+
+       (*)  Both Perl and PCRE allow non capturing parentheses by means of the
+       "?:" modifier within the pattern itself. e.g. (?:ab|cd) does  not  cap-
+       ture, while (ab|cd) does.
+
+       For  a  full  account on how each modifier works, please check the PCRE
+       API reference page.
+
+       For each modifier, there are two member functions whose  name  is  made
+       out  of  the  modifier  in  lowercase,  without the "PCRE_" prefix. For
+       instance, PCRE_CASELESS is handled by
+
+         bool caseless()
+
+       which returns true if the modifier is set, and
+
+         RE_Options & set_caseless(bool)
+
+       which sets or unsets the  modifier.  Moreover,  PCRE_CONFIG_MATCH_LIMIT
+       can  be accessed through the set_match_limit() and match_limit() member
+       functions. Setting match_limit to a non-zero value will limit the  exe-
+       cution  of pcre to keep it from doing bad things like blowing the stack
+       or taking an eternity to return a result.  A  value  of  5000  is  good
+       enough  to stop stack blowup in a 2MB thread stack. Setting match_limit
+       to zero disables match limiting.
+
+       Normally, to pass one or more modifiers to a RE class,  you  declare  a
+       RE_Options object, set the appropriate options, and pass this object to
+       a RE constructor. Example:
+
+          RE_options opt;
+          opt.set_caseless(true);
+          if (RE("HELLO", opt).PartialMatch("hello world")) ...
+
+       RE_options has two constructors. The default constructor takes no argu-
+       ments  and creates a set of flags that are off by default. The optional
+       parameter option_flags is to facilitate transfer of legacy code from  C
+       programs.  This lets you do
+
+          RE(pattern,
+            RE_Options(PCRE_CASELESS|PCRE_MULTILINE)).PartialMatch(str);
+
+       However, new code is better off doing
+
+          RE(pattern,
+            RE_Options().set_caseless(true).set_multiline(true))
+              .PartialMatch(str);
+
+       If you are going to pass one of the most used modifiers, there are some
+       convenience functions that return a RE_Options class with the appropri-
+       ate  modifier  already  set: CASELESS(), UTF8(), MULTILINE(), DOTALL(),
+       and EXTENDED().
+
+       If you need to set several options at once, and you don't  want  to  go
+       through  the pains of declaring a RE_Options object and setting several
+       options, there is a parallel method that give you such ability  on  the
+       fly.  You  can  concatenate several set_xxxxx() member functions, since
+       each of them returns a reference to its class object. For  example,  to
+       pass  PCRE_CASELESS, PCRE_EXTENDED, and PCRE_MULTILINE to a RE with one
+       statement, you may write:
+
+          RE(" ^ xyz \\s+ .* blah$",
+            RE_Options()
+              .set_caseless(true)
+              .set_extended(true)
+              .set_multiline(true)).PartialMatch(sometext);
+
+
+SCANNING TEXT INCREMENTALLY
+
+       The "Consume" operation may be useful if you want to  repeatedly  match
+       regular expressions at the front of a string and skip over them as they
+       match. This requires use of the "StringPiece" type, which represents  a
+       sub-range  of  a  real  string.  Like RE, StringPiece is defined in the
+       pcrecpp namespace.
+
+         Example: read lines of the form "var = value" from a string.
+            string contents = ...;                 // Fill string somehow
+            pcrecpp::StringPiece input(contents);  // Wrap in a StringPiece
+
+            string var;
+            int value;
+            pcrecpp::RE re("(\\w+) = (\\d+)\n");
+            while (re.Consume(&input, &var, &value)) {
+              ...;
+            }
+
+       Each successful call  to  "Consume"  will  set  "var/value",  and  also
+       advance "input" so it points past the matched text.
+
+       The  "FindAndConsume"  operation  is  similar to "Consume" but does not
+       anchor your match at the beginning of  the  string.  For  example,  you
+       could extract all words from a string by repeatedly calling
+
+         pcrecpp::RE("(\\w+)").FindAndConsume(&input, &word)
+
+
+PARSING HEX/OCTAL/C-RADIX NUMBERS
+
+       By default, if you pass a pointer to a numeric value, the corresponding
+       text is interpreted as a base-10  number.  You  can  instead  wrap  the
+       pointer with a call to one of the operators Hex(), Octal(), or CRadix()
+       to interpret the text in another base. The CRadix  operator  interprets
+       C-style  "0"  (base-8)  and  "0x"  (base-16)  prefixes, but defaults to
+       base-10.
+
+         Example:
+           int a, b, c, d;
+           pcrecpp::RE re("(.*) (.*) (.*) (.*)");
+           re.FullMatch("100 40 0100 0x40",
+                        pcrecpp::Octal(&a), pcrecpp::Hex(&b),
+                        pcrecpp::CRadix(&c), pcrecpp::CRadix(&d));
+
+       will leave 64 in a, b, c, and d.
+
+
+REPLACING PARTS OF STRINGS
+
+       You can replace the first match of "pattern" in "str"  with  "rewrite".
+       Within  "rewrite",  backslash-escaped  digits (\1 to \9) can be used to
+       insert text matching corresponding parenthesized group  from  the  pat-
+       tern. \0 in "rewrite" refers to the entire matching text. For example:
+
+         string s = "yabba dabba doo";
+         pcrecpp::RE("b+").Replace("d", &s);
+
+       will  leave  "s" containing "yada dabba doo". The result is true if the
+       pattern matches and a replacement occurs, false otherwise.
+
+       GlobalReplace is like Replace except that it replaces  all  occurrences
+       of  the  pattern  in  the string with the rewrite. Replacements are not
+       subject to re-matching. For example:
+
+         string s = "yabba dabba doo";
+         pcrecpp::RE("b+").GlobalReplace("d", &s);
+
+       will leave "s" containing "yada dada doo". It  returns  the  number  of
+       replacements made.
+
+       Extract  is like Replace, except that if the pattern matches, "rewrite"
+       is copied into "out" (an additional argument) with substitutions.   The
+       non-matching  portions  of "text" are ignored. Returns true iff a match
+       occurred and the extraction happened successfully;  if no match occurs,
+       the string is left unaffected.
+
+
+AUTHOR
+
+       The C++ wrapper was contributed by Google Inc.
+       Copyright (c) 2005 Google Inc.
+------------------------------------------------------------------------------
+
+
+PCRESAMPLE(3)                                                    PCRESAMPLE(3)
 
 
 NAME
        PCRE - Perl-compatible regular expressions
 
+
 PCRE SAMPLE PROGRAM
 
        A simple, complete demonstration program, to get you started with using
@@ -3765,5 +4707,4 @@ PCRE SAMPLE PROGRAM
 
 Last updated: 09 September 2004
 Copyright (c) 1997-2004 University of Cambridge.
------------------------------------------------------------------------------
-
+------------------------------------------------------------------------------
index 2b35d10ba9b3b87a497c0a59fcd40102f2651486..01db4bd22c4426f18240c65fac2d9e225a7dca00 100644 (file)
@@ -6,6 +6,7 @@ pcre_config
 pcre_callout
 pcre_compile
 pcre_copy_substring
+pcre_dfa_exec
 pcre_exec
 pcre_get_substring
 pcre_get_stringnumber
index 572344009e07c36473d4e6e39401c06a3cff87d8..5f302479694639bd39b277ad762bcea92d89e9fe 100644 (file)
@@ -6,6 +6,7 @@ pcre_config
 pcre_callout
 pcre_compile
 pcre_copy_substring
+pcre_dfa_exec
 pcre_exec
 pcre_get_substring
 pcre_get_stringnumber
index 4f6c4bff40da31438f388da1268b4aa9854c7297..adb53160d304d845c4b5a102b50597e9dafcad74 100644 (file)
@@ -5,6 +5,7 @@ pcre_free DATA
 
 pcre_compile
 pcre_copy_substring
+pcre_dfa_exec
 pcre_exec
 pcre_get_substring
 pcre_get_substring_list
index a2b78b376de30da02e2ca3470c5c85d4fc86ea47..ff3577402418c80adf42c2b93450f3950f8751e7 100644 (file)
@@ -5,7 +5,7 @@
 /* In its original form, this is the .in file that is transformed by
 "configure" into pcre.h.
 
-           Copyright (c) 1997-2004 University of Cambridge
+           Copyright (c) 1997-2005 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -44,11 +44,11 @@ make changes to pcre.in. */
 
 #include "php_compat.h"
 
-#define PCRE_MAJOR          5
-#define PCRE_MINOR          0
-#define PCRE_DATE           13-Sep-2004
+#define PCRE_MAJOR          6
+#define PCRE_MINOR          2
+#define PCRE_DATE           01-Aug-2005
 
-/* Win32 uses DLL by default */
+/* Win32 uses DLL by default; it needs special stuff for exported functions. */
 
 #ifdef _WIN32
 #  ifdef PCRE_DEFINITION
@@ -61,8 +61,15 @@ make changes to pcre.in. */
 #    endif
 #  endif
 #endif
+
+/* For other operating systems, we use the standard "extern". */
+
 #ifndef PCRE_DATA_SCOPE
-#  define PCRE_DATA_SCOPE     extern
+#  ifdef __cplusplus
+#    define PCRE_DATA_SCOPE     extern "C"
+#  else
+#    define PCRE_DATA_SCOPE     extern
+#  endif
 #endif
 
 /* Have to include stdlib.h in order to ensure that size_t is defined;
@@ -78,22 +85,25 @@ extern "C" {
 
 /* Options */
 
-#define PCRE_CASELESS           0x0001
-#define PCRE_MULTILINE          0x0002
-#define PCRE_DOTALL             0x0004
-#define PCRE_EXTENDED           0x0008
-#define PCRE_ANCHORED           0x0010
-#define PCRE_DOLLAR_ENDONLY     0x0020
-#define PCRE_EXTRA              0x0040
-#define PCRE_NOTBOL             0x0080
-#define PCRE_NOTEOL             0x0100
-#define PCRE_UNGREEDY           0x0200
-#define PCRE_NOTEMPTY           0x0400
-#define PCRE_UTF8               0x0800
-#define PCRE_NO_AUTO_CAPTURE    0x1000
-#define PCRE_NO_UTF8_CHECK      0x2000
-#define PCRE_AUTO_CALLOUT       0x4000
-#define PCRE_PARTIAL            0x8000
+#define PCRE_CASELESS           0x00000001
+#define PCRE_MULTILINE          0x00000002
+#define PCRE_DOTALL             0x00000004
+#define PCRE_EXTENDED           0x00000008
+#define PCRE_ANCHORED           0x00000010
+#define PCRE_DOLLAR_ENDONLY     0x00000020
+#define PCRE_EXTRA              0x00000040
+#define PCRE_NOTBOL             0x00000080
+#define PCRE_NOTEOL             0x00000100
+#define PCRE_UNGREEDY           0x00000200
+#define PCRE_NOTEMPTY           0x00000400
+#define PCRE_UTF8               0x00000800
+#define PCRE_NO_AUTO_CAPTURE    0x00001000
+#define PCRE_NO_UTF8_CHECK      0x00002000
+#define PCRE_AUTO_CALLOUT       0x00004000
+#define PCRE_PARTIAL            0x00008000
+#define PCRE_DFA_SHORTEST       0x00010000
+#define PCRE_DFA_RESTART        0x00020000
+#define PCRE_FIRSTLINE          0x00040000
 
 /* Exec-time and get/set-time error codes */
 
@@ -112,6 +122,11 @@ extern "C" {
 #define PCRE_ERROR_BADPARTIAL     (-13)
 #define PCRE_ERROR_INTERNAL       (-14)
 #define PCRE_ERROR_BADCOUNT       (-15)
+#define PCRE_ERROR_DFA_UITEM      (-16)
+#define PCRE_ERROR_DFA_UCOND      (-17)
+#define PCRE_ERROR_DFA_UMLIMIT    (-18)
+#define PCRE_ERROR_DFA_WSSIZE     (-19)
+#define PCRE_ERROR_DFA_RECURSE    (-20)
 
 /* Request types for pcre_fullinfo() */
 
@@ -189,9 +204,8 @@ typedef struct pcre_callout_block {
 /* Indirection for store get and free functions. These can be set to
 alternative malloc/free functions if required. Special ones are used in the
 non-recursive case for "frames". There is also an optional callout function
-that is triggered by the (?) regex item. Some magic is required for Win32 DLL;
-it is null on other OS. For Virtual Pascal, these have to be different again.
-*/
+that is triggered by the (?) regex item. For Virtual Pascal, these definitions
+have to take another form. */
 
 #ifndef VPCOMPAT
 PCRE_DATA_SCOPE void *(*pcre_malloc)(size_t);
@@ -200,39 +214,44 @@ PCRE_DATA_SCOPE void *(*pcre_stack_malloc)(size_t);
 PCRE_DATA_SCOPE void  (*pcre_stack_free)(void *);
 PCRE_DATA_SCOPE int   (*pcre_callout)(pcre_callout_block *);
 #else   /* VPCOMPAT */
-extern void *pcre_malloc(size_t);
-extern void  pcre_free(void *);
-extern void *pcre_stack_malloc(size_t);
-extern void  pcre_stack_free(void *);
-extern int   pcre_callout(pcre_callout_block *);
+PCRE_DATA_SCOPE void *pcre_malloc(size_t);
+PCRE_DATA_SCOPE void  pcre_free(void *);
+PCRE_DATA_SCOPE void *pcre_stack_malloc(size_t);
+PCRE_DATA_SCOPE void  pcre_stack_free(void *);
+PCRE_DATA_SCOPE int   pcre_callout(pcre_callout_block *);
 #endif  /* VPCOMPAT */
 
 /* Exported PCRE functions */
 
-extern pcre *pcre_compile(const char *, int, const char **,
-              int *, const unsigned char *);
-extern int  pcre_config(int, void *);
-extern int  pcre_copy_named_substring(const pcre *, const char *,
-              int *, int, const char *, char *, int);
-extern int  pcre_copy_substring(const char *, int *, int, int,
-              char *, int);
-extern int  pcre_exec(const pcre *, const pcre_extra *,
-              const char *, int, int, int, int *, int);
-extern void pcre_free_substring(const char *);
-extern void pcre_free_substring_list(const char **);
-extern int  pcre_fullinfo(const pcre *, const pcre_extra *, int,
-              void *);
-extern int  pcre_get_named_substring(const pcre *, const char *,
-              int *, int,  const char *, const char **);
-extern int  pcre_get_stringnumber(const pcre *, const char *);
-extern int  pcre_get_substring(const char *, int *, int, int,
-              const char **);
-extern int  pcre_get_substring_list(const char *, int *, int,
-              const char ***);
-extern int  pcre_info(const pcre *, int *, int *);
-extern const unsigned char *pcre_maketables(void);
-extern pcre_extra *pcre_study(const pcre *, int, const char **);
-extern const char *pcre_version(void);
+PCRE_DATA_SCOPE pcre *pcre_compile(const char *, int, const char **, int *,
+                  const unsigned char *);
+PCRE_DATA_SCOPE pcre *pcre_compile2(const char *, int, int *, const char **,
+                  int *, const unsigned char *);
+PCRE_DATA_SCOPE int  pcre_config(int, void *);
+PCRE_DATA_SCOPE int  pcre_copy_named_substring(const pcre *, const char *,
+                  int *, int, const char *, char *, int);
+PCRE_DATA_SCOPE int  pcre_copy_substring(const char *, int *, int, int, char *,
+                  int);
+PCRE_DATA_SCOPE int  pcre_dfa_exec(const pcre *, const pcre_extra *,
+                  const char *, int, int, int, int *, int , int *, int);
+PCRE_DATA_SCOPE int  pcre_exec(const pcre *, const pcre_extra *, const char *,
+                   int, int, int, int *, int);
+PCRE_DATA_SCOPE void pcre_free_substring(const char *);
+PCRE_DATA_SCOPE void pcre_free_substring_list(const char **);
+PCRE_DATA_SCOPE int  pcre_fullinfo(const pcre *, const pcre_extra *, int,
+                  void *);
+PCRE_DATA_SCOPE int  pcre_get_named_substring(const pcre *, const char *,
+                  int *, int, const char *, const char **);
+PCRE_DATA_SCOPE int  pcre_get_stringnumber(const pcre *, const char *);
+PCRE_DATA_SCOPE int  pcre_get_substring(const char *, int *, int, int,
+                  const char **);
+PCRE_DATA_SCOPE int  pcre_get_substring_list(const char *, int *, int,
+                  const char ***);
+PCRE_DATA_SCOPE int  pcre_info(const pcre *, int *, int *);
+PCRE_DATA_SCOPE const unsigned char *pcre_maketables(void);
+PCRE_DATA_SCOPE int  pcre_refcount(pcre *, int);
+PCRE_DATA_SCOPE pcre_extra *pcre_study(const pcre *, int, const char **);
+PCRE_DATA_SCOPE const char *pcre_version(void);
 
 #ifdef __cplusplus
 }  /* extern "C" */
similarity index 96%
rename from ext/pcre/pcrelib/chartables.c
rename to ext/pcre/pcrelib/pcre_chartables.c
index 55e413cfcaa861ccff7ad1aa4b79a68bc61a53c5..d491433e25472698a2d3b6d461a203eeb0313c05 100644 (file)
@@ -6,11 +6,11 @@
 program. If you edit it by hand, you might like to edit the Makefile to 
 prevent its ever being regenerated.
 
-This file is #included in the compilation of pcre.c to build the default
-character tables which are used when no tables are passed to the compile
-function. */
+This file contains the default tables for characters with codes less than
+128 (ASCII characters). These tables are used when no external tables are
+passed to PCRE. */
 
-static unsigned char pcre_default_tables[] = {
+const unsigned char _pcre_default_tables[] = {
 
 /* This table is a lower casing table. */
 
similarity index 52%
rename from ext/pcre/pcrelib/pcre.c
rename to ext/pcre/pcrelib/pcre_compile.c
index a411d00c357f6b176bf9f2f0ddd37586b176f9d7..228995252551f40fc8481e0a128a62fdff30fd6b 100644 (file)
@@ -2,14 +2,11 @@
 *      Perl-Compatible Regular Expressions       *
 *************************************************/
 
-/*
-This is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language. See
-the file Tech.Notes for some information on the internals.
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
 
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
-           Copyright (c) 1997-2004 University of Cambridge
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -41,31 +38,16 @@ POSSIBILITY OF SUCH DAMAGE.
 */
 
 
-/* Define DEBUG to get debugging output on stdout. */
-/* #define DEBUG */
-
-/* Use a macro for debugging printing, 'cause that eliminates the use of #ifdef
-inline, and there are *still* stupid compilers about that don't like indented
-pre-processor statements. I suppose it's only been 10 years... */
-
-#ifdef DEBUG
-#define DPRINTF(p) printf p
-#else
-#define DPRINTF(p) /*nothing*/
-#endif
+/* This module contains the external function pcre_compile(), along with
+supporting internal functions that are not used by other modules. */
 
-/* Include the internals header, which itself includes "config.h", the Standard
-C headers, and the external pcre header. */
 
-#include "internal.h"
+#include "pcre_internal.h"
 
-/* If Unicode Property support is wanted, include a private copy of the
-function that does it, and the table that translates names to numbers. */
 
-#ifdef SUPPORT_UCP
-#include "ucp.c"
-#include "ucptypetable.c"
-#endif
+/*************************************************
+*      Code parameters and static tables         *
+*************************************************/
 
 /* Maximum number of items on the nested bracket stacks at compile time. This
 applies to the nesting of all kinds of parentheses. It does not limit
@@ -76,29 +58,6 @@ compile time. */
 #define BRASTACK_SIZE 200
 
 
-/* Maximum number of ints of offset to save on the stack for recursive calls.
-If the offset vector is bigger, malloc is used. This should be a multiple of 3,
-because the offset vector is always a multiple of 3 long. */
-
-#define REC_STACK_SAVE_MAX 30
-
-
-/* The maximum remaining length of subject we are prepared to search for a
-req_byte match. */
-
-#define REQ_BYTE_MAX 1000
-
-
-/* Table of sizes for the fixed-length opcodes. It's defined in a macro so that
-the definition is next to the definition of the opcodes in internal.h. */
-
-static const uschar OP_lengths[] = { OP_LENGTHS };
-
-/* 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 };
-
 /* Table for handling escaped characters in the range '0'-'z'. Positive returns
 are simple data values; negative values are for special things like \d and so
 on. Zero means further processing is needed (for things like \x), or the escape
@@ -180,6 +139,71 @@ static const int posix_class_maps[] = {
   cbit_xdigit,-1,         -1              /* xdigit */
 };
 
+
+/* The texts of compile-time error messages. These are "char *" because they
+are passed to the outside world. */
+
+static const char *error_texts[] = {
+  "no error",
+  "\\ at end of pattern",
+  "\\c at end of pattern",
+  "unrecognized character follows \\",
+  "numbers out of order in {} quantifier",
+  /* 5 */
+  "number too big in {} quantifier",
+  "missing terminating ] for character class",
+  "invalid escape sequence in character class",
+  "range out of order in character class",
+  "nothing to repeat",
+  /* 10 */
+  "operand of unlimited repeat could match the empty string",
+  "internal error: unexpected repeat",
+  "unrecognized character after (?",
+  "POSIX named classes are supported only within a class",
+  "missing )",
+  /* 15 */
+  "reference to non-existent subpattern",
+  "erroffset passed as NULL",
+  "unknown option bit(s) set",
+  "missing ) after comment",
+  "parentheses nested too deeply",
+  /* 20 */
+  "regular expression too large",
+  "failed to get memory",
+  "unmatched parentheses",
+  "internal error: code overflow",
+  "unrecognized character after (?<",
+  /* 25 */
+  "lookbehind assertion is not fixed length",
+  "malformed number after (?(",
+  "conditional group contains more than two branches",
+  "assertion expected after (?(",
+  "(?R or (?digits must be followed by )",
+  /* 30 */
+  "unknown POSIX class name",
+  "POSIX collating elements are not supported",
+  "this version of PCRE is not compiled with PCRE_UTF8 support",
+  "spare error",
+  "character value in \\x{...} sequence is too large",
+  /* 35 */
+  "invalid condition (?(0)",
+  "\\C not allowed in lookbehind assertion",
+  "PCRE does not support \\L, \\l, \\N, \\U, or \\u",
+  "number after (?C is > 255",
+  "closing ) for (?C expected",
+  /* 40 */
+  "recursive call could loop indefinitely",
+  "unrecognized character after (?P",
+  "syntax error after (?P",
+  "two named groups have the same name",
+  "invalid UTF-8 string",
+  /* 45 */
+  "support for \\P, \\p, and \\X has not been compiled",
+  "malformed \\P or \\p sequence",
+  "unknown property name after \\P or \\p"
+};
+
+
 /* Table to identify digits and hex digits. This is used when compiling
 patterns. Note that the tables in chartables are dependent on the locale, and
 may mark arbitrary characters as digits - but the PCRE compiling code expects
@@ -307,579 +331,8 @@ static const unsigned char ebcdic_chartab[] = { /* chartable partial dup */
 /* Definition to allow mutual recursion */
 
 static BOOL
-  compile_regex(int, int, int *, uschar **, const uschar **, const char **,
-    BOOL, int, int *, int *, branch_chain *, compile_data *);
-
-/* Structure for building a chain of data that actually lives on the
-stack, for holding the values of the subject pointer at the start of each
-subpattern, so as to detect when an empty string has been matched by a
-subpattern - to break infinite loops. When NO_RECURSE is set, these blocks
-are on the heap, not on the stack. */
-
-typedef struct eptrblock {
-  struct eptrblock *epb_prev;
-  const uschar *epb_saved_eptr;
-} eptrblock;
-
-/* Flag bits for the match() function */
-
-#define match_condassert   0x01    /* Called to check a condition assertion */
-#define match_isgroup      0x02    /* Set if start of bracketed group */
-
-/* Non-error returns from the match() function. Error returns are externally
-defined PCRE_ERROR_xxx codes, which are all negative. */
-
-#define MATCH_MATCH        1
-#define MATCH_NOMATCH      0
-
-
-
-/*************************************************
-*               Global variables                 *
-*************************************************/
-
-/* PCRE is thread-clean and doesn't use any global variables in the normal
-sense. However, it calls memory allocation and free functions via the four
-indirections below, and it can optionally do callouts. These values can be
-changed by the caller, but are shared between all threads. However, when
-compiling for Virtual Pascal, things are done differently (see pcre.in). */
-
-#ifndef VPCOMPAT
-#ifdef __cplusplus
-extern "C" void *(*pcre_malloc)(size_t) = malloc;
-extern "C" void  (*pcre_free)(void *) = free;
-extern "C" void *(*pcre_stack_malloc)(size_t) = malloc;
-extern "C" void  (*pcre_stack_free)(void *) = free;
-extern "C" int   (*pcre_callout)(pcre_callout_block *) = NULL;
-#else
-void *(*pcre_malloc)(size_t) = malloc;
-void  (*pcre_free)(void *) = free;
-void *(*pcre_stack_malloc)(size_t) = malloc;
-void  (*pcre_stack_free)(void *) = free;
-int   (*pcre_callout)(pcre_callout_block *) = NULL;
-#endif
-#endif
-
-
-/*************************************************
-*    Macros and tables for character handling    *
-*************************************************/
-
-/* When UTF-8 encoding is being used, a character is no longer just a single
-byte. The macros for character handling generate simple sequences when used in
-byte-mode, and more complicated ones for UTF-8 characters. */
-
-#ifndef SUPPORT_UTF8
-#define GETCHAR(c, eptr) c = *eptr;
-#define GETCHARINC(c, eptr) c = *eptr++;
-#define GETCHARINCTEST(c, eptr) c = *eptr++;
-#define GETCHARLEN(c, eptr, len) c = *eptr;
-#define BACKCHAR(eptr)
-
-#else   /* SUPPORT_UTF8 */
-
-/* Get the next UTF-8 character, not advancing the pointer. This is called when
-we know we are in UTF-8 mode. */
-
-#define GETCHAR(c, eptr) \
-  c = *eptr; \
-  if ((c & 0xc0) == 0xc0) \
-    { \
-    int gcii; \
-    int gcaa = utf8_table4[c & 0x3f];  /* Number of additional bytes */ \
-    int gcss = 6*gcaa; \
-    c = (c & utf8_table3[gcaa]) << gcss; \
-    for (gcii = 1; gcii <= gcaa; gcii++) \
-      { \
-      gcss -= 6; \
-      c |= (eptr[gcii] & 0x3f) << gcss; \
-      } \
-    }
-
-/* Get the next UTF-8 character, advancing the pointer. This is called when we
-know we are in UTF-8 mode. */
-
-#define GETCHARINC(c, eptr) \
-  c = *eptr++; \
-  if ((c & 0xc0) == 0xc0) \
-    { \
-    int gcaa = utf8_table4[c & 0x3f];  /* Number of additional bytes */ \
-    int gcss = 6*gcaa; \
-    c = (c & utf8_table3[gcaa]) << gcss; \
-    while (gcaa-- > 0) \
-      { \
-      gcss -= 6; \
-      c |= (*eptr++ & 0x3f) << gcss; \
-      } \
-    }
-
-/* Get the next character, testing for UTF-8 mode, and advancing the pointer */
-
-#define GETCHARINCTEST(c, eptr) \
-  c = *eptr++; \
-  if (md->utf8 && (c & 0xc0) == 0xc0) \
-    { \
-    int gcaa = utf8_table4[c & 0x3f];  /* Number of additional bytes */ \
-    int gcss = 6*gcaa; \
-    c = (c & utf8_table3[gcaa]) << gcss; \
-    while (gcaa-- > 0) \
-      { \
-      gcss -= 6; \
-      c |= (*eptr++ & 0x3f) << gcss; \
-      } \
-    }
-
-/* Get the next UTF-8 character, not advancing the pointer, incrementing length
-if there are extra bytes. This is called when we know we are in UTF-8 mode. */
-
-#define GETCHARLEN(c, eptr, len) \
-  c = *eptr; \
-  if ((c & 0xc0) == 0xc0) \
-    { \
-    int gcii; \
-    int gcaa = utf8_table4[c & 0x3f];  /* Number of additional bytes */ \
-    int gcss = 6*gcaa; \
-    c = (c & utf8_table3[gcaa]) << gcss; \
-    for (gcii = 1; gcii <= gcaa; gcii++) \
-      { \
-      gcss -= 6; \
-      c |= (eptr[gcii] & 0x3f) << gcss; \
-      } \
-    len += gcaa; \
-    }
-
-/* If the pointer is not at the start of a character, move it back until
-it is. Called only in UTF-8 mode. */
-
-#define BACKCHAR(eptr) while((*eptr & 0xc0) == 0x80) eptr--;
-
-#endif
-
-
-
-/*************************************************
-*             Default character tables           *
-*************************************************/
-
-/* A default set of character tables is included in the PCRE binary. Its source
-is built by the maketables auxiliary program, which uses the default C ctypes
-functions, and put in the file chartables.c. These tables are used by PCRE
-whenever the caller of pcre_compile() does not provide an alternate set of
-tables. */
-
-#include "chartables.c"
-
-
-
-#ifdef SUPPORT_UTF8
-/*************************************************
-*           Tables for UTF-8 support             *
-*************************************************/
-
-/* These are the breakpoints for different numbers of bytes in a UTF-8
-character. */
-
-static const int utf8_table1[] =
-  { 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff};
-
-/* These are the indicator bits and the mask for the data bits to set in the
-first byte of a character, indexed by the number of additional bytes. */
-
-static const int utf8_table2[] = { 0,    0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
-static const int utf8_table3[] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
-
-/* Table of the number of extra characters, indexed by the first character
-masked with 0x3f. The highest number for a valid UTF-8 character is in fact
-0x3d. */
-
-static const uschar utf8_table4[] = {
-  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,1,1,1,1,1,
-  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
-  3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };
-
-
-/*************************************************
-*       Convert character value to UTF-8         *
-*************************************************/
-
-/* This function takes an integer value in the range 0 - 0x7fffffff
-and encodes it as a UTF-8 character in 0 to 6 bytes.
-
-Arguments:
-  cvalue     the character value
-  buffer     pointer to buffer for result - at least 6 bytes long
-
-Returns:     number of characters placed in the buffer
-*/
-
-static int
-ord2utf8(int cvalue, uschar *buffer)
-{
-register int i, j;
-for (i = 0; i < sizeof(utf8_table1)/sizeof(int); i++)
-  if (cvalue <= utf8_table1[i]) break;
-buffer += i;
-for (j = i; j > 0; j--)
- {
- *buffer-- = 0x80 | (cvalue & 0x3f);
- cvalue >>= 6;
- }
-*buffer = utf8_table2[i] | cvalue;
-return i + 1;
-}
-#endif
-
-
-
-/*************************************************
-*         Print compiled regex                   *
-*************************************************/
-
-/* The code for doing this is held in a separate file that is also included in
-pcretest.c. It defines a function called print_internals(). */
-
-#ifdef DEBUG
-#include "printint.c"
-#endif
-
-
-
-/*************************************************
-*          Return version string                 *
-*************************************************/
-
-#define STRING(a)  # a
-#define XSTRING(s) STRING(s)
-
-EXPORT const char *
-pcre_version(void)
-{
-return XSTRING(PCRE_MAJOR) "." XSTRING(PCRE_MINOR) " " XSTRING(PCRE_DATE);
-}
-
-
-
-
-/*************************************************
-*         Flip bytes in an integer               *
-*************************************************/
-
-/* This function is called when the magic number in a regex doesn't match in
-order to flip its bytes to see if we are dealing with a pattern that was
-compiled on a host of different endianness. If so, this function is used to
-flip other byte values.
-
-Arguments:
-  value        the number to flip
-  n            the number of bytes to flip (assumed to be 2 or 4)
-
-Returns:       the flipped value
-*/
-
-static long int
-byteflip(long int value, int n)
-{
-if (n == 2) return ((value & 0x00ff) << 8) | ((value & 0xff00) >> 8);
-return ((value & 0x000000ff) << 24) |
-       ((value & 0x0000ff00) <<  8) |
-       ((value & 0x00ff0000) >>  8) |
-       ((value & 0xff000000) >> 24);
-}
-
-
-
-/*************************************************
-*       Test for a byte-flipped compiled regex   *
-*************************************************/
-
-/* This function is called from pce_exec() and also from pcre_fullinfo(). Its
-job is to test whether the regex is byte-flipped - that is, it was compiled on
-a system of opposite endianness. The function is called only when the native
-MAGIC_NUMBER test fails. If the regex is indeed flipped, we flip all the
-relevant values into a different data block, and return it.
-
-Arguments:
-  re               points to the regex
-  study            points to study data, or NULL
-  internal_re      points to a new regex block
-  internal_study   points to a new study block
-
-Returns:           the new block if is is indeed a byte-flipped regex
-                   NULL if it is not
-*/
-
-static real_pcre *
-try_flipped(const real_pcre *re, real_pcre *internal_re,
-  const pcre_study_data *study, pcre_study_data *internal_study)
-{
-if (byteflip(re->magic_number, sizeof(re->magic_number)) != MAGIC_NUMBER)
-  return NULL;
-
-*internal_re = *re;           /* To copy other fields */
-internal_re->size = byteflip(re->size, sizeof(re->size));
-internal_re->options = byteflip(re->options, sizeof(re->options));
-internal_re->top_bracket = byteflip(re->top_bracket, sizeof(re->top_bracket));
-internal_re->top_backref = byteflip(re->top_backref, sizeof(re->top_backref));
-internal_re->first_byte = byteflip(re->first_byte, sizeof(re->first_byte));
-internal_re->req_byte = byteflip(re->req_byte, sizeof(re->req_byte));
-internal_re->name_table_offset = byteflip(re->name_table_offset,
-  sizeof(re->name_table_offset));
-internal_re->name_entry_size = byteflip(re->name_entry_size,
-  sizeof(re->name_entry_size));
-internal_re->name_count = byteflip(re->name_count, sizeof(re->name_count));
-
-if (study != NULL)
-  {
-  *internal_study = *study;   /* To copy other fields */
-  internal_study->size = byteflip(study->size, sizeof(study->size));
-  internal_study->options = byteflip(study->options, sizeof(study->options));
-  }
-
-return internal_re;
-}
-
-
-
-/*************************************************
-* (Obsolete) Return info about compiled pattern  *
-*************************************************/
-
-/* This is the original "info" function. It picks potentially useful data out
-of the private structure, but its interface was too rigid. It remains for
-backwards compatibility. The public options are passed back in an int - though
-the re->options field has been expanded to a long int, all the public options
-at the low end of it, and so even on 16-bit systems this will still be OK.
-Therefore, I haven't changed the API for pcre_info().
-
-Arguments:
-  argument_re   points to compiled code
-  optptr        where to pass back the options
-  first_byte    where to pass back the first character,
-                or -1 if multiline and all branches start ^,
-                or -2 otherwise
-
-Returns:        number of capturing subpatterns
-                or negative values on error
-*/
-
-EXPORT int
-pcre_info(const pcre *argument_re, int *optptr, int *first_byte)
-{
-real_pcre internal_re;
-const real_pcre *re = (const real_pcre *)argument_re;
-if (re == NULL) return PCRE_ERROR_NULL;
-if (re->magic_number != MAGIC_NUMBER)
-  {
-  re = try_flipped(re, &internal_re, NULL, NULL);
-  if (re == NULL) return PCRE_ERROR_BADMAGIC;
-  }
-if (optptr != NULL) *optptr = (int)(re->options & PUBLIC_OPTIONS);
-if (first_byte != NULL)
-  *first_byte = ((re->options & PCRE_FIRSTSET) != 0)? re->first_byte :
-     ((re->options & PCRE_STARTLINE) != 0)? -1 : -2;
-return re->top_bracket;
-}
-
-
-
-/*************************************************
-*        Return info about compiled pattern      *
-*************************************************/
-
-/* This is a newer "info" function which has an extensible interface so
-that additional items can be added compatibly.
-
-Arguments:
-  argument_re      points to compiled code
-  extra_data       points extra data, or NULL
-  what             what information is required
-  where            where to put the information
-
-Returns:           0 if data returned, negative on error
-*/
-
-EXPORT int
-pcre_fullinfo(const pcre *argument_re, const pcre_extra *extra_data, int what,
-  void *where)
-{
-real_pcre internal_re;
-pcre_study_data internal_study;
-const real_pcre *re = (const real_pcre *)argument_re;
-const pcre_study_data *study = NULL;
-
-if (re == NULL || where == NULL) return PCRE_ERROR_NULL;
-
-if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_STUDY_DATA) != 0)
-  study = (const pcre_study_data *)extra_data->study_data;
-
-if (re->magic_number != MAGIC_NUMBER)
-  {
-  re = try_flipped(re, &internal_re, study, &internal_study);
-  if (re == NULL) return PCRE_ERROR_BADMAGIC;
-  if (study != NULL) study = &internal_study;
-  }
-
-switch (what)
-  {
-  case PCRE_INFO_OPTIONS:
-  *((unsigned long int *)where) = re->options & PUBLIC_OPTIONS;
-  break;
-
-  case PCRE_INFO_SIZE:
-  *((size_t *)where) = re->size;
-  break;
-
-  case PCRE_INFO_STUDYSIZE:
-  *((size_t *)where) = (study == NULL)? 0 : study->size;
-  break;
-
-  case PCRE_INFO_CAPTURECOUNT:
-  *((int *)where) = re->top_bracket;
-  break;
-
-  case PCRE_INFO_BACKREFMAX:
-  *((int *)where) = re->top_backref;
-  break;
-
-  case PCRE_INFO_FIRSTBYTE:
-  *((int *)where) =
-    ((re->options & PCRE_FIRSTSET) != 0)? re->first_byte :
-    ((re->options & PCRE_STARTLINE) != 0)? -1 : -2;
-  break;
-
-  /* Make sure we pass back the pointer to the bit vector in the external
-  block, not the internal copy (with flipped integer fields). */
-
-  case PCRE_INFO_FIRSTTABLE:
-  *((const uschar **)where) =
-    (study != NULL && (study->options & PCRE_STUDY_MAPPED) != 0)?
-      ((const pcre_study_data *)extra_data->study_data)->start_bits : NULL;
-  break;
-
-  case PCRE_INFO_LASTLITERAL:
-  *((int *)where) =
-    ((re->options & PCRE_REQCHSET) != 0)? re->req_byte : -1;
-  break;
-
-  case PCRE_INFO_NAMEENTRYSIZE:
-  *((int *)where) = re->name_entry_size;
-  break;
-
-  case PCRE_INFO_NAMECOUNT:
-  *((int *)where) = re->name_count;
-  break;
-
-  case PCRE_INFO_NAMETABLE:
-  *((const uschar **)where) = (const uschar *)re + re->name_table_offset;
-  break;
-
-  case PCRE_INFO_DEFAULT_TABLES:
-  *((const uschar **)where) = (const uschar *)pcre_default_tables;
-  break;
-
-  default: return PCRE_ERROR_BADOPTION;
-  }
-
-return 0;
-}
-
-
-
-/*************************************************
-* Return info about what features are configured *
-*************************************************/
-
-/* This is function which has an extensible interface so that additional items
-can be added compatibly.
-
-Arguments:
-  what             what information is required
-  where            where to put the information
-
-Returns:           0 if data returned, negative on error
-*/
-
-EXPORT int
-pcre_config(int what, void *where)
-{
-switch (what)
-  {
-  case PCRE_CONFIG_UTF8:
-#ifdef SUPPORT_UTF8
-  *((int *)where) = 1;
-#else
-  *((int *)where) = 0;
-#endif
-  break;
-
-  case PCRE_CONFIG_UNICODE_PROPERTIES:
-#ifdef SUPPORT_UCP
-  *((int *)where) = 1;
-#else
-  *((int *)where) = 0;
-#endif
-  break;
-
-  case PCRE_CONFIG_NEWLINE:
-  *((int *)where) = NEWLINE;
-  break;
-
-  case PCRE_CONFIG_LINK_SIZE:
-  *((int *)where) = LINK_SIZE;
-  break;
-
-  case PCRE_CONFIG_POSIX_MALLOC_THRESHOLD:
-  *((int *)where) = POSIX_MALLOC_THRESHOLD;
-  break;
-
-  case PCRE_CONFIG_MATCH_LIMIT:
-  *((unsigned int *)where) = MATCH_LIMIT;
-  break;
-
-  case PCRE_CONFIG_STACKRECURSE:
-#ifdef NO_RECURSE
-  *((int *)where) = 0;
-#else
-  *((int *)where) = 1;
-#endif
-  break;
-
-  default: return PCRE_ERROR_BADOPTION;
-  }
-
-return 0;
-}
-
-
-
-#ifdef DEBUG
-/*************************************************
-*        Debugging function to print chars       *
-*************************************************/
-
-/* Print a sequence of chars in printable format, stopping at the end of the
-subject if the requested.
-
-Arguments:
-  p           points to characters
-  length      number to print
-  is_subject  TRUE if printing from within md->start_subject
-  md          pointer to matching data block, if is_subject is TRUE
-
-Returns:     nothing
-*/
-
-static void
-pchars(const uschar *p, int length, BOOL is_subject, match_data *md)
-{
-int c;
-if (is_subject && length > md->end_subject - p) length = md->end_subject - p;
-while (length-- > 0)
-  if (isprint(c = *(p++))) printf("%c", c); else printf("\\x%02x", c);
-}
-#endif
-
+  compile_regex(int, int, int *, uschar **, const uschar **, int *, BOOL, int,
+    int *, int *, branch_chain *, compile_data *);
 
 
 
@@ -894,19 +347,19 @@ a positive value greater than 255 may be returned. 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
-  errorptr   points to the pointer to the error message
-  bracount   number of previous extracting brackets
-  options    the options bits
-  isclass    TRUE if inside a character class
-
-Returns:     zero or positive => a data character
-             negative => a special escape sequence
-             on error, errorptr is set
+  ptrptr         points to the pattern position pointer
+  errorcodeptr   points to the errorcode variable
+  bracount       number of previous extracting brackets
+  options        the options bits
+  isclass        TRUE if inside a character class
+
+Returns:         zero or positive => a data character
+                 negative => a special escape sequence
+                 on error, errorptr is set
 */
 
 static int
-check_escape(const uschar **ptrptr, const char **errorptr, int bracount,
+check_escape(const uschar **ptrptr, int *errorcodeptr, int bracount,
   int options, BOOL isclass)
 {
 const uschar *ptr = *ptrptr;
@@ -915,7 +368,7 @@ int c, i;
 /* If backslash is at the end of the pattern, it's an error. */
 
 c = *(++ptr);
-if (c == 0) *errorptr = ERR1;
+if (c == 0) *errorcodeptr = ERR1;
 
 /* Non-alphamerics are literals. For digits or letters, do an initial lookup in
 a table. A non-zero result is something that can be returned immediately.
@@ -945,7 +398,7 @@ else
     case 'N':
     case 'u':
     case 'U':
-    *errorptr = ERR37;
+    *errorcodeptr = ERR37;
     break;
 
     /* The handling of escape sequences consisting of a string of digits
@@ -1022,7 +475,7 @@ else
         }
       if (*pt == '}')
         {
-        if (c < 0 || count > 8) *errorptr = ERR34;
+        if (c < 0 || count > 8) *errorcodeptr = ERR34;
         ptr = pt;
         break;
         }
@@ -1054,7 +507,7 @@ else
     c = *(++ptr);
     if (c == 0)
       {
-      *errorptr = ERR2;
+      *errorcodeptr = ERR2;
       return 0;
       }
 
@@ -1081,7 +534,7 @@ else
     if ((options & PCRE_EXTRA) != 0) switch(c)
       {
       default:
-      *errorptr = ERR3;
+      *errorcodeptr = ERR3;
       break;
       }
     break;
@@ -1105,15 +558,15 @@ pointing at the P or p. On exit, it is pointing at the final character of the
 escape sequence.
 
 Argument:
-  ptrptr     points to the pattern position pointer
-  negptr     points to a boolean that is set TRUE for negation else FALSE
-  errorptr   points to the pointer to the error message
+  ptrptr         points to the pattern position pointer
+  negptr         points to a boolean that is set TRUE for negation else FALSE
+  errorcodeptr   points to the error code variable
 
 Returns:     value from ucp_type_table, or -1 for an invalid type
 */
 
 static int
-get_ucp(const uschar **ptrptr, BOOL *negptr, const char **errorptr)
+get_ucp(const uschar **ptrptr, BOOL *negptr, int *errorcodeptr)
 {
 int c, i, bot, top;
 const uschar *ptr = *ptrptr;
@@ -1162,23 +615,23 @@ else
 /* Search for a recognized property name using binary chop */
 
 bot = 0;
-top = sizeof(utt)/sizeof(ucp_type_table);
+top = _pcre_utt_size;
 
 while (bot < top)
   {
   i = (bot + top)/2;
-  c = strcmp(name, utt[i].name);
-  if (c == 0) return utt[i].value;
+  c = strcmp(name, _pcre_utt[i].name);
+  if (c == 0) return _pcre_utt[i].value;
   if (c > 0) bot = i + 1; else top = i;
   }
 
 UNKNOWN_RETURN:
-*errorptr = ERR47;
+*errorcodeptr = ERR47;
 *ptrptr = ptr;
 return -1;
 
 ERROR_RETURN:
-*errorptr = ERR46;
+*errorcodeptr = ERR46;
 *ptrptr = ptr;
 return -1;
 }
@@ -1229,23 +682,34 @@ after is_counted_repeat() has confirmed that a repeat-count quantifier exists,
 so the syntax is guaranteed to be correct, but we need to check the values.
 
 Arguments:
-  p          pointer to first char after '{'
-  minp       pointer to int for min
-  maxp       pointer to int for max
-             returned as -1 if no max
-  errorptr   points to pointer to error message
-
-Returns:     pointer to '}' on success;
-             current ptr on error, with errorptr set
+  p              pointer to first char after '{'
+  minp           pointer to int for min
+  maxp           pointer to int for max
+                 returned as -1 if no max
+  errorcodeptr   points to error code variable
+
+Returns:         pointer to '}' on success;
+                 current ptr on error, with errorcodeptr set non-zero
 */
 
 static const uschar *
-read_repeat_counts(const uschar *p, int *minp, int *maxp, const char **errorptr)
+read_repeat_counts(const uschar *p, int *minp, int *maxp, int *errorcodeptr)
 {
 int min = 0;
 int max = -1;
 
+/* Read the minimum value and do a paranoid check: a negative value indicates
+an integer overflow. */
+
 while ((digitab[*p] & ctype_digit) != 0) min = min * 10 + *p++ - '0';
+if (min < 0 || min > 65535)
+  {
+  *errorcodeptr = ERR5;
+  return p;
+  }
+
+/* Read the maximum value if there is one, and again do a paranoid on its size.
+Also, max must not be less than min. */
 
 if (*p == '}') max = min; else
   {
@@ -1253,24 +717,24 @@ if (*p == '}') max = min; else
     {
     max = 0;
     while((digitab[*p] & ctype_digit) != 0) max = max * 10 + *p++ - '0';
+    if (max < 0 || max > 65535)
+      {
+      *errorcodeptr = ERR5;
+      return p;
+      }
     if (max < min)
       {
-      *errorptr = ERR4;
+      *errorcodeptr = ERR4;
       return p;
       }
     }
   }
 
-/* Do paranoid checks, then fill in the required variables, and pass back the
-pointer to the terminating '}'. */
+/* Fill in the required variables, and pass back the pointer to the terminating
+'}'. */
 
-if (min > 65535 || max > 65535)
-  *errorptr = ERR5;
-else
-  {
-  *minp = min;
-  *maxp = max;
-  }
+*minp = min;
+*maxp = max;
 return p;
 }
 
@@ -1315,7 +779,7 @@ for (;;)
     case OP_ASSERTBACK_NOT:
     if (!skipassert) return code;
     do code += GET(code, 1); while (*code == OP_ALT);
-    code += OP_lengths[*code];
+    code += _pcre_OP_lengths[*code];
     break;
 
     case OP_WORD_BOUNDARY:
@@ -1326,7 +790,7 @@ for (;;)
     case OP_CALLOUT:
     case OP_CREF:
     case OP_BRANUMBER:
-    code += OP_lengths[*code];
+    code += _pcre_OP_lengths[*code];
     break;
 
     default:
@@ -1424,7 +888,7 @@ for (;;)
     case OP_DOLL:
     case OP_NOT_WORD_BOUNDARY:
     case OP_WORD_BOUNDARY:
-    cc += OP_lengths[*cc];
+    cc += _pcre_OP_lengths[*cc];
     break;
 
     /* Handle literal characters */
@@ -1558,11 +1022,11 @@ for (;;)
     int n = c - OP_BRA;
     if (n > EXTRACT_BASIC_MAX) n = GET2(code, 2+LINK_SIZE);
     if (n == number) return (uschar *)code;
-    code += OP_lengths[OP_BRA];
+    code += _pcre_OP_lengths[OP_BRA];
     }
   else
     {
-    code += OP_lengths[c];
+    code += _pcre_OP_lengths[c];
 
 #ifdef SUPPORT_UTF8
 
@@ -1630,11 +1094,11 @@ for (;;)
   else if (c == OP_RECURSE) return code;
   else if (c > OP_BRA)
     {
-    code += OP_lengths[OP_BRA];
+    code += _pcre_OP_lengths[OP_BRA];
     }
   else
     {
-    code += OP_lengths[c];
+    code += _pcre_OP_lengths[c];
 
 #ifdef SUPPORT_UTF8
 
@@ -1698,7 +1162,7 @@ could_be_empty_branch(const uschar *code, const uschar *endcode, BOOL utf8)
 register int c;
 for (code = first_significant_code(code + 1 + LINK_SIZE, NULL, 0, TRUE);
      code < endcode;
-     code = first_significant_code(code + OP_lengths[c], NULL, 0, TRUE))
+     code = first_significant_code(code + _pcre_OP_lengths[c], NULL, 0, TRUE))
   {
   const uschar *ccode;
 
@@ -2028,7 +1492,8 @@ int c, chartype, othercase, next;
 
 for (c = *cptr; c <= d; c++)
   {
-  if (ucp_findchar(c, &chartype, &othercase) == ucp_L && othercase != 0) break;
+  if (_pcre_ucp_findchar(c, &chartype, &othercase) == ucp_L && othercase != 0)
+    break;
   }
 
 if (c > d) return FALSE;
@@ -2038,7 +1503,8 @@ next = othercase + 1;
 
 for (++c; c <= d; c++)
   {
-  if (ucp_findchar(c, &chartype, &othercase) != ucp_L || othercase != next)
+  if (_pcre_ucp_findchar(c, &chartype, &othercase) != ucp_L ||
+        othercase != next)
     break;
   next++;
   }
@@ -2064,19 +1530,19 @@ Arguments:
   brackets       points to number of extracting brackets used
   codeptr        points to the pointer to the current code point
   ptrptr         points to the current pattern pointer
-  errorptr       points to pointer to error message
+  errorcodeptr   points to error code variable
   firstbyteptr   set to initial literal character, or < 0 (REQ_UNSET, REQ_NONE)
   reqbyteptr     set to the last literal character required, else < 0
   bcptr          points to current branch chain
   cd             contains pointers to tables etc.
 
 Returns:         TRUE on success
-                 FALSE, with *errorptr set on error
+                 FALSE, with *errorcodeptr set non-zero on error
 */
 
 static BOOL
 compile_branch(int *optionsptr, int *brackets, uschar **codeptr,
-  const uschar **ptrptr, const char **errorptr, int *firstbyteptr,
+  const uschar **ptrptr, int *errorcodeptr, int *firstbyteptr,
   int *reqbyteptr, branch_chain *bcptr, compile_data *cd)
 {
 int repeat_type, op_type;
@@ -2277,7 +1743,7 @@ for (;; ptr++)
     if ((ptr[1] == ':' || ptr[1] == '.' || ptr[1] == '=') &&
         check_posix_syntax(ptr, &tempptr, cd))
       {
-      *errorptr = (ptr[1] == ':')? ERR13 : ERR31;
+      *errorcodeptr = (ptr[1] == ':')? ERR13 : ERR31;
       goto FAILED;
       }
 
@@ -2356,7 +1822,7 @@ for (;; ptr++)
 
         if (ptr[1] != ':')
           {
-          *errorptr = ERR31;
+          *errorcodeptr = ERR31;
           goto FAILED;
           }
 
@@ -2370,7 +1836,7 @@ for (;; ptr++)
         posix_class = check_posix_name(ptr, tempptr - ptr);
         if (posix_class < 0)
           {
-          *errorptr = ERR30;
+          *errorcodeptr = ERR30;
           goto FAILED;
           }
 
@@ -2422,7 +1888,7 @@ for (;; ptr++)
 
       if (c == '\\')
         {
-        c = check_escape(&ptr, errorptr, *brackets, options, TRUE);
+        c = check_escape(&ptr, errorcodeptr, *brackets, options, TRUE);
 
         if (-c == ESC_b) c = '\b';       /* \b is backslash in a class */
         else if (-c == ESC_X) c = 'X';   /* \X is literal X in a class */
@@ -2473,7 +1939,7 @@ for (;; ptr++)
             case ESC_P:
               {
               BOOL negated;
-              int property = get_ucp(&ptr, &negated, errorptr);
+              int property = get_ucp(&ptr, &negated, errorcodeptr);
               if (property < 0) goto FAILED;
               class_utf8 = TRUE;
               *class_utf8data++ = ((-c == ESC_p) != negated)?
@@ -2491,7 +1957,7 @@ for (;; ptr++)
             default:
             if ((options & PCRE_EXTRA) != 0)
               {
-              *errorptr = ERR7;
+              *errorcodeptr = ERR7;
               goto FAILED;
               }
             c = *ptr;              /* The final character */
@@ -2529,7 +1995,7 @@ for (;; ptr++)
         if (d == '\\')
           {
           const uschar *oldptr = ptr;
-          d = check_escape(&ptr, errorptr, *brackets, options, TRUE);
+          d = check_escape(&ptr, errorcodeptr, *brackets, options, TRUE);
 
           /* \b is backslash; \X is literal X; any other special means the '-'
           was literal */
@@ -2592,9 +2058,9 @@ for (;; ptr++)
               else
                 {
                 *class_utf8data++ = XCL_RANGE;
-                class_utf8data += ord2utf8(occ, class_utf8data);
+                class_utf8data += _pcre_ord2utf8(occ, class_utf8data);
                 }
-              class_utf8data += ord2utf8(ocd, class_utf8data);
+              class_utf8data += _pcre_ord2utf8(ocd, class_utf8data);
               }
             }
 #endif  /* SUPPORT_UCP */
@@ -2603,8 +2069,8 @@ for (;; ptr++)
           overlapping ranges. */
 
           *class_utf8data++ = XCL_RANGE;
-          class_utf8data += ord2utf8(c, class_utf8data);
-          class_utf8data += ord2utf8(d, class_utf8data);
+          class_utf8data += _pcre_ord2utf8(c, class_utf8data);
+          class_utf8data += _pcre_ord2utf8(d, class_utf8data);
 
           /* With UCP support, we are done. Without UCP support, there is no
           caseless matching for UTF-8 characters > 127; we can use the bit map
@@ -2655,17 +2121,18 @@ for (;; ptr++)
         {
         class_utf8 = TRUE;
         *class_utf8data++ = XCL_SINGLE;
-        class_utf8data += ord2utf8(c, class_utf8data);
+        class_utf8data += _pcre_ord2utf8(c, class_utf8data);
 
 #ifdef SUPPORT_UCP
         if ((options & PCRE_CASELESS) != 0)
           {
           int chartype;
           int othercase;
-          if (ucp_findchar(c, &chartype, &othercase) >= 0 && othercase > 0)
+          if (_pcre_ucp_findchar(c, &chartype, &othercase) >= 0 &&
+               othercase > 0)
             {
             *class_utf8data++ = XCL_SINGLE;
-            class_utf8data += ord2utf8(othercase, class_utf8data);
+            class_utf8data += _pcre_ord2utf8(othercase, class_utf8data);
             }
           }
 #endif  /* SUPPORT_UCP */
@@ -2733,7 +2200,7 @@ for (;; ptr++)
 
 #ifdef SUPPORT_UTF8
       if (utf8 && class_lastchar > 127)
-        mclength = ord2utf8(class_lastchar, mcbuffer);
+        mclength = _pcre_ord2utf8(class_lastchar, mcbuffer);
       else
 #endif
         {
@@ -2813,8 +2280,8 @@ for (;; ptr++)
 
     case '{':
     if (!is_quantifier) goto NORMAL_CHAR;
-    ptr = read_repeat_counts(ptr+1, &repeat_min, &repeat_max, errorptr);
-    if (*errorptr != NULL) goto FAILED;
+    ptr = read_repeat_counts(ptr+1, &repeat_min, &repeat_max, errorcodeptr);
+    if (*errorcodeptr != 0) goto FAILED;
     goto REPEAT;
 
     case '*':
@@ -2834,7 +2301,7 @@ for (;; ptr++)
     REPEAT:
     if (previous == NULL)
       {
-      *errorptr = ERR9;
+      *errorcodeptr = ERR9;
       goto FAILED;
       }
 
@@ -3273,7 +2740,7 @@ for (;; ptr++)
 
     else
       {
-      *errorptr = ERR11;
+      *errorcodeptr = ERR11;
       goto FAILED;
       }
 
@@ -3357,7 +2824,7 @@ for (;; ptr++)
           while (*(++ptr) != ')') condref = condref*10 + *ptr - '0';
           if (condref == 0)
             {
-            *errorptr = ERR35;
+            *errorcodeptr = ERR35;
             goto FAILED;
             }
           ptr++;
@@ -3409,7 +2876,7 @@ for (;; ptr++)
             n = n * 10 + *ptr - '0';
           if (n > 255)
             {
-            *errorptr = ERR38;
+            *errorcodeptr = ERR38;
             goto FAILED;
             }
           *code++ = n;
@@ -3438,7 +2905,7 @@ for (;; ptr++)
               {
               if (slot[2+namelen] == 0)
                 {
-                *errorptr = ERR43;
+                *errorcodeptr = ERR43;
                 goto FAILED;
                 }
               crc = -1;             /* Current name is substring */
@@ -3476,7 +2943,7 @@ for (;; ptr++)
             }
           if (i >= cd->names_found)
             {
-            *errorptr = ERR15;
+            *errorcodeptr = ERR15;
             goto FAILED;
             }
 
@@ -3526,7 +2993,7 @@ for (;; ptr++)
 
           if (called == NULL)
             {
-            *errorptr = ERR15;
+            *errorcodeptr = ERR15;
             goto FAILED;
             }
 
@@ -3536,7 +3003,7 @@ for (;; ptr++)
 
           if (GET(called, 1) == 0 && could_be_empty(called, code, bcptr, utf8))
             {
-            *errorptr = ERR40;
+            *errorcodeptr = ERR40;
             goto FAILED;
             }
 
@@ -3656,7 +3123,7 @@ for (;; ptr++)
          brackets,                     /* Extracting bracket count */
          &tempcode,                    /* Where to put code (updated) */
          &ptr,                         /* Input pointer (updated) */
-         errorptr,                     /* Where to put an error message */
+         errorcodeptr,                 /* Where to put an error message */
          (bravalue == OP_ASSERTBACK ||
           bravalue == OP_ASSERTBACK_NOT), /* TRUE if back assert */
          skipbytes,                    /* Skip over OP_COND/OP_BRANUMBER */
@@ -3687,7 +3154,7 @@ for (;; ptr++)
 
       if (condcount > 2)
         {
-        *errorptr = ERR27;
+        *errorcodeptr = ERR27;
         goto FAILED;
         }
 
@@ -3757,7 +3224,7 @@ for (;; ptr++)
 
     if (*ptr != ')')
       {
-      *errorptr = ERR14;
+      *errorcodeptr = ERR14;
       goto FAILED;
       }
     break;
@@ -3768,7 +3235,7 @@ for (;; ptr++)
 
     case '\\':
     tempptr = ptr;
-    c = check_escape(&ptr, errorptr, *brackets, options, FALSE);
+    c = check_escape(&ptr, errorcodeptr, *brackets, options, FALSE);
 
     /* Handle metacharacters introduced by \. For ones like \d, the ESC_ values
     are arranged to be the negation of the corresponding OP_values. For the
@@ -3814,7 +3281,7 @@ for (;; ptr++)
       else if (-c == ESC_P || -c == ESC_p)
         {
         BOOL negated;
-        int value = get_ucp(&ptr, &negated, errorptr);
+        int value = get_ucp(&ptr, &negated, errorcodeptr);
         previous = code;
         *code++ = ((-c == ESC_p) != negated)? OP_PROP : OP_NOTPROP;
         *code++ = value;
@@ -3838,7 +3305,7 @@ for (;; ptr++)
 
 #ifdef SUPPORT_UTF8
     if (utf8 && c > 127)
-      mclength = ord2utf8(c, mcbuffer);
+      mclength = _pcre_ord2utf8(c, mcbuffer);
     else
 #endif
 
@@ -3940,7 +3407,7 @@ Argument:
   brackets       -> int containing the number of extracting brackets used
   codeptr        -> the address of the current code pointer
   ptrptr         -> the address of the current pattern pointer
-  errorptr       -> pointer to error message
+  errorcodeptr   -> pointer to error code variable
   lookbehind     TRUE if this is a lookbehind assertion
   skipbytes      skip this many bytes at start (for OP_COND, OP_BRANUMBER)
   firstbyteptr   place to put the first required character, or a negative number
@@ -3953,7 +3420,7 @@ Returns:      TRUE on success
 
 static BOOL
 compile_regex(int options, int oldims, int *brackets, uschar **codeptr,
-  const uschar **ptrptr, const char **errorptr, BOOL lookbehind, int skipbytes,
+  const uschar **ptrptr, int *errorcodeptr, BOOL lookbehind, int skipbytes,
   int *firstbyteptr, int *reqbyteptr, branch_chain *bcptr, compile_data *cd)
 {
 const uschar *ptr = *ptrptr;
@@ -3998,7 +3465,7 @@ for (;;)
 
   /* Now compile the branch */
 
-  if (!compile_branch(&options, brackets, &code, &ptr, errorptr,
+  if (!compile_branch(&options, brackets, &code, &ptr, errorcodeptr,
         &branchfirstbyte, &branchreqbyte, &bc, cd))
     {
     *ptrptr = ptr;
@@ -4056,7 +3523,7 @@ for (;;)
     DPRINTF(("fixed length = %d\n", length));
     if (length < 0)
       {
-      *errorptr = (length == -2)? ERR36 : ERR25;
+      *errorcodeptr = (length == -2)? ERR36 : ERR25;
       *ptrptr = ptr;
       return FALSE;
       }
@@ -4350,114 +3817,39 @@ return c;
 
 
 
-
-#ifdef SUPPORT_UTF8
 /*************************************************
-*         Validate a UTF-8 string                *
+*        Compile a Regular Expression            *
 *************************************************/
 
-/* This function is called (optionally) at the start of compile or match, to
-validate that a supposed UTF-8 string is actually valid. The early check means
-that subsequent code can assume it is dealing with a valid string. The check
-can be turned off for maximum performance, but then consequences of supplying
-an invalid string are then undefined.
+/* This function takes a string and returns a pointer to a block of store
+holding a compiled version of the expression. The original API for this
+function had no error code return variable; it is retained for backwards
+compatibility. The new function is given a new name.
 
 Arguments:
-  string       points to the string
-  length       length of string, or -1 if the string is zero-terminated
-
-Returns:       < 0    if the string is a valid UTF-8 string
-               >= 0   otherwise; the value is the offset of the bad byte
+  pattern       the regular expression
+  options       various option bits
+  errorcodeptr  pointer to error code variable (pcre_compile2() only)
+                  can be NULL if you don't want a code value
+  errorptr      pointer to pointer to error text
+  erroroffset   ptr offset in pattern where error was detected
+  tables        pointer to character tables or NULL
+
+Returns:        pointer to compiled data block, or NULL on error,
+                with errorptr and erroroffset set
 */
 
-static int
-valid_utf8(const uschar *string, int length)
+EXPORT pcre *
+pcre_compile(const char *pattern, int options, const char **errorptr,
+  int *erroroffset, const unsigned char *tables)
 {
-register const uschar *p;
-
-if (length < 0)
-  {
-  for (p = string; *p != 0; p++);
-  length = p - string;
-  }
-
-for (p = string; length-- > 0; p++)
-  {
-  register int ab;
-  register int c = *p;
-  if (c < 128) continue;
-  if ((c & 0xc0) != 0xc0) return p - string;
-  ab = utf8_table4[c & 0x3f];  /* Number of additional bytes */
-  if (length < ab) return p - string;
-  length -= ab;
-
-  /* Check top bits in the second byte */
-  if ((*(++p) & 0xc0) != 0x80) return p - string;
-
-  /* Check for overlong sequences for each different length */
-  switch (ab)
-    {
-    /* Check for xx00 000x */
-    case 1:
-    if ((c & 0x3e) == 0) return p - string;
-    continue;   /* We know there aren't any more bytes to check */
-
-    /* Check for 1110 0000, xx0x xxxx */
-    case 2:
-    if (c == 0xe0 && (*p & 0x20) == 0) return p - string;
-    break;
-
-    /* Check for 1111 0000, xx00 xxxx */
-    case 3:
-    if (c == 0xf0 && (*p & 0x30) == 0) return p - string;
-    break;
+return pcre_compile2(pattern, options, NULL, errorptr, erroroffset, tables);
+}
 
-    /* Check for 1111 1000, xx00 0xxx */
-    case 4:
-    if (c == 0xf8 && (*p & 0x38) == 0) return p - string;
-    break;
-
-    /* Check for leading 0xfe or 0xff, and then for 1111 1100, xx00 00xx */
-    case 5:
-    if (c == 0xfe || c == 0xff ||
-       (c == 0xfc && (*p & 0x3c) == 0)) return p - string;
-    break;
-    }
-
-  /* Check for valid bytes after the 2nd, if any; all must start 10 */
-  while (--ab > 0)
-    {
-    if ((*(++p) & 0xc0) != 0x80) return p - string;
-    }
-  }
-
-return -1;
-}
-#endif
-
-
-
-/*************************************************
-*        Compile a Regular Expression            *
-*************************************************/
-
-/* This function takes a string and returns a pointer to a block of store
-holding a compiled version of the expression.
-
-Arguments:
-  pattern      the regular expression
-  options      various option bits
-  errorptr     pointer to pointer to error text
-  erroroffset  ptr offset in pattern where error was detected
-  tables       pointer to character tables or NULL
-
-Returns:       pointer to compiled data block, or NULL on error,
-               with errorptr and erroroffset set
-*/
 
 EXPORT pcre *
-pcre_compile(const char *pattern, int options, const char **errorptr,
-  int *erroroffset, const unsigned char *tables)
+pcre_compile2(const char *pattern, int options, int *errorcodeptr,
+  const char **errorptr, int *erroroffset, const unsigned char *tables)
 {
 real_pcre *re;
 int length = 1 + LINK_SIZE;      /* For initial BRA plus length */
@@ -4469,11 +3861,13 @@ int item_count = -1;
 int name_count = 0;
 int max_name_size = 0;
 int lastitemlength = 0;
+int errorcode = 0;
 #ifdef SUPPORT_UTF8
 BOOL utf8;
 BOOL class_utf8;
 #endif
 BOOL inescq = FALSE;
+BOOL capturing;
 unsigned int brastackptr = 0;
 size_t size;
 uschar *code;
@@ -4484,18 +3878,26 @@ int brastack[BRASTACK_SIZE];
 uschar bralenstack[BRASTACK_SIZE];
 
 /* We can't pass back an error message if errorptr is NULL; I guess the best we
-can do is just return NULL. */
+can do is just return NULL, but we can set a code value if there is a code
+pointer. */
+
+if (errorptr == NULL)
+  {
+  if (errorcodeptr != NULL) *errorcodeptr = 99;
+  return NULL;
+  }
 
-if (errorptr == NULL) return NULL;
 *errorptr = NULL;
+if (errorcodeptr != NULL) *errorcodeptr = ERR0;
 
 /* However, we can give a message for this error */
 
 if (erroroffset == NULL)
   {
-  *errorptr = ERR16;
-  return NULL;
+  errorcode = ERR16;
+  goto PCRE_EARLY_ERROR_RETURN;
   }
+
 *erroroffset = 0;
 
 /* Can't support UTF8 unless PCRE has been compiled to include the code. */
@@ -4503,28 +3905,28 @@ if (erroroffset == NULL)
 #ifdef SUPPORT_UTF8
 utf8 = (options & PCRE_UTF8) != 0;
 if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0 &&
-     (*erroroffset = valid_utf8((uschar *)pattern, -1)) >= 0)
+     (*erroroffset = _pcre_valid_utf8((uschar *)pattern, -1)) >= 0)
   {
-  *errorptr = ERR44;
-  return NULL;
+  errorcode = ERR44;
+  goto PCRE_EARLY_ERROR_RETURN;
   }
 #else
 if ((options & PCRE_UTF8) != 0)
   {
-  *errorptr = ERR32;
-  return NULL;
+  errorcode = ERR32;
+  goto PCRE_EARLY_ERROR_RETURN;
   }
 #endif
 
 if ((options & ~PUBLIC_OPTIONS) != 0)
   {
-  *errorptr = ERR17;
-  return NULL;
+  errorcode = ERR17;
+  goto PCRE_EARLY_ERROR_RETURN;
   }
 
 /* Set up pointers to the individual character tables */
 
-if (tables == NULL) tables = pcre_default_tables;
+if (tables == NULL) tables = _pcre_default_tables;
 compile_block.lcc = tables + lcc_offset;
 compile_block.fcc = tables + fcc_offset;
 compile_block.cbits = tables + cbits_offset;
@@ -4596,8 +3998,8 @@ while ((c = *(++ptr)) != 0)
     character type. */
 
     case '\\':
-    c = check_escape(&ptr, errorptr, bracount, options, FALSE);
-    if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
+    c = check_escape(&ptr, &errorcode, bracount, options, FALSE);
+    if (errorcode != 0) goto PCRE_ERROR_RETURN;
 
     lastitemlength = 1;     /* Default length of last item for repeats */
 
@@ -4609,8 +4011,8 @@ while ((c = *(++ptr)) != 0)
       if (utf8 && c > 127)
         {
         int i;
-        for (i = 0; i < sizeof(utf8_table1)/sizeof(int); i++)
-          if (c <= utf8_table1[i]) break;
+        for (i = 0; i < _pcre_utf8_table1_size; i++)
+          if (c <= _pcre_utf8_table1[i]) break;
         length += i;
         lastitemlength += i;
         }
@@ -4632,7 +4034,7 @@ while ((c = *(++ptr)) != 0)
 #ifndef SUPPORT_UCP
     if (-c == ESC_X)
       {
-      *errorptr = ERR45;
+      errorcode = ERR45;
       goto PCRE_ERROR_RETURN;
       }
 #endif
@@ -4646,10 +4048,10 @@ while ((c = *(++ptr)) != 0)
       BOOL negated;
       length += 2;
       lastitemlength = 2;
-      if (get_ucp(&ptr, &negated, errorptr) < 0) goto PCRE_ERROR_RETURN;
+      if (get_ucp(&ptr, &negated, &errorcode) < 0) goto PCRE_ERROR_RETURN;
       continue;
 #else
-      *errorptr = ERR45;
+      errorcode = ERR45;
       goto PCRE_ERROR_RETURN;
 #endif
       }
@@ -4671,8 +4073,8 @@ while ((c = *(++ptr)) != 0)
       length += 2;   /* For single back reference */
       if (ptr[1] == '{' && is_counted_repeat(ptr+2))
         {
-        ptr = read_repeat_counts(ptr+2, &min, &max, errorptr);
-        if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
+        ptr = read_repeat_counts(ptr+2, &min, &max, &errorcode);
+        if (errorcode != 0) goto PCRE_ERROR_RETURN;
         if ((min == 0 && (max == 1 || max == -1)) ||
           (min == 1 && max == -1))
             length++;
@@ -4700,8 +4102,8 @@ while ((c = *(++ptr)) != 0)
 
     case '{':
     if (!is_counted_repeat(ptr+1)) goto NORMAL_CHAR;
-    ptr = read_repeat_counts(ptr+1, &min, &max, errorptr);
-    if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
+    ptr = read_repeat_counts(ptr+1, &min, &max, &errorcode);
+    if (errorcode != 0) goto PCRE_ERROR_RETURN;
 
     /* These special cases just insert one extra opcode */
 
@@ -4778,8 +4180,8 @@ while ((c = *(++ptr)) != 0)
 
       if (*ptr == '\\')
         {
-        c = check_escape(&ptr, errorptr, bracount, options, TRUE);
-        if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
+        c = check_escape(&ptr, &errorcode, bracount, options, TRUE);
+        if (errorcode != 0) goto PCRE_ERROR_RETURN;
 
         /* \b is backspace inside a class; \X is literal */
 
@@ -4863,8 +4265,8 @@ while ((c = *(++ptr)) != 0)
           if (ptr[1] == '\\')
             {
             ptr++;
-            d = check_escape(&ptr, errorptr, bracount, options, TRUE);
-            if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
+            d = check_escape(&ptr, &errorcode, bracount, options, TRUE);
+            if (errorcode != 0) goto PCRE_ERROR_RETURN;
             if (-d == ESC_b) d = '\b';        /* backspace */
             else if (-d == ESC_X) d = 'X';    /* literal X in a class */
             }
@@ -4893,7 +4295,7 @@ while ((c = *(++ptr)) != 0)
           class_optcount = 10;     /* Ensure > 1 */
           if (d < c)
             {
-            *errorptr = ERR8;
+            errorcode = ERR8;
             goto PCRE_ERROR_RETURN;
             }
 
@@ -4936,15 +4338,15 @@ while ((c = *(++ptr)) != 0)
 
                 /* An extra item is needed */
 
-                length += 1 + ord2utf8(occ, buffer) +
-                  ((occ == ocd)? 0 : ord2utf8(ocd, buffer));
+                length += 1 + _pcre_ord2utf8(occ, buffer) +
+                  ((occ == ocd)? 0 : _pcre_ord2utf8(ocd, buffer));
                 }
               }
 #endif  /* SUPPORT_UCP */
 
             /* The length of the (possibly extended) range */
 
-            length += 1 + ord2utf8(c, buffer) + ord2utf8(d, buffer);
+            length += 1 + _pcre_ord2utf8(c, buffer) + _pcre_ord2utf8(d, buffer);
             }
 #endif  /* SUPPORT_UTF8 */
 
@@ -4969,9 +4371,9 @@ while ((c = *(++ptr)) != 0)
               }
 #ifdef SUPPORT_UCP
             length += (((options & PCRE_CASELESS) != 0)? 2 : 1) *
-              (1 + ord2utf8(c, buffer));
+              (1 + _pcre_ord2utf8(c, buffer));
 #else   /* SUPPORT_UCP */
-            length += 1 + ord2utf8(c, buffer);
+            length += 1 + _pcre_ord2utf8(c, buffer);
 #endif  /* SUPPORT_UCP */
             }
 #endif  /* SUPPORT_UTF8 */
@@ -4982,7 +4384,7 @@ while ((c = *(++ptr)) != 0)
 
     if (*ptr == 0)                          /* Missing terminating ']' */
       {
-      *errorptr = ERR6;
+      errorcode = ERR6;
       goto PCRE_ERROR_RETURN;
       }
 
@@ -4999,8 +4401,8 @@ while ((c = *(++ptr)) != 0)
 
       if (*ptr != 0 && ptr[1] == '{' && is_counted_repeat(ptr+2))
         {
-        ptr = read_repeat_counts(ptr+2, &min, &max, errorptr);
-        if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
+        ptr = read_repeat_counts(ptr+2, &min, &max, &errorcode);
+        if (errorcode != 0) goto PCRE_ERROR_RETURN;
         if ((min == 0 && (max == 1 || max == -1)) ||
           (min == 1 && max == -1))
             length++;
@@ -5020,6 +4422,7 @@ while ((c = *(++ptr)) != 0)
     case '(':
     branch_newextra = 0;
     bracket_length = 1 + LINK_SIZE;
+    capturing = FALSE;
 
     /* Handle special forms of bracket, which all start (? */
 
@@ -5036,7 +4439,7 @@ while ((c = *(++ptr)) != 0)
         while (*ptr != 0 && *ptr != ')') ptr++;
         if (*ptr == 0)
           {
-          *errorptr = ERR18;
+          errorcode = ERR18;
           goto PCRE_ERROR_RETURN;
           }
         continue;
@@ -5071,7 +4474,7 @@ while ((c = *(++ptr)) != 0)
           while ((digitab[*(++ptr)] & ctype_digit) != 0);
         if (*ptr != ')')
           {
-          *errorptr = ERR29;
+          errorcode = ERR29;
           goto PCRE_ERROR_RETURN;
           }
         length += 1 + LINK_SIZE;
@@ -5097,7 +4500,7 @@ while ((c = *(++ptr)) != 0)
         while ((digitab[*(++ptr)] & ctype_digit) != 0);
         if (*ptr != ')')
           {
-          *errorptr = ERR39;
+          errorcode = ERR39;
           goto PCRE_ERROR_RETURN;
           }
         length += 2 + 2*LINK_SIZE;
@@ -5107,6 +4510,9 @@ while ((c = *(++ptr)) != 0)
 
         case 'P':
         ptr += 3;
+
+        /* Handle the definition of a named subpattern */
+
         if (*ptr == '<')
           {
           const uschar *p;    /* Don't amalgamate; some compilers */
@@ -5114,20 +4520,23 @@ while ((c = *(++ptr)) != 0)
           while ((compile_block.ctypes[*ptr] & ctype_word) != 0) ptr++;
           if (*ptr != '>')
             {
-            *errorptr = ERR42;
+            errorcode = ERR42;
             goto PCRE_ERROR_RETURN;
             }
           name_count++;
           if (ptr - p > max_name_size) max_name_size = (ptr - p);
+          capturing = TRUE;   /* Named parentheses are always capturing */
           break;
           }
 
+        /* Handle back references and recursive calls to named subpatterns */
+
         if (*ptr == '=' || *ptr == '>')
           {
           while ((compile_block.ctypes[*(++ptr)] & ctype_word) != 0);
           if (*ptr != ')')
             {
-            *errorptr = ERR42;
+            errorcode = ERR42;
             goto PCRE_ERROR_RETURN;
             }
           break;
@@ -5135,7 +4544,7 @@ while ((c = *(++ptr)) != 0)
 
         /* Unknown character after (?P */
 
-        *errorptr = ERR41;
+        errorcode = ERR41;
         goto PCRE_ERROR_RETURN;
 
         /* Lookbehinds are in Perl from version 5.005 */
@@ -5148,7 +4557,7 @@ while ((c = *(++ptr)) != 0)
           length += 1 + LINK_SIZE;         /* For the first branch */
           break;
           }
-        *errorptr = ERR24;
+        errorcode = ERR24;
         goto PCRE_ERROR_RETURN;
 
         /* Conditionals are in Perl from version 5.005. The bracket must either
@@ -5168,7 +4577,7 @@ while ((c = *(++ptr)) != 0)
           while ((digitab[*ptr] & ctype_digit) != 0) ptr++;
           if (*ptr != ')')
             {
-            *errorptr = ERR26;
+            errorcode = ERR26;
             goto PCRE_ERROR_RETURN;
             }
           }
@@ -5179,7 +4588,7 @@ while ((c = *(++ptr)) != 0)
              (ptr[3] != '=' && ptr[3] != '!' && ptr[3] != '<') )
             {
             ptr += 2;    /* To get right offset in message */
-            *errorptr = ERR28;
+            errorcode = ERR28;
             goto PCRE_ERROR_RETURN;
             }
           }
@@ -5235,6 +4644,14 @@ while ((c = *(++ptr)) != 0)
             nothing is done here and it is handled during the compiling
             process.
 
+            We allow for more than one options setting at the start. If such
+            settings do not change the existing options, nothing is compiled.
+            However, we must leave space just in case something is compiled.
+            This can happen for pathological sequences such as (?i)(?-i)
+            because the global options will end up with -i set. The space is
+            small and not significant. (Before I did this there was a reported
+            bug with (?i)(?-i) in a machine-generated pattern.)
+
             [Historical note: Up to Perl 5.8, options settings at top level
             were always global settings, wherever they appeared in the pattern.
             That is, they were equivalent to an external setting. From 5.8
@@ -5247,6 +4664,7 @@ while ((c = *(++ptr)) != 0)
               options = (options | set) & (~unset);
               set = unset = 0;     /* To save length */
               item_count--;        /* To allow for several */
+              length += 2;
               }
 
             /* Fall through */
@@ -5276,7 +4694,7 @@ while ((c = *(++ptr)) != 0)
             /* Unrecognized option character */
 
             default:
-            *errorptr = ERR12;
+            errorcode = ERR12;
             goto PCRE_ERROR_RETURN;
             }
           }
@@ -5296,18 +4714,24 @@ while ((c = *(++ptr)) != 0)
           continue;
           }
 
-        /* If options were terminated by ':' control comes here. Fall through
-        to handle the group below. */
+        /* If options were terminated by ':' control comes here. This is a
+        non-capturing group with an options change. There is nothing more that
+        needs to be done because "capturing" is already set FALSE by default;
+        we can just fall through. */
+
         }
       }
 
-    /* Extracting brackets must be counted so we can process escapes in a
-    Perlish way. If the number exceeds EXTRACT_BASIC_MAX we are going to
-    need an additional 3 bytes of store per extracting bracket. However, if
-    PCRE_NO_AUTO)CAPTURE is set, unadorned brackets become non-capturing, so we
-    must leave the count alone (it will aways be zero). */
+    /* Ordinary parentheses, not followed by '?', are capturing unless
+    PCRE_NO_AUTO_CAPTURE is set. */
+
+    else capturing = (options & PCRE_NO_AUTO_CAPTURE) == 0;
+
+    /* Capturing brackets must be counted so we can process escapes in a
+    Perlish way. If the number exceeds EXTRACT_BASIC_MAX we are going to need
+    an additional 3 bytes of memory per capturing bracket. */
 
-    else if ((options & PCRE_NO_AUTO_CAPTURE) == 0)
+    if (capturing)
       {
       bracount++;
       if (bracount > EXTRACT_BASIC_MAX) bracket_length += 3;
@@ -5320,7 +4744,7 @@ while ((c = *(++ptr)) != 0)
 
     if (brastackptr >= sizeof(brastack)/sizeof(int))
       {
-      *errorptr = ERR19;
+      errorcode = ERR19;
       goto PCRE_ERROR_RETURN;
       }
 
@@ -5358,8 +4782,8 @@ while ((c = *(++ptr)) != 0)
 
     if ((c = ptr[1]) == '{' && is_counted_repeat(ptr+2))
       {
-      ptr = read_repeat_counts(ptr+2, &min, &max, errorptr);
-      if (*errorptr != NULL) goto PCRE_ERROR_RETURN;
+      ptr = read_repeat_counts(ptr+2, &min, &max, &errorcode);
+      if (errorcode != 0) goto PCRE_ERROR_RETURN;
       }
     else if (c == '*') { min = 0; max = -1; ptr++; }
     else if (c == '+') { min = 1; max = -1; ptr++; }
@@ -5442,8 +4866,8 @@ if ((options & PCRE_AUTO_CALLOUT) != 0)
 
 if (length > MAX_PATTERN_SIZE)
   {
-  *errorptr = ERR20;
-  return NULL;
+  errorcode = ERR20;
+  goto PCRE_EARLY_ERROR_RETURN;
   }
 
 /* Compute the size of data block needed and get it, either from malloc or
@@ -5454,8 +4878,8 @@ re = (real_pcre *)(pcre_malloc)(size);
 
 if (re == NULL)
   {
-  *errorptr = ERR21;
-  return NULL;
+  errorcode = ERR21;
+  goto PCRE_EARLY_ERROR_RETURN;
   }
 
 /* Put in the magic number, and save the sizes, options, and character table
@@ -5466,11 +4890,12 @@ the end; it's there to help in the case when a regex compiled on a system with
 re->magic_number = MAGIC_NUMBER;
 re->size = size;
 re->options = options;
-re->dummy1 = re->dummy2 = 0;
+re->dummy1 = 0;
 re->name_table_offset = sizeof(real_pcre);
 re->name_entry_size = max_name_size + 3;
 re->name_count = name_count;
-re->tables = (tables == pcre_default_tables)? NULL : tables;
+re->ref_count = 0;
+re->tables = (tables == _pcre_default_tables)? NULL : tables;
 re->nullpad = NULL;
 
 /* The starting points of the name/number translation table and of the code are
@@ -5486,7 +4911,7 @@ compile_block.req_varyopt = 0;
 compile_block.nopartial = FALSE;
 
 /* Set up a starting, non-extracting bracket, then compile the expression. On
-error, *errorptr will be set non-NULL, so we don't need to look at the result
+error, errorcode will be set non-zero, so we don't need to look at the result
 of the function here. */
 
 ptr = (const uschar *)pattern;
@@ -5494,7 +4919,7 @@ code = (uschar *)codestart;
 *code = OP_BRA;
 bracount = 0;
 (void)compile_regex(options, options & PCRE_IMS, &bracount, &code, &ptr,
-  errorptr, FALSE, 0, &firstbyte, &reqbyte, NULL, &compile_block);
+  &errorcode, FALSE, 0, &firstbyte, &reqbyte, NULL, &compile_block);
 re->top_bracket = bracount;
 re->top_backref = compile_block.top_backref;
 
@@ -5502,7 +4927,7 @@ if (compile_block.nopartial) re->options |= PCRE_NOPARTIAL;
 
 /* If not reached end of pattern on success, there's an excess bracket. */
 
-if (*errorptr == NULL && *ptr != 0) *errorptr = ERR22;
+if (errorcode == 0 && *ptr != 0) errorcode = ERR22;
 
 /* Fill in the terminating state and check for disastrous overflow, but
 if debugging, leave the test till after things are printed out. */
@@ -5510,21 +4935,24 @@ if debugging, leave the test till after things are printed out. */
 *code++ = OP_END;
 
 #ifndef DEBUG
-if (code - codestart > length) *errorptr = ERR23;
+if (code - codestart > length) errorcode = ERR23;
 #endif
 
 /* Give an error if there's back reference to a non-existent capturing
 subpattern. */
 
-if (re->top_backref > re->top_bracket) *errorptr = ERR15;
+if (re->top_backref > re->top_bracket) errorcode = ERR15;
 
 /* Failed to compile, or error while post-processing */
 
-if (*errorptr != NULL)
+if (errorcode != 0)
   {
   (pcre_free)(re);
   PCRE_ERROR_RETURN:
   *erroroffset = ptr - (const uschar *)pattern;
+  PCRE_EARLY_ERROR_RETURN:
+  *errorptr = error_texts[errorcode];
+  if (errorcodeptr != NULL) *errorcodeptr = errorcode;
   return NULL;
   }
 
@@ -5610,16 +5038,17 @@ if ((re->options & PCRE_REQCHSET) != 0)
     else printf("Req char = \\x%02x%s\n", ch, caseless);
   }
 
-print_internals(re, stdout);
+_pcre_printint(re, stdout);
 
 /* This check is done here in the debugging case so that the code that
 was compiled can be seen. */
 
 if (code - codestart > length)
   {
-  *errorptr = ERR23;
   (pcre_free)(re);
+  *errorptr = error_texts[ERR23];
   *erroroffset = ptr - (uschar *)pattern;
+  if (errorcodeptr != NULL) *errorcodeptr = ERR23;
   return NULL;
   }
 #endif
@@ -5627,3568 +5056,4 @@ if (code - codestart > length)
 return (pcre *)re;
 }
 
-
-
-/*************************************************
-*          Match a back-reference                *
-*************************************************/
-
-/* If a back reference hasn't been set, the length that is passed is greater
-than the number of characters left in the string, so the match fails.
-
-Arguments:
-  offset      index into the offset vector
-  eptr        points into the subject
-  length      length to be matched
-  md          points to match data block
-  ims         the ims flags
-
-Returns:      TRUE if matched
-*/
-
-static BOOL
-match_ref(int offset, register const uschar *eptr, int length, match_data *md,
-  unsigned long int ims)
-{
-const uschar *p = md->start_subject + md->offset_vector[offset];
-
-#ifdef DEBUG
-if (eptr >= md->end_subject)
-  printf("matching subject <null>");
-else
-  {
-  printf("matching subject ");
-  pchars(eptr, length, TRUE, md);
-  }
-printf(" against backref ");
-pchars(p, length, FALSE, md);
-printf("\n");
-#endif
-
-/* Always fail if not enough characters left */
-
-if (length > md->end_subject - eptr) return FALSE;
-
-/* Separate the caselesss case for speed */
-
-if ((ims & PCRE_CASELESS) != 0)
-  {
-  while (length-- > 0)
-    if (md->lcc[*p++] != md->lcc[*eptr++]) return FALSE;
-  }
-else
-  { while (length-- > 0) if (*p++ != *eptr++) return FALSE; }
-
-return TRUE;
-}
-
-
-#ifdef SUPPORT_UTF8
-/*************************************************
-*       Match character against an XCLASS        *
-*************************************************/
-
-/* This function is called from within the XCLASS code below, to match a
-character against an extended class which might match values > 255.
-
-Arguments:
-  c           the character
-  data        points to the flag byte of the XCLASS data
-
-Returns:      TRUE if character matches, else FALSE
-*/
-
-static BOOL
-match_xclass(int c, const uschar *data)
-{
-int t;
-BOOL negated = (*data & XCL_NOT) != 0;
-
-/* Character values < 256 are matched against a bitmap, if one is present. If
-not, we still carry on, because there may be ranges that start below 256 in the
-additional data. */
-
-if (c < 256)
-  {
-  if ((*data & XCL_MAP) != 0 && (data[1 + c/8] & (1 << (c&7))) != 0)
-    return !negated;   /* char found */
-  }
-
-/* First skip the bit map if present. Then match against the list of Unicode
-properties or large chars or ranges that end with a large char. We won't ever
-encounter XCL_PROP or XCL_NOTPROP when UCP support is not compiled. */
-
-if ((*data++ & XCL_MAP) != 0) data += 32;
-
-while ((t = *data++) != XCL_END)
-  {
-  int x, y;
-  if (t == XCL_SINGLE)
-    {
-    GETCHARINC(x, data);
-    if (c == x) return !negated;
-    }
-  else if (t == XCL_RANGE)
-    {
-    GETCHARINC(x, data);
-    GETCHARINC(y, data);
-    if (c >= x && c <= y) return !negated;
-    }
-
-#ifdef SUPPORT_UCP
-  else  /* XCL_PROP & XCL_NOTPROP */
-    {
-    int chartype, othercase;
-    int rqdtype = *data++;
-    int category = ucp_findchar(c, &chartype, &othercase);
-    if (rqdtype >= 128)
-      {
-      if ((rqdtype - 128 == category) == (t == XCL_PROP)) return !negated;
-      }
-    else
-      {
-      if ((rqdtype == chartype) == (t == XCL_PROP)) return !negated;
-      }
-    }
-#endif  /* SUPPORT_UCP */
-  }
-
-return negated;   /* char did not match */
-}
-#endif
-
-
-/***************************************************************************
-****************************************************************************
-                   RECURSION IN THE match() FUNCTION
-
-The match() function is highly recursive. Some regular expressions can cause
-it to recurse thousands of times. I was writing for Unix, so I just let it
-call itself recursively. This uses the stack for saving everything that has
-to be saved for a recursive call. On Unix, the stack can be large, and this
-works fine.
-
-It turns out that on non-Unix systems there are problems with programs that
-use a lot of stack. (This despite the fact that every last chip has oodles
-of memory these days, and techniques for extending the stack have been known
-for decades.) So....
-
-There is a fudge, triggered by defining NO_RECURSE, which avoids recursive
-calls by keeping local variables that need to be preserved in blocks of memory
-obtained from malloc instead instead of on the stack. Macros are used to
-achieve this so that the actual code doesn't look very different to what it
-always used to.
-****************************************************************************
-***************************************************************************/
-
-
-/* These versions of the macros use the stack, as normal */
-
-#ifndef NO_RECURSE
-#define REGISTER register
-#define RMATCH(rx,ra,rb,rc,rd,re,rf,rg) rx = match(ra,rb,rc,rd,re,rf,rg)
-#define RRETURN(ra) return ra
-#else
-
-
-/* These versions of the macros manage a private stack on the heap. Note
-that the rd argument of RMATCH isn't actually used. It's the md argument of
-match(), which never changes. */
-
-#define REGISTER
-
-#define RMATCH(rx,ra,rb,rc,rd,re,rf,rg)\
-  {\
-  heapframe *newframe = (pcre_stack_malloc)(sizeof(heapframe));\
-  if (setjmp(frame->Xwhere) == 0)\
-    {\
-    newframe->Xeptr = ra;\
-    newframe->Xecode = rb;\
-    newframe->Xoffset_top = rc;\
-    newframe->Xims = re;\
-    newframe->Xeptrb = rf;\
-    newframe->Xflags = rg;\
-    newframe->Xprevframe = frame;\
-    frame = newframe;\
-    DPRINTF(("restarting from line %d\n", __LINE__));\
-    goto HEAP_RECURSE;\
-    }\
-  else\
-    {\
-    DPRINTF(("longjumped back to line %d\n", __LINE__));\
-    frame = md->thisframe;\
-    rx = frame->Xresult;\
-    }\
-  }
-
-#define RRETURN(ra)\
-  {\
-  heapframe *newframe = frame;\
-  frame = newframe->Xprevframe;\
-  (pcre_stack_free)(newframe);\
-  if (frame != NULL)\
-    {\
-    frame->Xresult = ra;\
-    md->thisframe = frame;\
-    longjmp(frame->Xwhere, 1);\
-    }\
-  return ra;\
-  }
-
-
-/* Structure for remembering the local variables in a private frame */
-
-typedef struct heapframe {
-  struct heapframe *Xprevframe;
-
-  /* Function arguments that may change */
-
-  const uschar *Xeptr;
-  const uschar *Xecode;
-  int Xoffset_top;
-  long int Xims;
-  eptrblock *Xeptrb;
-  int Xflags;
-
-  /* Function local variables */
-
-  const uschar *Xcallpat;
-  const uschar *Xcharptr;
-  const uschar *Xdata;
-  const uschar *Xnext;
-  const uschar *Xpp;
-  const uschar *Xprev;
-  const uschar *Xsaved_eptr;
-
-  recursion_info Xnew_recursive;
-
-  BOOL Xcur_is_word;
-  BOOL Xcondition;
-  BOOL Xminimize;
-  BOOL Xprev_is_word;
-
-  unsigned long int Xoriginal_ims;
-
-#ifdef SUPPORT_UCP
-  int Xprop_type;
-  int Xprop_fail_result;
-  int Xprop_category;
-  int Xprop_chartype;
-  int Xprop_othercase;
-  int Xprop_test_against;
-  int *Xprop_test_variable;
-#endif
-
-  int Xctype;
-  int Xfc;
-  int Xfi;
-  int Xlength;
-  int Xmax;
-  int Xmin;
-  int Xnumber;
-  int Xoffset;
-  int Xop;
-  int Xsave_capture_last;
-  int Xsave_offset1, Xsave_offset2, Xsave_offset3;
-  int Xstacksave[REC_STACK_SAVE_MAX];
-
-  eptrblock Xnewptrb;
-
-  /* Place to pass back result, and where to jump back to */
-
-  int  Xresult;
-  jmp_buf Xwhere;
-
-} heapframe;
-
-#endif
-
-
-/***************************************************************************
-***************************************************************************/
-
-
-
-/*************************************************
-*         Match from current position            *
-*************************************************/
-
-/* On entry ecode points to the first opcode, and eptr to the first character
-in the subject string, while eptrb holds the value of eptr at the start of the
-last bracketed group - used for breaking infinite loops matching zero-length
-strings. This function is called recursively in many circumstances. Whenever it
-returns a negative (error) response, the outer incarnation must also return the
-same response.
-
-Performance note: It might be tempting to extract commonly used fields from the
-md structure (e.g. utf8, end_subject) into individual variables to improve
-performance. Tests using gcc on a SPARC disproved this; in the first case, it
-made performance worse.
-
-Arguments:
-   eptr        pointer in subject
-   ecode       position in code
-   offset_top  current top pointer
-   md          pointer to "static" info for the match
-   ims         current /i, /m, and /s options
-   eptrb       pointer to chain of blocks containing eptr at start of
-                 brackets - for testing for empty matches
-   flags       can contain
-                 match_condassert - this is an assertion condition
-                 match_isgroup - this is the start of a bracketed group
-
-Returns:       MATCH_MATCH if matched            )  these values are >= 0
-               MATCH_NOMATCH if failed to match  )
-               a negative PCRE_ERROR_xxx value if aborted by an error condition
-                 (e.g. stopped by recursion limit)
-*/
-
-static int
-match(REGISTER const uschar *eptr, REGISTER const uschar *ecode,
-  int offset_top, match_data *md, unsigned long int ims, eptrblock *eptrb,
-  int flags)
-{
-/* These variables do not need to be preserved over recursion in this function,
-so they can be ordinary variables in all cases. Mark them with "register"
-because they are used a lot in loops. */
-
-register int rrc;    /* Returns from recursive calls */
-register int i;      /* Used for loops not involving calls to RMATCH() */
-register int c;      /* Character values not kept over RMATCH() calls */
-
-/* When recursion is not being used, all "local" variables that have to be
-preserved over calls to RMATCH() are part of a "frame" which is obtained from
-heap storage. Set up the top-level frame here; others are obtained from the
-heap whenever RMATCH() does a "recursion". See the macro definitions above. */
-
-#ifdef NO_RECURSE
-heapframe *frame = (pcre_stack_malloc)(sizeof(heapframe));
-frame->Xprevframe = NULL;            /* Marks the top level */
-
-/* Copy in the original argument variables */
-
-frame->Xeptr = eptr;
-frame->Xecode = ecode;
-frame->Xoffset_top = offset_top;
-frame->Xims = ims;
-frame->Xeptrb = eptrb;
-frame->Xflags = flags;
-
-/* This is where control jumps back to to effect "recursion" */
-
-HEAP_RECURSE:
-
-/* Macros make the argument variables come from the current frame */
-
-#define eptr               frame->Xeptr
-#define ecode              frame->Xecode
-#define offset_top         frame->Xoffset_top
-#define ims                frame->Xims
-#define eptrb              frame->Xeptrb
-#define flags              frame->Xflags
-
-/* Ditto for the local variables */
-
-#ifdef SUPPORT_UTF8
-#define charptr            frame->Xcharptr
-#endif
-#define callpat            frame->Xcallpat
-#define data               frame->Xdata
-#define next               frame->Xnext
-#define pp                 frame->Xpp
-#define prev               frame->Xprev
-#define saved_eptr         frame->Xsaved_eptr
-
-#define new_recursive      frame->Xnew_recursive
-
-#define cur_is_word        frame->Xcur_is_word
-#define condition          frame->Xcondition
-#define minimize           frame->Xminimize
-#define prev_is_word       frame->Xprev_is_word
-
-#define original_ims       frame->Xoriginal_ims
-
-#ifdef SUPPORT_UCP
-#define prop_type          frame->Xprop_type
-#define prop_fail_result   frame->Xprop_fail_result
-#define prop_category      frame->Xprop_category
-#define prop_chartype      frame->Xprop_chartype
-#define prop_othercase     frame->Xprop_othercase
-#define prop_test_against  frame->Xprop_test_against
-#define prop_test_variable frame->Xprop_test_variable
-#endif
-
-#define ctype              frame->Xctype
-#define fc                 frame->Xfc
-#define fi                 frame->Xfi
-#define length             frame->Xlength
-#define max                frame->Xmax
-#define min                frame->Xmin
-#define number             frame->Xnumber
-#define offset             frame->Xoffset
-#define op                 frame->Xop
-#define save_capture_last  frame->Xsave_capture_last
-#define save_offset1       frame->Xsave_offset1
-#define save_offset2       frame->Xsave_offset2
-#define save_offset3       frame->Xsave_offset3
-#define stacksave          frame->Xstacksave
-
-#define newptrb            frame->Xnewptrb
-
-/* When recursion is being used, local variables are allocated on the stack and
-get preserved during recursion in the normal way. In this environment, fi and
-i, and fc and c, can be the same variables. */
-
-#else
-#define fi i
-#define fc c
-
-
-#ifdef SUPPORT_UTF8                /* Many of these variables are used ony */
-const uschar *charptr;             /* small blocks of the code. My normal  */
-#endif                             /* style of coding would have declared  */
-const uschar *callpat;             /* them within each of those blocks.    */
-const uschar *data;                /* However, in order to accommodate the */
-const uschar *next;                /* version of this code that uses an    */
-const uschar *pp;                  /* external "stack" implemented on the  */
-const uschar *prev;                /* heap, it is easier to declare them   */
-const uschar *saved_eptr;          /* all here, so the declarations can    */
-                                   /* be cut out in a block. The only      */
-recursion_info new_recursive;      /* declarations within blocks below are */
-                                   /* for variables that do not have to    */
-BOOL cur_is_word;                  /* be preserved over a recursive call   */
-BOOL condition;                    /* to RMATCH().                         */
-BOOL minimize;
-BOOL prev_is_word;
-
-unsigned long int original_ims;
-
-#ifdef SUPPORT_UCP
-int prop_type;
-int prop_fail_result;
-int prop_category;
-int prop_chartype;
-int prop_othercase;
-int prop_test_against;
-int *prop_test_variable;
-#endif
-
-int ctype;
-int length;
-int max;
-int min;
-int number;
-int offset;
-int op;
-int save_capture_last;
-int save_offset1, save_offset2, save_offset3;
-int stacksave[REC_STACK_SAVE_MAX];
-
-eptrblock newptrb;
-#endif
-
-/* These statements are here to stop the compiler complaining about unitialized
-variables. */
-
-#ifdef SUPPORT_UCP
-prop_fail_result = 0;
-prop_test_against = 0;
-prop_test_variable = NULL;
-#endif
-
-/* OK, now we can get on with the real code of the function. Recursion is
-specified by the macros RMATCH and RRETURN. When NO_RECURSE is *not* defined,
-these just turn into a recursive call to match() and a "return", respectively.
-However, RMATCH isn't like a function call because it's quite a complicated
-macro. It has to be used in one particular way. This shouldn't, however, impact
-performance when true recursion is being used. */
-
-if (md->match_call_count++ >= md->match_limit) RRETURN(PCRE_ERROR_MATCHLIMIT);
-
-original_ims = ims;    /* Save for resetting on ')' */
-
-/* At the start of a bracketed group, add the current subject pointer to the
-stack of such pointers, to be re-instated at the end of the group when we hit
-the closing ket. When match() is called in other circumstances, we don't add to
-this stack. */
-
-if ((flags & match_isgroup) != 0)
-  {
-  newptrb.epb_prev = eptrb;
-  newptrb.epb_saved_eptr = eptr;
-  eptrb = &newptrb;
-  }
-
-/* Now start processing the operations. */
-
-for (;;)
-  {
-  op = *ecode;
-  minimize = FALSE;
-
-  /* For partial matching, remember if we ever hit the end of the subject after
-  matching at least one subject character. */
-
-  if (md->partial &&
-      eptr >= md->end_subject &&
-      eptr > md->start_match)
-    md->hitend = TRUE;
-
-  /* Opening capturing bracket. If there is space in the offset vector, save
-  the current subject position in the working slot at the top of the vector. We
-  mustn't change the current values of the data slot, because they may be set
-  from a previous iteration of this group, and be referred to by a reference
-  inside the group.
-
-  If the bracket fails to match, we need to restore this value and also the
-  values of the final offsets, in case they were set by a previous iteration of
-  the same bracket.
-
-  If there isn't enough space in the offset vector, treat this as if it were a
-  non-capturing bracket. Don't worry about setting the flag for the error case
-  here; that is handled in the code for KET. */
-
-  if (op > OP_BRA)
-    {
-    number = op - OP_BRA;
-
-    /* For extended extraction brackets (large number), we have to fish out the
-    number from a dummy opcode at the start. */
-
-    if (number > EXTRACT_BASIC_MAX)
-      number = GET2(ecode, 2+LINK_SIZE);
-    offset = number << 1;
-
-#ifdef DEBUG
-    printf("start bracket %d subject=", number);
-    pchars(eptr, 16, TRUE, md);
-    printf("\n");
-#endif
-
-    if (offset < md->offset_max)
-      {
-      save_offset1 = md->offset_vector[offset];
-      save_offset2 = md->offset_vector[offset+1];
-      save_offset3 = md->offset_vector[md->offset_end - number];
-      save_capture_last = md->capture_last;
-
-      DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3));
-      md->offset_vector[md->offset_end - number] = eptr - md->start_subject;
-
-      do
-        {
-        RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb,
-          match_isgroup);
-        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-        md->capture_last = save_capture_last;
-        ecode += GET(ecode, 1);
-        }
-      while (*ecode == OP_ALT);
-
-      DPRINTF(("bracket %d failed\n", number));
-
-      md->offset_vector[offset] = save_offset1;
-      md->offset_vector[offset+1] = save_offset2;
-      md->offset_vector[md->offset_end - number] = save_offset3;
-
-      RRETURN(MATCH_NOMATCH);
-      }
-
-    /* Insufficient room for saving captured contents */
-
-    else op = OP_BRA;
-    }
-
-  /* Other types of node can be handled by a switch */
-
-  switch(op)
-    {
-    case OP_BRA:     /* Non-capturing bracket: optimized */
-    DPRINTF(("start bracket 0\n"));
-    do
-      {
-      RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb,
-        match_isgroup);
-      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-      ecode += GET(ecode, 1);
-      }
-    while (*ecode == OP_ALT);
-    DPRINTF(("bracket 0 failed\n"));
-    RRETURN(MATCH_NOMATCH);
-
-    /* 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. */
-
-    case OP_COND:
-    if (ecode[LINK_SIZE+1] == OP_CREF) /* Condition extract or recurse test */
-      {
-      offset = GET2(ecode, LINK_SIZE+2) << 1;  /* Doubled ref number */
-      condition = (offset == CREF_RECURSE * 2)?
-        (md->recursive != NULL) :
-        (offset < offset_top && md->offset_vector[offset] >= 0);
-      RMATCH(rrc, eptr, ecode + (condition?
-        (LINK_SIZE + 4) : (LINK_SIZE + 1 + GET(ecode, 1))),
-        offset_top, md, ims, eptrb, match_isgroup);
-      RRETURN(rrc);
-      }
-
-    /* The condition is an assertion. Call match() to evaluate it - setting
-    the final argument TRUE causes it to stop at the end of an assertion. */
-
-    else
-      {
-      RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,
-          match_condassert | match_isgroup);
-      if (rrc == MATCH_MATCH)
-        {
-        ecode += 1 + LINK_SIZE + GET(ecode, LINK_SIZE+2);
-        while (*ecode == OP_ALT) ecode += GET(ecode, 1);
-        }
-      else if (rrc != MATCH_NOMATCH)
-        {
-        RRETURN(rrc);         /* Need braces because of following else */
-        }
-      else ecode += GET(ecode, 1);
-      RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb,
-        match_isgroup);
-      RRETURN(rrc);
-      }
-    /* Control never reaches here */
-
-    /* Skip over conditional reference or large extraction number data if
-    encountered. */
-
-    case OP_CREF:
-    case OP_BRANUMBER:
-    ecode += 3;
-    break;
-
-    /* End of the pattern. If we are in a recursion, we should restore the
-    offsets appropriately and continue from after the call. */
-
-    case OP_END:
-    if (md->recursive != NULL && md->recursive->group_num == 0)
-      {
-      recursion_info *rec = md->recursive;
-      DPRINTF(("Hit the end in a (?0) recursion\n"));
-      md->recursive = rec->prevrec;
-      memmove(md->offset_vector, rec->offset_save,
-        rec->saved_max * sizeof(int));
-      md->start_match = rec->save_start;
-      ims = original_ims;
-      ecode = rec->after_call;
-      break;
-      }
-
-    /* Otherwise, if PCRE_NOTEMPTY is set, fail if we have matched an empty
-    string - backtracking will then try other alternatives, if any. */
-
-    if (md->notempty && eptr == md->start_match) RRETURN(MATCH_NOMATCH);
-    md->end_match_ptr = eptr;          /* Record where we ended */
-    md->end_offset_top = offset_top;   /* and how many extracts were taken */
-    RRETURN(MATCH_MATCH);
-
-    /* Change option settings */
-
-    case OP_OPT:
-    ims = ecode[1];
-    ecode += 2;
-    DPRINTF(("ims set to %02lx\n", ims));
-    break;
-
-    /* Assertion brackets. Check the alternative branches in turn - the
-    matching won't pass the KET for an assertion. If any one branch matches,
-    the assertion is true. Lookbehind assertions have an OP_REVERSE item at the
-    start of each branch to move the current point backwards, so the code at
-    this level is identical to the lookahead case. */
-
-    case OP_ASSERT:
-    case OP_ASSERTBACK:
-    do
-      {
-      RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,
-        match_isgroup);
-      if (rrc == MATCH_MATCH) break;
-      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-      ecode += GET(ecode, 1);
-      }
-    while (*ecode == OP_ALT);
-    if (*ecode == OP_KET) RRETURN(MATCH_NOMATCH);
-
-    /* If checking an assertion for a condition, return MATCH_MATCH. */
-
-    if ((flags & match_condassert) != 0) RRETURN(MATCH_MATCH);
-
-    /* Continue from after the assertion, updating the offsets high water
-    mark, since extracts may have been taken during the assertion. */
-
-    do ecode += GET(ecode,1); while (*ecode == OP_ALT);
-    ecode += 1 + LINK_SIZE;
-    offset_top = md->end_offset_top;
-    continue;
-
-    /* Negative assertion: all branches must fail to match */
-
-    case OP_ASSERT_NOT:
-    case OP_ASSERTBACK_NOT:
-    do
-      {
-      RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,
-        match_isgroup);
-      if (rrc == MATCH_MATCH) RRETURN(MATCH_NOMATCH);
-      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-      ecode += GET(ecode,1);
-      }
-    while (*ecode == OP_ALT);
-
-    if ((flags & match_condassert) != 0) RRETURN(MATCH_MATCH);
-
-    ecode += 1 + LINK_SIZE;
-    continue;
-
-    /* Move the subject pointer back. This occurs only at the start of
-    each branch of a lookbehind assertion. If we are too close to the start to
-    move back, this match function fails. When working with UTF-8 we move
-    back a number of characters, not bytes. */
-
-    case OP_REVERSE:
-#ifdef SUPPORT_UTF8
-    if (md->utf8)
-      {
-      c = GET(ecode,1);
-      for (i = 0; i < c; i++)
-        {
-        eptr--;
-        if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH);
-        BACKCHAR(eptr)
-        }
-      }
-    else
-#endif
-
-    /* No UTF-8 support, or not in UTF-8 mode: count is byte count */
-
-      {
-      eptr -= GET(ecode,1);
-      if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH);
-      }
-
-    /* Skip to next op code */
-
-    ecode += 1 + LINK_SIZE;
-    break;
-
-    /* The callout item calls an external function, if one is provided, passing
-    details of the match so far. This is mainly for debugging, though the
-    function is able to force a failure. */
-
-    case OP_CALLOUT:
-    if (pcre_callout != NULL)
-      {
-      pcre_callout_block cb;
-      cb.version          = 1;   /* Version 1 of the callout block */
-      cb.callout_number   = ecode[1];
-      cb.offset_vector    = md->offset_vector;
-      cb.subject          = (const char *)md->start_subject;
-      cb.subject_length   = md->end_subject - md->start_subject;
-      cb.start_match      = md->start_match - md->start_subject;
-      cb.current_position = eptr - md->start_subject;
-      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;
-      cb.callout_data     = md->callout_data;
-      if ((rrc = (*pcre_callout)(&cb)) > 0) RRETURN(MATCH_NOMATCH);
-      if (rrc < 0) RRETURN(rrc);
-      }
-    ecode += 2 + 2*LINK_SIZE;
-    break;
-
-    /* Recursion either matches the current regex, or some subexpression. The
-    offset data is the offset to the starting bracket from the start of the
-    whole pattern. (This is so that it works from duplicated subpatterns.)
-
-    If there are any capturing brackets started but not finished, we have to
-    save their starting points and reinstate them after the recursion. However,
-    we don't know how many such there are (offset_top records the completed
-    total) so we just have to save all the potential data. There may be up to
-    65535 such values, which is too large to put on the stack, but using malloc
-    for small numbers seems expensive. As a compromise, the stack is used when
-    there are no more than REC_STACK_SAVE_MAX values to store; otherwise malloc
-    is used. A problem is what to do if the malloc fails ... there is no way of
-    returning to the top level with an error. Save the top REC_STACK_SAVE_MAX
-    values on the stack, and accept that the rest may be wrong.
-
-    There are also other values that have to be saved. We use a chained
-    sequence of blocks that actually live on the stack. Thanks to Robin Houston
-    for the original version of this logic. */
-
-    case OP_RECURSE:
-      {
-      callpat = md->start_code + GET(ecode, 1);
-      new_recursive.group_num = *callpat - OP_BRA;
-
-      /* For extended extraction brackets (large number), we have to fish out
-      the number from a dummy opcode at the start. */
-
-      if (new_recursive.group_num > EXTRACT_BASIC_MAX)
-        new_recursive.group_num = GET2(callpat, 2+LINK_SIZE);
-
-      /* Add to "recursing stack" */
-
-      new_recursive.prevrec = md->recursive;
-      md->recursive = &new_recursive;
-
-      /* Find where to continue from afterwards */
-
-      ecode += 1 + LINK_SIZE;
-      new_recursive.after_call = ecode;
-
-      /* Now save the offset data. */
-
-      new_recursive.saved_max = md->offset_end;
-      if (new_recursive.saved_max <= REC_STACK_SAVE_MAX)
-        new_recursive.offset_save = stacksave;
-      else
-        {
-        new_recursive.offset_save =
-          (int *)(pcre_malloc)(new_recursive.saved_max * sizeof(int));
-        if (new_recursive.offset_save == NULL) RRETURN(PCRE_ERROR_NOMEMORY);
-        }
-
-      memcpy(new_recursive.offset_save, md->offset_vector,
-            new_recursive.saved_max * sizeof(int));
-      new_recursive.save_start = md->start_match;
-      md->start_match = eptr;
-
-      /* OK, now we can do the recursion. For each top-level alternative we
-      restore the offset and recursion data. */
-
-      DPRINTF(("Recursing into group %d\n", new_recursive.group_num));
-      do
-        {
-        RMATCH(rrc, eptr, callpat + 1 + LINK_SIZE, offset_top, md, ims,
-            eptrb, match_isgroup);
-        if (rrc == MATCH_MATCH)
-          {
-          md->recursive = new_recursive.prevrec;
-          if (new_recursive.offset_save != stacksave)
-            (pcre_free)(new_recursive.offset_save);
-          RRETURN(MATCH_MATCH);
-          }
-        else if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-
-        md->recursive = &new_recursive;
-        memcpy(md->offset_vector, new_recursive.offset_save,
-            new_recursive.saved_max * sizeof(int));
-        callpat += GET(callpat, 1);
-        }
-      while (*callpat == OP_ALT);
-
-      DPRINTF(("Recursion didn't match\n"));
-      md->recursive = new_recursive.prevrec;
-      if (new_recursive.offset_save != stacksave)
-        (pcre_free)(new_recursive.offset_save);
-      RRETURN(MATCH_NOMATCH);
-      }
-    /* Control never reaches here */
-
-    /* "Once" brackets are like assertion brackets except that after a match,
-    the point in the subject string is not moved back. Thus there can never be
-    a move back into the brackets. Friedl calls these "atomic" subpatterns.
-    Check the alternative branches in turn - the matching won't pass the KET
-    for this kind of subpattern. If any one branch matches, we carry on as at
-    the end of a normal bracket, leaving the subject pointer. */
-
-    case OP_ONCE:
-      {
-      prev = ecode;
-      saved_eptr = eptr;
-
-      do
-        {
-        RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims,
-          eptrb, match_isgroup);
-        if (rrc == MATCH_MATCH) break;
-        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-        ecode += GET(ecode,1);
-        }
-      while (*ecode == OP_ALT);
-
-      /* If hit the end of the group (which could be repeated), fail */
-
-      if (*ecode != OP_ONCE && *ecode != OP_ALT) RRETURN(MATCH_NOMATCH);
-
-      /* Continue as from after the assertion, updating the offsets high water
-      mark, since extracts may have been taken. */
-
-      do ecode += GET(ecode,1); while (*ecode == OP_ALT);
-
-      offset_top = md->end_offset_top;
-      eptr = md->end_match_ptr;
-
-      /* For a non-repeating ket, just continue at this level. This also
-      happens for a repeating ket if no characters were matched in the group.
-      This is the forcible breaking of infinite loops as implemented in Perl
-      5.005. If there is an options reset, it will get obeyed in the normal
-      course of events. */
-
-      if (*ecode == OP_KET || eptr == saved_eptr)
-        {
-        ecode += 1+LINK_SIZE;
-        break;
-        }
-
-      /* The repeating kets try the rest of the pattern or restart from the
-      preceding bracket, in the appropriate order. We need to reset any options
-      that changed within the bracket before re-running it, so check the next
-      opcode. */
-
-      if (ecode[1+LINK_SIZE] == OP_OPT)
-        {
-        ims = (ims & ~PCRE_IMS) | ecode[4];
-        DPRINTF(("ims set to %02lx at group repeat\n", ims));
-        }
-
-      if (*ecode == OP_KETRMIN)
-        {
-        RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0);
-        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-        RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, match_isgroup);
-        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-        }
-      else  /* OP_KETRMAX */
-        {
-        RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, match_isgroup);
-        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-        RMATCH(rrc, eptr, ecode + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0);
-        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-        }
-      }
-    RRETURN(MATCH_NOMATCH);
-
-    /* An alternation is the end of a branch; scan along to find the end of the
-    bracketed group and go to there. */
-
-    case OP_ALT:
-    do ecode += GET(ecode,1); while (*ecode == OP_ALT);
-    break;
-
-    /* BRAZERO and BRAMINZERO occur just before a bracket group, indicating
-    that it may occur zero times. It may repeat infinitely, or not at all -
-    i.e. it could be ()* or ()? in the pattern. Brackets with fixed upper
-    repeat limits are compiled as a number of copies, with the optional ones
-    preceded by BRAZERO or BRAMINZERO. */
-
-    case OP_BRAZERO:
-      {
-      next = ecode+1;
-      RMATCH(rrc, eptr, next, offset_top, md, ims, eptrb, match_isgroup);
-      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-      do next += GET(next,1); while (*next == OP_ALT);
-      ecode = next + 1+LINK_SIZE;
-      }
-    break;
-
-    case OP_BRAMINZERO:
-      {
-      next = ecode+1;
-      do next += GET(next,1); while (*next == OP_ALT);
-      RMATCH(rrc, eptr, next + 1+LINK_SIZE, offset_top, md, ims, eptrb,
-        match_isgroup);
-      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-      ecode++;
-      }
-    break;
-
-    /* End of a group, repeated or non-repeating. If we are at the end of
-    an assertion "group", stop matching and return MATCH_MATCH, but record the
-    current high water mark for use by positive assertions. Do this also
-    for the "once" (not-backup up) groups. */
-
-    case OP_KET:
-    case OP_KETRMIN:
-    case OP_KETRMAX:
-      {
-      prev = ecode - GET(ecode, 1);
-      saved_eptr = eptrb->epb_saved_eptr;
-
-      /* Back up the stack of bracket start pointers. */
-
-      eptrb = eptrb->epb_prev;
-
-      if (*prev == OP_ASSERT || *prev == OP_ASSERT_NOT ||
-          *prev == OP_ASSERTBACK || *prev == OP_ASSERTBACK_NOT ||
-          *prev == OP_ONCE)
-        {
-        md->end_match_ptr = eptr;      /* For ONCE */
-        md->end_offset_top = offset_top;
-        RRETURN(MATCH_MATCH);
-        }
-
-      /* In all other cases except a conditional group we have to check the
-      group number back at the start and if necessary complete handling an
-      extraction by setting the offsets and bumping the high water mark. */
-
-      if (*prev != OP_COND)
-        {
-        number = *prev - OP_BRA;
-
-        /* For extended extraction brackets (large number), we have to fish out
-        the number from a dummy opcode at the start. */
-
-        if (number > EXTRACT_BASIC_MAX) number = GET2(prev, 2+LINK_SIZE);
-        offset = number << 1;
-
-#ifdef DEBUG
-        printf("end bracket %d", number);
-        printf("\n");
-#endif
-
-        /* Test for a numbered group. This includes groups called as a result
-        of recursion. Note that whole-pattern recursion is coded as a recurse
-        into group 0, so it won't be picked up here. Instead, we catch it when
-        the OP_END is reached. */
-
-        if (number > 0)
-          {
-          md->capture_last = number;
-          if (offset >= md->offset_max) md->offset_overflow = TRUE; else
-            {
-            md->offset_vector[offset] =
-              md->offset_vector[md->offset_end - number];
-            md->offset_vector[offset+1] = eptr - md->start_subject;
-            if (offset_top <= offset) offset_top = offset + 2;
-            }
-
-          /* Handle a recursively called group. Restore the offsets
-          appropriately and continue from after the call. */
-
-          if (md->recursive != NULL && md->recursive->group_num == number)
-            {
-            recursion_info *rec = md->recursive;
-            DPRINTF(("Recursion (%d) succeeded - continuing\n", number));
-            md->recursive = rec->prevrec;
-            md->start_match = rec->save_start;
-            memcpy(md->offset_vector, rec->offset_save,
-              rec->saved_max * sizeof(int));
-            ecode = rec->after_call;
-            ims = original_ims;
-            break;
-            }
-          }
-        }
-
-      /* Reset the value of the ims flags, in case they got changed during
-      the group. */
-
-      ims = original_ims;
-      DPRINTF(("ims reset to %02lx\n", ims));
-
-      /* For a non-repeating ket, just continue at this level. This also
-      happens for a repeating ket if no characters were matched in the group.
-      This is the forcible breaking of infinite loops as implemented in Perl
-      5.005. If there is an options reset, it will get obeyed in the normal
-      course of events. */
-
-      if (*ecode == OP_KET || eptr == saved_eptr)
-        {
-        ecode += 1 + LINK_SIZE;
-        break;
-        }
-
-      /* The repeating kets try the rest of the pattern or restart from the
-      preceding bracket, in the appropriate order. */
-
-      if (*ecode == OP_KETRMIN)
-        {
-        RMATCH(rrc, eptr, ecode + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0);
-        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-        RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, match_isgroup);
-        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-        }
-      else  /* OP_KETRMAX */
-        {
-        RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, match_isgroup);
-        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-        RMATCH(rrc, eptr, ecode + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0);
-        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-        }
-      }
-
-    RRETURN(MATCH_NOMATCH);
-
-    /* Start of subject unless notbol, or after internal newline if multiline */
-
-    case OP_CIRC:
-    if (md->notbol && eptr == md->start_subject) RRETURN(MATCH_NOMATCH);
-    if ((ims & PCRE_MULTILINE) != 0)
-      {
-      if (eptr != md->start_subject && eptr[-1] != NEWLINE)
-        RRETURN(MATCH_NOMATCH);
-      ecode++;
-      break;
-      }
-    /* ... else fall through */
-
-    /* Start of subject assertion */
-
-    case OP_SOD:
-    if (eptr != md->start_subject) RRETURN(MATCH_NOMATCH);
-    ecode++;
-    break;
-
-    /* Start of match assertion */
-
-    case OP_SOM:
-    if (eptr != md->start_subject + md->start_offset) RRETURN(MATCH_NOMATCH);
-    ecode++;
-    break;
-
-    /* Assert before internal newline if multiline, or before a terminating
-    newline unless endonly is set, else end of subject unless noteol is set. */
-
-    case OP_DOLL:
-    if ((ims & PCRE_MULTILINE) != 0)
-      {
-      if (eptr < md->end_subject)
-        { if (*eptr != NEWLINE) RRETURN(MATCH_NOMATCH); }
-      else
-        { if (md->noteol) RRETURN(MATCH_NOMATCH); }
-      ecode++;
-      break;
-      }
-    else
-      {
-      if (md->noteol) RRETURN(MATCH_NOMATCH);
-      if (!md->endonly)
-        {
-        if (eptr < md->end_subject - 1 ||
-           (eptr == md->end_subject - 1 && *eptr != NEWLINE))
-          RRETURN(MATCH_NOMATCH);
-        ecode++;
-        break;
-        }
-      }
-    /* ... else fall through */
-
-    /* End of subject assertion (\z) */
-
-    case OP_EOD:
-    if (eptr < md->end_subject) RRETURN(MATCH_NOMATCH);
-    ecode++;
-    break;
-
-    /* End of subject or ending \n assertion (\Z) */
-
-    case OP_EODN:
-    if (eptr < md->end_subject - 1 ||
-       (eptr == md->end_subject - 1 && *eptr != NEWLINE)) RRETURN(MATCH_NOMATCH);
-    ecode++;
-    break;
-
-    /* Word boundary assertions */
-
-    case OP_NOT_WORD_BOUNDARY:
-    case OP_WORD_BOUNDARY:
-      {
-
-      /* Find out if the previous and current characters are "word" characters.
-      It takes a bit more work in UTF-8 mode. Characters > 255 are assumed to
-      be "non-word" characters. */
-
-#ifdef SUPPORT_UTF8
-      if (md->utf8)
-        {
-        if (eptr == md->start_subject) prev_is_word = FALSE; else
-          {
-          const uschar *lastptr = eptr - 1;
-          while((*lastptr & 0xc0) == 0x80) lastptr--;
-          GETCHAR(c, lastptr);
-          prev_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;
-          }
-        if (eptr >= md->end_subject) cur_is_word = FALSE; else
-          {
-          GETCHAR(c, eptr);
-          cur_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;
-          }
-        }
-      else
-#endif
-
-      /* More streamlined when not in UTF-8 mode */
-
-        {
-        prev_is_word = (eptr != md->start_subject) &&
-          ((md->ctypes[eptr[-1]] & ctype_word) != 0);
-        cur_is_word = (eptr < md->end_subject) &&
-          ((md->ctypes[*eptr] & ctype_word) != 0);
-        }
-
-      /* Now see if the situation is what we want */
-
-      if ((*ecode++ == OP_WORD_BOUNDARY)?
-           cur_is_word == prev_is_word : cur_is_word != prev_is_word)
-        RRETURN(MATCH_NOMATCH);
-      }
-    break;
-
-    /* Match a single character type; inline for speed */
-
-    case OP_ANY:
-    if ((ims & PCRE_DOTALL) == 0 && eptr < md->end_subject && *eptr == NEWLINE)
-      RRETURN(MATCH_NOMATCH);
-    if (eptr++ >= md->end_subject) RRETURN(MATCH_NOMATCH);
-#ifdef SUPPORT_UTF8
-    if (md->utf8)
-      while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
-#endif
-    ecode++;
-    break;
-
-    /* Match a single byte, even in UTF-8 mode. This opcode really does match
-    any byte, even newline, independent of the setting of PCRE_DOTALL. */
-
-    case OP_ANYBYTE:
-    if (eptr++ >= md->end_subject) RRETURN(MATCH_NOMATCH);
-    ecode++;
-    break;
-
-    case OP_NOT_DIGIT:
-    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-    GETCHARINCTEST(c, eptr);
-    if (
-#ifdef SUPPORT_UTF8
-       c < 256 &&
-#endif
-       (md->ctypes[c] & ctype_digit) != 0
-       )
-      RRETURN(MATCH_NOMATCH);
-    ecode++;
-    break;
-
-    case OP_DIGIT:
-    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-    GETCHARINCTEST(c, eptr);
-    if (
-#ifdef SUPPORT_UTF8
-       c >= 256 ||
-#endif
-       (md->ctypes[c] & ctype_digit) == 0
-       )
-      RRETURN(MATCH_NOMATCH);
-    ecode++;
-    break;
-
-    case OP_NOT_WHITESPACE:
-    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-    GETCHARINCTEST(c, eptr);
-    if (
-#ifdef SUPPORT_UTF8
-       c < 256 &&
-#endif
-       (md->ctypes[c] & ctype_space) != 0
-       )
-      RRETURN(MATCH_NOMATCH);
-    ecode++;
-    break;
-
-    case OP_WHITESPACE:
-    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-    GETCHARINCTEST(c, eptr);
-    if (
-#ifdef SUPPORT_UTF8
-       c >= 256 ||
-#endif
-       (md->ctypes[c] & ctype_space) == 0
-       )
-      RRETURN(MATCH_NOMATCH);
-    ecode++;
-    break;
-
-    case OP_NOT_WORDCHAR:
-    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-    GETCHARINCTEST(c, eptr);
-    if (
-#ifdef SUPPORT_UTF8
-       c < 256 &&
-#endif
-       (md->ctypes[c] & ctype_word) != 0
-       )
-      RRETURN(MATCH_NOMATCH);
-    ecode++;
-    break;
-
-    case OP_WORDCHAR:
-    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-    GETCHARINCTEST(c, eptr);
-    if (
-#ifdef SUPPORT_UTF8
-       c >= 256 ||
-#endif
-       (md->ctypes[c] & ctype_word) == 0
-       )
-      RRETURN(MATCH_NOMATCH);
-    ecode++;
-    break;
-
-#ifdef SUPPORT_UCP
-    /* Check the next character by Unicode property. We will get here only
-    if the support is in the binary; otherwise a compile-time error occurs. */
-
-    case OP_PROP:
-    case OP_NOTPROP:
-    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-    GETCHARINCTEST(c, eptr);
-      {
-      int chartype, rqdtype;
-      int othercase;
-      int category = ucp_findchar(c, &chartype, &othercase);
-
-      rqdtype = *(++ecode);
-      ecode++;
-
-      if (rqdtype >= 128)
-        {
-        if ((rqdtype - 128 != category) == (op == OP_PROP))
-          RRETURN(MATCH_NOMATCH);
-        }
-      else
-        {
-        if ((rqdtype != chartype) == (op == OP_PROP))
-          RRETURN(MATCH_NOMATCH);
-        }
-      }
-    break;
-
-    /* Match an extended Unicode sequence. We will get here only if the support
-    is in the binary; otherwise a compile-time error occurs. */
-
-    case OP_EXTUNI:
-    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-    GETCHARINCTEST(c, eptr);
-      {
-      int chartype;
-      int othercase;
-      int category = ucp_findchar(c, &chartype, &othercase);
-      if (category == ucp_M) RRETURN(MATCH_NOMATCH);
-      while (eptr < md->end_subject)
-        {
-        int len = 1;
-        if (!md->utf8) c = *eptr; else
-          {
-          GETCHARLEN(c, eptr, len);
-          }
-        category = ucp_findchar(c, &chartype, &othercase);
-        if (category != ucp_M) break;
-        eptr += len;
-        }
-      }
-    ecode++;
-    break;
-#endif
-
-
-    /* Match a back reference, possibly repeatedly. Look past the end of the
-    item to see if there is repeat information following. The code is similar
-    to that for character classes, but repeated for efficiency. Then obey
-    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:
-      {
-      offset = GET2(ecode, 1) << 1;               /* Doubled ref number */
-      ecode += 3;                                 /* Advance past item */
-
-      /* If the reference is unset, set the length to be longer than the amount
-      of subject left; this ensures that every attempt at a match fails. We
-      can't just fail here, because of the possibility of quantifiers with zero
-      minima. */
-
-      length = (offset >= offset_top || md->offset_vector[offset] < 0)?
-        md->end_subject - eptr + 1 :
-        md->offset_vector[offset+1] - md->offset_vector[offset];
-
-      /* Set up for repetition, or handle the non-repeated case */
-
-      switch (*ecode)
-        {
-        case OP_CRSTAR:
-        case OP_CRMINSTAR:
-        case OP_CRPLUS:
-        case OP_CRMINPLUS:
-        case OP_CRQUERY:
-        case OP_CRMINQUERY:
-        c = *ecode++ - OP_CRSTAR;
-        minimize = (c & 1) != 0;
-        min = rep_min[c];                 /* Pick up values from tables; */
-        max = rep_max[c];                 /* zero for max => infinity */
-        if (max == 0) max = INT_MAX;
-        break;
-
-        case OP_CRRANGE:
-        case OP_CRMINRANGE:
-        minimize = (*ecode == OP_CRMINRANGE);
-        min = GET2(ecode, 1);
-        max = GET2(ecode, 3);
-        if (max == 0) max = INT_MAX;
-        ecode += 5;
-        break;
-
-        default:               /* No repeat follows */
-        if (!match_ref(offset, eptr, length, md, ims)) RRETURN(MATCH_NOMATCH);
-        eptr += length;
-        continue;              /* With the main loop */
-        }
-
-      /* If the length of the reference is zero, just continue with the
-      main loop. */
-
-      if (length == 0) continue;
-
-      /* First, ensure the minimum number of matches are present. We get back
-      the length of the reference string explicitly rather than passing the
-      address of eptr, so that eptr can be a register variable. */
-
-      for (i = 1; i <= min; i++)
-        {
-        if (!match_ref(offset, eptr, length, md, ims)) RRETURN(MATCH_NOMATCH);
-        eptr += length;
-        }
-
-      /* If min = max, continue at the same level without recursion.
-      They are not both allowed to be zero. */
-
-      if (min == max) continue;
-
-      /* If minimizing, keep trying and advancing the pointer */
-
-      if (minimize)
-        {
-        for (fi = min;; fi++)
-          {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-          if (fi >= max || !match_ref(offset, eptr, length, md, ims))
-            RRETURN(MATCH_NOMATCH);
-          eptr += length;
-          }
-        /* Control never gets here */
-        }
-
-      /* If maximizing, find the longest string and work backwards */
-
-      else
-        {
-        pp = eptr;
-        for (i = min; i < max; i++)
-          {
-          if (!match_ref(offset, eptr, length, md, ims)) break;
-          eptr += length;
-          }
-        while (eptr >= pp)
-          {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-          eptr -= length;
-          }
-        RRETURN(MATCH_NOMATCH);
-        }
-      }
-    /* Control never gets here */
-
-
-
-    /* Match a bit-mapped character class, possibly repeatedly. This op code is
-    used when all the characters in the class have values in the range 0-255,
-    and either the matching is caseful, or the characters are in the range
-    0-127 when UTF-8 processing is enabled. The only difference between
-    OP_CLASS and OP_NCLASS occurs when a data character outside the range is
-    encountered.
-
-    First, look past the end of the item to see if there is repeat information
-    following. Then obey similar code to character type repeats - written out
-    again for speed. */
-
-    case OP_NCLASS:
-    case OP_CLASS:
-      {
-      data = ecode + 1;                /* Save for matching */
-      ecode += 33;                     /* Advance past the item */
-
-      switch (*ecode)
-        {
-        case OP_CRSTAR:
-        case OP_CRMINSTAR:
-        case OP_CRPLUS:
-        case OP_CRMINPLUS:
-        case OP_CRQUERY:
-        case OP_CRMINQUERY:
-        c = *ecode++ - OP_CRSTAR;
-        minimize = (c & 1) != 0;
-        min = rep_min[c];                 /* Pick up values from tables; */
-        max = rep_max[c];                 /* zero for max => infinity */
-        if (max == 0) max = INT_MAX;
-        break;
-
-        case OP_CRRANGE:
-        case OP_CRMINRANGE:
-        minimize = (*ecode == OP_CRMINRANGE);
-        min = GET2(ecode, 1);
-        max = GET2(ecode, 3);
-        if (max == 0) max = INT_MAX;
-        ecode += 5;
-        break;
-
-        default:               /* No repeat follows */
-        min = max = 1;
-        break;
-        }
-
-      /* First, ensure the minimum number of matches are present. */
-
-#ifdef SUPPORT_UTF8
-      /* UTF-8 mode */
-      if (md->utf8)
-        {
-        for (i = 1; i <= min; i++)
-          {
-          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-          GETCHARINC(c, eptr);
-          if (c > 255)
-            {
-            if (op == OP_CLASS) RRETURN(MATCH_NOMATCH);
-            }
-          else
-            {
-            if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);
-            }
-          }
-        }
-      else
-#endif
-      /* Not UTF-8 mode */
-        {
-        for (i = 1; i <= min; i++)
-          {
-          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-          c = *eptr++;
-          if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);
-          }
-        }
-
-      /* If max == min we can continue with the main loop without the
-      need to recurse. */
-
-      if (min == max) continue;
-
-      /* If minimizing, keep testing the rest of the expression and advancing
-      the pointer while it matches the class. */
-
-      if (minimize)
-        {
-#ifdef SUPPORT_UTF8
-        /* UTF-8 mode */
-        if (md->utf8)
-          {
-          for (fi = min;; fi++)
-            {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-            if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-            GETCHARINC(c, eptr);
-            if (c > 255)
-              {
-              if (op == OP_CLASS) RRETURN(MATCH_NOMATCH);
-              }
-            else
-              {
-              if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);
-              }
-            }
-          }
-        else
-#endif
-        /* Not UTF-8 mode */
-          {
-          for (fi = min;; fi++)
-            {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-            if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-            c = *eptr++;
-            if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);
-            }
-          }
-        /* Control never gets here */
-        }
-
-      /* If maximizing, find the longest possible run, then work backwards. */
-
-      else
-        {
-        pp = eptr;
-
-#ifdef SUPPORT_UTF8
-        /* UTF-8 mode */
-        if (md->utf8)
-          {
-          for (i = min; i < max; i++)
-            {
-            int len = 1;
-            if (eptr >= md->end_subject) break;
-            GETCHARLEN(c, eptr, len);
-            if (c > 255)
-              {
-              if (op == OP_CLASS) break;
-              }
-            else
-              {
-              if ((data[c/8] & (1 << (c&7))) == 0) break;
-              }
-            eptr += len;
-            }
-          for (;;)
-            {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-            if (eptr-- == pp) break;        /* Stop if tried at original pos */
-            BACKCHAR(eptr);
-            }
-          }
-        else
-#endif
-          /* Not UTF-8 mode */
-          {
-          for (i = min; i < max; i++)
-            {
-            if (eptr >= md->end_subject) break;
-            c = *eptr;
-            if ((data[c/8] & (1 << (c&7))) == 0) break;
-            eptr++;
-            }
-          while (eptr >= pp)
-            {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-            eptr--;
-            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-            }
-          }
-
-        RRETURN(MATCH_NOMATCH);
-        }
-      }
-    /* Control never gets here */
-
-
-    /* Match an extended character class. This opcode is encountered only
-    in UTF-8 mode, because that's the only time it is compiled. */
-
-#ifdef SUPPORT_UTF8
-    case OP_XCLASS:
-      {
-      data = ecode + 1 + LINK_SIZE;                /* Save for matching */
-      ecode += GET(ecode, 1);                      /* Advance past the item */
-
-      switch (*ecode)
-        {
-        case OP_CRSTAR:
-        case OP_CRMINSTAR:
-        case OP_CRPLUS:
-        case OP_CRMINPLUS:
-        case OP_CRQUERY:
-        case OP_CRMINQUERY:
-        c = *ecode++ - OP_CRSTAR;
-        minimize = (c & 1) != 0;
-        min = rep_min[c];                 /* Pick up values from tables; */
-        max = rep_max[c];                 /* zero for max => infinity */
-        if (max == 0) max = INT_MAX;
-        break;
-
-        case OP_CRRANGE:
-        case OP_CRMINRANGE:
-        minimize = (*ecode == OP_CRMINRANGE);
-        min = GET2(ecode, 1);
-        max = GET2(ecode, 3);
-        if (max == 0) max = INT_MAX;
-        ecode += 5;
-        break;
-
-        default:               /* No repeat follows */
-        min = max = 1;
-        break;
-        }
-
-      /* First, ensure the minimum number of matches are present. */
-
-      for (i = 1; i <= min; i++)
-        {
-        if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-        GETCHARINC(c, eptr);
-        if (!match_xclass(c, data)) RRETURN(MATCH_NOMATCH);
-        }
-
-      /* If max == min we can continue with the main loop without the
-      need to recurse. */
-
-      if (min == max) continue;
-
-      /* If minimizing, keep testing the rest of the expression and advancing
-      the pointer while it matches the class. */
-
-      if (minimize)
-        {
-        for (fi = min;; fi++)
-          {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-          if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-          GETCHARINC(c, eptr);
-          if (!match_xclass(c, data)) RRETURN(MATCH_NOMATCH);
-          }
-        /* Control never gets here */
-        }
-
-      /* If maximizing, find the longest possible run, then work backwards. */
-
-      else
-        {
-        pp = eptr;
-        for (i = min; i < max; i++)
-          {
-          int len = 1;
-          if (eptr >= md->end_subject) break;
-          GETCHARLEN(c, eptr, len);
-          if (!match_xclass(c, data)) break;
-          eptr += len;
-          }
-        for(;;)
-          {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-          if (eptr-- == pp) break;        /* Stop if tried at original pos */
-          BACKCHAR(eptr)
-          }
-        RRETURN(MATCH_NOMATCH);
-        }
-
-      /* Control never gets here */
-      }
-#endif    /* End of XCLASS */
-
-    /* Match a single character, casefully */
-
-    case OP_CHAR:
-#ifdef SUPPORT_UTF8
-    if (md->utf8)
-      {
-      length = 1;
-      ecode++;
-      GETCHARLEN(fc, ecode, length);
-      if (length > md->end_subject - eptr) RRETURN(MATCH_NOMATCH);
-      while (length-- > 0) if (*ecode++ != *eptr++) RRETURN(MATCH_NOMATCH);
-      }
-    else
-#endif
-
-    /* Non-UTF-8 mode */
-      {
-      if (md->end_subject - eptr < 1) RRETURN(MATCH_NOMATCH);
-      if (ecode[1] != *eptr++) RRETURN(MATCH_NOMATCH);
-      ecode += 2;
-      }
-    break;
-
-    /* Match a single character, caselessly */
-
-    case OP_CHARNC:
-#ifdef SUPPORT_UTF8
-    if (md->utf8)
-      {
-      length = 1;
-      ecode++;
-      GETCHARLEN(fc, ecode, length);
-
-      if (length > md->end_subject - eptr) RRETURN(MATCH_NOMATCH);
-
-      /* If the pattern character's value is < 128, we have only one byte, and
-      can use the fast lookup table. */
-
-      if (fc < 128)
-        {
-        if (md->lcc[*ecode++] != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH);
-        }
-
-      /* Otherwise we must pick up the subject character */
-
-      else
-        {
-        int dc;
-        GETCHARINC(dc, eptr);
-        ecode += length;
-
-        /* If we have Unicode property support, we can use it to test the other
-        case of the character, if there is one. The result of ucp_findchar() is
-        < 0 if the char isn't found, and othercase is returned as zero if there
-        isn't one. */
-
-        if (fc != dc)
-          {
-#ifdef SUPPORT_UCP
-          int chartype;
-          int othercase;
-          if (ucp_findchar(fc, &chartype, &othercase) < 0 || dc != othercase)
-#endif
-            RRETURN(MATCH_NOMATCH);
-          }
-        }
-      }
-    else
-#endif   /* SUPPORT_UTF8 */
-
-    /* Non-UTF-8 mode */
-      {
-      if (md->end_subject - eptr < 1) RRETURN(MATCH_NOMATCH);
-      if (md->lcc[ecode[1]] != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH);
-      ecode += 2;
-      }
-    break;
-
-    /* Match a single character repeatedly; different opcodes share code. */
-
-    case OP_EXACT:
-    min = max = GET2(ecode, 1);
-    ecode += 3;
-    goto REPEATCHAR;
-
-    case OP_UPTO:
-    case OP_MINUPTO:
-    min = 0;
-    max = GET2(ecode, 1);
-    minimize = *ecode == OP_MINUPTO;
-    ecode += 3;
-    goto REPEATCHAR;
-
-    case OP_STAR:
-    case OP_MINSTAR:
-    case OP_PLUS:
-    case OP_MINPLUS:
-    case OP_QUERY:
-    case OP_MINQUERY:
-    c = *ecode++ - OP_STAR;
-    minimize = (c & 1) != 0;
-    min = rep_min[c];                 /* Pick up values from tables; */
-    max = rep_max[c];                 /* zero for max => infinity */
-    if (max == 0) max = INT_MAX;
-
-    /* Common code for all repeated single-character matches. We can give
-    up quickly if there are fewer than the minimum number of characters left in
-    the subject. */
-
-    REPEATCHAR:
-#ifdef SUPPORT_UTF8
-    if (md->utf8)
-      {
-      length = 1;
-      charptr = ecode;
-      GETCHARLEN(fc, ecode, length);
-      if (min * length > md->end_subject - eptr) RRETURN(MATCH_NOMATCH);
-      ecode += length;
-
-      /* Handle multibyte character matching specially here. There is
-      support for caseless matching if UCP support is present. */
-
-      if (length > 1)
-        {
-        int oclength = 0;
-        uschar occhars[8];
-
-#ifdef SUPPORT_UCP
-        int othercase;
-        int chartype;
-        if ((ims & PCRE_CASELESS) != 0 &&
-             ucp_findchar(fc, &chartype, &othercase) >= 0 &&
-             othercase > 0)
-          oclength = ord2utf8(othercase, occhars);
-#endif  /* SUPPORT_UCP */
-
-        for (i = 1; i <= min; i++)
-          {
-          if (memcmp(eptr, charptr, length) == 0) eptr += length;
-          /* Need braces because of following else */
-          else if (oclength == 0) { RRETURN(MATCH_NOMATCH); }
-          else
-            {
-            if (memcmp(eptr, occhars, oclength) != 0) RRETURN(MATCH_NOMATCH);
-            eptr += oclength;
-            }
-          }
-
-        if (min == max) continue;
-
-        if (minimize)
-          {
-          for (fi = min;; fi++)
-            {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-            if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-            if (memcmp(eptr, charptr, length) == 0) eptr += length;
-            /* Need braces because of following else */
-            else if (oclength == 0) { RRETURN(MATCH_NOMATCH); }
-            else
-              {
-              if (memcmp(eptr, occhars, oclength) != 0) RRETURN(MATCH_NOMATCH);
-              eptr += oclength;
-              }
-            }
-          /* Control never gets here */
-          }
-        else
-          {
-          pp = eptr;
-          for (i = min; i < max; i++)
-            {
-            if (eptr > md->end_subject - length) break;
-            if (memcmp(eptr, charptr, length) == 0) eptr += length;
-            else if (oclength == 0) break;
-            else
-              {
-              if (memcmp(eptr, occhars, oclength) != 0) break;
-              eptr += oclength;
-              }
-            }
-          while (eptr >= pp)
-           {
-           RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-           eptr -= length;
-           }
-          RRETURN(MATCH_NOMATCH);
-          }
-        /* Control never gets here */
-        }
-
-      /* If the length of a UTF-8 character is 1, we fall through here, and
-      obey the code as for non-UTF-8 characters below, though in this case the
-      value of fc will always be < 128. */
-      }
-    else
-#endif  /* SUPPORT_UTF8 */
-
-    /* When not in UTF-8 mode, load a single-byte character. */
-      {
-      if (min > md->end_subject - eptr) RRETURN(MATCH_NOMATCH);
-      fc = *ecode++;
-      }
-
-    /* The value of fc at this point is always less than 256, though we may or
-    may not be in UTF-8 mode. The code is duplicated for the caseless and
-    caseful cases, for speed, since matching characters is likely to be quite
-    common. First, ensure the minimum number of matches are present. If min =
-    max, continue at the same level without recursing. Otherwise, if
-    minimizing, keep trying the rest of the expression and advancing one
-    matching character if failing, up to the maximum. Alternatively, if
-    maximizing, find the maximum number of characters and work backwards. */
-
-    DPRINTF(("matching %c{%d,%d} against subject %.*s\n", fc, min, max,
-      max, eptr));
-
-    if ((ims & PCRE_CASELESS) != 0)
-      {
-      fc = md->lcc[fc];
-      for (i = 1; i <= min; i++)
-        if (fc != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH);
-      if (min == max) continue;
-      if (minimize)
-        {
-        for (fi = min;; fi++)
-          {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-          if (fi >= max || eptr >= md->end_subject ||
-              fc != md->lcc[*eptr++])
-            RRETURN(MATCH_NOMATCH);
-          }
-        /* Control never gets here */
-        }
-      else
-        {
-        pp = eptr;
-        for (i = min; i < max; i++)
-          {
-          if (eptr >= md->end_subject || fc != md->lcc[*eptr]) break;
-          eptr++;
-          }
-        while (eptr >= pp)
-          {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-          eptr--;
-          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-          }
-        RRETURN(MATCH_NOMATCH);
-        }
-      /* Control never gets here */
-      }
-
-    /* Caseful comparisons (includes all multi-byte characters) */
-
-    else
-      {
-      for (i = 1; i <= min; i++) if (fc != *eptr++) RRETURN(MATCH_NOMATCH);
-      if (min == max) continue;
-      if (minimize)
-        {
-        for (fi = min;; fi++)
-          {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-          if (fi >= max || eptr >= md->end_subject || fc != *eptr++)
-            RRETURN(MATCH_NOMATCH);
-          }
-        /* Control never gets here */
-        }
-      else
-        {
-        pp = eptr;
-        for (i = min; i < max; i++)
-          {
-          if (eptr >= md->end_subject || fc != *eptr) break;
-          eptr++;
-          }
-        while (eptr >= pp)
-          {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-          eptr--;
-          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-          }
-        RRETURN(MATCH_NOMATCH);
-        }
-      }
-    /* Control never gets here */
-
-    /* Match a negated single one-byte character. The character we are
-    checking can be multibyte. */
-
-    case OP_NOT:
-    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-    ecode++;
-    GETCHARINCTEST(c, eptr);
-    if ((ims & PCRE_CASELESS) != 0)
-      {
-#ifdef SUPPORT_UTF8
-      if (c < 256)
-#endif
-      c = md->lcc[c];
-      if (md->lcc[*ecode++] == c) RRETURN(MATCH_NOMATCH);
-      }
-    else
-      {
-      if (*ecode++ == c) RRETURN(MATCH_NOMATCH);
-      }
-    break;
-
-    /* Match a negated single one-byte character repeatedly. This is almost a
-    repeat of the code for a repeated single character, but I haven't found a
-    nice way of commoning these up that doesn't require a test of the
-    positive/negative option for each character match. Maybe that wouldn't add
-    very much to the time taken, but character matching *is* what this is all
-    about... */
-
-    case OP_NOTEXACT:
-    min = max = GET2(ecode, 1);
-    ecode += 3;
-    goto REPEATNOTCHAR;
-
-    case OP_NOTUPTO:
-    case OP_NOTMINUPTO:
-    min = 0;
-    max = GET2(ecode, 1);
-    minimize = *ecode == OP_NOTMINUPTO;
-    ecode += 3;
-    goto REPEATNOTCHAR;
-
-    case OP_NOTSTAR:
-    case OP_NOTMINSTAR:
-    case OP_NOTPLUS:
-    case OP_NOTMINPLUS:
-    case OP_NOTQUERY:
-    case OP_NOTMINQUERY:
-    c = *ecode++ - OP_NOTSTAR;
-    minimize = (c & 1) != 0;
-    min = rep_min[c];                 /* Pick up values from tables; */
-    max = rep_max[c];                 /* zero for max => infinity */
-    if (max == 0) max = INT_MAX;
-
-    /* Common code for all repeated single-byte matches. We can give up quickly
-    if there are fewer than the minimum number of bytes left in the
-    subject. */
-
-    REPEATNOTCHAR:
-    if (min > md->end_subject - eptr) RRETURN(MATCH_NOMATCH);
-    fc = *ecode++;
-
-    /* The code is duplicated for the caseless and caseful cases, for speed,
-    since matching characters is likely to be quite common. First, ensure the
-    minimum number of matches are present. If min = max, continue at the same
-    level without recursing. Otherwise, if minimizing, keep trying the rest of
-    the expression and advancing one matching character if failing, up to the
-    maximum. Alternatively, if maximizing, find the maximum number of
-    characters and work backwards. */
-
-    DPRINTF(("negative matching %c{%d,%d} against subject %.*s\n", fc, min, max,
-      max, eptr));
-
-    if ((ims & PCRE_CASELESS) != 0)
-      {
-      fc = md->lcc[fc];
-
-#ifdef SUPPORT_UTF8
-      /* UTF-8 mode */
-      if (md->utf8)
-        {
-        register int d;
-        for (i = 1; i <= min; i++)
-          {
-          GETCHARINC(d, eptr);
-          if (d < 256) d = md->lcc[d];
-          if (fc == d) RRETURN(MATCH_NOMATCH);
-          }
-        }
-      else
-#endif
-
-      /* Not UTF-8 mode */
-        {
-        for (i = 1; i <= min; i++)
-          if (fc == md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH);
-        }
-
-      if (min == max) continue;
-
-      if (minimize)
-        {
-#ifdef SUPPORT_UTF8
-        /* UTF-8 mode */
-        if (md->utf8)
-          {
-          register int d;
-          for (fi = min;; fi++)
-            {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-            GETCHARINC(d, eptr);
-            if (d < 256) d = md->lcc[d];
-            if (fi >= max || eptr >= md->end_subject || fc == d)
-              RRETURN(MATCH_NOMATCH);
-            }
-          }
-        else
-#endif
-        /* Not UTF-8 mode */
-          {
-          for (fi = min;; fi++)
-            {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-            if (fi >= max || eptr >= md->end_subject || fc == md->lcc[*eptr++])
-              RRETURN(MATCH_NOMATCH);
-            }
-          }
-        /* Control never gets here */
-        }
-
-      /* Maximize case */
-
-      else
-        {
-        pp = eptr;
-
-#ifdef SUPPORT_UTF8
-        /* UTF-8 mode */
-        if (md->utf8)
-          {
-          register int d;
-          for (i = min; i < max; i++)
-            {
-            int len = 1;
-            if (eptr >= md->end_subject) break;
-            GETCHARLEN(d, eptr, len);
-            if (d < 256) d = md->lcc[d];
-            if (fc == d) break;
-            eptr += len;
-            }
-          for(;;)
-            {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-            if (eptr-- == pp) break;        /* Stop if tried at original pos */
-            BACKCHAR(eptr);
-            }
-          }
-        else
-#endif
-        /* Not UTF-8 mode */
-          {
-          for (i = min; i < max; i++)
-            {
-            if (eptr >= md->end_subject || fc == md->lcc[*eptr]) break;
-            eptr++;
-            }
-          while (eptr >= pp)
-            {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-            eptr--;
-            }
-          }
-
-        RRETURN(MATCH_NOMATCH);
-        }
-      /* Control never gets here */
-      }
-
-    /* Caseful comparisons */
-
-    else
-      {
-#ifdef SUPPORT_UTF8
-      /* UTF-8 mode */
-      if (md->utf8)
-        {
-        register int d;
-        for (i = 1; i <= min; i++)
-          {
-          GETCHARINC(d, eptr);
-          if (fc == d) RRETURN(MATCH_NOMATCH);
-          }
-        }
-      else
-#endif
-      /* Not UTF-8 mode */
-        {
-        for (i = 1; i <= min; i++)
-          if (fc == *eptr++) RRETURN(MATCH_NOMATCH);
-        }
-
-      if (min == max) continue;
-
-      if (minimize)
-        {
-#ifdef SUPPORT_UTF8
-        /* UTF-8 mode */
-        if (md->utf8)
-          {
-          register int d;
-          for (fi = min;; fi++)
-            {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-            GETCHARINC(d, eptr);
-            if (fi >= max || eptr >= md->end_subject || fc == d)
-              RRETURN(MATCH_NOMATCH);
-            }
-          }
-        else
-#endif
-        /* Not UTF-8 mode */
-          {
-          for (fi = min;; fi++)
-            {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-            if (fi >= max || eptr >= md->end_subject || fc == *eptr++)
-              RRETURN(MATCH_NOMATCH);
-            }
-          }
-        /* Control never gets here */
-        }
-
-      /* Maximize case */
-
-      else
-        {
-        pp = eptr;
-
-#ifdef SUPPORT_UTF8
-        /* UTF-8 mode */
-        if (md->utf8)
-          {
-          register int d;
-          for (i = min; i < max; i++)
-            {
-            int len = 1;
-            if (eptr >= md->end_subject) break;
-            GETCHARLEN(d, eptr, len);
-            if (fc == d) break;
-            eptr += len;
-            }
-          for(;;)
-            {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-            if (eptr-- == pp) break;        /* Stop if tried at original pos */
-            BACKCHAR(eptr);
-            }
-          }
-        else
-#endif
-        /* Not UTF-8 mode */
-          {
-          for (i = min; i < max; i++)
-            {
-            if (eptr >= md->end_subject || fc == *eptr) break;
-            eptr++;
-            }
-          while (eptr >= pp)
-            {
-            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-            eptr--;
-            }
-          }
-
-        RRETURN(MATCH_NOMATCH);
-        }
-      }
-    /* Control never gets here */
-
-    /* Match a single character type repeatedly; several different opcodes
-    share code. This is very similar to the code for single characters, but we
-    repeat it in the interests of efficiency. */
-
-    case OP_TYPEEXACT:
-    min = max = GET2(ecode, 1);
-    minimize = TRUE;
-    ecode += 3;
-    goto REPEATTYPE;
-
-    case OP_TYPEUPTO:
-    case OP_TYPEMINUPTO:
-    min = 0;
-    max = GET2(ecode, 1);
-    minimize = *ecode == OP_TYPEMINUPTO;
-    ecode += 3;
-    goto REPEATTYPE;
-
-    case OP_TYPESTAR:
-    case OP_TYPEMINSTAR:
-    case OP_TYPEPLUS:
-    case OP_TYPEMINPLUS:
-    case OP_TYPEQUERY:
-    case OP_TYPEMINQUERY:
-    c = *ecode++ - OP_TYPESTAR;
-    minimize = (c & 1) != 0;
-    min = rep_min[c];                 /* Pick up values from tables; */
-    max = rep_max[c];                 /* zero for max => infinity */
-    if (max == 0) max = INT_MAX;
-
-    /* Common code for all repeated single character type matches. Note that
-    in UTF-8 mode, '.' matches a character of any length, but for the other
-    character types, the valid characters are all one-byte long. */
-
-    REPEATTYPE:
-    ctype = *ecode++;      /* Code for the character type */
-
-#ifdef SUPPORT_UCP
-    if (ctype == OP_PROP || ctype == OP_NOTPROP)
-      {
-      prop_fail_result = ctype == OP_NOTPROP;
-      prop_type = *ecode++;
-      if (prop_type >= 128)
-        {
-        prop_test_against = prop_type - 128;
-        prop_test_variable = &prop_category;
-        }
-      else
-        {
-        prop_test_against = prop_type;
-        prop_test_variable = &prop_chartype;
-        }
-      }
-    else prop_type = -1;
-#endif
-
-    /* First, ensure the minimum number of matches are present. Use inline
-    code for maximizing the speed, and do the type test once at the start
-    (i.e. keep it out of the loop). Also we can test that there are at least
-    the minimum number of bytes before we start. This isn't as effective in
-    UTF-8 mode, but it does no harm. Separate the UTF-8 code completely as that
-    is tidier. Also separate the UCP code, which can be the same for both UTF-8
-    and single-bytes. */
-
-    if (min > md->end_subject - eptr) RRETURN(MATCH_NOMATCH);
-    if (min > 0)
-      {
-#ifdef SUPPORT_UCP
-      if (prop_type > 0)
-        {
-        for (i = 1; i <= min; i++)
-          {
-          GETCHARINC(c, eptr);
-          prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
-          if ((*prop_test_variable == prop_test_against) == prop_fail_result)
-            RRETURN(MATCH_NOMATCH);
-          }
-        }
-
-      /* Match extended Unicode sequences. We will get here only if the
-      support is in the binary; otherwise a compile-time error occurs. */
-
-      else if (ctype == OP_EXTUNI)
-        {
-        for (i = 1; i <= min; i++)
-          {
-          GETCHARINCTEST(c, eptr);
-          prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
-          if (prop_category == ucp_M) RRETURN(MATCH_NOMATCH);
-          while (eptr < md->end_subject)
-            {
-            int len = 1;
-            if (!md->utf8) c = *eptr; else
-              {
-              GETCHARLEN(c, eptr, len);
-              }
-            prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
-            if (prop_category != ucp_M) break;
-            eptr += len;
-            }
-          }
-        }
-
-      else
-#endif     /* SUPPORT_UCP */
-
-/* Handle all other cases when the coding is UTF-8 */
-
-#ifdef SUPPORT_UTF8
-      if (md->utf8) switch(ctype)
-        {
-        case OP_ANY:
-        for (i = 1; i <= min; i++)
-          {
-          if (eptr >= md->end_subject ||
-             (*eptr++ == NEWLINE && (ims & PCRE_DOTALL) == 0))
-            RRETURN(MATCH_NOMATCH);
-          while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
-          }
-        break;
-
-        case OP_ANYBYTE:
-        eptr += min;
-        break;
-
-        case OP_NOT_DIGIT:
-        for (i = 1; i <= min; i++)
-          {
-          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-          GETCHARINC(c, eptr);
-          if (c < 128 && (md->ctypes[c] & ctype_digit) != 0)
-            RRETURN(MATCH_NOMATCH);
-          }
-        break;
-
-        case OP_DIGIT:
-        for (i = 1; i <= min; i++)
-          {
-          if (eptr >= md->end_subject ||
-             *eptr >= 128 || (md->ctypes[*eptr++] & ctype_digit) == 0)
-            RRETURN(MATCH_NOMATCH);
-          /* No need to skip more bytes - we know it's a 1-byte character */
-          }
-        break;
-
-        case OP_NOT_WHITESPACE:
-        for (i = 1; i <= min; i++)
-          {
-          if (eptr >= md->end_subject ||
-             (*eptr < 128 && (md->ctypes[*eptr++] & ctype_space) != 0))
-            RRETURN(MATCH_NOMATCH);
-          while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
-          }
-        break;
-
-        case OP_WHITESPACE:
-        for (i = 1; i <= min; i++)
-          {
-          if (eptr >= md->end_subject ||
-             *eptr >= 128 || (md->ctypes[*eptr++] & ctype_space) == 0)
-            RRETURN(MATCH_NOMATCH);
-          /* No need to skip more bytes - we know it's a 1-byte character */
-          }
-        break;
-
-        case OP_NOT_WORDCHAR:
-        for (i = 1; i <= min; i++)
-          {
-          if (eptr >= md->end_subject ||
-             (*eptr < 128 && (md->ctypes[*eptr++] & ctype_word) != 0))
-            RRETURN(MATCH_NOMATCH);
-          while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
-          }
-        break;
-
-        case OP_WORDCHAR:
-        for (i = 1; i <= min; i++)
-          {
-          if (eptr >= md->end_subject ||
-             *eptr >= 128 || (md->ctypes[*eptr++] & ctype_word) == 0)
-            RRETURN(MATCH_NOMATCH);
-          /* No need to skip more bytes - we know it's a 1-byte character */
-          }
-        break;
-
-        default:
-        RRETURN(PCRE_ERROR_INTERNAL);
-        }  /* End switch(ctype) */
-
-      else
-#endif     /* SUPPORT_UTF8 */
-
-      /* Code for the non-UTF-8 case for minimum matching of operators other
-      than OP_PROP and OP_NOTPROP. */
-
-      switch(ctype)
-        {
-        case OP_ANY:
-        if ((ims & PCRE_DOTALL) == 0)
-          {
-          for (i = 1; i <= min; i++)
-            if (*eptr++ == NEWLINE) RRETURN(MATCH_NOMATCH);
-          }
-        else eptr += min;
-        break;
-
-        case OP_ANYBYTE:
-        eptr += min;
-        break;
-
-        case OP_NOT_DIGIT:
-        for (i = 1; i <= min; i++)
-          if ((md->ctypes[*eptr++] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH);
-        break;
-
-        case OP_DIGIT:
-        for (i = 1; i <= min; i++)
-          if ((md->ctypes[*eptr++] & ctype_digit) == 0) RRETURN(MATCH_NOMATCH);
-        break;
-
-        case OP_NOT_WHITESPACE:
-        for (i = 1; i <= min; i++)
-          if ((md->ctypes[*eptr++] & ctype_space) != 0) RRETURN(MATCH_NOMATCH);
-        break;
-
-        case OP_WHITESPACE:
-        for (i = 1; i <= min; i++)
-          if ((md->ctypes[*eptr++] & ctype_space) == 0) RRETURN(MATCH_NOMATCH);
-        break;
-
-        case OP_NOT_WORDCHAR:
-        for (i = 1; i <= min; i++)
-          if ((md->ctypes[*eptr++] & ctype_word) != 0)
-            RRETURN(MATCH_NOMATCH);
-        break;
-
-        case OP_WORDCHAR:
-        for (i = 1; i <= min; i++)
-          if ((md->ctypes[*eptr++] & ctype_word) == 0)
-            RRETURN(MATCH_NOMATCH);
-        break;
-
-        default:
-        RRETURN(PCRE_ERROR_INTERNAL);
-        }
-      }
-
-    /* If min = max, continue at the same level without recursing */
-
-    if (min == max) continue;
-
-    /* If minimizing, we have to test the rest of the pattern before each
-    subsequent match. Again, separate the UTF-8 case for speed, and also
-    separate the UCP cases. */
-
-    if (minimize)
-      {
-#ifdef SUPPORT_UCP
-      if (prop_type > 0)
-        {
-        for (fi = min;; fi++)
-          {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-          if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-          GETCHARINC(c, eptr);
-          prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
-          if ((*prop_test_variable == prop_test_against) == prop_fail_result)
-            RRETURN(MATCH_NOMATCH);
-          }
-        }
-
-      /* Match extended Unicode sequences. We will get here only if the
-      support is in the binary; otherwise a compile-time error occurs. */
-
-      else if (ctype == OP_EXTUNI)
-        {
-        for (fi = min;; fi++)
-          {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-          if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-          GETCHARINCTEST(c, eptr);
-          prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
-          if (prop_category == ucp_M) RRETURN(MATCH_NOMATCH);
-          while (eptr < md->end_subject)
-            {
-            int len = 1;
-            if (!md->utf8) c = *eptr; else
-              {
-              GETCHARLEN(c, eptr, len);
-              }
-            prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
-            if (prop_category != ucp_M) break;
-            eptr += len;
-            }
-          }
-        }
-
-      else
-#endif     /* SUPPORT_UCP */
-
-#ifdef SUPPORT_UTF8
-      /* UTF-8 mode */
-      if (md->utf8)
-        {
-        for (fi = min;; fi++)
-          {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-          if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-
-          GETCHARINC(c, eptr);
-          switch(ctype)
-            {
-            case OP_ANY:
-            if ((ims & PCRE_DOTALL) == 0 && c == NEWLINE) RRETURN(MATCH_NOMATCH);
-            break;
-
-            case OP_ANYBYTE:
-            break;
-
-            case OP_NOT_DIGIT:
-            if (c < 256 && (md->ctypes[c] & ctype_digit) != 0)
-              RRETURN(MATCH_NOMATCH);
-            break;
-
-            case OP_DIGIT:
-            if (c >= 256 || (md->ctypes[c] & ctype_digit) == 0)
-              RRETURN(MATCH_NOMATCH);
-            break;
-
-            case OP_NOT_WHITESPACE:
-            if (c < 256 && (md->ctypes[c] & ctype_space) != 0)
-              RRETURN(MATCH_NOMATCH);
-            break;
-
-            case OP_WHITESPACE:
-            if  (c >= 256 || (md->ctypes[c] & ctype_space) == 0)
-              RRETURN(MATCH_NOMATCH);
-            break;
-
-            case OP_NOT_WORDCHAR:
-            if (c < 256 && (md->ctypes[c] & ctype_word) != 0)
-              RRETURN(MATCH_NOMATCH);
-            break;
-
-            case OP_WORDCHAR:
-            if (c >= 256 && (md->ctypes[c] & ctype_word) == 0)
-              RRETURN(MATCH_NOMATCH);
-            break;
-
-            default:
-            RRETURN(PCRE_ERROR_INTERNAL);
-            }
-          }
-        }
-      else
-#endif
-      /* Not UTF-8 mode */
-        {
-        for (fi = min;; fi++)
-          {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-          if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
-          c = *eptr++;
-          switch(ctype)
-            {
-            case OP_ANY:
-            if ((ims & PCRE_DOTALL) == 0 && c == NEWLINE) RRETURN(MATCH_NOMATCH);
-            break;
-
-            case OP_ANYBYTE:
-            break;
-
-            case OP_NOT_DIGIT:
-            if ((md->ctypes[c] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH);
-            break;
-
-            case OP_DIGIT:
-            if ((md->ctypes[c] & ctype_digit) == 0) RRETURN(MATCH_NOMATCH);
-            break;
-
-            case OP_NOT_WHITESPACE:
-            if ((md->ctypes[c] & ctype_space) != 0) RRETURN(MATCH_NOMATCH);
-            break;
-
-            case OP_WHITESPACE:
-            if  ((md->ctypes[c] & ctype_space) == 0) RRETURN(MATCH_NOMATCH);
-            break;
-
-            case OP_NOT_WORDCHAR:
-            if ((md->ctypes[c] & ctype_word) != 0) RRETURN(MATCH_NOMATCH);
-            break;
-
-            case OP_WORDCHAR:
-            if ((md->ctypes[c] & ctype_word) == 0) RRETURN(MATCH_NOMATCH);
-            break;
-
-            default:
-            RRETURN(PCRE_ERROR_INTERNAL);
-            }
-          }
-        }
-      /* Control never gets here */
-      }
-
-    /* If maximizing it is worth using inline code for speed, doing the type
-    test once at the start (i.e. keep it out of the loop). Again, keep the
-    UTF-8 and UCP stuff separate. */
-
-    else
-      {
-      pp = eptr;  /* Remember where we started */
-
-#ifdef SUPPORT_UCP
-      if (prop_type > 0)
-        {
-        for (i = min; i < max; i++)
-          {
-          int len = 1;
-          if (eptr >= md->end_subject) break;
-          GETCHARLEN(c, eptr, len);
-          prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
-          if ((*prop_test_variable == prop_test_against) == prop_fail_result)
-            break;
-          eptr+= len;
-          }
-
-        /* eptr is now past the end of the maximum run */
-
-        for(;;)
-          {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-          if (eptr-- == pp) break;        /* Stop if tried at original pos */
-          BACKCHAR(eptr);
-          }
-        }
-
-      /* Match extended Unicode sequences. We will get here only if the
-      support is in the binary; otherwise a compile-time error occurs. */
-
-      else if (ctype == OP_EXTUNI)
-        {
-        for (i = min; i < max; i++)
-          {
-          if (eptr >= md->end_subject) break;
-          GETCHARINCTEST(c, eptr);
-          prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
-          if (prop_category == ucp_M) break;
-          while (eptr < md->end_subject)
-            {
-            int len = 1;
-            if (!md->utf8) c = *eptr; else
-              {
-              GETCHARLEN(c, eptr, len);
-              }
-            prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
-            if (prop_category != ucp_M) break;
-            eptr += len;
-            }
-          }
-
-        /* eptr is now past the end of the maximum run */
-
-        for(;;)
-          {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-          if (eptr-- == pp) break;        /* Stop if tried at original pos */
-          for (;;)                        /* Move back over one extended */
-            {
-            int len = 1;
-            BACKCHAR(eptr);
-            if (!md->utf8) c = *eptr; else
-              {
-              GETCHARLEN(c, eptr, len);
-              }
-            prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
-            if (prop_category != ucp_M) break;
-            eptr--;
-            }
-          }
-        }
-
-      else
-#endif   /* SUPPORT_UCP */
-
-#ifdef SUPPORT_UTF8
-      /* UTF-8 mode */
-
-      if (md->utf8)
-        {
-        switch(ctype)
-          {
-          case OP_ANY:
-
-          /* Special code is required for UTF8, but when the maximum is unlimited
-          we don't need it, so we repeat the non-UTF8 code. This is probably
-          worth it, because .* is quite a common idiom. */
-
-          if (max < INT_MAX)
-            {
-            if ((ims & PCRE_DOTALL) == 0)
-              {
-              for (i = min; i < max; i++)
-                {
-                if (eptr >= md->end_subject || *eptr == NEWLINE) break;
-                eptr++;
-                while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
-                }
-              }
-            else
-              {
-              for (i = min; i < max; i++)
-                {
-                eptr++;
-                while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
-                }
-              }
-            }
-
-          /* Handle unlimited UTF-8 repeat */
-
-          else
-            {
-            if ((ims & PCRE_DOTALL) == 0)
-              {
-              for (i = min; i < max; i++)
-                {
-                if (eptr >= md->end_subject || *eptr == NEWLINE) break;
-                eptr++;
-                }
-              break;
-              }
-            else
-              {
-              c = max - min;
-              if (c > md->end_subject - eptr) c = md->end_subject - eptr;
-              eptr += c;
-              }
-            }
-          break;
-
-          /* The byte case is the same as non-UTF8 */
-
-          case OP_ANYBYTE:
-          c = max - min;
-          if (c > md->end_subject - eptr) c = md->end_subject - eptr;
-          eptr += c;
-          break;
-
-          case OP_NOT_DIGIT:
-          for (i = min; i < max; i++)
-            {
-            int len = 1;
-            if (eptr >= md->end_subject) break;
-            GETCHARLEN(c, eptr, len);
-            if (c < 256 && (md->ctypes[c] & ctype_digit) != 0) break;
-            eptr+= len;
-            }
-          break;
-
-          case OP_DIGIT:
-          for (i = min; i < max; i++)
-            {
-            int len = 1;
-            if (eptr >= md->end_subject) break;
-            GETCHARLEN(c, eptr, len);
-            if (c >= 256 ||(md->ctypes[c] & ctype_digit) == 0) break;
-            eptr+= len;
-            }
-          break;
-
-          case OP_NOT_WHITESPACE:
-          for (i = min; i < max; i++)
-            {
-            int len = 1;
-            if (eptr >= md->end_subject) break;
-            GETCHARLEN(c, eptr, len);
-            if (c < 256 && (md->ctypes[c] & ctype_space) != 0) break;
-            eptr+= len;
-            }
-          break;
-
-          case OP_WHITESPACE:
-          for (i = min; i < max; i++)
-            {
-            int len = 1;
-            if (eptr >= md->end_subject) break;
-            GETCHARLEN(c, eptr, len);
-            if (c >= 256 ||(md->ctypes[c] & ctype_space) == 0) break;
-            eptr+= len;
-            }
-          break;
-
-          case OP_NOT_WORDCHAR:
-          for (i = min; i < max; i++)
-            {
-            int len = 1;
-            if (eptr >= md->end_subject) break;
-            GETCHARLEN(c, eptr, len);
-            if (c < 256 && (md->ctypes[c] & ctype_word) != 0) break;
-            eptr+= len;
-            }
-          break;
-
-          case OP_WORDCHAR:
-          for (i = min; i < max; i++)
-            {
-            int len = 1;
-            if (eptr >= md->end_subject) break;
-            GETCHARLEN(c, eptr, len);
-            if (c >= 256 || (md->ctypes[c] & ctype_word) == 0) break;
-            eptr+= len;
-            }
-          break;
-
-          default:
-          RRETURN(PCRE_ERROR_INTERNAL);
-          }
-
-        /* eptr is now past the end of the maximum run */
-
-        for(;;)
-          {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-          if (eptr-- == pp) break;        /* Stop if tried at original pos */
-          BACKCHAR(eptr);
-          }
-        }
-      else
-#endif
-
-      /* Not UTF-8 mode */
-        {
-        switch(ctype)
-          {
-          case OP_ANY:
-          if ((ims & PCRE_DOTALL) == 0)
-            {
-            for (i = min; i < max; i++)
-              {
-              if (eptr >= md->end_subject || *eptr == NEWLINE) break;
-              eptr++;
-              }
-            break;
-            }
-          /* For DOTALL case, fall through and treat as \C */
-
-          case OP_ANYBYTE:
-          c = max - min;
-          if (c > md->end_subject - eptr) c = md->end_subject - eptr;
-          eptr += c;
-          break;
-
-          case OP_NOT_DIGIT:
-          for (i = min; i < max; i++)
-            {
-            if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_digit) != 0)
-              break;
-            eptr++;
-            }
-          break;
-
-          case OP_DIGIT:
-          for (i = min; i < max; i++)
-            {
-            if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_digit) == 0)
-              break;
-            eptr++;
-            }
-          break;
-
-          case OP_NOT_WHITESPACE:
-          for (i = min; i < max; i++)
-            {
-            if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_space) != 0)
-              break;
-            eptr++;
-            }
-          break;
-
-          case OP_WHITESPACE:
-          for (i = min; i < max; i++)
-            {
-            if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_space) == 0)
-              break;
-            eptr++;
-            }
-          break;
-
-          case OP_NOT_WORDCHAR:
-          for (i = min; i < max; i++)
-            {
-            if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_word) != 0)
-              break;
-            eptr++;
-            }
-          break;
-
-          case OP_WORDCHAR:
-          for (i = min; i < max; i++)
-            {
-            if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_word) == 0)
-              break;
-            eptr++;
-            }
-          break;
-
-          default:
-          RRETURN(PCRE_ERROR_INTERNAL);
-          }
-
-        /* eptr is now past the end of the maximum run */
-
-        while (eptr >= pp)
-          {
-          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
-          eptr--;
-          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
-          }
-        }
-
-      /* Get here if we can't make it match with any permitted repetitions */
-
-      RRETURN(MATCH_NOMATCH);
-      }
-    /* Control never gets here */
-
-    /* There's been some horrible disaster. Since all codes > OP_BRA are
-    for capturing brackets, and there shouldn't be any gaps between 0 and
-    OP_BRA, arrival here can only mean there is something seriously wrong
-    in the code above or the OP_xxx definitions. */
-
-    default:
-    DPRINTF(("Unknown opcode %d\n", *ecode));
-    RRETURN(PCRE_ERROR_UNKNOWN_NODE);
-    }
-
-  /* Do not stick any code in here without much thought; it is assumed
-  that "continue" in the code above comes out to here to repeat the main
-  loop. */
-
-  }             /* End of main loop */
-/* Control never reaches here */
-}
-
-
-/***************************************************************************
-****************************************************************************
-                   RECURSION IN THE match() FUNCTION
-
-Undefine all the macros that were defined above to handle this. */
-
-#ifdef NO_RECURSE
-#undef eptr
-#undef ecode
-#undef offset_top
-#undef ims
-#undef eptrb
-#undef flags
-
-#undef callpat
-#undef charptr
-#undef data
-#undef next
-#undef pp
-#undef prev
-#undef saved_eptr
-
-#undef new_recursive
-
-#undef cur_is_word
-#undef condition
-#undef minimize
-#undef prev_is_word
-
-#undef original_ims
-
-#undef ctype
-#undef length
-#undef max
-#undef min
-#undef number
-#undef offset
-#undef op
-#undef save_capture_last
-#undef save_offset1
-#undef save_offset2
-#undef save_offset3
-#undef stacksave
-
-#undef newptrb
-
-#endif
-
-/* These two are defined as macros in both cases */
-
-#undef fc
-#undef fi
-
-/***************************************************************************
-***************************************************************************/
-
-
-
-/*************************************************
-*         Execute a Regular Expression           *
-*************************************************/
-
-/* This function applies a compiled re to a subject string and picks out
-portions of the string if it matches. Two elements in the vector are set for
-each substring: the offsets to the start and end of the substring.
-
-Arguments:
-  argument_re     points to the compiled expression
-  extra_data      points to extra data or is NULL
-  subject         points to the subject string
-  length          length of subject string (may contain binary zeros)
-  start_offset    where to start in the subject string
-  options         option bits
-  offsets         points to a vector of ints to be filled in with offsets
-  offsetcount     the number of elements in the vector
-
-Returns:          > 0 => success; value is the number of elements filled in
-                  = 0 => success, but offsets is not big enough
-                   -1 => failed to match
-                 < -1 => some kind of unexpected problem
-*/
-
-EXPORT int
-pcre_exec(const pcre *argument_re, const pcre_extra *extra_data,
-  const char *subject, int length, int start_offset, int options, int *offsets,
-  int offsetcount)
-{
-int rc, resetcount, ocount;
-int first_byte = -1;
-int req_byte = -1;
-int req_byte2 = -1;
-unsigned long int ims = 0;
-BOOL using_temporary_offsets = FALSE;
-BOOL anchored;
-BOOL startline;
-BOOL first_byte_caseless = FALSE;
-BOOL req_byte_caseless = FALSE;
-match_data match_block;
-const uschar *tables;
-const uschar *start_bits = NULL;
-const uschar *start_match = (const uschar *)subject + start_offset;
-const uschar *end_subject;
-const uschar *req_byte_ptr = start_match - 1;
-
-pcre_study_data internal_study;
-const pcre_study_data *study;
-
-real_pcre internal_re;
-const real_pcre *external_re = (const real_pcre *)argument_re;
-const real_pcre *re = external_re;
-
-/* Plausibility checks */
-
-if ((options & ~PUBLIC_EXEC_OPTIONS) != 0) return PCRE_ERROR_BADOPTION;
-if (re == NULL || subject == NULL ||
-   (offsets == NULL && offsetcount > 0)) return PCRE_ERROR_NULL;
-if (offsetcount < 0) return PCRE_ERROR_BADCOUNT;
-
-/* Fish out the optional data from the extra_data structure, first setting
-the default values. */
-
-study = NULL;
-match_block.match_limit = MATCH_LIMIT;
-match_block.callout_data = NULL;
-
-/* The table pointer is always in native byte order. */
-
-tables = external_re->tables;
-
-if (extra_data != NULL)
-  {
-  register unsigned int flags = extra_data->flags;
-  if ((flags & PCRE_EXTRA_STUDY_DATA) != 0)
-    study = (const pcre_study_data *)extra_data->study_data;
-  if ((flags & PCRE_EXTRA_MATCH_LIMIT) != 0)
-    match_block.match_limit = extra_data->match_limit;
-  if ((flags & PCRE_EXTRA_CALLOUT_DATA) != 0)
-    match_block.callout_data = extra_data->callout_data;
-  if ((flags & PCRE_EXTRA_TABLES) != 0) tables = extra_data->tables;
-  }
-
-/* If the exec call supplied NULL for tables, use the inbuilt ones. This
-is a feature that makes it possible to save compiled regex and re-use them
-in other programs later. */
-
-if (tables == NULL) tables = pcre_default_tables;
-
-/* Check that the first field in the block is the magic number. If it is not,
-test for a regex that was compiled on a host of opposite endianness. If this is
-the case, flipped values are put in internal_re and internal_study if there was
-study data too. */
-
-if (re->magic_number != MAGIC_NUMBER)
-  {
-  re = try_flipped(re, &internal_re, study, &internal_study);
-  if (re == NULL) return PCRE_ERROR_BADMAGIC;
-  if (study != NULL) study = &internal_study;
-  }
-
-/* Set up other data */
-
-anchored = ((re->options | options) & PCRE_ANCHORED) != 0;
-startline = (re->options & PCRE_STARTLINE) != 0;
-
-/* The code starts after the real_pcre block and the capture name table. */
-
-match_block.start_code = (const uschar *)external_re + re->name_table_offset +
-  re->name_count * re->name_entry_size;
-
-match_block.start_subject = (const uschar *)subject;
-match_block.start_offset = start_offset;
-match_block.end_subject = match_block.start_subject + length;
-end_subject = match_block.end_subject;
-
-match_block.endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;
-match_block.utf8 = (re->options & PCRE_UTF8) != 0;
-
-match_block.notbol = (options & PCRE_NOTBOL) != 0;
-match_block.noteol = (options & PCRE_NOTEOL) != 0;
-match_block.notempty = (options & PCRE_NOTEMPTY) != 0;
-match_block.partial = (options & PCRE_PARTIAL) != 0;
-match_block.hitend = FALSE;
-
-match_block.recursive = NULL;                   /* No recursion at top level */
-
-match_block.lcc = tables + lcc_offset;
-match_block.ctypes = tables + ctypes_offset;
-
-/* Partial matching is supported only for a restricted set of regexes at the
-moment. */
-
-if (match_block.partial && (re->options & PCRE_NOPARTIAL) != 0)
-  return PCRE_ERROR_BADPARTIAL;
-
-/* Check a UTF-8 string if required. Unfortunately there's no way of passing
-back the character offset. */
-
-#ifdef SUPPORT_UTF8
-if (match_block.utf8 && (options & PCRE_NO_UTF8_CHECK) == 0)
-  {
-  if (valid_utf8((uschar *)subject, length) >= 0)
-    return PCRE_ERROR_BADUTF8;
-  if (start_offset > 0 && start_offset < length)
-    {
-    int tb = ((uschar *)subject)[start_offset];
-    if (tb > 127)
-      {
-      tb &= 0xc0;
-      if (tb != 0 && tb != 0xc0) return PCRE_ERROR_BADUTF8_OFFSET;
-      }
-    }
-  }
-#endif
-
-/* The ims options can vary during the matching as a result of the presence
-of (?ims) items in the pattern. They are kept in a local variable so that
-restoring at the exit of a group is easy. */
-
-ims = re->options & (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL);
-
-/* If the expression has got more back references than the offsets supplied can
-hold, we get a temporary chunk of working store to use during the matching.
-Otherwise, we can use the vector supplied, rounding down its size to a multiple
-of 3. */
-
-ocount = offsetcount - (offsetcount % 3);
-
-if (re->top_backref > 0 && re->top_backref >= ocount/3)
-  {
-  ocount = re->top_backref * 3 + 3;
-  match_block.offset_vector = (int *)(pcre_malloc)(ocount * sizeof(int));
-  if (match_block.offset_vector == NULL) return PCRE_ERROR_NOMEMORY;
-  using_temporary_offsets = TRUE;
-  DPRINTF(("Got memory to hold back references\n"));
-  }
-else match_block.offset_vector = offsets;
-
-match_block.offset_end = ocount;
-match_block.offset_max = (2*ocount)/3;
-match_block.offset_overflow = FALSE;
-match_block.capture_last = -1;
-
-/* Compute the minimum number of offsets that we need to reset each time. Doing
-this makes a huge difference to execution time when there aren't many brackets
-in the pattern. */
-
-resetcount = 2 + re->top_bracket * 2;
-if (resetcount > offsetcount) resetcount = ocount;
-
-/* Reset the working variable associated with each extraction. These should
-never be used unless previously set, but they get saved and restored, and so we
-initialize them to avoid reading uninitialized locations. */
-
-if (match_block.offset_vector != NULL)
-  {
-  register int *iptr = match_block.offset_vector + ocount;
-  register int *iend = iptr - resetcount/2 + 1;
-  while (--iptr >= iend) *iptr = -1;
-  }
-
-/* Set up the first character to match, if available. The first_byte value is
-never set for an anchored regular expression, but the anchoring may be forced
-at run time, so we have to test for anchoring. The first char may be unset for
-an unanchored pattern, of course. If there's no first char and the pattern was
-studied, there may be a bitmap of possible first characters. */
-
-if (!anchored)
-  {
-  if ((re->options & PCRE_FIRSTSET) != 0)
-    {
-    first_byte = re->first_byte & 255;
-    if ((first_byte_caseless = ((re->first_byte & REQ_CASELESS) != 0)) == TRUE)
-      first_byte = match_block.lcc[first_byte];
-    }
-  else
-    if (!startline && study != NULL &&
-      (study->options & PCRE_STUDY_MAPPED) != 0)
-        start_bits = study->start_bits;
-  }
-
-/* For anchored or unanchored matches, there may be a "last known required
-character" set. */
-
-if ((re->options & PCRE_REQCHSET) != 0)
-  {
-  req_byte = re->req_byte & 255;
-  req_byte_caseless = (re->req_byte & REQ_CASELESS) != 0;
-  req_byte2 = (tables + fcc_offset)[req_byte];  /* case flipped */
-  }
-
-/* Loop for handling unanchored repeated matching attempts; for anchored regexs
-the loop runs just once. */
-
-do
-  {
-  /* Reset the maximum number of extractions we might see. */
-
-  if (match_block.offset_vector != NULL)
-    {
-    register int *iptr = match_block.offset_vector;
-    register int *iend = iptr + resetcount;
-    while (iptr < iend) *iptr++ = -1;
-    }
-
-  /* Advance to a unique first char if possible */
-
-  if (first_byte >= 0)
-    {
-    if (first_byte_caseless)
-      while (start_match < end_subject &&
-             match_block.lcc[*start_match] != first_byte)
-        start_match++;
-    else
-      while (start_match < end_subject && *start_match != first_byte)
-        start_match++;
-    }
-
-  /* Or to just after \n for a multiline match if possible */
-
-  else if (startline)
-    {
-    if (start_match > match_block.start_subject + start_offset)
-      {
-      while (start_match < end_subject && start_match[-1] != NEWLINE)
-        start_match++;
-      }
-    }
-
-  /* Or to a non-unique first char after study */
-
-  else if (start_bits != NULL)
-    {
-    while (start_match < end_subject)
-      {
-      register unsigned int c = *start_match;
-      if ((start_bits[c/8] & (1 << (c&7))) == 0) start_match++; else break;
-      }
-    }
-
-#ifdef DEBUG  /* Sigh. Some compilers never learn. */
-  printf(">>>> Match against: ");
-  pchars(start_match, end_subject - start_match, TRUE, &match_block);
-  printf("\n");
-#endif
-
-  /* If req_byte is set, we know that that character must appear in the subject
-  for the match to succeed. If the first character is set, req_byte must be
-  later in the subject; otherwise the test starts at the match point. This
-  optimization can save a huge amount of backtracking in patterns with nested
-  unlimited repeats that aren't going to match. Writing separate code for
-  cased/caseless versions makes it go faster, as does using an autoincrement
-  and backing off on a match.
-
-  HOWEVER: when the subject string is very, very long, searching to its end can
-  take a long time, and give bad performance on quite ordinary patterns. This
-  showed up when somebody was matching /^C/ on a 32-megabyte string... so we
-  don't do this when the string is sufficiently long.
-
-  ALSO: this processing is disabled when partial matching is requested.
-  */
-
-  if (req_byte >= 0 &&
-      end_subject - start_match < REQ_BYTE_MAX &&
-      !match_block.partial)
-    {
-    register const uschar *p = start_match + ((first_byte >= 0)? 1 : 0);
-
-    /* We don't need to repeat the search if we haven't yet reached the
-    place we found it at last time. */
-
-    if (p > req_byte_ptr)
-      {
-      if (req_byte_caseless)
-        {
-        while (p < end_subject)
-          {
-          register int pp = *p++;
-          if (pp == req_byte || pp == req_byte2) { p--; break; }
-          }
-        }
-      else
-        {
-        while (p < end_subject)
-          {
-          if (*p++ == req_byte) { p--; break; }
-          }
-        }
-
-      /* If we can't find the required character, break the matching loop */
-
-      if (p >= end_subject) break;
-
-      /* If we have found the required character, save the point where we
-      found it, so that we don't search again next time round the loop if
-      the start hasn't passed this character yet. */
-
-      req_byte_ptr = p;
-      }
-    }
-
-  /* When a match occurs, substrings will be set for all internal extractions;
-  we just need to set up the whole thing as substring 0 before returning. If
-  there were too many extractions, set the return code to zero. In the case
-  where we had to get some local store to hold offsets for backreferences, copy
-  those back references that we can. In this case there need not be overflow
-  if certain parts of the pattern were not used. */
-
-  match_block.start_match = start_match;
-  match_block.match_call_count = 0;
-
-  rc = match(start_match, match_block.start_code, 2, &match_block, ims, NULL,
-    match_isgroup);
-
-  if (rc == MATCH_NOMATCH)
-    {
-    start_match++;
-#ifdef SUPPORT_UTF8
-    if (match_block.utf8)
-      while(start_match < end_subject && (*start_match & 0xc0) == 0x80)
-        start_match++;
-#endif
-    continue;
-    }
-
-  if (rc != MATCH_MATCH)
-    {
-    DPRINTF((">>>> error: returning %d\n", rc));
-    return rc;
-    }
-
-  /* We have a match! Copy the offset information from temporary store if
-  necessary */
-
-  if (using_temporary_offsets)
-    {
-    if (offsetcount >= 4)
-      {
-      memcpy(offsets + 2, match_block.offset_vector + 2,
-        (offsetcount - 2) * sizeof(int));
-      DPRINTF(("Copied offsets from temporary memory\n"));
-      }
-    if (match_block.end_offset_top > offsetcount)
-      match_block.offset_overflow = TRUE;
-
-    DPRINTF(("Freeing temporary memory\n"));
-    (pcre_free)(match_block.offset_vector);
-    }
-
-  rc = match_block.offset_overflow? 0 : match_block.end_offset_top/2;
-
-  if (offsetcount < 2) rc = 0; else
-    {
-    offsets[0] = start_match - match_block.start_subject;
-    offsets[1] = match_block.end_match_ptr - match_block.start_subject;
-    }
-
-  DPRINTF((">>>> returning %d\n", rc));
-  return rc;
-  }
-
-/* This "while" is the end of the "do" above */
-
-while (!anchored && start_match <= end_subject);
-
-if (using_temporary_offsets)
-  {
-  DPRINTF(("Freeing temporary memory\n"));
-  (pcre_free)(match_block.offset_vector);
-  }
-
-if (match_block.partial && match_block.hitend)
-  {
-  DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n"));
-  return PCRE_ERROR_PARTIAL;
-  }
-else
-  {
-  DPRINTF((">>>> returning PCRE_ERROR_NOMATCH\n"));
-  return PCRE_ERROR_NOMATCH;
-  }
-}
-
-/* End of pcre.c */
+/* End of pcre_compile.c */
diff --git a/ext/pcre/pcrelib/pcre_config.c b/ext/pcre/pcrelib/pcre_config.c
new file mode 100644 (file)
index 0000000..04029a9
--- /dev/null
@@ -0,0 +1,112 @@
+/*************************************************
+*      Perl-Compatible Regular Expressions       *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+
+/* This module contains the external function pcre_config(). */
+
+
+#include "pcre_internal.h"
+
+
+/*************************************************
+* Return info about what features are configured *
+*************************************************/
+
+/* This function has an extensible interface so that additional items can be
+added compatibly.
+
+Arguments:
+  what             what information is required
+  where            where to put the information
+
+Returns:           0 if data returned, negative on error
+*/
+
+EXPORT int
+pcre_config(int what, void *where)
+{
+switch (what)
+  {
+  case PCRE_CONFIG_UTF8:
+#ifdef SUPPORT_UTF8
+  *((int *)where) = 1;
+#else
+  *((int *)where) = 0;
+#endif
+  break;
+
+  case PCRE_CONFIG_UNICODE_PROPERTIES:
+#ifdef SUPPORT_UCP
+  *((int *)where) = 1;
+#else
+  *((int *)where) = 0;
+#endif
+  break;
+
+  case PCRE_CONFIG_NEWLINE:
+  *((int *)where) = NEWLINE;
+  break;
+
+  case PCRE_CONFIG_LINK_SIZE:
+  *((int *)where) = LINK_SIZE;
+  break;
+
+  case PCRE_CONFIG_POSIX_MALLOC_THRESHOLD:
+  *((int *)where) = POSIX_MALLOC_THRESHOLD;
+  break;
+
+  case PCRE_CONFIG_MATCH_LIMIT:
+  *((unsigned int *)where) = MATCH_LIMIT;
+  break;
+
+  case PCRE_CONFIG_STACKRECURSE:
+#ifdef NO_RECURSE
+  *((int *)where) = 0;
+#else
+  *((int *)where) = 1;
+#endif
+  break;
+
+  default: return PCRE_ERROR_BADOPTION;
+  }
+
+return 0;
+}
+
+/* End of pcre_config.c */
diff --git a/ext/pcre/pcrelib/pcre_dfa_exec.c b/ext/pcre/pcrelib/pcre_dfa_exec.c
new file mode 100644 (file)
index 0000000..7101570
--- /dev/null
@@ -0,0 +1,1922 @@
+/*************************************************
+*      Perl-Compatible Regular Expressions       *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+
+/* This module contains the external function pcre_dfa_exec(), which is an
+alternative matching function that uses a DFA algorithm. This is NOT Perl-
+compatible, but it has advantages in certain applications. */
+
+
+#include "pcre_internal.h"
+
+
+/* For use to indent debugging output */
+
+#define SP "                   "
+
+
+
+/*************************************************
+*      Code parameters and static tables         *
+*************************************************/
+
+/* These are offsets that are used to turn the OP_TYPESTAR and friends opcodes
+into others, under special conditions. A gap of 10 between the blocks should be
+enough. */
+
+#define OP_PROP_EXTRA    (EXTRACT_BASIC_MAX+1)
+#define OP_EXTUNI_EXTRA  (EXTRACT_BASIC_MAX+11)
+
+
+/* This table identifies those opcodes that are followed immediately by a
+character that is to be tested in some way. This makes is possible to
+centralize the loading of these characters. In the case of Type * etc, the
+"character" is the opcode for \D, \d, \S, \s, \W, or \w, which will always be a
+small value. */
+
+static uschar coptable[] = {
+  0,                             /* End                                    */
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* \A, \G, \B, \b, \D, \d, \S, \s, \W, \w */
+  0, 0,                          /* Any, Anybyte                           */
+  0, 0, 0,                       /* NOTPROP, PROP, EXTUNI                  */
+  0, 0, 0, 0, 0,                 /* \Z, \z, Opt, ^, $                      */
+  1,                             /* Char                                   */
+  1,                             /* Charnc                                 */
+  1,                             /* not                                    */
+  /* Positive single-char repeats                                          */
+  1, 1, 1, 1, 1, 1,              /* *, *?, +, +?, ?, ??                    */
+  3, 3, 3,                       /* upto, minupto, exact                   */
+  /* Negative single-char repeats - only for chars < 256                   */
+  1, 1, 1, 1, 1, 1,              /* NOT *, *?, +, +?, ?, ??                */
+  3, 3, 3,                       /* NOT upto, minupto, exact               */
+  /* Positive type repeats                                                 */
+  1, 1, 1, 1, 1, 1,              /* Type *, *?, +, +?, ?, ??               */
+  3, 3, 3,                       /* Type upto, minupto, exact              */
+  /* Character class & ref repeats                                         */
+  0, 0, 0, 0, 0, 0,              /* *, *?, +, +?, ?, ??                    */
+  0, 0,                          /* CRRANGE, CRMINRANGE                    */
+  0,                             /* CLASS                                  */
+  0,                             /* NCLASS                                 */
+  0,                             /* XCLASS - variable length               */
+  0,                             /* REF                                    */
+  0,                             /* RECURSE                                */
+  0,                             /* CALLOUT                                */
+  0,                             /* Alt                                    */
+  0,                             /* Ket                                    */
+  0,                             /* KetRmax                                */
+  0,                             /* KetRmin                                */
+  0,                             /* Assert                                 */
+  0,                             /* Assert not                             */
+  0,                             /* Assert behind                          */
+  0,                             /* Assert behind not                      */
+  0,                             /* Reverse                                */
+  0,                             /* Once                                   */
+  0,                             /* COND                                   */
+  0,                             /* CREF                                   */
+  0, 0,                          /* BRAZERO, BRAMINZERO                    */
+  0,                             /* BRANUMBER                              */
+  0                              /* BRA                                    */
+};
+
+/* These 2 tables allow for compact code for testing for \D, \d, \S, \s, \W,
+and \w */
+
+static uschar toptable1[] = {
+  0, 0, 0, 0, 0,
+  ctype_digit, ctype_digit,
+  ctype_space, ctype_space,
+  ctype_word,  ctype_word,
+  0                               /* OP_ANY */
+};
+
+static uschar toptable2[] = {
+  0, 0, 0, 0, 0,
+  ctype_digit, 0,
+  ctype_space, 0,
+  ctype_word,  0,
+  1                               /* OP_ANY */
+};
+
+
+/* Structure for holding data about a particular state, which is in effect the
+current data for an active path through the match tree. It must consist
+entirely of ints because the working vector we are passed, and which we put
+these structures in, is a vector of ints. */
+
+typedef struct stateblock {
+  int offset;                     /* Offset to opcode */
+  int count;                      /* Count for repeats */
+  int ims;                        /* ims flag bits */
+  int data;                       /* Some use extra data */
+} stateblock;
+
+#define INTS_PER_STATEBLOCK  (sizeof(stateblock)/sizeof(int))
+
+
+#ifdef DEBUG
+/*************************************************
+*             Print character string             *
+*************************************************/
+
+/* Character string printing function for debugging.
+
+Arguments:
+  p            points to string
+  length       number of bytes
+  f            where to print
+
+Returns:       nothing
+*/
+
+static void
+pchars(unsigned char *p, int length, FILE *f)
+{
+int c;
+while (length-- > 0)
+  {
+  if (isprint(c = *(p++)))
+    fprintf(f, "%c", c);
+  else
+    fprintf(f, "\\x%02x", c);
+  }
+}
+#endif
+
+
+
+/*************************************************
+*    Execute a Regular Expression - DFA engine   *
+*************************************************/
+
+/* This internal function applies a compiled pattern to a subject string,
+starting at a given point, using a DFA engine. This function is called from the
+external one, possibly multiple times if the pattern is not anchored. The
+function calls itself recursively for some kinds of subpattern.
+
+Arguments:
+  md                the match_data block with fixed information
+  this_start_code   the opening bracket of this subexpression's code
+  current_subject   where we currently are in the subject string
+  start_offset      start offset in the subject string
+  offsets           vector to contain the matching string offsets
+  offsetcount       size of same
+  workspace         vector of workspace
+  wscount           size of same
+  ims               the current ims flags
+  rlevel            function call recursion level
+  recursing         regex recursive call level
+
+Returns:            > 0 =>
+                    = 0 =>
+                     -1 => failed to match
+                   < -1 => some kind of unexpected problem
+
+The following macros are used for adding states to the two state vectors (one
+for the current character, one for the following character). */
+
+#define ADD_ACTIVE(x,y) \
+  if (active_count++ < wscount) \
+    { \
+    next_active_state->offset = (x); \
+    next_active_state->count  = (y); \
+    next_active_state->ims    = ims; \
+    next_active_state++; \
+    DPRINTF(("%.*sADD_ACTIVE(%d,%d)\n", rlevel*2-2, SP, (x), (y))); \
+    } \
+  else return PCRE_ERROR_DFA_WSSIZE
+
+#define ADD_ACTIVE_DATA(x,y,z) \
+  if (active_count++ < wscount) \
+    { \
+    next_active_state->offset = (x); \
+    next_active_state->count  = (y); \
+    next_active_state->ims    = ims; \
+    next_active_state->data   = (z); \
+    next_active_state++; \
+    DPRINTF(("%.*sADD_ACTIVE_DATA(%d,%d,%d)\n", rlevel*2-2, SP, (x), (y), (z))); \
+    } \
+  else return PCRE_ERROR_DFA_WSSIZE
+
+#define ADD_NEW(x,y) \
+  if (new_count++ < wscount) \
+    { \
+    next_new_state->offset = (x); \
+    next_new_state->count  = (y); \
+    next_new_state->ims    = ims; \
+    next_new_state++; \
+    DPRINTF(("%.*sADD_NEW(%d,%d)\n", rlevel*2-2, SP, (x), (y))); \
+    } \
+  else return PCRE_ERROR_DFA_WSSIZE
+
+#define ADD_NEW_DATA(x,y,z) \
+  if (new_count++ < wscount) \
+    { \
+    next_new_state->offset = (x); \
+    next_new_state->count  = (y); \
+    next_new_state->ims    = ims; \
+    next_new_state->data   = (z); \
+    next_new_state++; \
+    DPRINTF(("%.*sADD_NEW_DATA(%d,%d,%d)\n", rlevel*2-2, SP, (x), (y), (z))); \
+    } \
+  else return PCRE_ERROR_DFA_WSSIZE
+
+/* And now, here is the code */
+
+static int
+internal_dfa_exec(
+  dfa_match_data *md,
+  const uschar *this_start_code,
+  const uschar *current_subject,
+  int start_offset,
+  int *offsets,
+  int offsetcount,
+  int *workspace,
+  int wscount,
+  int ims,
+  int  rlevel,
+  int  recursing)
+{
+stateblock *active_states, *new_states, *temp_states;
+stateblock *next_active_state, *next_new_state;
+
+const uschar *ctypes, *lcc, *fcc;
+const uschar *ptr;
+const uschar *end_code;
+
+int active_count, new_count, match_count;
+
+/* Some fields in the md block are frequently referenced, so we load them into
+independent variables in the hope that this will perform better. */
+
+const uschar *start_subject = md->start_subject;
+const uschar *end_subject = md->end_subject;
+const uschar *start_code = md->start_code;
+
+BOOL utf8 = (md->poptions & PCRE_UTF8) != 0;
+
+rlevel++;
+offsetcount &= (-2);
+
+wscount -= 2;
+wscount = (wscount - (wscount % (INTS_PER_STATEBLOCK * 2))) /
+          (2 * INTS_PER_STATEBLOCK);
+
+DPRINTF(("\n%.*s---------------------\n"
+  "%.*sCall to internal_dfa_exec f=%d r=%d\n",
+  rlevel*2-2, SP, rlevel*2-2, SP, rlevel, recursing));
+
+ctypes = md->tables + ctypes_offset;
+lcc = md->tables + lcc_offset;
+fcc = md->tables + fcc_offset;
+
+match_count = PCRE_ERROR_NOMATCH;   /* A negative number */
+
+active_states = (stateblock *)(workspace + 2);
+next_new_state = new_states = active_states + wscount;
+new_count = 0;
+
+/* The first thing in any (sub) pattern is a bracket of some sort. Push all
+the alternative states onto the list, and find out where the end is. This
+makes is possible to use this function recursively, when we want to stop at a
+matching internal ket rather than at the end.
+
+If the first opcode in the first alternative is OP_REVERSE, we are dealing with
+a backward assertion. In that case, we have to find out the maximum amount to
+move back, and set up each alternative appropriately. */
+
+if (this_start_code[1+LINK_SIZE] == OP_REVERSE)
+  {
+  int max_back = 0;
+  int gone_back;
+
+  end_code = this_start_code;
+  do
+    {
+    int back = GET(end_code, 2+LINK_SIZE);
+    if (back > max_back) max_back = back;
+    end_code += GET(end_code, 1);
+    }
+  while (*end_code == OP_ALT);
+
+  /* If we can't go back the amount required for the longest lookbehind
+  pattern, go back as far as we can; some alternatives may still be viable. */
+
+#ifdef SUPPORT_UTF8
+  /* In character mode we have to step back character by character */
+
+  if (utf8)
+    {
+    for (gone_back = 0; gone_back < max_back; gone_back++)
+      {
+      if (current_subject <= start_subject) break;
+      current_subject--;
+      while (current_subject > start_subject &&
+             (*current_subject & 0xc0) == 0x80)
+        current_subject--;
+      }
+    }
+  else
+#endif
+
+  /* In byte-mode we can do this quickly. */
+
+    {
+    gone_back = (current_subject - max_back < start_subject)?
+      current_subject - start_subject : max_back;
+    current_subject -= gone_back;
+    }
+
+  /* Now we can process the individual branches. */
+
+  end_code = this_start_code;
+  do
+    {
+    int back = GET(end_code, 2+LINK_SIZE);
+    if (back <= gone_back)
+      {
+      int bstate = end_code - start_code + 2 + 2*LINK_SIZE;
+      ADD_NEW_DATA(-bstate, 0, gone_back - back);
+      }
+    end_code += GET(end_code, 1);
+    }
+  while (*end_code == OP_ALT);
+ }
+
+/* This is the code for a "normal" subpattern (not a backward assertion). The
+start of a whole pattern is always one of these. If we are at the top level,
+we may be asked to restart matching from the same point that we reached for a
+previous partial match. We still have to scan through the top-level branches to
+find the end state. */
+
+else
+  {
+  end_code = this_start_code;
+
+  /* Restarting */
+
+  if (rlevel == 1 && (md->moptions & PCRE_DFA_RESTART) != 0)
+    {
+    do { end_code += GET(end_code, 1); } while (*end_code == OP_ALT);
+    new_count = workspace[1];
+    if (!workspace[0])
+      memcpy(new_states, active_states, new_count * sizeof(stateblock));
+    }
+
+  /* Not restarting */
+
+  else
+    {
+    do
+      {
+      ADD_NEW(end_code - start_code + 1 + LINK_SIZE, 0);
+      end_code += GET(end_code, 1);
+      }
+    while (*end_code == OP_ALT);
+    }
+  }
+
+workspace[0] = 0;    /* Bit indicating which vector is current */
+
+DPRINTF(("%.*sEnd state = %d\n", rlevel*2-2, SP, end_code - start_code));
+
+/* Loop for scanning the subject */
+
+ptr = current_subject;
+for (;;)
+  {
+  int i, j;
+  int c, d, clen, dlen;
+
+  /* Make the new state list into the active state list and empty the
+  new state list. */
+
+  temp_states = active_states;
+  active_states = new_states;
+  new_states = temp_states;
+  active_count = new_count;
+  new_count = 0;
+
+  workspace[0] ^= 1;              /* Remember for the restarting feature */
+  workspace[1] = active_count;
+
+#ifdef DEBUG
+  printf("%.*sNext character: rest of subject = \"", rlevel*2-2, SP);
+  pchars((uschar *)ptr, strlen((char *)ptr), stdout);
+  printf("\"\n");
+
+  printf("%.*sActive states: ", rlevel*2-2, SP);
+  for (i = 0; i < active_count; i++)
+    printf("%d/%d ", active_states[i].offset, active_states[i].count);
+  printf("\n");
+#endif
+
+  /* Set the pointers for adding new states */
+
+  next_active_state = active_states + active_count;
+  next_new_state = new_states;
+
+  /* Load the current character from the subject outside the loop, as many
+  different states may want to look at it, and we assume that at least one
+  will. */
+
+  if (ptr < end_subject)
+    {
+    clen = 1;
+#ifdef SUPPORT_UTF8
+    if (utf8) { GETCHARLEN(c, ptr, clen); } else
+#endif  /* SUPPORT_UTF8 */
+    c = *ptr;
+    }
+  else
+    {
+    clen = 0;    /* At end subject */
+    c = -1;
+    }
+
+  /* Scan up the active states and act on each one. The result of an action
+  may be to add more states to the currently active list (e.g. on hitting a
+  parenthesis) or it may be to put states on the new list, for considering
+  when we move the character pointer on. */
+
+  for (i = 0; i < active_count; i++)
+    {
+    stateblock *current_state = active_states + i;
+    const uschar *code;
+    int state_offset = current_state->offset;
+    int count, codevalue;
+    int chartype, othercase;
+
+#ifdef DEBUG
+    printf ("%.*sProcessing state %d c=", rlevel*2-2, SP, state_offset);
+    if (c < 0) printf("-1\n");
+      else if (c > 32 && c < 127) printf("'%c'\n", c);
+        else printf("0x%02x\n", c);
+#endif
+
+    /* This variable is referred to implicity in the ADD_xxx macros. */
+
+    ims = current_state->ims;
+
+    /* A negative offset is a special case meaning "hold off going to this
+    (negated) state until the number of characters in the data field have
+    been skipped". */
+
+    if (state_offset < 0)
+      {
+      if (current_state->data > 0)
+        {
+        DPRINTF(("%.*sSkipping this character\n", rlevel*2-2, SP));
+        ADD_NEW_DATA(state_offset, current_state->count,
+          current_state->data - 1);
+        continue;
+        }
+      else
+        {
+        current_state->offset = state_offset = -state_offset;
+        }
+      }
+
+    /* Check for a duplicate state with the same count, and skip if found. */
+
+    for (j = 0; j < i; j++)
+      {
+      if (active_states[j].offset == state_offset &&
+          active_states[j].count == current_state->count)
+        {
+        DPRINTF(("%.*sDuplicate state: skipped\n", rlevel*2-2, SP));
+        goto NEXT_ACTIVE_STATE;
+        }
+      }
+
+    /* The state offset is the offset to the opcode */
+
+    code = start_code + state_offset;
+    codevalue = *code;
+    if (codevalue >= OP_BRA) codevalue = OP_BRA; /* All brackets are equal */
+
+    /* If this opcode is followed by an inline character, load it. It is
+    tempting to test for the presence of a subject character here, but that
+    is wrong, because sometimes zero repetitions of the subject are
+    permitted.
+
+    We also use this mechanism for opcodes such as OP_TYPEPLUS that take an
+    argument that is not a data character - but is always one byte long.
+    Unfortunately, we have to take special action to deal with  \P, \p, and
+    \X in this case. To keep the other cases fast, convert these ones to new
+    opcodes. */
+
+    if (coptable[codevalue] > 0)
+      {
+      dlen = 1;
+#ifdef SUPPORT_UTF8
+      if (utf8) { GETCHARLEN(d, (code + coptable[codevalue]), dlen); } else
+#endif  /* SUPPORT_UTF8 */
+      d = code[coptable[codevalue]];
+      if (codevalue >= OP_TYPESTAR)
+        {
+        if (d == OP_ANYBYTE) return PCRE_ERROR_DFA_UITEM;
+        if (d >= OP_NOTPROP)
+          codevalue += (d == OP_EXTUNI)? OP_EXTUNI_EXTRA : OP_PROP_EXTRA;
+        }
+      }
+    else
+      {
+      dlen = 0;         /* Not strictly necessary, but compilers moan */
+      d = -1;           /* if these variables are not set. */
+      }
+
+
+    /* Now process the individual opcodes */
+
+    switch (codevalue)
+      {
+
+/* ========================================================================== */
+      /* Reached a closing bracket. If not at the end of the pattern, carry
+      on with the next opcode. Otherwise, unless we have an empty string and
+      PCRE_NOTEMPTY is set, save the match data, shifting up all previous
+      matches so we always have the longest first. */
+
+      case OP_KET:
+      case OP_KETRMIN:
+      case OP_KETRMAX:
+      if (code != end_code)
+        {
+        ADD_ACTIVE(state_offset + 1 + LINK_SIZE, 0);
+        if (codevalue != OP_KET)
+          {
+          ADD_ACTIVE(state_offset - GET(code, 1), 0);
+          }
+        }
+      else if (ptr > current_subject || (md->moptions & PCRE_NOTEMPTY) == 0)
+        {
+        if (match_count < 0) match_count = (offsetcount >= 2)? 1 : 0;
+          else if (match_count > 0 && ++match_count * 2 >= offsetcount)
+            match_count = 0;
+        count = ((match_count == 0)? offsetcount : match_count * 2) - 2;
+        if (count > 0) memmove(offsets + 2, offsets, count * sizeof(int));
+        if (offsetcount >= 2)
+          {
+          offsets[0] = current_subject - start_subject;
+          offsets[1] = ptr - start_subject;
+          DPRINTF(("%.*sSet matched string = \"%.*s\"\n", rlevel*2-2, SP,
+            offsets[1] - offsets[0], current_subject));
+          }
+        if ((md->moptions & PCRE_DFA_SHORTEST) != 0)
+          {
+          DPRINTF(("%.*sEnd of internal_dfa_exec %d: returning %d\n"
+            "%.*s---------------------\n\n", rlevel*2-2, SP, rlevel,
+            match_count, rlevel*2-2, SP));
+          return match_count;
+          }
+        }
+      break;
+
+/* ========================================================================== */
+      /* These opcodes add to the current list of states without looking
+      at the current character. */
+
+      /*-----------------------------------------------------------------*/
+      case OP_ALT:
+      do { code += GET(code, 1); } while (*code == OP_ALT);
+      ADD_ACTIVE(code - start_code, 0);
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_BRA:
+      do
+        {
+        ADD_ACTIVE(code - start_code + 1 + LINK_SIZE, 0);
+        code += GET(code, 1);
+        }
+      while (*code == OP_ALT);
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_BRAZERO:
+      case OP_BRAMINZERO:
+      ADD_ACTIVE(state_offset + 1, 0);
+      code += 1 + GET(code, 2);
+      while (*code == OP_ALT) code += GET(code, 1);
+      ADD_ACTIVE(code - start_code + 1 + LINK_SIZE, 0);
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_BRANUMBER:
+      ADD_ACTIVE(state_offset + 1 + LINK_SIZE, 0);
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_CIRC:
+      if ((ptr == start_subject && (md->moptions & PCRE_NOTBOL) == 0) ||
+          ((ims & PCRE_MULTILINE) != 0 && ptr[-1] == NEWLINE))
+        { ADD_ACTIVE(state_offset + 1, 0); }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_EOD:
+      if (ptr >= end_subject) { ADD_ACTIVE(state_offset + 1, 0); }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_OPT:
+      ims = code[1];
+      ADD_ACTIVE(state_offset + 2, 0);
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_SOD:
+      if (ptr == start_subject) { ADD_ACTIVE(state_offset + 1, 0); }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_SOM:
+      if (ptr == start_subject + start_offset) { ADD_ACTIVE(state_offset + 1, 0); }
+      break;
+
+
+/* ========================================================================== */
+      /* These opcodes inspect the next subject character, and sometimes
+      the previous one as well, but do not have an argument. The variable
+      clen contains the length of the current character and is zero if we are
+      at the end of the subject. */
+
+      /*-----------------------------------------------------------------*/
+      case OP_ANY:
+      if (clen > 0 && (c != NEWLINE || (ims & PCRE_DOTALL) != 0))
+        { ADD_NEW(state_offset + 1, 0); }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_EODN:
+      if (clen == 0 || (c == NEWLINE && ptr + 1 == end_subject))
+        { ADD_ACTIVE(state_offset + 1, 0); }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_DOLL:
+      if ((md->moptions & PCRE_NOTEOL) == 0)
+        {
+        if (clen == 0 || (c == NEWLINE && (ptr + 1 == end_subject ||
+                                (ims & PCRE_MULTILINE) != 0)))
+          { ADD_ACTIVE(state_offset + 1, 0); }
+        }
+      else if (c == NEWLINE && (ims & PCRE_MULTILINE) != 0)
+        { ADD_ACTIVE(state_offset + 1, 0); }
+      break;
+
+      /*-----------------------------------------------------------------*/
+
+      case OP_DIGIT:
+      case OP_WHITESPACE:
+      case OP_WORDCHAR:
+      if (clen > 0 && c < 256 &&
+            ((ctypes[c] & toptable1[codevalue]) ^ toptable2[codevalue]) != 0)
+        { ADD_NEW(state_offset + 1, 0); }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_NOT_DIGIT:
+      case OP_NOT_WHITESPACE:
+      case OP_NOT_WORDCHAR:
+      if (clen > 0 && (c >= 256 ||
+            ((ctypes[c] & toptable1[codevalue]) ^ toptable2[codevalue]) != 0))
+        { ADD_NEW(state_offset + 1, 0); }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_WORD_BOUNDARY:
+      case OP_NOT_WORD_BOUNDARY:
+        {
+        int left_word, right_word;
+
+        if (ptr > start_subject)
+          {
+          const uschar *temp = ptr - 1;
+#ifdef SUPPORT_UTF8
+          if (utf8) BACKCHAR(temp);
+#endif
+          GETCHARTEST(d, temp);
+          left_word = d < 256 && (ctypes[d] & ctype_word) != 0;
+          }
+        else left_word = 0;
+
+        if (clen > 0) right_word = c < 256 && (ctypes[c] & ctype_word) != 0;
+          else right_word = 0;
+
+        if ((left_word == right_word) == (codevalue == OP_NOT_WORD_BOUNDARY))
+          { ADD_ACTIVE(state_offset + 1, 0); }
+        }
+      break;
+
+
+#ifdef SUPPORT_UCP
+
+      /*-----------------------------------------------------------------*/
+      /* Check the next character by Unicode property. We will get here only
+      if the support is in the binary; otherwise a compile-time error occurs.
+      */
+
+      case OP_PROP:
+      case OP_NOTPROP:
+      if (clen > 0)
+        {
+        int rqdtype, category;
+        category = ucp_findchar(c, &chartype, &othercase);
+        rqdtype = code[1];
+        if (rqdtype >= 128)
+          {
+          if ((rqdtype - 128 == category) == (codevalue == OP_PROP))
+            { ADD_NEW(state_offset + 2, 0); }
+          }
+        else
+          {
+          if ((rqdtype == chartype) == (codevalue == OP_PROP))
+            { ADD_NEW(state_offset + 2, 0); }
+          }
+        }
+      break;
+#endif
+
+
+
+/* ========================================================================== */
+      /* These opcodes likewise inspect the subject character, but have an
+      argument that is not a data character. It is one of these opcodes:
+      OP_ANY, OP_DIGIT, OP_NOT_DIGIT, OP_WHITESPACE, OP_NOT_SPACE, OP_WORDCHAR,
+      OP_NOT_WORDCHAR. The value is loaded into d. */
+
+      case OP_TYPEPLUS:
+      case OP_TYPEMINPLUS:
+      count = current_state->count;  /* Already matched */
+      if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); }
+      if (clen > 0)
+        {
+        if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) ||
+            (c < 256 &&
+              (d != OP_ANY || c != '\n' || (ims & PCRE_DOTALL) != 0) &&
+              ((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
+          {
+          count++;
+          ADD_NEW(state_offset, count);
+          }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_TYPEQUERY:
+      case OP_TYPEMINQUERY:
+      ADD_ACTIVE(state_offset + 2, 0);
+      if (clen > 0)
+        {
+        if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) ||
+            (c < 256 &&
+              (d != OP_ANY || c != '\n' || (ims & PCRE_DOTALL) != 0) &&
+              ((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
+          {
+          ADD_NEW(state_offset + 2, 0);
+          }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_TYPESTAR:
+      case OP_TYPEMINSTAR:
+      ADD_ACTIVE(state_offset + 2, 0);
+      if (clen > 0)
+        {
+        if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) ||
+            (c < 256 &&
+              (d != OP_ANY || c != '\n' || (ims & PCRE_DOTALL) != 0) &&
+              ((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
+          {
+          ADD_NEW(state_offset, 0);
+          }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_TYPEEXACT:
+      case OP_TYPEUPTO:
+      case OP_TYPEMINUPTO:
+      if (codevalue != OP_TYPEEXACT)
+        { ADD_ACTIVE(state_offset + 4, 0); }
+      count = current_state->count;  /* Number already matched */
+      if (clen > 0)
+        {
+        if ((c >= 256 && d != OP_DIGIT && d != OP_WHITESPACE && d != OP_WORDCHAR) ||
+            (c < 256 &&
+              (d != OP_ANY || c != '\n' || (ims & PCRE_DOTALL) != 0) &&
+              ((ctypes[c] & toptable1[d]) ^ toptable2[d]) != 0))
+          {
+          if (++count >= GET2(code, 1))
+            { ADD_NEW(state_offset + 4, 0); }
+          else
+            { ADD_NEW(state_offset, count); }
+          }
+        }
+      break;
+
+/* ========================================================================== */
+      /* These are virtual opcodes that are used when something like
+      OP_TYPEPLUS has OP_PROP, OP_NOTPROP, or OP_EXTUNI as its argument. It
+      keeps the code above fast for the other cases. The argument is in the
+      d variable. */
+
+      case OP_PROP_EXTRA + OP_TYPEPLUS:
+      case OP_PROP_EXTRA + OP_TYPEMINPLUS:
+      count = current_state->count;           /* Already matched */
+      if (count > 0) { ADD_ACTIVE(state_offset + 3, 0); }
+      if (clen > 0)
+        {
+        int category = ucp_findchar(c, &chartype, &othercase);
+        int rqdtype = code[2];
+        if ((d == OP_PROP) ==
+            (rqdtype == ((rqdtype >= 128)? (category + 128) : chartype)))
+          { count++; ADD_NEW(state_offset, count); }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_EXTUNI_EXTRA + OP_TYPEPLUS:
+      case OP_EXTUNI_EXTRA + OP_TYPEMINPLUS:
+      count = current_state->count;  /* Already matched */
+      if (count > 0) { ADD_ACTIVE(state_offset + 2, 0); }
+      if (clen > 0 && ucp_findchar(c, &chartype, &othercase) != ucp_M)
+        {
+        const uschar *nptr = ptr + clen;
+        int ncount = 0;
+        while (nptr < end_subject)
+          {
+          int nd;
+          int ndlen = 1;
+          GETCHARLEN(nd, nptr, ndlen);
+          if (ucp_findchar(nd, &chartype, &othercase) != ucp_M) break;
+          ncount++;
+          nptr += ndlen;
+          }
+        count++;
+        ADD_NEW_DATA(-state_offset, count, ncount);
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_PROP_EXTRA + OP_TYPEQUERY:
+      case OP_PROP_EXTRA + OP_TYPEMINQUERY:
+      count = 3;
+      goto QS1;
+
+      case OP_PROP_EXTRA + OP_TYPESTAR:
+      case OP_PROP_EXTRA + OP_TYPEMINSTAR:
+      count = 0;
+
+      QS1:
+
+      ADD_ACTIVE(state_offset + 3, 0);
+      if (clen > 0)
+        {
+        int category = ucp_findchar(c, &chartype, &othercase);
+        int rqdtype = code[2];
+        if ((d == OP_PROP) ==
+            (rqdtype == ((rqdtype >= 128)? (category + 128) : chartype)))
+          { ADD_NEW(state_offset + count, 0); }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_EXTUNI_EXTRA + OP_TYPEQUERY:
+      case OP_EXTUNI_EXTRA + OP_TYPEMINQUERY:
+      count = 2;
+      goto QS2;
+
+      case OP_EXTUNI_EXTRA + OP_TYPESTAR:
+      case OP_EXTUNI_EXTRA + OP_TYPEMINSTAR:
+      count = 0;
+
+      QS2:
+
+      ADD_ACTIVE(state_offset + 2, 0);
+      if (clen > 0 && ucp_findchar(c, &chartype, &othercase) != ucp_M)
+        {
+        const uschar *nptr = ptr + clen;
+        int ncount = 0;
+        while (nptr < end_subject)
+          {
+          int nd;
+          int ndlen = 1;
+          GETCHARLEN(nd, nptr, ndlen);
+          if (ucp_findchar(nd, &chartype, &othercase) != ucp_M) break;
+          ncount++;
+          nptr += ndlen;
+          }
+        ADD_NEW_DATA(-(state_offset + count), 0, ncount);
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_PROP_EXTRA + OP_TYPEEXACT:
+      case OP_PROP_EXTRA + OP_TYPEUPTO:
+      case OP_PROP_EXTRA + OP_TYPEMINUPTO:
+      if (codevalue != OP_PROP_EXTRA + OP_TYPEEXACT)
+        { ADD_ACTIVE(state_offset + 5, 0); }
+      count = current_state->count;  /* Number already matched */
+      if (clen > 0)
+        {
+        int category = ucp_findchar(c, &chartype, &othercase);
+        int rqdtype = code[4];
+        if ((d == OP_PROP) ==
+            (rqdtype == ((rqdtype >= 128)? (category + 128) : chartype)))
+          {
+          if (++count >= GET2(code, 1))
+            { ADD_NEW(state_offset + 5, 0); }
+          else
+            { ADD_NEW(state_offset, count); }
+          }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_EXTUNI_EXTRA + OP_TYPEEXACT:
+      case OP_EXTUNI_EXTRA + OP_TYPEUPTO:
+      case OP_EXTUNI_EXTRA + OP_TYPEMINUPTO:
+      if (codevalue != OP_EXTUNI_EXTRA + OP_TYPEEXACT)
+        { ADD_ACTIVE(state_offset + 4, 0); }
+      count = current_state->count;  /* Number already matched */
+      if (clen > 0 && ucp_findchar(c, &chartype, &othercase) != ucp_M)
+        {
+        const uschar *nptr = ptr + clen;
+        int ncount = 0;
+        while (nptr < end_subject)
+          {
+          int nd;
+          int ndlen = 1;
+          GETCHARLEN(nd, nptr, ndlen);
+          if (ucp_findchar(nd, &chartype, &othercase) != ucp_M) break;
+          ncount++;
+          nptr += ndlen;
+          }
+        if (++count >= GET2(code, 1))
+          { ADD_NEW_DATA(-(state_offset + 4), 0, ncount); }
+        else
+          { ADD_NEW_DATA(-state_offset, count, ncount); }
+        }
+      break;
+
+/* ========================================================================== */
+      /* These opcodes are followed by a character that is usually compared
+      to the current subject character; it is loaded into d. We still get
+      here even if there is no subject character, because in some cases zero
+      repetitions are permitted. */
+
+      /*-----------------------------------------------------------------*/
+      case OP_CHAR:
+      if (clen > 0 && c == d) { ADD_NEW(state_offset + dlen + 1, 0); }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_CHARNC:
+      if (clen == 0) break;
+
+#ifdef SUPPORT_UTF8
+      if (utf8)
+        {
+        if (c == d) { ADD_NEW(state_offset + dlen + 1, 0); } else
+          {
+          if (c < 128) othercase = fcc[c]; else
+
+          /* If we have Unicode property support, we can use it to test the
+          other case of the character, if there is one. The result of
+          ucp_findchar() is < 0 if the char isn't found, and othercase is
+          returned as zero if there isn't another case. */
+
+#ifdef SUPPORT_UCP
+          if (ucp_findchar(c, &chartype, &othercase) < 0)
+#endif
+            othercase = -1;
+
+          if (d == othercase) { ADD_NEW(state_offset + dlen + 1, 0); }
+          }
+        }
+      else
+#endif  /* SUPPORT_UTF8 */
+
+      /* Non-UTF-8 mode */
+        {
+        if (lcc[c] == lcc[d]) { ADD_NEW(state_offset + 2, 0); }
+        }
+      break;
+
+
+#ifdef SUPPORT_UCP
+      /*-----------------------------------------------------------------*/
+      /* This is a tricky one because it can match more than one character.
+      Find out how many characters to skip, and then set up a negative state
+      to wait for them to pass before continuing. */
+
+      case OP_EXTUNI:
+      if (clen > 0 && ucp_findchar(c, &chartype, &othercase) != ucp_M)
+        {
+        const uschar *nptr = ptr + clen;
+        int ncount = 0;
+        while (nptr < end_subject)
+          {
+          int nclen = 1;
+          GETCHARLEN(c, nptr, nclen);
+          if (ucp_findchar(c, &chartype, &othercase) != ucp_M) break;
+          ncount++;
+          nptr += nclen;
+          }
+        ADD_NEW_DATA(-(state_offset + 1), 0, ncount);
+        }
+      break;
+#endif
+
+      /*-----------------------------------------------------------------*/
+      /* Match a negated single character. This is only used for one-byte
+      characters, that is, we know that d < 256. The character we are
+      checking (c) can be multibyte. */
+
+      case OP_NOT:
+      if (clen > 0)
+        {
+        int otherd = ((ims & PCRE_CASELESS) != 0)? fcc[d] : d;
+        if (c != d && c != otherd) { ADD_NEW(state_offset + dlen + 1, 0); }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_PLUS:
+      case OP_MINPLUS:
+      case OP_NOTPLUS:
+      case OP_NOTMINPLUS:
+      count = current_state->count;  /* Already matched */
+      if (count > 0) { ADD_ACTIVE(state_offset + dlen + 1, 0); }
+      if (clen > 0)
+        {
+        int otherd = -1;
+        if ((ims & PCRE_CASELESS) != 0)
+          {
+#ifdef SUPPORT_UTF8
+          if (utf8 && c >= 128)
+            {
+#ifdef SUPPORT_UCP
+            if (ucp_findchar(d, &chartype, &otherd) < 0) otherd = -1;
+#endif  /* SUPPORT_UCP */
+            }
+          else
+#endif  /* SUPPORT_UTF8 */
+          otherd = fcc[d];
+          }
+        if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
+          { count++; ADD_NEW(state_offset, count); }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_QUERY:
+      case OP_MINQUERY:
+      case OP_NOTQUERY:
+      case OP_NOTMINQUERY:
+      ADD_ACTIVE(state_offset + dlen + 1, 0);
+      if (clen > 0)
+        {
+        int otherd = -1;
+        if ((ims && PCRE_CASELESS) != 0)
+          {
+#ifdef SUPPORT_UTF8
+          if (utf8 && c >= 128)
+            {
+#ifdef SUPPORT_UCP
+            if (ucp_findchar(c, &chartype, &otherd) < 0) otherd = -1;
+#endif  /* SUPPORT_UCP */
+            }
+          else
+#endif  /* SUPPORT_UTF8 */
+          otherd = fcc[d];
+          }
+        if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
+          { ADD_NEW(state_offset + dlen + 1, 0); }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_STAR:
+      case OP_MINSTAR:
+      case OP_NOTSTAR:
+      case OP_NOTMINSTAR:
+      ADD_ACTIVE(state_offset + dlen + 1, 0);
+      if (clen > 0)
+        {
+        int otherd = -1;
+        if ((ims && PCRE_CASELESS) != 0)
+          {
+#ifdef SUPPORT_UTF8
+          if (utf8 && c >= 128)
+            {
+#ifdef SUPPORT_UCP
+            if (ucp_findchar(c, &chartype, &otherd) < 0) otherd = -1;
+#endif  /* SUPPORT_UCP */
+            }
+          else
+#endif  /* SUPPORT_UTF8 */
+          otherd = fcc[d];
+          }
+        if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
+          { ADD_NEW(state_offset, 0); }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_EXACT:
+      case OP_UPTO:
+      case OP_MINUPTO:
+      case OP_NOTEXACT:
+      case OP_NOTUPTO:
+      case OP_NOTMINUPTO:
+      if (codevalue != OP_EXACT && codevalue != OP_NOTEXACT)
+        { ADD_ACTIVE(state_offset + dlen + 3, 0); }
+      count = current_state->count;  /* Number already matched */
+      if (clen > 0)
+        {
+        int otherd = -1;
+        if ((ims & PCRE_CASELESS) != 0)
+          {
+#ifdef SUPPORT_UTF8
+          if (utf8 && c >= 128)
+            {
+#ifdef SUPPORT_UCP
+            if (ucp_findchar(d, &chartype, &otherd) < 0) otherd = -1;
+#endif  /* SUPPORT_UCP */
+            }
+          else
+#endif  /* SUPPORT_UTF8 */
+          otherd = fcc[d];
+          }
+        if ((c == d || c == otherd) == (codevalue < OP_NOTSTAR))
+          {
+          if (++count >= GET2(code, 1))
+            { ADD_NEW(state_offset + dlen + 3, 0); }
+          else
+            { ADD_NEW(state_offset, count); }
+          }
+        }
+      break;
+
+
+/* ========================================================================== */
+      /* These are the class-handling opcodes */
+
+      case OP_CLASS:
+      case OP_NCLASS:
+      case OP_XCLASS:
+        {
+        BOOL isinclass = FALSE;
+        int next_state_offset;
+        const uschar *ecode;
+
+        /* For a simple class, there is always just a 32-byte table, and we
+        can set isinclass from it. */
+
+        if (codevalue != OP_XCLASS)
+          {
+          ecode = code + 33;
+          if (clen > 0)
+            {
+            isinclass = (c > 255)? (codevalue == OP_NCLASS) :
+              ((code[1 + c/8] & (1 << (c&7))) != 0);
+            }
+          }
+
+        /* An extended class may have a table or a list of single characters,
+        ranges, or both, and it may be positive or negative. There's a
+        function that sorts all this out. */
+
+        else
+         {
+         ecode = code + GET(code, 1);
+         if (clen > 0) isinclass = _pcre_xclass(c, code + 1 + LINK_SIZE);
+         }
+
+        /* At this point, isinclass is set for all kinds of class, and ecode
+        points to the byte after the end of the class. If there is a
+        quantifier, this is where it will be. */
+
+        next_state_offset = ecode - start_code;
+
+        switch (*ecode)
+          {
+          case OP_CRSTAR:
+          case OP_CRMINSTAR:
+          ADD_ACTIVE(next_state_offset + 1, 0);
+          if (isinclass) { ADD_NEW(state_offset, 0); }
+          break;
+
+          case OP_CRPLUS:
+          case OP_CRMINPLUS:
+          count = current_state->count;  /* Already matched */
+          if (count > 0) { ADD_ACTIVE(next_state_offset + 1, 0); }
+          if (isinclass) { count++; ADD_NEW(state_offset, count); }
+          break;
+
+          case OP_CRQUERY:
+          case OP_CRMINQUERY:
+          ADD_ACTIVE(next_state_offset + 1, 0);
+          if (isinclass) { ADD_NEW(next_state_offset + 1, 0); }
+          break;
+
+          case OP_CRRANGE:
+          case OP_CRMINRANGE:
+          count = current_state->count;  /* Already matched */
+          if (count >= GET2(ecode, 1))
+            { ADD_ACTIVE(next_state_offset + 5, 0); }
+          if (isinclass)
+            {
+            if (++count >= GET2(ecode, 3))
+              { ADD_NEW(next_state_offset + 5, 0); }
+            else
+              { ADD_NEW(state_offset, count); }
+            }
+          break;
+
+          default:
+          if (isinclass) { ADD_NEW(next_state_offset, 0); }
+          break;
+          }
+        }
+      break;
+
+/* ========================================================================== */
+      /* These are the opcodes for fancy brackets of various kinds. We have
+      to use recursion in order to handle them. */
+
+      case OP_ASSERT:
+      case OP_ASSERT_NOT:
+      case OP_ASSERTBACK:
+      case OP_ASSERTBACK_NOT:
+        {
+        int rc;
+        int local_offsets[2];
+        int local_workspace[1000];
+        const uschar *endasscode = code + GET(code, 1);
+
+        while (*endasscode == OP_ALT) endasscode += GET(endasscode, 1);
+
+        rc = internal_dfa_exec(
+          md,                                   /* static match data */
+          code,                                 /* this subexpression's code */
+          ptr,                                  /* where we currently are */
+          ptr - start_subject,                  /* start offset */
+          local_offsets,                        /* offset vector */
+          sizeof(local_offsets)/sizeof(int),    /* size of same */
+          local_workspace,                      /* workspace vector */
+          sizeof(local_workspace)/sizeof(int),  /* size of same */
+          ims,                                  /* the current ims flags */
+          rlevel,                               /* function recursion level */
+          recursing);                           /* pass on regex recursion */
+
+        if ((rc >= 0) == (codevalue == OP_ASSERT || codevalue == OP_ASSERTBACK))
+            { ADD_ACTIVE(endasscode + LINK_SIZE + 1 - start_code, 0); }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_COND:
+        {
+        int local_offsets[1000];
+        int local_workspace[1000];
+        int condcode = code[LINK_SIZE+1];
+
+        /* The only supported version of OP_CREF is for the value 0xffff, which
+        means "test if in a recursion". */
+
+        if (condcode == OP_CREF)
+          {
+          int value = GET2(code, LINK_SIZE+2);
+          if (value != 0xffff) return PCRE_ERROR_DFA_UCOND;
+          if (recursing > 0) { ADD_ACTIVE(state_offset + LINK_SIZE + 4, 0); }
+            else { ADD_ACTIVE(state_offset + GET(code, 1) + LINK_SIZE + 1, 0); }
+          }
+
+        /* Otherwise, the condition is an assertion */
+
+        else
+          {
+          int rc;
+          const uschar *asscode = code + LINK_SIZE + 1;
+          const uschar *endasscode = asscode + GET(asscode, 1);
+
+          while (*endasscode == OP_ALT) endasscode += GET(endasscode, 1);
+
+          rc = internal_dfa_exec(
+            md,                                   /* fixed match data */
+            asscode,                              /* this subexpression's code */
+            ptr,                                  /* where we currently are */
+            ptr - start_subject,                  /* start offset */
+            local_offsets,                        /* offset vector */
+            sizeof(local_offsets)/sizeof(int),    /* size of same */
+            local_workspace,                      /* workspace vector */
+            sizeof(local_workspace)/sizeof(int),  /* size of same */
+            ims,                                  /* the current ims flags */
+            rlevel,                               /* function recursion level */
+            recursing);                           /* pass on regex recursion */
+
+          if ((rc >= 0) ==
+                (condcode == OP_ASSERT || condcode == OP_ASSERTBACK))
+            { ADD_ACTIVE(endasscode + LINK_SIZE + 1 - start_code, 0); }
+          else
+            { ADD_ACTIVE(state_offset + GET(code, 1) + LINK_SIZE + 1, 0); }
+          }
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_RECURSE:
+        {
+        int local_offsets[1000];
+        int local_workspace[1000];
+        int rc;
+
+        DPRINTF(("%.*sStarting regex recursion %d\n", rlevel*2-2, SP,
+          recursing + 1));
+
+        rc = internal_dfa_exec(
+          md,                                   /* fixed match data */
+          start_code + GET(code, 1),            /* this subexpression's code */
+          ptr,                                  /* where we currently are */
+          ptr - start_subject,                  /* start offset */
+          local_offsets,                        /* offset vector */
+          sizeof(local_offsets)/sizeof(int),    /* size of same */
+          local_workspace,                      /* workspace vector */
+          sizeof(local_workspace)/sizeof(int),  /* size of same */
+          ims,                                  /* the current ims flags */
+          rlevel,                               /* function recursion level */
+          recursing + 1);                       /* regex recurse level */
+
+        DPRINTF(("%.*sReturn from regex recursion %d: rc=%d\n", rlevel*2-2, SP,
+          recursing + 1, rc));
+
+        /* Ran out of internal offsets */
+
+        if (rc == 0) return PCRE_ERROR_DFA_RECURSE;
+
+        /* For each successful matched substring, set up the next state with a
+        count of characters to skip before trying it. Note that the count is in
+        characters, not bytes. */
+
+        if (rc > 0)
+          {
+          for (rc = rc*2 - 2; rc >= 0; rc -= 2)
+            {
+            const uschar *p = start_subject + local_offsets[rc];
+            const uschar *pp = start_subject + local_offsets[rc+1];
+            int charcount = local_offsets[rc+1] - local_offsets[rc];
+            while (p < pp) if ((*p++ & 0xc0) == 0x80) charcount--;
+            if (charcount > 0)
+              {
+              ADD_NEW_DATA(-(state_offset + LINK_SIZE + 1), 0, (charcount - 1));
+              }
+            else
+              {
+              ADD_ACTIVE(state_offset + LINK_SIZE + 1, 0);
+              }
+            }
+          }
+        else if (rc != PCRE_ERROR_NOMATCH) return rc;
+        }
+      break;
+
+      /*-----------------------------------------------------------------*/
+      case OP_ONCE:
+        {
+        const uschar *endcode;
+        int local_offsets[2];
+        int local_workspace[1000];
+
+        int rc = internal_dfa_exec(
+          md,                                   /* fixed match data */
+          code,                                 /* this subexpression's code */
+          ptr,                                  /* where we currently are */
+          ptr - start_subject,                  /* start offset */
+          local_offsets,                        /* offset vector */
+          sizeof(local_offsets)/sizeof(int),    /* size of same */
+          local_workspace,                      /* workspace vector */
+          sizeof(local_workspace)/sizeof(int),  /* size of same */
+          ims,                                  /* the current ims flags */
+          rlevel,                               /* function recursion level */
+          recursing);                           /* pass on regex recursion */
+
+        if (rc >= 0)
+          {
+          const uschar *end_subpattern = code;
+          int charcount = local_offsets[1] - local_offsets[0];
+          int next_state_offset, repeat_state_offset;
+          BOOL is_repeated;
+
+          do { end_subpattern += GET(end_subpattern, 1); }
+            while (*end_subpattern == OP_ALT);
+          next_state_offset = end_subpattern - start_code + LINK_SIZE + 1;
+
+          /* If the end of this subpattern is KETRMAX or KETRMIN, we must
+          arrange for the repeat state also to be added to the relevant list.
+          Calculate the offset, or set -1 for no repeat. */
+
+          repeat_state_offset = (*end_subpattern == OP_KETRMAX ||
+                                 *end_subpattern == OP_KETRMIN)?
+            end_subpattern - start_code - GET(end_subpattern, 1) : -1;
+
+          /* If we have matched an empty string, add the next state at the
+          current character pointer. This is important so that the duplicate
+          checking kicks in, which is what breaks infinite loops that match an
+          empty string. */
+
+          if (charcount == 0)
+            {
+            ADD_ACTIVE(next_state_offset, 0);
+            }
+
+          /* Optimization: if there are no more active states, and there
+          are no new states yet set up, then skip over the subject string
+          right here, to save looping. Otherwise, set up the new state to swing
+          into action when the end of the substring is reached. */
+
+          else if (i + 1 >= active_count && new_count == 0)
+            {
+            ptr += charcount;
+            clen = 0;
+            ADD_NEW(next_state_offset, 0);
+
+            /* If we are adding a repeat state at the new character position,
+            we must fudge things so that it is the only current state.
+            Otherwise, it might be a duplicate of one we processed before, and
+            that would cause it to be skipped. */
+
+            if (repeat_state_offset >= 0)
+              {
+              next_active_state = active_states;
+              active_count = 0;
+              i = -1;
+              ADD_ACTIVE(repeat_state_offset, 0);
+              }
+            }
+          else
+            {
+            const uschar *p = start_subject + local_offsets[0];
+            const uschar *pp = start_subject + local_offsets[1];
+            while (p < pp) if ((*p++ & 0xc0) == 0x80) charcount--;
+            ADD_NEW_DATA(-next_state_offset, 0, (charcount - 1));
+            if (repeat_state_offset >= 0)
+              { ADD_NEW_DATA(-repeat_state_offset, 0, (charcount - 1)); }
+            }
+
+          }
+        else if (rc != PCRE_ERROR_NOMATCH) return rc;
+        }
+      break;
+
+
+/* ========================================================================== */
+      /* Handle callouts */
+
+      case OP_CALLOUT:
+      if (pcre_callout != NULL)
+        {
+        int rrc;
+        pcre_callout_block cb;
+        cb.version          = 1;   /* Version 1 of the callout block */
+        cb.callout_number   = code[1];
+        cb.offset_vector    = offsets;
+        cb.subject          = (char *)start_subject;
+        cb.subject_length   = end_subject - start_subject;
+        cb.start_match      = current_subject - start_subject;
+        cb.current_position = ptr - start_subject;
+        cb.pattern_position = GET(code, 2);
+        cb.next_item_length = GET(code, 2 + LINK_SIZE);
+        cb.capture_top      = 1;
+        cb.capture_last     = -1;
+        cb.callout_data     = md->callout_data;
+        if ((rrc = (*pcre_callout)(&cb)) < 0) return rrc;   /* Abandon */
+        if (rrc == 0) { ADD_ACTIVE(state_offset + 2 + 2*LINK_SIZE, 0); }
+        }
+      break;
+
+
+/* ========================================================================== */
+      default:        /* Unsupported opcode */
+      return PCRE_ERROR_DFA_UITEM;
+      }
+
+    NEXT_ACTIVE_STATE: continue;
+
+    }      /* End of loop scanning active states */
+
+  /* We have finished the processing at the current subject character. If no
+  new states have been set for the next character, we have found all the
+  matches that we are going to find. If we are at the top level and partial
+  matching has been requested, check for appropriate conditions. */
+
+  if (new_count <= 0)
+    {
+    if (match_count < 0 &&                     /* No matches found */
+        rlevel == 1 &&                         /* Top level match function */
+        (md->moptions & PCRE_PARTIAL) != 0 &&  /* Want partial matching */
+        ptr >= end_subject &&                  /* Reached end of subject */
+        ptr > current_subject)                 /* Matched non-empty string */
+      {
+      if (offsetcount >= 2)
+        {
+        offsets[0] = current_subject - start_subject;
+        offsets[1] = end_subject - start_subject;
+        }
+      match_count = PCRE_ERROR_PARTIAL;
+      }
+
+    DPRINTF(("%.*sEnd of internal_dfa_exec %d: returning %d\n"
+      "%.*s---------------------\n\n", rlevel*2-2, SP, rlevel, match_count,
+      rlevel*2-2, SP));
+    return match_count;
+    }
+
+  /* One or more states are active for the next character. */
+
+  ptr += clen;    /* Advance to next subject character */
+  }               /* Loop to move along the subject string */
+
+/* Control never gets here, but we must keep the compiler happy. */
+
+DPRINTF(("%.*s+++ Unexpected end of internal_dfa_exec %d +++\n"
+  "%.*s---------------------\n\n", rlevel*2-2, SP, rlevel, rlevel*2-2, SP));
+return PCRE_ERROR_NOMATCH;
+}
+
+
+
+
+/*************************************************
+*    Execute a Regular Expression - DFA engine   *
+*************************************************/
+
+/* This external function applies a compiled re to a subject string using a DFA
+engine. This function calls the internal function multiple times if the pattern
+is not anchored.
+
+Arguments:
+  argument_re     points to the compiled expression
+  extra_data      points to extra data or is NULL (not currently used)
+  subject         points to the subject string
+  length          length of subject string (may contain binary zeros)
+  start_offset    where to start in the subject string
+  options         option bits
+  offsets         vector of match offsets
+  offsetcount     size of same
+  workspace       workspace vector
+  wscount         size of same
+
+Returns:          > 0 => number of match offset pairs placed in offsets
+                  = 0 => offsets overflowed; longest matches are present
+                   -1 => failed to match
+                 < -1 => some kind of unexpected problem
+*/
+
+EXPORT int
+pcre_dfa_exec(const pcre *argument_re, const pcre_extra *extra_data,
+  const char *subject, int length, int start_offset, int options, int *offsets,
+  int offsetcount, int *workspace, int wscount)
+{
+real_pcre *re = (real_pcre *)argument_re;
+dfa_match_data match_block;
+BOOL utf8, anchored, startline, firstline;
+const uschar *current_subject, *end_subject, *lcc;
+
+pcre_study_data internal_study;
+const pcre_study_data *study = NULL;
+real_pcre internal_re;
+
+const uschar *req_byte_ptr;
+const uschar *start_bits = NULL;
+BOOL first_byte_caseless = FALSE;
+BOOL req_byte_caseless = FALSE;
+int first_byte = -1;
+int req_byte = -1;
+int req_byte2 = -1;
+
+/* Plausibility checks */
+
+if ((options & ~PUBLIC_DFA_EXEC_OPTIONS) != 0) return PCRE_ERROR_BADOPTION;
+if (re == NULL || subject == NULL || workspace == NULL ||
+   (offsets == NULL && offsetcount > 0)) return PCRE_ERROR_NULL;
+if (offsetcount < 0) return PCRE_ERROR_BADCOUNT;
+if (wscount < 20) return PCRE_ERROR_DFA_WSSIZE;
+
+/* We need to find the pointer to any study data before we test for byte
+flipping, so we scan the extra_data block first. This may set two fields in the
+match block, so we must initialize them beforehand. However, the other fields
+in the match block must not be set until after the byte flipping. */
+
+match_block.tables = re->tables;
+match_block.callout_data = NULL;
+
+if (extra_data != NULL)
+  {
+  unsigned int flags = extra_data->flags;
+  if ((flags & PCRE_EXTRA_STUDY_DATA) != 0)
+    study = (const pcre_study_data *)extra_data->study_data;
+  if ((flags & PCRE_EXTRA_MATCH_LIMIT) != 0) return PCRE_ERROR_DFA_UMLIMIT;
+  if ((flags & PCRE_EXTRA_CALLOUT_DATA) != 0)
+    match_block.callout_data = extra_data->callout_data;
+  if ((flags & PCRE_EXTRA_TABLES) != 0)
+    match_block.tables = extra_data->tables;
+  }
+
+/* Check that the first field in the block is the magic number. If it is not,
+test for a regex that was compiled on a host of opposite endianness. If this is
+the case, flipped values are put in internal_re and internal_study if there was
+study data too. */
+
+if (re->magic_number != MAGIC_NUMBER)
+  {
+  re = _pcre_try_flipped(re, &internal_re, study, &internal_study);
+  if (re == NULL) return PCRE_ERROR_BADMAGIC;
+  if (study != NULL) study = &internal_study;
+  }
+
+/* Set some local values */
+
+current_subject = (const unsigned char *)subject + start_offset;
+end_subject = (const unsigned char *)subject + length;
+req_byte_ptr = current_subject - 1;
+
+utf8 = (re->options & PCRE_UTF8) != 0;
+anchored = (options & PCRE_ANCHORED) != 0 || (re->options & PCRE_ANCHORED) != 0;
+
+/* The remaining fixed data for passing around. */
+
+match_block.start_code = (const uschar *)argument_re +
+    re->name_table_offset + re->name_count * re->name_entry_size;
+match_block.start_subject = (const unsigned char *)subject;
+match_block.end_subject = end_subject;
+match_block.moptions = options;
+match_block.poptions = re->options;
+
+/* Check a UTF-8 string if required. Unfortunately there's no way of passing
+back the character offset. */
+
+#ifdef SUPPORT_UTF8
+if (utf8 && (options & PCRE_NO_UTF8_CHECK) == 0)
+  {
+  if (_pcre_valid_utf8((uschar *)subject, length) >= 0)
+    return PCRE_ERROR_BADUTF8;
+  if (start_offset > 0 && start_offset < length)
+    {
+    int tb = ((uschar *)subject)[start_offset];
+    if (tb > 127)
+      {
+      tb &= 0xc0;
+      if (tb != 0 && tb != 0xc0) return PCRE_ERROR_BADUTF8_OFFSET;
+      }
+    }
+  }
+#endif
+
+/* If the exec call supplied NULL for tables, use the inbuilt ones. This
+is a feature that makes it possible to save compiled regex and re-use them
+in other programs later. */
+
+if (match_block.tables == NULL) match_block.tables = _pcre_default_tables;
+
+/* The lower casing table and the "must be at the start of a line" flag are
+used in a loop when finding where to start. */
+
+lcc = match_block.tables + lcc_offset;
+startline = (re->options & PCRE_STARTLINE) != 0;
+firstline = (re->options & PCRE_FIRSTLINE) != 0;
+
+/* Set up the first character to match, if available. The first_byte value is
+never set for an anchored regular expression, but the anchoring may be forced
+at run time, so we have to test for anchoring. The first char may be unset for
+an unanchored pattern, of course. If there's no first char and the pattern was
+studied, there may be a bitmap of possible first characters. */
+
+if (!anchored)
+  {
+  if ((re->options & PCRE_FIRSTSET) != 0)
+    {
+    first_byte = re->first_byte & 255;
+    if ((first_byte_caseless = ((re->first_byte & REQ_CASELESS) != 0)) == TRUE)
+      first_byte = lcc[first_byte];
+    }
+  else
+    {
+    if (startline && study != NULL &&
+         (study->options & PCRE_STUDY_MAPPED) != 0)
+      start_bits = study->start_bits;
+    }
+  }
+
+/* For anchored or unanchored matches, there may be a "last known required
+character" set. */
+
+if ((re->options & PCRE_REQCHSET) != 0)
+  {
+  req_byte = re->req_byte & 255;
+  req_byte_caseless = (re->req_byte & REQ_CASELESS) != 0;
+  req_byte2 = (match_block.tables + fcc_offset)[req_byte];  /* case flipped */
+  }
+
+/* Call the main matching function, looping for a non-anchored regex after a
+failed match. Unless restarting, optimize by moving to the first match
+character if possible, when not anchored. Then unless wanting a partial match,
+check for a required later character. */
+
+for (;;)
+  {
+  int rc;
+
+  if ((options & PCRE_DFA_RESTART) == 0)
+    {
+    const uschar *save_end_subject = end_subject;
+
+    /* Advance to a unique first char if possible. If firstline is TRUE, the
+    start of the match is constrained to the first line of a multiline string.
+    Implement this by temporarily adjusting end_subject so that we stop scanning
+    at a newline. If the match fails at the newline, later code breaks this loop.
+    */
+
+    if (firstline)
+      {
+      const uschar *t = current_subject;
+      while (t < save_end_subject && *t != '\n') t++;
+      end_subject = t;
+      }
+
+    if (first_byte >= 0)
+      {
+      if (first_byte_caseless)
+        while (current_subject < end_subject &&
+               lcc[*current_subject] != first_byte)
+          current_subject++;
+      else
+        while (current_subject < end_subject && *current_subject != first_byte)
+          current_subject++;
+      }
+
+    /* Or to just after \n for a multiline match if possible */
+
+    else if (startline)
+      {
+      if (current_subject > match_block.start_subject + start_offset)
+        {
+        while (current_subject < end_subject && current_subject[-1] != NEWLINE)
+          current_subject++;
+        }
+      }
+
+    /* Or to a non-unique first char after study */
+
+    else if (start_bits != NULL)
+      {
+      while (current_subject < end_subject)
+        {
+        register unsigned int c = *current_subject;
+        if ((start_bits[c/8] & (1 << (c&7))) == 0) current_subject++;
+          else break;
+        }
+      }
+
+    /* Restore fudged end_subject */
+
+    end_subject = save_end_subject;
+    }
+
+  /* If req_byte is set, we know that that character must appear in the subject
+  for the match to succeed. If the first character is set, req_byte must be
+  later in the subject; otherwise the test starts at the match point. This
+  optimization can save a huge amount of work in patterns with nested unlimited
+  repeats that aren't going to match. Writing separate code for cased/caseless
+  versions makes it go faster, as does using an autoincrement and backing off
+  on a match.
+
+  HOWEVER: when the subject string is very, very long, searching to its end can
+  take a long time, and give bad performance on quite ordinary patterns. This
+  showed up when somebody was matching /^C/ on a 32-megabyte string... so we
+  don't do this when the string is sufficiently long.
+
+  ALSO: this processing is disabled when partial matching is requested.
+  */
+
+  if (req_byte >= 0 &&
+      end_subject - current_subject < REQ_BYTE_MAX &&
+      (options & PCRE_PARTIAL) == 0)
+    {
+    register const uschar *p = current_subject + ((first_byte >= 0)? 1 : 0);
+
+    /* We don't need to repeat the search if we haven't yet reached the
+    place we found it at last time. */
+
+    if (p > req_byte_ptr)
+      {
+      if (req_byte_caseless)
+        {
+        while (p < end_subject)
+          {
+          register int pp = *p++;
+          if (pp == req_byte || pp == req_byte2) { p--; break; }
+          }
+        }
+      else
+        {
+        while (p < end_subject)
+          {
+          if (*p++ == req_byte) { p--; break; }
+          }
+        }
+
+      /* If we can't find the required character, break the matching loop,
+      which will cause a return or PCRE_ERROR_NOMATCH. */
+
+      if (p >= end_subject) break;
+
+      /* If we have found the required character, save the point where we
+      found it, so that we don't search again next time round the loop if
+      the start hasn't passed this character yet. */
+
+      req_byte_ptr = p;
+      }
+    }
+
+  /* OK, now we can do the business */
+
+  rc = internal_dfa_exec(
+    &match_block,                              /* fixed match data */
+    match_block.start_code,                    /* this subexpression's code */
+    current_subject,                           /* where we currently are */
+    start_offset,                              /* start offset in subject */
+    offsets,                                   /* offset vector */
+    offsetcount,                               /* size of same */
+    workspace,                                 /* workspace vector */
+    wscount,                                   /* size of same */
+    re->options & (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL), /* ims flags */
+    0,                                         /* function recurse level */
+    0);                                        /* regex recurse level */
+
+  /* Anything other than "no match" means we are done, always; otherwise, carry
+  on only if not anchored. */
+
+  if (rc != PCRE_ERROR_NOMATCH || anchored) return rc;
+
+  /* Advance to the next subject character unless we are at the end of a line
+  and firstline is set. */
+
+  if (firstline && *current_subject == NEWLINE) break;
+  current_subject++;
+
+#ifdef SUPPORT_UTF8
+  if (utf8)
+    {
+    while (current_subject < end_subject && (*current_subject & 0xc0) == 0x80)
+      current_subject++;
+    }
+#endif
+
+  if (current_subject > end_subject) break;
+  }
+
+return PCRE_ERROR_NOMATCH;
+}
+
+/* End of pcre_dfa_exec.c */
diff --git a/ext/pcre/pcrelib/pcre_exec.c b/ext/pcre/pcrelib/pcre_exec.c
new file mode 100644 (file)
index 0000000..65173e2
--- /dev/null
@@ -0,0 +1,3632 @@
+/*************************************************
+*      Perl-Compatible Regular Expressions       *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+
+/* This module contains pcre_exec(), the externally visible function that does
+pattern matching using an NFA algorithm, trying to mimic Perl as closely as
+possible. There are also some static supporting functions. */
+
+
+#include "pcre_internal.h"
+
+
+/* Structure for building a chain of data that actually lives on the
+stack, for holding the values of the subject pointer at the start of each
+subpattern, so as to detect when an empty string has been matched by a
+subpattern - to break infinite loops. When NO_RECURSE is set, these blocks
+are on the heap, not on the stack. */
+
+typedef struct eptrblock {
+  struct eptrblock *epb_prev;
+  const uschar *epb_saved_eptr;
+} eptrblock;
+
+/* Flag bits for the match() function */
+
+#define match_condassert   0x01    /* Called to check a condition assertion */
+#define match_isgroup      0x02    /* Set if start of bracketed group */
+
+/* Non-error returns from the match() function. Error returns are externally
+defined PCRE_ERROR_xxx codes, which are all negative. */
+
+#define MATCH_MATCH        1
+#define MATCH_NOMATCH      0
+
+/* Maximum number of ints of offset to save on the stack for recursive calls.
+If the offset vector is bigger, malloc is used. This should be a multiple of 3,
+because the offset vector is always a multiple of 3 long. */
+
+#define REC_STACK_SAVE_MAX 30
+
+/* 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 };
+
+
+
+#ifdef DEBUG
+/*************************************************
+*        Debugging function to print chars       *
+*************************************************/
+
+/* Print a sequence of chars in printable format, stopping at the end of the
+subject if the requested.
+
+Arguments:
+  p           points to characters
+  length      number to print
+  is_subject  TRUE if printing from within md->start_subject
+  md          pointer to matching data block, if is_subject is TRUE
+
+Returns:     nothing
+*/
+
+static void
+pchars(const uschar *p, int length, BOOL is_subject, match_data *md)
+{
+int c;
+if (is_subject && length > md->end_subject - p) length = md->end_subject - p;
+while (length-- > 0)
+  if (isprint(c = *(p++))) printf("%c", c); else printf("\\x%02x", c);
+}
+#endif
+
+
+
+/*************************************************
+*          Match a back-reference                *
+*************************************************/
+
+/* If a back reference hasn't been set, the length that is passed is greater
+than the number of characters left in the string, so the match fails.
+
+Arguments:
+  offset      index into the offset vector
+  eptr        points into the subject
+  length      length to be matched
+  md          points to match data block
+  ims         the ims flags
+
+Returns:      TRUE if matched
+*/
+
+static BOOL
+match_ref(int offset, register const uschar *eptr, int length, match_data *md,
+  unsigned long int ims)
+{
+const uschar *p = md->start_subject + md->offset_vector[offset];
+
+#ifdef DEBUG
+if (eptr >= md->end_subject)
+  printf("matching subject <null>");
+else
+  {
+  printf("matching subject ");
+  pchars(eptr, length, TRUE, md);
+  }
+printf(" against backref ");
+pchars(p, length, FALSE, md);
+printf("\n");
+#endif
+
+/* Always fail if not enough characters left */
+
+if (length > md->end_subject - eptr) return FALSE;
+
+/* Separate the caselesss case for speed */
+
+if ((ims & PCRE_CASELESS) != 0)
+  {
+  while (length-- > 0)
+    if (md->lcc[*p++] != md->lcc[*eptr++]) return FALSE;
+  }
+else
+  { while (length-- > 0) if (*p++ != *eptr++) return FALSE; }
+
+return TRUE;
+}
+
+
+
+/***************************************************************************
+****************************************************************************
+                   RECURSION IN THE match() FUNCTION
+
+The match() function is highly recursive. Some regular expressions can cause
+it to recurse thousands of times. I was writing for Unix, so I just let it
+call itself recursively. This uses the stack for saving everything that has
+to be saved for a recursive call. On Unix, the stack can be large, and this
+works fine.
+
+It turns out that on non-Unix systems there are problems with programs that
+use a lot of stack. (This despite the fact that every last chip has oodles
+of memory these days, and techniques for extending the stack have been known
+for decades.) So....
+
+There is a fudge, triggered by defining NO_RECURSE, which avoids recursive
+calls by keeping local variables that need to be preserved in blocks of memory
+obtained from malloc instead instead of on the stack. Macros are used to
+achieve this so that the actual code doesn't look very different to what it
+always used to.
+****************************************************************************
+***************************************************************************/
+
+
+/* These versions of the macros use the stack, as normal */
+
+#ifndef NO_RECURSE
+#define REGISTER register
+#define RMATCH(rx,ra,rb,rc,rd,re,rf,rg) rx = match(ra,rb,rc,rd,re,rf,rg)
+#define RRETURN(ra) return ra
+#else
+
+
+/* These versions of the macros manage a private stack on the heap. Note
+that the rd argument of RMATCH isn't actually used. It's the md argument of
+match(), which never changes. */
+
+#define REGISTER
+
+#define RMATCH(rx,ra,rb,rc,rd,re,rf,rg)\
+  {\
+  heapframe *newframe = (pcre_stack_malloc)(sizeof(heapframe));\
+  if (setjmp(frame->Xwhere) == 0)\
+    {\
+    newframe->Xeptr = ra;\
+    newframe->Xecode = rb;\
+    newframe->Xoffset_top = rc;\
+    newframe->Xims = re;\
+    newframe->Xeptrb = rf;\
+    newframe->Xflags = rg;\
+    newframe->Xprevframe = frame;\
+    frame = newframe;\
+    DPRINTF(("restarting from line %d\n", __LINE__));\
+    goto HEAP_RECURSE;\
+    }\
+  else\
+    {\
+    DPRINTF(("longjumped back to line %d\n", __LINE__));\
+    frame = md->thisframe;\
+    rx = frame->Xresult;\
+    }\
+  }
+
+#define RRETURN(ra)\
+  {\
+  heapframe *newframe = frame;\
+  frame = newframe->Xprevframe;\
+  (pcre_stack_free)(newframe);\
+  if (frame != NULL)\
+    {\
+    frame->Xresult = ra;\
+    md->thisframe = frame;\
+    longjmp(frame->Xwhere, 1);\
+    }\
+  return ra;\
+  }
+
+
+/* Structure for remembering the local variables in a private frame */
+
+typedef struct heapframe {
+  struct heapframe *Xprevframe;
+
+  /* Function arguments that may change */
+
+  const uschar *Xeptr;
+  const uschar *Xecode;
+  int Xoffset_top;
+  long int Xims;
+  eptrblock *Xeptrb;
+  int Xflags;
+
+  /* Function local variables */
+
+  const uschar *Xcallpat;
+  const uschar *Xcharptr;
+  const uschar *Xdata;
+  const uschar *Xnext;
+  const uschar *Xpp;
+  const uschar *Xprev;
+  const uschar *Xsaved_eptr;
+
+  recursion_info Xnew_recursive;
+
+  BOOL Xcur_is_word;
+  BOOL Xcondition;
+  BOOL Xminimize;
+  BOOL Xprev_is_word;
+
+  unsigned long int Xoriginal_ims;
+
+#ifdef SUPPORT_UCP
+  int Xprop_type;
+  int Xprop_fail_result;
+  int Xprop_category;
+  int Xprop_chartype;
+  int Xprop_othercase;
+  int Xprop_test_against;
+  int *Xprop_test_variable;
+#endif
+
+  int Xctype;
+  int Xfc;
+  int Xfi;
+  int Xlength;
+  int Xmax;
+  int Xmin;
+  int Xnumber;
+  int Xoffset;
+  int Xop;
+  int Xsave_capture_last;
+  int Xsave_offset1, Xsave_offset2, Xsave_offset3;
+  int Xstacksave[REC_STACK_SAVE_MAX];
+
+  eptrblock Xnewptrb;
+
+  /* Place to pass back result, and where to jump back to */
+
+  int  Xresult;
+  jmp_buf Xwhere;
+
+} heapframe;
+
+#endif
+
+
+/***************************************************************************
+***************************************************************************/
+
+
+
+/*************************************************
+*         Match from current position            *
+*************************************************/
+
+/* On entry ecode points to the first opcode, and eptr to the first character
+in the subject string, while eptrb holds the value of eptr at the start of the
+last bracketed group - used for breaking infinite loops matching zero-length
+strings. This function is called recursively in many circumstances. Whenever it
+returns a negative (error) response, the outer incarnation must also return the
+same response.
+
+Performance note: It might be tempting to extract commonly used fields from the
+md structure (e.g. utf8, end_subject) into individual variables to improve
+performance. Tests using gcc on a SPARC disproved this; in the first case, it
+made performance worse.
+
+Arguments:
+   eptr        pointer in subject
+   ecode       position in code
+   offset_top  current top pointer
+   md          pointer to "static" info for the match
+   ims         current /i, /m, and /s options
+   eptrb       pointer to chain of blocks containing eptr at start of
+                 brackets - for testing for empty matches
+   flags       can contain
+                 match_condassert - this is an assertion condition
+                 match_isgroup - this is the start of a bracketed group
+
+Returns:       MATCH_MATCH if matched            )  these values are >= 0
+               MATCH_NOMATCH if failed to match  )
+               a negative PCRE_ERROR_xxx value if aborted by an error condition
+                 (e.g. stopped by recursion limit)
+*/
+
+static int
+match(REGISTER const uschar *eptr, REGISTER const uschar *ecode,
+  int offset_top, match_data *md, unsigned long int ims, eptrblock *eptrb,
+  int flags)
+{
+/* These variables do not need to be preserved over recursion in this function,
+so they can be ordinary variables in all cases. Mark them with "register"
+because they are used a lot in loops. */
+
+register int  rrc;    /* Returns from recursive calls */
+register int  i;      /* Used for loops not involving calls to RMATCH() */
+register int  c;      /* Character values not kept over RMATCH() calls */
+register BOOL utf8;   /* Local copy of UTF-8 flag for speed */
+
+/* When recursion is not being used, all "local" variables that have to be
+preserved over calls to RMATCH() are part of a "frame" which is obtained from
+heap storage. Set up the top-level frame here; others are obtained from the
+heap whenever RMATCH() does a "recursion". See the macro definitions above. */
+
+#ifdef NO_RECURSE
+heapframe *frame = (pcre_stack_malloc)(sizeof(heapframe));
+frame->Xprevframe = NULL;            /* Marks the top level */
+
+/* Copy in the original argument variables */
+
+frame->Xeptr = eptr;
+frame->Xecode = ecode;
+frame->Xoffset_top = offset_top;
+frame->Xims = ims;
+frame->Xeptrb = eptrb;
+frame->Xflags = flags;
+
+/* This is where control jumps back to to effect "recursion" */
+
+HEAP_RECURSE:
+
+/* Macros make the argument variables come from the current frame */
+
+#define eptr               frame->Xeptr
+#define ecode              frame->Xecode
+#define offset_top         frame->Xoffset_top
+#define ims                frame->Xims
+#define eptrb              frame->Xeptrb
+#define flags              frame->Xflags
+
+/* Ditto for the local variables */
+
+#ifdef SUPPORT_UTF8
+#define charptr            frame->Xcharptr
+#endif
+#define callpat            frame->Xcallpat
+#define data               frame->Xdata
+#define next               frame->Xnext
+#define pp                 frame->Xpp
+#define prev               frame->Xprev
+#define saved_eptr         frame->Xsaved_eptr
+
+#define new_recursive      frame->Xnew_recursive
+
+#define cur_is_word        frame->Xcur_is_word
+#define condition          frame->Xcondition
+#define minimize           frame->Xminimize
+#define prev_is_word       frame->Xprev_is_word
+
+#define original_ims       frame->Xoriginal_ims
+
+#ifdef SUPPORT_UCP
+#define prop_type          frame->Xprop_type
+#define prop_fail_result   frame->Xprop_fail_result
+#define prop_category      frame->Xprop_category
+#define prop_chartype      frame->Xprop_chartype
+#define prop_othercase     frame->Xprop_othercase
+#define prop_test_against  frame->Xprop_test_against
+#define prop_test_variable frame->Xprop_test_variable
+#endif
+
+#define ctype              frame->Xctype
+#define fc                 frame->Xfc
+#define fi                 frame->Xfi
+#define length             frame->Xlength
+#define max                frame->Xmax
+#define min                frame->Xmin
+#define number             frame->Xnumber
+#define offset             frame->Xoffset
+#define op                 frame->Xop
+#define save_capture_last  frame->Xsave_capture_last
+#define save_offset1       frame->Xsave_offset1
+#define save_offset2       frame->Xsave_offset2
+#define save_offset3       frame->Xsave_offset3
+#define stacksave          frame->Xstacksave
+
+#define newptrb            frame->Xnewptrb
+
+/* When recursion is being used, local variables are allocated on the stack and
+get preserved during recursion in the normal way. In this environment, fi and
+i, and fc and c, can be the same variables. */
+
+#else
+#define fi i
+#define fc c
+
+
+#ifdef SUPPORT_UTF8                /* Many of these variables are used ony */
+const uschar *charptr;             /* small blocks of the code. My normal  */
+#endif                             /* style of coding would have declared  */
+const uschar *callpat;             /* them within each of those blocks.    */
+const uschar *data;                /* However, in order to accommodate the */
+const uschar *next;                /* version of this code that uses an    */
+const uschar *pp;                  /* external "stack" implemented on the  */
+const uschar *prev;                /* heap, it is easier to declare them   */
+const uschar *saved_eptr;          /* all here, so the declarations can    */
+                                   /* be cut out in a block. The only      */
+recursion_info new_recursive;      /* declarations within blocks below are */
+                                   /* for variables that do not have to    */
+BOOL cur_is_word;                  /* be preserved over a recursive call   */
+BOOL condition;                    /* to RMATCH().                         */
+BOOL minimize;
+BOOL prev_is_word;
+
+unsigned long int original_ims;
+
+#ifdef SUPPORT_UCP
+int prop_type;
+int prop_fail_result;
+int prop_category;
+int prop_chartype;
+int prop_othercase;
+int prop_test_against;
+int *prop_test_variable;
+#endif
+
+int ctype;
+int length;
+int max;
+int min;
+int number;
+int offset;
+int op;
+int save_capture_last;
+int save_offset1, save_offset2, save_offset3;
+int stacksave[REC_STACK_SAVE_MAX];
+
+eptrblock newptrb;
+#endif
+
+/* These statements are here to stop the compiler complaining about unitialized
+variables. */
+
+#ifdef SUPPORT_UCP
+prop_fail_result = 0;
+prop_test_against = 0;
+prop_test_variable = NULL;
+#endif
+
+/* OK, now we can get on with the real code of the function. Recursion is
+specified by the macros RMATCH and RRETURN. When NO_RECURSE is *not* defined,
+these just turn into a recursive call to match() and a "return", respectively.
+However, RMATCH isn't like a function call because it's quite a complicated
+macro. It has to be used in one particular way. This shouldn't, however, impact
+performance when true recursion is being used. */
+
+if (md->match_call_count++ >= md->match_limit) RRETURN(PCRE_ERROR_MATCHLIMIT);
+
+original_ims = ims;    /* Save for resetting on ')' */
+utf8 = md->utf8;       /* Local copy of the flag */
+
+/* At the start of a bracketed group, add the current subject pointer to the
+stack of such pointers, to be re-instated at the end of the group when we hit
+the closing ket. When match() is called in other circumstances, we don't add to
+this stack. */
+
+if ((flags & match_isgroup) != 0)
+  {
+  newptrb.epb_prev = eptrb;
+  newptrb.epb_saved_eptr = eptr;
+  eptrb = &newptrb;
+  }
+
+/* Now start processing the operations. */
+
+for (;;)
+  {
+  op = *ecode;
+  minimize = FALSE;
+
+  /* For partial matching, remember if we ever hit the end of the subject after
+  matching at least one subject character. */
+
+  if (md->partial &&
+      eptr >= md->end_subject &&
+      eptr > md->start_match)
+    md->hitend = TRUE;
+
+  /* Opening capturing bracket. If there is space in the offset vector, save
+  the current subject position in the working slot at the top of the vector. We
+  mustn't change the current values of the data slot, because they may be set
+  from a previous iteration of this group, and be referred to by a reference
+  inside the group.
+
+  If the bracket fails to match, we need to restore this value and also the
+  values of the final offsets, in case they were set by a previous iteration of
+  the same bracket.
+
+  If there isn't enough space in the offset vector, treat this as if it were a
+  non-capturing bracket. Don't worry about setting the flag for the error case
+  here; that is handled in the code for KET. */
+
+  if (op > OP_BRA)
+    {
+    number = op - OP_BRA;
+
+    /* For extended extraction brackets (large number), we have to fish out the
+    number from a dummy opcode at the start. */
+
+    if (number > EXTRACT_BASIC_MAX)
+      number = GET2(ecode, 2+LINK_SIZE);
+    offset = number << 1;
+
+#ifdef DEBUG
+    printf("start bracket %d subject=", number);
+    pchars(eptr, 16, TRUE, md);
+    printf("\n");
+#endif
+
+    if (offset < md->offset_max)
+      {
+      save_offset1 = md->offset_vector[offset];
+      save_offset2 = md->offset_vector[offset+1];
+      save_offset3 = md->offset_vector[md->offset_end - number];
+      save_capture_last = md->capture_last;
+
+      DPRINTF(("saving %d %d %d\n", save_offset1, save_offset2, save_offset3));
+      md->offset_vector[md->offset_end - number] = eptr - md->start_subject;
+
+      do
+        {
+        RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb,
+          match_isgroup);
+        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+        md->capture_last = save_capture_last;
+        ecode += GET(ecode, 1);
+        }
+      while (*ecode == OP_ALT);
+
+      DPRINTF(("bracket %d failed\n", number));
+
+      md->offset_vector[offset] = save_offset1;
+      md->offset_vector[offset+1] = save_offset2;
+      md->offset_vector[md->offset_end - number] = save_offset3;
+
+      RRETURN(MATCH_NOMATCH);
+      }
+
+    /* Insufficient room for saving captured contents */
+
+    else op = OP_BRA;
+    }
+
+  /* Other types of node can be handled by a switch */
+
+  switch(op)
+    {
+    case OP_BRA:     /* Non-capturing bracket: optimized */
+    DPRINTF(("start bracket 0\n"));
+    do
+      {
+      RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb,
+        match_isgroup);
+      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+      ecode += GET(ecode, 1);
+      }
+    while (*ecode == OP_ALT);
+    DPRINTF(("bracket 0 failed\n"));
+    RRETURN(MATCH_NOMATCH);
+
+    /* 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. */
+
+    case OP_COND:
+    if (ecode[LINK_SIZE+1] == OP_CREF) /* Condition extract or recurse test */
+      {
+      offset = GET2(ecode, LINK_SIZE+2) << 1;  /* Doubled ref number */
+      condition = (offset == CREF_RECURSE * 2)?
+        (md->recursive != NULL) :
+        (offset < offset_top && md->offset_vector[offset] >= 0);
+      RMATCH(rrc, eptr, ecode + (condition?
+        (LINK_SIZE + 4) : (LINK_SIZE + 1 + GET(ecode, 1))),
+        offset_top, md, ims, eptrb, match_isgroup);
+      RRETURN(rrc);
+      }
+
+    /* The condition is an assertion. Call match() to evaluate it - setting
+    the final argument TRUE causes it to stop at the end of an assertion. */
+
+    else
+      {
+      RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,
+          match_condassert | match_isgroup);
+      if (rrc == MATCH_MATCH)
+        {
+        ecode += 1 + LINK_SIZE + GET(ecode, LINK_SIZE+2);
+        while (*ecode == OP_ALT) ecode += GET(ecode, 1);
+        }
+      else if (rrc != MATCH_NOMATCH)
+        {
+        RRETURN(rrc);         /* Need braces because of following else */
+        }
+      else ecode += GET(ecode, 1);
+      RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb,
+        match_isgroup);
+      RRETURN(rrc);
+      }
+    /* Control never reaches here */
+
+    /* Skip over conditional reference or large extraction number data if
+    encountered. */
+
+    case OP_CREF:
+    case OP_BRANUMBER:
+    ecode += 3;
+    break;
+
+    /* End of the pattern. If we are in a recursion, we should restore the
+    offsets appropriately and continue from after the call. */
+
+    case OP_END:
+    if (md->recursive != NULL && md->recursive->group_num == 0)
+      {
+      recursion_info *rec = md->recursive;
+      DPRINTF(("Hit the end in a (?0) recursion\n"));
+      md->recursive = rec->prevrec;
+      memmove(md->offset_vector, rec->offset_save,
+        rec->saved_max * sizeof(int));
+      md->start_match = rec->save_start;
+      ims = original_ims;
+      ecode = rec->after_call;
+      break;
+      }
+
+    /* Otherwise, if PCRE_NOTEMPTY is set, fail if we have matched an empty
+    string - backtracking will then try other alternatives, if any. */
+
+    if (md->notempty && eptr == md->start_match) RRETURN(MATCH_NOMATCH);
+    md->end_match_ptr = eptr;          /* Record where we ended */
+    md->end_offset_top = offset_top;   /* and how many extracts were taken */
+    RRETURN(MATCH_MATCH);
+
+    /* Change option settings */
+
+    case OP_OPT:
+    ims = ecode[1];
+    ecode += 2;
+    DPRINTF(("ims set to %02lx\n", ims));
+    break;
+
+    /* Assertion brackets. Check the alternative branches in turn - the
+    matching won't pass the KET for an assertion. If any one branch matches,
+    the assertion is true. Lookbehind assertions have an OP_REVERSE item at the
+    start of each branch to move the current point backwards, so the code at
+    this level is identical to the lookahead case. */
+
+    case OP_ASSERT:
+    case OP_ASSERTBACK:
+    do
+      {
+      RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,
+        match_isgroup);
+      if (rrc == MATCH_MATCH) break;
+      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+      ecode += GET(ecode, 1);
+      }
+    while (*ecode == OP_ALT);
+    if (*ecode == OP_KET) RRETURN(MATCH_NOMATCH);
+
+    /* If checking an assertion for a condition, return MATCH_MATCH. */
+
+    if ((flags & match_condassert) != 0) RRETURN(MATCH_MATCH);
+
+    /* Continue from after the assertion, updating the offsets high water
+    mark, since extracts may have been taken during the assertion. */
+
+    do ecode += GET(ecode,1); while (*ecode == OP_ALT);
+    ecode += 1 + LINK_SIZE;
+    offset_top = md->end_offset_top;
+    continue;
+
+    /* Negative assertion: all branches must fail to match */
+
+    case OP_ASSERT_NOT:
+    case OP_ASSERTBACK_NOT:
+    do
+      {
+      RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, NULL,
+        match_isgroup);
+      if (rrc == MATCH_MATCH) RRETURN(MATCH_NOMATCH);
+      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+      ecode += GET(ecode,1);
+      }
+    while (*ecode == OP_ALT);
+
+    if ((flags & match_condassert) != 0) RRETURN(MATCH_MATCH);
+
+    ecode += 1 + LINK_SIZE;
+    continue;
+
+    /* Move the subject pointer back. This occurs only at the start of
+    each branch of a lookbehind assertion. If we are too close to the start to
+    move back, this match function fails. When working with UTF-8 we move
+    back a number of characters, not bytes. */
+
+    case OP_REVERSE:
+#ifdef SUPPORT_UTF8
+    if (utf8)
+      {
+      c = GET(ecode,1);
+      for (i = 0; i < c; i++)
+        {
+        eptr--;
+        if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH);
+        BACKCHAR(eptr)
+        }
+      }
+    else
+#endif
+
+    /* No UTF-8 support, or not in UTF-8 mode: count is byte count */
+
+      {
+      eptr -= GET(ecode,1);
+      if (eptr < md->start_subject) RRETURN(MATCH_NOMATCH);
+      }
+
+    /* Skip to next op code */
+
+    ecode += 1 + LINK_SIZE;
+    break;
+
+    /* The callout item calls an external function, if one is provided, passing
+    details of the match so far. This is mainly for debugging, though the
+    function is able to force a failure. */
+
+    case OP_CALLOUT:
+    if (pcre_callout != NULL)
+      {
+      pcre_callout_block cb;
+      cb.version          = 1;   /* Version 1 of the callout block */
+      cb.callout_number   = ecode[1];
+      cb.offset_vector    = md->offset_vector;
+      cb.subject          = (const char *)md->start_subject;
+      cb.subject_length   = md->end_subject - md->start_subject;
+      cb.start_match      = md->start_match - md->start_subject;
+      cb.current_position = eptr - md->start_subject;
+      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;
+      cb.callout_data     = md->callout_data;
+      if ((rrc = (*pcre_callout)(&cb)) > 0) RRETURN(MATCH_NOMATCH);
+      if (rrc < 0) RRETURN(rrc);
+      }
+    ecode += 2 + 2*LINK_SIZE;
+    break;
+
+    /* Recursion either matches the current regex, or some subexpression. The
+    offset data is the offset to the starting bracket from the start of the
+    whole pattern. (This is so that it works from duplicated subpatterns.)
+
+    If there are any capturing brackets started but not finished, we have to
+    save their starting points and reinstate them after the recursion. However,
+    we don't know how many such there are (offset_top records the completed
+    total) so we just have to save all the potential data. There may be up to
+    65535 such values, which is too large to put on the stack, but using malloc
+    for small numbers seems expensive. As a compromise, the stack is used when
+    there are no more than REC_STACK_SAVE_MAX values to store; otherwise malloc
+    is used. A problem is what to do if the malloc fails ... there is no way of
+    returning to the top level with an error. Save the top REC_STACK_SAVE_MAX
+    values on the stack, and accept that the rest may be wrong.
+
+    There are also other values that have to be saved. We use a chained
+    sequence of blocks that actually live on the stack. Thanks to Robin Houston
+    for the original version of this logic. */
+
+    case OP_RECURSE:
+      {
+      callpat = md->start_code + GET(ecode, 1);
+      new_recursive.group_num = *callpat - OP_BRA;
+
+      /* For extended extraction brackets (large number), we have to fish out
+      the number from a dummy opcode at the start. */
+
+      if (new_recursive.group_num > EXTRACT_BASIC_MAX)
+        new_recursive.group_num = GET2(callpat, 2+LINK_SIZE);
+
+      /* Add to "recursing stack" */
+
+      new_recursive.prevrec = md->recursive;
+      md->recursive = &new_recursive;
+
+      /* Find where to continue from afterwards */
+
+      ecode += 1 + LINK_SIZE;
+      new_recursive.after_call = ecode;
+
+      /* Now save the offset data. */
+
+      new_recursive.saved_max = md->offset_end;
+      if (new_recursive.saved_max <= REC_STACK_SAVE_MAX)
+        new_recursive.offset_save = stacksave;
+      else
+        {
+        new_recursive.offset_save =
+          (int *)(pcre_malloc)(new_recursive.saved_max * sizeof(int));
+        if (new_recursive.offset_save == NULL) RRETURN(PCRE_ERROR_NOMEMORY);
+        }
+
+      memcpy(new_recursive.offset_save, md->offset_vector,
+            new_recursive.saved_max * sizeof(int));
+      new_recursive.save_start = md->start_match;
+      md->start_match = eptr;
+
+      /* OK, now we can do the recursion. For each top-level alternative we
+      restore the offset and recursion data. */
+
+      DPRINTF(("Recursing into group %d\n", new_recursive.group_num));
+      do
+        {
+        RMATCH(rrc, eptr, callpat + 1 + LINK_SIZE, offset_top, md, ims,
+            eptrb, match_isgroup);
+        if (rrc == MATCH_MATCH)
+          {
+          md->recursive = new_recursive.prevrec;
+          if (new_recursive.offset_save != stacksave)
+            (pcre_free)(new_recursive.offset_save);
+          RRETURN(MATCH_MATCH);
+          }
+        else if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+
+        md->recursive = &new_recursive;
+        memcpy(md->offset_vector, new_recursive.offset_save,
+            new_recursive.saved_max * sizeof(int));
+        callpat += GET(callpat, 1);
+        }
+      while (*callpat == OP_ALT);
+
+      DPRINTF(("Recursion didn't match\n"));
+      md->recursive = new_recursive.prevrec;
+      if (new_recursive.offset_save != stacksave)
+        (pcre_free)(new_recursive.offset_save);
+      RRETURN(MATCH_NOMATCH);
+      }
+    /* Control never reaches here */
+
+    /* "Once" brackets are like assertion brackets except that after a match,
+    the point in the subject string is not moved back. Thus there can never be
+    a move back into the brackets. Friedl calls these "atomic" subpatterns.
+    Check the alternative branches in turn - the matching won't pass the KET
+    for this kind of subpattern. If any one branch matches, we carry on as at
+    the end of a normal bracket, leaving the subject pointer. */
+
+    case OP_ONCE:
+      {
+      prev = ecode;
+      saved_eptr = eptr;
+
+      do
+        {
+        RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims,
+          eptrb, match_isgroup);
+        if (rrc == MATCH_MATCH) break;
+        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+        ecode += GET(ecode,1);
+        }
+      while (*ecode == OP_ALT);
+
+      /* If hit the end of the group (which could be repeated), fail */
+
+      if (*ecode != OP_ONCE && *ecode != OP_ALT) RRETURN(MATCH_NOMATCH);
+
+      /* Continue as from after the assertion, updating the offsets high water
+      mark, since extracts may have been taken. */
+
+      do ecode += GET(ecode,1); while (*ecode == OP_ALT);
+
+      offset_top = md->end_offset_top;
+      eptr = md->end_match_ptr;
+
+      /* For a non-repeating ket, just continue at this level. This also
+      happens for a repeating ket if no characters were matched in the group.
+      This is the forcible breaking of infinite loops as implemented in Perl
+      5.005. If there is an options reset, it will get obeyed in the normal
+      course of events. */
+
+      if (*ecode == OP_KET || eptr == saved_eptr)
+        {
+        ecode += 1+LINK_SIZE;
+        break;
+        }
+
+      /* The repeating kets try the rest of the pattern or restart from the
+      preceding bracket, in the appropriate order. We need to reset any options
+      that changed within the bracket before re-running it, so check the next
+      opcode. */
+
+      if (ecode[1+LINK_SIZE] == OP_OPT)
+        {
+        ims = (ims & ~PCRE_IMS) | ecode[4];
+        DPRINTF(("ims set to %02lx at group repeat\n", ims));
+        }
+
+      if (*ecode == OP_KETRMIN)
+        {
+        RMATCH(rrc, eptr, ecode + 1 + LINK_SIZE, offset_top, md, ims, eptrb, 0);
+        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+        RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, match_isgroup);
+        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+        }
+      else  /* OP_KETRMAX */
+        {
+        RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, match_isgroup);
+        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+        RMATCH(rrc, eptr, ecode + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0);
+        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+        }
+      }
+    RRETURN(MATCH_NOMATCH);
+
+    /* An alternation is the end of a branch; scan along to find the end of the
+    bracketed group and go to there. */
+
+    case OP_ALT:
+    do ecode += GET(ecode,1); while (*ecode == OP_ALT);
+    break;
+
+    /* BRAZERO and BRAMINZERO occur just before a bracket group, indicating
+    that it may occur zero times. It may repeat infinitely, or not at all -
+    i.e. it could be ()* or ()? in the pattern. Brackets with fixed upper
+    repeat limits are compiled as a number of copies, with the optional ones
+    preceded by BRAZERO or BRAMINZERO. */
+
+    case OP_BRAZERO:
+      {
+      next = ecode+1;
+      RMATCH(rrc, eptr, next, offset_top, md, ims, eptrb, match_isgroup);
+      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+      do next += GET(next,1); while (*next == OP_ALT);
+      ecode = next + 1+LINK_SIZE;
+      }
+    break;
+
+    case OP_BRAMINZERO:
+      {
+      next = ecode+1;
+      do next += GET(next,1); while (*next == OP_ALT);
+      RMATCH(rrc, eptr, next + 1+LINK_SIZE, offset_top, md, ims, eptrb,
+        match_isgroup);
+      if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+      ecode++;
+      }
+    break;
+
+    /* End of a group, repeated or non-repeating. If we are at the end of
+    an assertion "group", stop matching and return MATCH_MATCH, but record the
+    current high water mark for use by positive assertions. Do this also
+    for the "once" (not-backup up) groups. */
+
+    case OP_KET:
+    case OP_KETRMIN:
+    case OP_KETRMAX:
+      {
+      prev = ecode - GET(ecode, 1);
+      saved_eptr = eptrb->epb_saved_eptr;
+
+      /* Back up the stack of bracket start pointers. */
+
+      eptrb = eptrb->epb_prev;
+
+      if (*prev == OP_ASSERT || *prev == OP_ASSERT_NOT ||
+          *prev == OP_ASSERTBACK || *prev == OP_ASSERTBACK_NOT ||
+          *prev == OP_ONCE)
+        {
+        md->end_match_ptr = eptr;      /* For ONCE */
+        md->end_offset_top = offset_top;
+        RRETURN(MATCH_MATCH);
+        }
+
+      /* In all other cases except a conditional group we have to check the
+      group number back at the start and if necessary complete handling an
+      extraction by setting the offsets and bumping the high water mark. */
+
+      if (*prev != OP_COND)
+        {
+        number = *prev - OP_BRA;
+
+        /* For extended extraction brackets (large number), we have to fish out
+        the number from a dummy opcode at the start. */
+
+        if (number > EXTRACT_BASIC_MAX) number = GET2(prev, 2+LINK_SIZE);
+        offset = number << 1;
+
+#ifdef DEBUG
+        printf("end bracket %d", number);
+        printf("\n");
+#endif
+
+        /* Test for a numbered group. This includes groups called as a result
+        of recursion. Note that whole-pattern recursion is coded as a recurse
+        into group 0, so it won't be picked up here. Instead, we catch it when
+        the OP_END is reached. */
+
+        if (number > 0)
+          {
+          md->capture_last = number;
+          if (offset >= md->offset_max) md->offset_overflow = TRUE; else
+            {
+            md->offset_vector[offset] =
+              md->offset_vector[md->offset_end - number];
+            md->offset_vector[offset+1] = eptr - md->start_subject;
+            if (offset_top <= offset) offset_top = offset + 2;
+            }
+
+          /* Handle a recursively called group. Restore the offsets
+          appropriately and continue from after the call. */
+
+          if (md->recursive != NULL && md->recursive->group_num == number)
+            {
+            recursion_info *rec = md->recursive;
+            DPRINTF(("Recursion (%d) succeeded - continuing\n", number));
+            md->recursive = rec->prevrec;
+            md->start_match = rec->save_start;
+            memcpy(md->offset_vector, rec->offset_save,
+              rec->saved_max * sizeof(int));
+            ecode = rec->after_call;
+            ims = original_ims;
+            break;
+            }
+          }
+        }
+
+      /* Reset the value of the ims flags, in case they got changed during
+      the group. */
+
+      ims = original_ims;
+      DPRINTF(("ims reset to %02lx\n", ims));
+
+      /* For a non-repeating ket, just continue at this level. This also
+      happens for a repeating ket if no characters were matched in the group.
+      This is the forcible breaking of infinite loops as implemented in Perl
+      5.005. If there is an options reset, it will get obeyed in the normal
+      course of events. */
+
+      if (*ecode == OP_KET || eptr == saved_eptr)
+        {
+        ecode += 1 + LINK_SIZE;
+        break;
+        }
+
+      /* The repeating kets try the rest of the pattern or restart from the
+      preceding bracket, in the appropriate order. */
+
+      if (*ecode == OP_KETRMIN)
+        {
+        RMATCH(rrc, eptr, ecode + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0);
+        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+        RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, match_isgroup);
+        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+        }
+      else  /* OP_KETRMAX */
+        {
+        RMATCH(rrc, eptr, prev, offset_top, md, ims, eptrb, match_isgroup);
+        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+        RMATCH(rrc, eptr, ecode + 1+LINK_SIZE, offset_top, md, ims, eptrb, 0);
+        if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+        }
+      }
+
+    RRETURN(MATCH_NOMATCH);
+
+    /* Start of subject unless notbol, or after internal newline if multiline */
+
+    case OP_CIRC:
+    if (md->notbol && eptr == md->start_subject) RRETURN(MATCH_NOMATCH);
+    if ((ims & PCRE_MULTILINE) != 0)
+      {
+      if (eptr != md->start_subject && eptr[-1] != NEWLINE)
+        RRETURN(MATCH_NOMATCH);
+      ecode++;
+      break;
+      }
+    /* ... else fall through */
+
+    /* Start of subject assertion */
+
+    case OP_SOD:
+    if (eptr != md->start_subject) RRETURN(MATCH_NOMATCH);
+    ecode++;
+    break;
+
+    /* Start of match assertion */
+
+    case OP_SOM:
+    if (eptr != md->start_subject + md->start_offset) RRETURN(MATCH_NOMATCH);
+    ecode++;
+    break;
+
+    /* Assert before internal newline if multiline, or before a terminating
+    newline unless endonly is set, else end of subject unless noteol is set. */
+
+    case OP_DOLL:
+    if ((ims & PCRE_MULTILINE) != 0)
+      {
+      if (eptr < md->end_subject)
+        { if (*eptr != NEWLINE) RRETURN(MATCH_NOMATCH); }
+      else
+        { if (md->noteol) RRETURN(MATCH_NOMATCH); }
+      ecode++;
+      break;
+      }
+    else
+      {
+      if (md->noteol) RRETURN(MATCH_NOMATCH);
+      if (!md->endonly)
+        {
+        if (eptr < md->end_subject - 1 ||
+           (eptr == md->end_subject - 1 && *eptr != NEWLINE))
+          RRETURN(MATCH_NOMATCH);
+        ecode++;
+        break;
+        }
+      }
+    /* ... else fall through */
+
+    /* End of subject assertion (\z) */
+
+    case OP_EOD:
+    if (eptr < md->end_subject) RRETURN(MATCH_NOMATCH);
+    ecode++;
+    break;
+
+    /* End of subject or ending \n assertion (\Z) */
+
+    case OP_EODN:
+    if (eptr < md->end_subject - 1 ||
+       (eptr == md->end_subject - 1 && *eptr != NEWLINE)) RRETURN(MATCH_NOMATCH);
+    ecode++;
+    break;
+
+    /* Word boundary assertions */
+
+    case OP_NOT_WORD_BOUNDARY:
+    case OP_WORD_BOUNDARY:
+      {
+
+      /* Find out if the previous and current characters are "word" characters.
+      It takes a bit more work in UTF-8 mode. Characters > 255 are assumed to
+      be "non-word" characters. */
+
+#ifdef SUPPORT_UTF8
+      if (utf8)
+        {
+        if (eptr == md->start_subject) prev_is_word = FALSE; else
+          {
+          const uschar *lastptr = eptr - 1;
+          while((*lastptr & 0xc0) == 0x80) lastptr--;
+          GETCHAR(c, lastptr);
+          prev_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;
+          }
+        if (eptr >= md->end_subject) cur_is_word = FALSE; else
+          {
+          GETCHAR(c, eptr);
+          cur_is_word = c < 256 && (md->ctypes[c] & ctype_word) != 0;
+          }
+        }
+      else
+#endif
+
+      /* More streamlined when not in UTF-8 mode */
+
+        {
+        prev_is_word = (eptr != md->start_subject) &&
+          ((md->ctypes[eptr[-1]] & ctype_word) != 0);
+        cur_is_word = (eptr < md->end_subject) &&
+          ((md->ctypes[*eptr] & ctype_word) != 0);
+        }
+
+      /* Now see if the situation is what we want */
+
+      if ((*ecode++ == OP_WORD_BOUNDARY)?
+           cur_is_word == prev_is_word : cur_is_word != prev_is_word)
+        RRETURN(MATCH_NOMATCH);
+      }
+    break;
+
+    /* Match a single character type; inline for speed */
+
+    case OP_ANY:
+    if ((ims & PCRE_DOTALL) == 0 && eptr < md->end_subject && *eptr == NEWLINE)
+      RRETURN(MATCH_NOMATCH);
+    if (eptr++ >= md->end_subject) RRETURN(MATCH_NOMATCH);
+#ifdef SUPPORT_UTF8
+    if (utf8)
+      while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
+#endif
+    ecode++;
+    break;
+
+    /* Match a single byte, even in UTF-8 mode. This opcode really does match
+    any byte, even newline, independent of the setting of PCRE_DOTALL. */
+
+    case OP_ANYBYTE:
+    if (eptr++ >= md->end_subject) RRETURN(MATCH_NOMATCH);
+    ecode++;
+    break;
+
+    case OP_NOT_DIGIT:
+    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+    GETCHARINCTEST(c, eptr);
+    if (
+#ifdef SUPPORT_UTF8
+       c < 256 &&
+#endif
+       (md->ctypes[c] & ctype_digit) != 0
+       )
+      RRETURN(MATCH_NOMATCH);
+    ecode++;
+    break;
+
+    case OP_DIGIT:
+    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+    GETCHARINCTEST(c, eptr);
+    if (
+#ifdef SUPPORT_UTF8
+       c >= 256 ||
+#endif
+       (md->ctypes[c] & ctype_digit) == 0
+       )
+      RRETURN(MATCH_NOMATCH);
+    ecode++;
+    break;
+
+    case OP_NOT_WHITESPACE:
+    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+    GETCHARINCTEST(c, eptr);
+    if (
+#ifdef SUPPORT_UTF8
+       c < 256 &&
+#endif
+       (md->ctypes[c] & ctype_space) != 0
+       )
+      RRETURN(MATCH_NOMATCH);
+    ecode++;
+    break;
+
+    case OP_WHITESPACE:
+    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+    GETCHARINCTEST(c, eptr);
+    if (
+#ifdef SUPPORT_UTF8
+       c >= 256 ||
+#endif
+       (md->ctypes[c] & ctype_space) == 0
+       )
+      RRETURN(MATCH_NOMATCH);
+    ecode++;
+    break;
+
+    case OP_NOT_WORDCHAR:
+    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+    GETCHARINCTEST(c, eptr);
+    if (
+#ifdef SUPPORT_UTF8
+       c < 256 &&
+#endif
+       (md->ctypes[c] & ctype_word) != 0
+       )
+      RRETURN(MATCH_NOMATCH);
+    ecode++;
+    break;
+
+    case OP_WORDCHAR:
+    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+    GETCHARINCTEST(c, eptr);
+    if (
+#ifdef SUPPORT_UTF8
+       c >= 256 ||
+#endif
+       (md->ctypes[c] & ctype_word) == 0
+       )
+      RRETURN(MATCH_NOMATCH);
+    ecode++;
+    break;
+
+#ifdef SUPPORT_UCP
+    /* Check the next character by Unicode property. We will get here only
+    if the support is in the binary; otherwise a compile-time error occurs. */
+
+    case OP_PROP:
+    case OP_NOTPROP:
+    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+    GETCHARINCTEST(c, eptr);
+      {
+      int chartype, rqdtype;
+      int othercase;
+      int category = ucp_findchar(c, &chartype, &othercase);
+
+      rqdtype = *(++ecode);
+      ecode++;
+
+      if (rqdtype >= 128)
+        {
+        if ((rqdtype - 128 != category) == (op == OP_PROP))
+          RRETURN(MATCH_NOMATCH);
+        }
+      else
+        {
+        if ((rqdtype != chartype) == (op == OP_PROP))
+          RRETURN(MATCH_NOMATCH);
+        }
+      }
+    break;
+
+    /* Match an extended Unicode sequence. We will get here only if the support
+    is in the binary; otherwise a compile-time error occurs. */
+
+    case OP_EXTUNI:
+    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+    GETCHARINCTEST(c, eptr);
+      {
+      int chartype;
+      int othercase;
+      int category = ucp_findchar(c, &chartype, &othercase);
+      if (category == ucp_M) RRETURN(MATCH_NOMATCH);
+      while (eptr < md->end_subject)
+        {
+        int len = 1;
+        if (!utf8) c = *eptr; else
+          {
+          GETCHARLEN(c, eptr, len);
+          }
+        category = ucp_findchar(c, &chartype, &othercase);
+        if (category != ucp_M) break;
+        eptr += len;
+        }
+      }
+    ecode++;
+    break;
+#endif
+
+
+    /* Match a back reference, possibly repeatedly. Look past the end of the
+    item to see if there is repeat information following. The code is similar
+    to that for character classes, but repeated for efficiency. Then obey
+    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:
+      {
+      offset = GET2(ecode, 1) << 1;               /* Doubled ref number */
+      ecode += 3;                                 /* Advance past item */
+
+      /* If the reference is unset, set the length to be longer than the amount
+      of subject left; this ensures that every attempt at a match fails. We
+      can't just fail here, because of the possibility of quantifiers with zero
+      minima. */
+
+      length = (offset >= offset_top || md->offset_vector[offset] < 0)?
+        md->end_subject - eptr + 1 :
+        md->offset_vector[offset+1] - md->offset_vector[offset];
+
+      /* Set up for repetition, or handle the non-repeated case */
+
+      switch (*ecode)
+        {
+        case OP_CRSTAR:
+        case OP_CRMINSTAR:
+        case OP_CRPLUS:
+        case OP_CRMINPLUS:
+        case OP_CRQUERY:
+        case OP_CRMINQUERY:
+        c = *ecode++ - OP_CRSTAR;
+        minimize = (c & 1) != 0;
+        min = rep_min[c];                 /* Pick up values from tables; */
+        max = rep_max[c];                 /* zero for max => infinity */
+        if (max == 0) max = INT_MAX;
+        break;
+
+        case OP_CRRANGE:
+        case OP_CRMINRANGE:
+        minimize = (*ecode == OP_CRMINRANGE);
+        min = GET2(ecode, 1);
+        max = GET2(ecode, 3);
+        if (max == 0) max = INT_MAX;
+        ecode += 5;
+        break;
+
+        default:               /* No repeat follows */
+        if (!match_ref(offset, eptr, length, md, ims)) RRETURN(MATCH_NOMATCH);
+        eptr += length;
+        continue;              /* With the main loop */
+        }
+
+      /* If the length of the reference is zero, just continue with the
+      main loop. */
+
+      if (length == 0) continue;
+
+      /* First, ensure the minimum number of matches are present. We get back
+      the length of the reference string explicitly rather than passing the
+      address of eptr, so that eptr can be a register variable. */
+
+      for (i = 1; i <= min; i++)
+        {
+        if (!match_ref(offset, eptr, length, md, ims)) RRETURN(MATCH_NOMATCH);
+        eptr += length;
+        }
+
+      /* If min = max, continue at the same level without recursion.
+      They are not both allowed to be zero. */
+
+      if (min == max) continue;
+
+      /* If minimizing, keep trying and advancing the pointer */
+
+      if (minimize)
+        {
+        for (fi = min;; fi++)
+          {
+          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+          if (fi >= max || !match_ref(offset, eptr, length, md, ims))
+            RRETURN(MATCH_NOMATCH);
+          eptr += length;
+          }
+        /* Control never gets here */
+        }
+
+      /* If maximizing, find the longest string and work backwards */
+
+      else
+        {
+        pp = eptr;
+        for (i = min; i < max; i++)
+          {
+          if (!match_ref(offset, eptr, length, md, ims)) break;
+          eptr += length;
+          }
+        while (eptr >= pp)
+          {
+          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+          eptr -= length;
+          }
+        RRETURN(MATCH_NOMATCH);
+        }
+      }
+    /* Control never gets here */
+
+
+
+    /* Match a bit-mapped character class, possibly repeatedly. This op code is
+    used when all the characters in the class have values in the range 0-255,
+    and either the matching is caseful, or the characters are in the range
+    0-127 when UTF-8 processing is enabled. The only difference between
+    OP_CLASS and OP_NCLASS occurs when a data character outside the range is
+    encountered.
+
+    First, look past the end of the item to see if there is repeat information
+    following. Then obey similar code to character type repeats - written out
+    again for speed. */
+
+    case OP_NCLASS:
+    case OP_CLASS:
+      {
+      data = ecode + 1;                /* Save for matching */
+      ecode += 33;                     /* Advance past the item */
+
+      switch (*ecode)
+        {
+        case OP_CRSTAR:
+        case OP_CRMINSTAR:
+        case OP_CRPLUS:
+        case OP_CRMINPLUS:
+        case OP_CRQUERY:
+        case OP_CRMINQUERY:
+        c = *ecode++ - OP_CRSTAR;
+        minimize = (c & 1) != 0;
+        min = rep_min[c];                 /* Pick up values from tables; */
+        max = rep_max[c];                 /* zero for max => infinity */
+        if (max == 0) max = INT_MAX;
+        break;
+
+        case OP_CRRANGE:
+        case OP_CRMINRANGE:
+        minimize = (*ecode == OP_CRMINRANGE);
+        min = GET2(ecode, 1);
+        max = GET2(ecode, 3);
+        if (max == 0) max = INT_MAX;
+        ecode += 5;
+        break;
+
+        default:               /* No repeat follows */
+        min = max = 1;
+        break;
+        }
+
+      /* First, ensure the minimum number of matches are present. */
+
+#ifdef SUPPORT_UTF8
+      /* UTF-8 mode */
+      if (utf8)
+        {
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+          GETCHARINC(c, eptr);
+          if (c > 255)
+            {
+            if (op == OP_CLASS) RRETURN(MATCH_NOMATCH);
+            }
+          else
+            {
+            if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);
+            }
+          }
+        }
+      else
+#endif
+      /* Not UTF-8 mode */
+        {
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+          c = *eptr++;
+          if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);
+          }
+        }
+
+      /* If max == min we can continue with the main loop without the
+      need to recurse. */
+
+      if (min == max) continue;
+
+      /* If minimizing, keep testing the rest of the expression and advancing
+      the pointer while it matches the class. */
+
+      if (minimize)
+        {
+#ifdef SUPPORT_UTF8
+        /* UTF-8 mode */
+        if (utf8)
+          {
+          for (fi = min;; fi++)
+            {
+            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+            if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+            GETCHARINC(c, eptr);
+            if (c > 255)
+              {
+              if (op == OP_CLASS) RRETURN(MATCH_NOMATCH);
+              }
+            else
+              {
+              if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);
+              }
+            }
+          }
+        else
+#endif
+        /* Not UTF-8 mode */
+          {
+          for (fi = min;; fi++)
+            {
+            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+            if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+            c = *eptr++;
+            if ((data[c/8] & (1 << (c&7))) == 0) RRETURN(MATCH_NOMATCH);
+            }
+          }
+        /* Control never gets here */
+        }
+
+      /* If maximizing, find the longest possible run, then work backwards. */
+
+      else
+        {
+        pp = eptr;
+
+#ifdef SUPPORT_UTF8
+        /* UTF-8 mode */
+        if (utf8)
+          {
+          for (i = min; i < max; i++)
+            {
+            int len = 1;
+            if (eptr >= md->end_subject) break;
+            GETCHARLEN(c, eptr, len);
+            if (c > 255)
+              {
+              if (op == OP_CLASS) break;
+              }
+            else
+              {
+              if ((data[c/8] & (1 << (c&7))) == 0) break;
+              }
+            eptr += len;
+            }
+          for (;;)
+            {
+            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+            if (eptr-- == pp) break;        /* Stop if tried at original pos */
+            BACKCHAR(eptr);
+            }
+          }
+        else
+#endif
+          /* Not UTF-8 mode */
+          {
+          for (i = min; i < max; i++)
+            {
+            if (eptr >= md->end_subject) break;
+            c = *eptr;
+            if ((data[c/8] & (1 << (c&7))) == 0) break;
+            eptr++;
+            }
+          while (eptr >= pp)
+            {
+            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            eptr--;
+            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+            }
+          }
+
+        RRETURN(MATCH_NOMATCH);
+        }
+      }
+    /* Control never gets here */
+
+
+    /* Match an extended character class. This opcode is encountered only
+    in UTF-8 mode, because that's the only time it is compiled. */
+
+#ifdef SUPPORT_UTF8
+    case OP_XCLASS:
+      {
+      data = ecode + 1 + LINK_SIZE;                /* Save for matching */
+      ecode += GET(ecode, 1);                      /* Advance past the item */
+
+      switch (*ecode)
+        {
+        case OP_CRSTAR:
+        case OP_CRMINSTAR:
+        case OP_CRPLUS:
+        case OP_CRMINPLUS:
+        case OP_CRQUERY:
+        case OP_CRMINQUERY:
+        c = *ecode++ - OP_CRSTAR;
+        minimize = (c & 1) != 0;
+        min = rep_min[c];                 /* Pick up values from tables; */
+        max = rep_max[c];                 /* zero for max => infinity */
+        if (max == 0) max = INT_MAX;
+        break;
+
+        case OP_CRRANGE:
+        case OP_CRMINRANGE:
+        minimize = (*ecode == OP_CRMINRANGE);
+        min = GET2(ecode, 1);
+        max = GET2(ecode, 3);
+        if (max == 0) max = INT_MAX;
+        ecode += 5;
+        break;
+
+        default:               /* No repeat follows */
+        min = max = 1;
+        break;
+        }
+
+      /* First, ensure the minimum number of matches are present. */
+
+      for (i = 1; i <= min; i++)
+        {
+        if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+        GETCHARINC(c, eptr);
+        if (!_pcre_xclass(c, data)) RRETURN(MATCH_NOMATCH);
+        }
+
+      /* If max == min we can continue with the main loop without the
+      need to recurse. */
+
+      if (min == max) continue;
+
+      /* If minimizing, keep testing the rest of the expression and advancing
+      the pointer while it matches the class. */
+
+      if (minimize)
+        {
+        for (fi = min;; fi++)
+          {
+          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+          if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+          GETCHARINC(c, eptr);
+          if (!_pcre_xclass(c, data)) RRETURN(MATCH_NOMATCH);
+          }
+        /* Control never gets here */
+        }
+
+      /* If maximizing, find the longest possible run, then work backwards. */
+
+      else
+        {
+        pp = eptr;
+        for (i = min; i < max; i++)
+          {
+          int len = 1;
+          if (eptr >= md->end_subject) break;
+          GETCHARLEN(c, eptr, len);
+          if (!_pcre_xclass(c, data)) break;
+          eptr += len;
+          }
+        for(;;)
+          {
+          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+          if (eptr-- == pp) break;        /* Stop if tried at original pos */
+          BACKCHAR(eptr)
+          }
+        RRETURN(MATCH_NOMATCH);
+        }
+
+      /* Control never gets here */
+      }
+#endif    /* End of XCLASS */
+
+    /* Match a single character, casefully */
+
+    case OP_CHAR:
+#ifdef SUPPORT_UTF8
+    if (utf8)
+      {
+      length = 1;
+      ecode++;
+      GETCHARLEN(fc, ecode, length);
+      if (length > md->end_subject - eptr) RRETURN(MATCH_NOMATCH);
+      while (length-- > 0) if (*ecode++ != *eptr++) RRETURN(MATCH_NOMATCH);
+      }
+    else
+#endif
+
+    /* Non-UTF-8 mode */
+      {
+      if (md->end_subject - eptr < 1) RRETURN(MATCH_NOMATCH);
+      if (ecode[1] != *eptr++) RRETURN(MATCH_NOMATCH);
+      ecode += 2;
+      }
+    break;
+
+    /* Match a single character, caselessly */
+
+    case OP_CHARNC:
+#ifdef SUPPORT_UTF8
+    if (utf8)
+      {
+      length = 1;
+      ecode++;
+      GETCHARLEN(fc, ecode, length);
+
+      if (length > md->end_subject - eptr) RRETURN(MATCH_NOMATCH);
+
+      /* If the pattern character's value is < 128, we have only one byte, and
+      can use the fast lookup table. */
+
+      if (fc < 128)
+        {
+        if (md->lcc[*ecode++] != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH);
+        }
+
+      /* Otherwise we must pick up the subject character */
+
+      else
+        {
+        int dc;
+        GETCHARINC(dc, eptr);
+        ecode += length;
+
+        /* If we have Unicode property support, we can use it to test the other
+        case of the character, if there is one. The result of ucp_findchar() is
+        < 0 if the char isn't found, and othercase is returned as zero if there
+        isn't one. */
+
+        if (fc != dc)
+          {
+#ifdef SUPPORT_UCP
+          int chartype;
+          int othercase;
+          if (ucp_findchar(fc, &chartype, &othercase) < 0 || dc != othercase)
+#endif
+            RRETURN(MATCH_NOMATCH);
+          }
+        }
+      }
+    else
+#endif   /* SUPPORT_UTF8 */
+
+    /* Non-UTF-8 mode */
+      {
+      if (md->end_subject - eptr < 1) RRETURN(MATCH_NOMATCH);
+      if (md->lcc[ecode[1]] != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH);
+      ecode += 2;
+      }
+    break;
+
+    /* Match a single character repeatedly; different opcodes share code. */
+
+    case OP_EXACT:
+    min = max = GET2(ecode, 1);
+    ecode += 3;
+    goto REPEATCHAR;
+
+    case OP_UPTO:
+    case OP_MINUPTO:
+    min = 0;
+    max = GET2(ecode, 1);
+    minimize = *ecode == OP_MINUPTO;
+    ecode += 3;
+    goto REPEATCHAR;
+
+    case OP_STAR:
+    case OP_MINSTAR:
+    case OP_PLUS:
+    case OP_MINPLUS:
+    case OP_QUERY:
+    case OP_MINQUERY:
+    c = *ecode++ - OP_STAR;
+    minimize = (c & 1) != 0;
+    min = rep_min[c];                 /* Pick up values from tables; */
+    max = rep_max[c];                 /* zero for max => infinity */
+    if (max == 0) max = INT_MAX;
+
+    /* Common code for all repeated single-character matches. We can give
+    up quickly if there are fewer than the minimum number of characters left in
+    the subject. */
+
+    REPEATCHAR:
+#ifdef SUPPORT_UTF8
+    if (utf8)
+      {
+      length = 1;
+      charptr = ecode;
+      GETCHARLEN(fc, ecode, length);
+      if (min * length > md->end_subject - eptr) RRETURN(MATCH_NOMATCH);
+      ecode += length;
+
+      /* Handle multibyte character matching specially here. There is
+      support for caseless matching if UCP support is present. */
+
+      if (length > 1)
+        {
+        int oclength = 0;
+        uschar occhars[8];
+
+#ifdef SUPPORT_UCP
+        int othercase;
+        int chartype;
+        if ((ims & PCRE_CASELESS) != 0 &&
+             ucp_findchar(fc, &chartype, &othercase) >= 0 &&
+             othercase > 0)
+          oclength = _pcre_ord2utf8(othercase, occhars);
+#endif  /* SUPPORT_UCP */
+
+        for (i = 1; i <= min; i++)
+          {
+          if (memcmp(eptr, charptr, length) == 0) eptr += length;
+          /* Need braces because of following else */
+          else if (oclength == 0) { RRETURN(MATCH_NOMATCH); }
+          else
+            {
+            if (memcmp(eptr, occhars, oclength) != 0) RRETURN(MATCH_NOMATCH);
+            eptr += oclength;
+            }
+          }
+
+        if (min == max) continue;
+
+        if (minimize)
+          {
+          for (fi = min;; fi++)
+            {
+            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+            if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+            if (memcmp(eptr, charptr, length) == 0) eptr += length;
+            /* Need braces because of following else */
+            else if (oclength == 0) { RRETURN(MATCH_NOMATCH); }
+            else
+              {
+              if (memcmp(eptr, occhars, oclength) != 0) RRETURN(MATCH_NOMATCH);
+              eptr += oclength;
+              }
+            }
+          /* Control never gets here */
+          }
+        else
+          {
+          pp = eptr;
+          for (i = min; i < max; i++)
+            {
+            if (eptr > md->end_subject - length) break;
+            if (memcmp(eptr, charptr, length) == 0) eptr += length;
+            else if (oclength == 0) break;
+            else
+              {
+              if (memcmp(eptr, occhars, oclength) != 0) break;
+              eptr += oclength;
+              }
+            }
+          while (eptr >= pp)
+           {
+           RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+           if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+           eptr -= length;
+           }
+          RRETURN(MATCH_NOMATCH);
+          }
+        /* Control never gets here */
+        }
+
+      /* If the length of a UTF-8 character is 1, we fall through here, and
+      obey the code as for non-UTF-8 characters below, though in this case the
+      value of fc will always be < 128. */
+      }
+    else
+#endif  /* SUPPORT_UTF8 */
+
+    /* When not in UTF-8 mode, load a single-byte character. */
+      {
+      if (min > md->end_subject - eptr) RRETURN(MATCH_NOMATCH);
+      fc = *ecode++;
+      }
+
+    /* The value of fc at this point is always less than 256, though we may or
+    may not be in UTF-8 mode. The code is duplicated for the caseless and
+    caseful cases, for speed, since matching characters is likely to be quite
+    common. First, ensure the minimum number of matches are present. If min =
+    max, continue at the same level without recursing. Otherwise, if
+    minimizing, keep trying the rest of the expression and advancing one
+    matching character if failing, up to the maximum. Alternatively, if
+    maximizing, find the maximum number of characters and work backwards. */
+
+    DPRINTF(("matching %c{%d,%d} against subject %.*s\n", fc, min, max,
+      max, eptr));
+
+    if ((ims & PCRE_CASELESS) != 0)
+      {
+      fc = md->lcc[fc];
+      for (i = 1; i <= min; i++)
+        if (fc != md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH);
+      if (min == max) continue;
+      if (minimize)
+        {
+        for (fi = min;; fi++)
+          {
+          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+          if (fi >= max || eptr >= md->end_subject ||
+              fc != md->lcc[*eptr++])
+            RRETURN(MATCH_NOMATCH);
+          }
+        /* Control never gets here */
+        }
+      else
+        {
+        pp = eptr;
+        for (i = min; i < max; i++)
+          {
+          if (eptr >= md->end_subject || fc != md->lcc[*eptr]) break;
+          eptr++;
+          }
+        while (eptr >= pp)
+          {
+          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          eptr--;
+          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+          }
+        RRETURN(MATCH_NOMATCH);
+        }
+      /* Control never gets here */
+      }
+
+    /* Caseful comparisons (includes all multi-byte characters) */
+
+    else
+      {
+      for (i = 1; i <= min; i++) if (fc != *eptr++) RRETURN(MATCH_NOMATCH);
+      if (min == max) continue;
+      if (minimize)
+        {
+        for (fi = min;; fi++)
+          {
+          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+          if (fi >= max || eptr >= md->end_subject || fc != *eptr++)
+            RRETURN(MATCH_NOMATCH);
+          }
+        /* Control never gets here */
+        }
+      else
+        {
+        pp = eptr;
+        for (i = min; i < max; i++)
+          {
+          if (eptr >= md->end_subject || fc != *eptr) break;
+          eptr++;
+          }
+        while (eptr >= pp)
+          {
+          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          eptr--;
+          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+          }
+        RRETURN(MATCH_NOMATCH);
+        }
+      }
+    /* Control never gets here */
+
+    /* Match a negated single one-byte character. The character we are
+    checking can be multibyte. */
+
+    case OP_NOT:
+    if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+    ecode++;
+    GETCHARINCTEST(c, eptr);
+    if ((ims & PCRE_CASELESS) != 0)
+      {
+#ifdef SUPPORT_UTF8
+      if (c < 256)
+#endif
+      c = md->lcc[c];
+      if (md->lcc[*ecode++] == c) RRETURN(MATCH_NOMATCH);
+      }
+    else
+      {
+      if (*ecode++ == c) RRETURN(MATCH_NOMATCH);
+      }
+    break;
+
+    /* Match a negated single one-byte character repeatedly. This is almost a
+    repeat of the code for a repeated single character, but I haven't found a
+    nice way of commoning these up that doesn't require a test of the
+    positive/negative option for each character match. Maybe that wouldn't add
+    very much to the time taken, but character matching *is* what this is all
+    about... */
+
+    case OP_NOTEXACT:
+    min = max = GET2(ecode, 1);
+    ecode += 3;
+    goto REPEATNOTCHAR;
+
+    case OP_NOTUPTO:
+    case OP_NOTMINUPTO:
+    min = 0;
+    max = GET2(ecode, 1);
+    minimize = *ecode == OP_NOTMINUPTO;
+    ecode += 3;
+    goto REPEATNOTCHAR;
+
+    case OP_NOTSTAR:
+    case OP_NOTMINSTAR:
+    case OP_NOTPLUS:
+    case OP_NOTMINPLUS:
+    case OP_NOTQUERY:
+    case OP_NOTMINQUERY:
+    c = *ecode++ - OP_NOTSTAR;
+    minimize = (c & 1) != 0;
+    min = rep_min[c];                 /* Pick up values from tables; */
+    max = rep_max[c];                 /* zero for max => infinity */
+    if (max == 0) max = INT_MAX;
+
+    /* Common code for all repeated single-byte matches. We can give up quickly
+    if there are fewer than the minimum number of bytes left in the
+    subject. */
+
+    REPEATNOTCHAR:
+    if (min > md->end_subject - eptr) RRETURN(MATCH_NOMATCH);
+    fc = *ecode++;
+
+    /* The code is duplicated for the caseless and caseful cases, for speed,
+    since matching characters is likely to be quite common. First, ensure the
+    minimum number of matches are present. If min = max, continue at the same
+    level without recursing. Otherwise, if minimizing, keep trying the rest of
+    the expression and advancing one matching character if failing, up to the
+    maximum. Alternatively, if maximizing, find the maximum number of
+    characters and work backwards. */
+
+    DPRINTF(("negative matching %c{%d,%d} against subject %.*s\n", fc, min, max,
+      max, eptr));
+
+    if ((ims & PCRE_CASELESS) != 0)
+      {
+      fc = md->lcc[fc];
+
+#ifdef SUPPORT_UTF8
+      /* UTF-8 mode */
+      if (utf8)
+        {
+        register int d;
+        for (i = 1; i <= min; i++)
+          {
+          GETCHARINC(d, eptr);
+          if (d < 256) d = md->lcc[d];
+          if (fc == d) RRETURN(MATCH_NOMATCH);
+          }
+        }
+      else
+#endif
+
+      /* Not UTF-8 mode */
+        {
+        for (i = 1; i <= min; i++)
+          if (fc == md->lcc[*eptr++]) RRETURN(MATCH_NOMATCH);
+        }
+
+      if (min == max) continue;
+
+      if (minimize)
+        {
+#ifdef SUPPORT_UTF8
+        /* UTF-8 mode */
+        if (utf8)
+          {
+          register int d;
+          for (fi = min;; fi++)
+            {
+            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+            GETCHARINC(d, eptr);
+            if (d < 256) d = md->lcc[d];
+            if (fi >= max || eptr >= md->end_subject || fc == d)
+              RRETURN(MATCH_NOMATCH);
+            }
+          }
+        else
+#endif
+        /* Not UTF-8 mode */
+          {
+          for (fi = min;; fi++)
+            {
+            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+            if (fi >= max || eptr >= md->end_subject || fc == md->lcc[*eptr++])
+              RRETURN(MATCH_NOMATCH);
+            }
+          }
+        /* Control never gets here */
+        }
+
+      /* Maximize case */
+
+      else
+        {
+        pp = eptr;
+
+#ifdef SUPPORT_UTF8
+        /* UTF-8 mode */
+        if (utf8)
+          {
+          register int d;
+          for (i = min; i < max; i++)
+            {
+            int len = 1;
+            if (eptr >= md->end_subject) break;
+            GETCHARLEN(d, eptr, len);
+            if (d < 256) d = md->lcc[d];
+            if (fc == d) break;
+            eptr += len;
+            }
+          for(;;)
+            {
+            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+            if (eptr-- == pp) break;        /* Stop if tried at original pos */
+            BACKCHAR(eptr);
+            }
+          }
+        else
+#endif
+        /* Not UTF-8 mode */
+          {
+          for (i = min; i < max; i++)
+            {
+            if (eptr >= md->end_subject || fc == md->lcc[*eptr]) break;
+            eptr++;
+            }
+          while (eptr >= pp)
+            {
+            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+            eptr--;
+            }
+          }
+
+        RRETURN(MATCH_NOMATCH);
+        }
+      /* Control never gets here */
+      }
+
+    /* Caseful comparisons */
+
+    else
+      {
+#ifdef SUPPORT_UTF8
+      /* UTF-8 mode */
+      if (utf8)
+        {
+        register int d;
+        for (i = 1; i <= min; i++)
+          {
+          GETCHARINC(d, eptr);
+          if (fc == d) RRETURN(MATCH_NOMATCH);
+          }
+        }
+      else
+#endif
+      /* Not UTF-8 mode */
+        {
+        for (i = 1; i <= min; i++)
+          if (fc == *eptr++) RRETURN(MATCH_NOMATCH);
+        }
+
+      if (min == max) continue;
+
+      if (minimize)
+        {
+#ifdef SUPPORT_UTF8
+        /* UTF-8 mode */
+        if (utf8)
+          {
+          register int d;
+          for (fi = min;; fi++)
+            {
+            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+            GETCHARINC(d, eptr);
+            if (fi >= max || eptr >= md->end_subject || fc == d)
+              RRETURN(MATCH_NOMATCH);
+            }
+          }
+        else
+#endif
+        /* Not UTF-8 mode */
+          {
+          for (fi = min;; fi++)
+            {
+            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+            if (fi >= max || eptr >= md->end_subject || fc == *eptr++)
+              RRETURN(MATCH_NOMATCH);
+            }
+          }
+        /* Control never gets here */
+        }
+
+      /* Maximize case */
+
+      else
+        {
+        pp = eptr;
+
+#ifdef SUPPORT_UTF8
+        /* UTF-8 mode */
+        if (utf8)
+          {
+          register int d;
+          for (i = min; i < max; i++)
+            {
+            int len = 1;
+            if (eptr >= md->end_subject) break;
+            GETCHARLEN(d, eptr, len);
+            if (fc == d) break;
+            eptr += len;
+            }
+          for(;;)
+            {
+            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+            if (eptr-- == pp) break;        /* Stop if tried at original pos */
+            BACKCHAR(eptr);
+            }
+          }
+        else
+#endif
+        /* Not UTF-8 mode */
+          {
+          for (i = min; i < max; i++)
+            {
+            if (eptr >= md->end_subject || fc == *eptr) break;
+            eptr++;
+            }
+          while (eptr >= pp)
+            {
+            RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+            if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+            eptr--;
+            }
+          }
+
+        RRETURN(MATCH_NOMATCH);
+        }
+      }
+    /* Control never gets here */
+
+    /* Match a single character type repeatedly; several different opcodes
+    share code. This is very similar to the code for single characters, but we
+    repeat it in the interests of efficiency. */
+
+    case OP_TYPEEXACT:
+    min = max = GET2(ecode, 1);
+    minimize = TRUE;
+    ecode += 3;
+    goto REPEATTYPE;
+
+    case OP_TYPEUPTO:
+    case OP_TYPEMINUPTO:
+    min = 0;
+    max = GET2(ecode, 1);
+    minimize = *ecode == OP_TYPEMINUPTO;
+    ecode += 3;
+    goto REPEATTYPE;
+
+    case OP_TYPESTAR:
+    case OP_TYPEMINSTAR:
+    case OP_TYPEPLUS:
+    case OP_TYPEMINPLUS:
+    case OP_TYPEQUERY:
+    case OP_TYPEMINQUERY:
+    c = *ecode++ - OP_TYPESTAR;
+    minimize = (c & 1) != 0;
+    min = rep_min[c];                 /* Pick up values from tables; */
+    max = rep_max[c];                 /* zero for max => infinity */
+    if (max == 0) max = INT_MAX;
+
+    /* Common code for all repeated single character type matches. Note that
+    in UTF-8 mode, '.' matches a character of any length, but for the other
+    character types, the valid characters are all one-byte long. */
+
+    REPEATTYPE:
+    ctype = *ecode++;      /* Code for the character type */
+
+#ifdef SUPPORT_UCP
+    if (ctype == OP_PROP || ctype == OP_NOTPROP)
+      {
+      prop_fail_result = ctype == OP_NOTPROP;
+      prop_type = *ecode++;
+      if (prop_type >= 128)
+        {
+        prop_test_against = prop_type - 128;
+        prop_test_variable = &prop_category;
+        }
+      else
+        {
+        prop_test_against = prop_type;
+        prop_test_variable = &prop_chartype;
+        }
+      }
+    else prop_type = -1;
+#endif
+
+    /* First, ensure the minimum number of matches are present. Use inline
+    code for maximizing the speed, and do the type test once at the start
+    (i.e. keep it out of the loop). Also we can test that there are at least
+    the minimum number of bytes before we start. This isn't as effective in
+    UTF-8 mode, but it does no harm. Separate the UTF-8 code completely as that
+    is tidier. Also separate the UCP code, which can be the same for both UTF-8
+    and single-bytes. */
+
+    if (min > md->end_subject - eptr) RRETURN(MATCH_NOMATCH);
+    if (min > 0)
+      {
+#ifdef SUPPORT_UCP
+      if (prop_type > 0)
+        {
+        for (i = 1; i <= min; i++)
+          {
+          GETCHARINC(c, eptr);
+          prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
+          if ((*prop_test_variable == prop_test_against) == prop_fail_result)
+            RRETURN(MATCH_NOMATCH);
+          }
+        }
+
+      /* Match extended Unicode sequences. We will get here only if the
+      support is in the binary; otherwise a compile-time error occurs. */
+
+      else if (ctype == OP_EXTUNI)
+        {
+        for (i = 1; i <= min; i++)
+          {
+          GETCHARINCTEST(c, eptr);
+          prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
+          if (prop_category == ucp_M) RRETURN(MATCH_NOMATCH);
+          while (eptr < md->end_subject)
+            {
+            int len = 1;
+            if (!utf8) c = *eptr; else
+              {
+              GETCHARLEN(c, eptr, len);
+              }
+            prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
+            if (prop_category != ucp_M) break;
+            eptr += len;
+            }
+          }
+        }
+
+      else
+#endif     /* SUPPORT_UCP */
+
+/* Handle all other cases when the coding is UTF-8 */
+
+#ifdef SUPPORT_UTF8
+      if (utf8) switch(ctype)
+        {
+        case OP_ANY:
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject ||
+             (*eptr++ == NEWLINE && (ims & PCRE_DOTALL) == 0))
+            RRETURN(MATCH_NOMATCH);
+          while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
+          }
+        break;
+
+        case OP_ANYBYTE:
+        eptr += min;
+        break;
+
+        case OP_NOT_DIGIT:
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+          GETCHARINC(c, eptr);
+          if (c < 128 && (md->ctypes[c] & ctype_digit) != 0)
+            RRETURN(MATCH_NOMATCH);
+          }
+        break;
+
+        case OP_DIGIT:
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject ||
+             *eptr >= 128 || (md->ctypes[*eptr++] & ctype_digit) == 0)
+            RRETURN(MATCH_NOMATCH);
+          /* No need to skip more bytes - we know it's a 1-byte character */
+          }
+        break;
+
+        case OP_NOT_WHITESPACE:
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject ||
+             (*eptr < 128 && (md->ctypes[*eptr++] & ctype_space) != 0))
+            RRETURN(MATCH_NOMATCH);
+          while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
+          }
+        break;
+
+        case OP_WHITESPACE:
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject ||
+             *eptr >= 128 || (md->ctypes[*eptr++] & ctype_space) == 0)
+            RRETURN(MATCH_NOMATCH);
+          /* No need to skip more bytes - we know it's a 1-byte character */
+          }
+        break;
+
+        case OP_NOT_WORDCHAR:
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject ||
+             (*eptr < 128 && (md->ctypes[*eptr++] & ctype_word) != 0))
+            RRETURN(MATCH_NOMATCH);
+          while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
+          }
+        break;
+
+        case OP_WORDCHAR:
+        for (i = 1; i <= min; i++)
+          {
+          if (eptr >= md->end_subject ||
+             *eptr >= 128 || (md->ctypes[*eptr++] & ctype_word) == 0)
+            RRETURN(MATCH_NOMATCH);
+          /* No need to skip more bytes - we know it's a 1-byte character */
+          }
+        break;
+
+        default:
+        RRETURN(PCRE_ERROR_INTERNAL);
+        }  /* End switch(ctype) */
+
+      else
+#endif     /* SUPPORT_UTF8 */
+
+      /* Code for the non-UTF-8 case for minimum matching of operators other
+      than OP_PROP and OP_NOTPROP. */
+
+      switch(ctype)
+        {
+        case OP_ANY:
+        if ((ims & PCRE_DOTALL) == 0)
+          {
+          for (i = 1; i <= min; i++)
+            if (*eptr++ == NEWLINE) RRETURN(MATCH_NOMATCH);
+          }
+        else eptr += min;
+        break;
+
+        case OP_ANYBYTE:
+        eptr += min;
+        break;
+
+        case OP_NOT_DIGIT:
+        for (i = 1; i <= min; i++)
+          if ((md->ctypes[*eptr++] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH);
+        break;
+
+        case OP_DIGIT:
+        for (i = 1; i <= min; i++)
+          if ((md->ctypes[*eptr++] & ctype_digit) == 0) RRETURN(MATCH_NOMATCH);
+        break;
+
+        case OP_NOT_WHITESPACE:
+        for (i = 1; i <= min; i++)
+          if ((md->ctypes[*eptr++] & ctype_space) != 0) RRETURN(MATCH_NOMATCH);
+        break;
+
+        case OP_WHITESPACE:
+        for (i = 1; i <= min; i++)
+          if ((md->ctypes[*eptr++] & ctype_space) == 0) RRETURN(MATCH_NOMATCH);
+        break;
+
+        case OP_NOT_WORDCHAR:
+        for (i = 1; i <= min; i++)
+          if ((md->ctypes[*eptr++] & ctype_word) != 0)
+            RRETURN(MATCH_NOMATCH);
+        break;
+
+        case OP_WORDCHAR:
+        for (i = 1; i <= min; i++)
+          if ((md->ctypes[*eptr++] & ctype_word) == 0)
+            RRETURN(MATCH_NOMATCH);
+        break;
+
+        default:
+        RRETURN(PCRE_ERROR_INTERNAL);
+        }
+      }
+
+    /* If min = max, continue at the same level without recursing */
+
+    if (min == max) continue;
+
+    /* If minimizing, we have to test the rest of the pattern before each
+    subsequent match. Again, separate the UTF-8 case for speed, and also
+    separate the UCP cases. */
+
+    if (minimize)
+      {
+#ifdef SUPPORT_UCP
+      if (prop_type > 0)
+        {
+        for (fi = min;; fi++)
+          {
+          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+          if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+          GETCHARINC(c, eptr);
+          prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
+          if ((*prop_test_variable == prop_test_against) == prop_fail_result)
+            RRETURN(MATCH_NOMATCH);
+          }
+        }
+
+      /* Match extended Unicode sequences. We will get here only if the
+      support is in the binary; otherwise a compile-time error occurs. */
+
+      else if (ctype == OP_EXTUNI)
+        {
+        for (fi = min;; fi++)
+          {
+          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+          if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+          GETCHARINCTEST(c, eptr);
+          prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
+          if (prop_category == ucp_M) RRETURN(MATCH_NOMATCH);
+          while (eptr < md->end_subject)
+            {
+            int len = 1;
+            if (!utf8) c = *eptr; else
+              {
+              GETCHARLEN(c, eptr, len);
+              }
+            prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
+            if (prop_category != ucp_M) break;
+            eptr += len;
+            }
+          }
+        }
+
+      else
+#endif     /* SUPPORT_UCP */
+
+#ifdef SUPPORT_UTF8
+      /* UTF-8 mode */
+      if (utf8)
+        {
+        for (fi = min;; fi++)
+          {
+          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+          if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+
+          GETCHARINC(c, eptr);
+          switch(ctype)
+            {
+            case OP_ANY:
+            if ((ims & PCRE_DOTALL) == 0 && c == NEWLINE) RRETURN(MATCH_NOMATCH);
+            break;
+
+            case OP_ANYBYTE:
+            break;
+
+            case OP_NOT_DIGIT:
+            if (c < 256 && (md->ctypes[c] & ctype_digit) != 0)
+              RRETURN(MATCH_NOMATCH);
+            break;
+
+            case OP_DIGIT:
+            if (c >= 256 || (md->ctypes[c] & ctype_digit) == 0)
+              RRETURN(MATCH_NOMATCH);
+            break;
+
+            case OP_NOT_WHITESPACE:
+            if (c < 256 && (md->ctypes[c] & ctype_space) != 0)
+              RRETURN(MATCH_NOMATCH);
+            break;
+
+            case OP_WHITESPACE:
+            if  (c >= 256 || (md->ctypes[c] & ctype_space) == 0)
+              RRETURN(MATCH_NOMATCH);
+            break;
+
+            case OP_NOT_WORDCHAR:
+            if (c < 256 && (md->ctypes[c] & ctype_word) != 0)
+              RRETURN(MATCH_NOMATCH);
+            break;
+
+            case OP_WORDCHAR:
+            if (c >= 256 || (md->ctypes[c] & ctype_word) == 0)
+              RRETURN(MATCH_NOMATCH);
+            break;
+
+            default:
+            RRETURN(PCRE_ERROR_INTERNAL);
+            }
+          }
+        }
+      else
+#endif
+      /* Not UTF-8 mode */
+        {
+        for (fi = min;; fi++)
+          {
+          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+          if (fi >= max || eptr >= md->end_subject) RRETURN(MATCH_NOMATCH);
+          c = *eptr++;
+          switch(ctype)
+            {
+            case OP_ANY:
+            if ((ims & PCRE_DOTALL) == 0 && c == NEWLINE) RRETURN(MATCH_NOMATCH);
+            break;
+
+            case OP_ANYBYTE:
+            break;
+
+            case OP_NOT_DIGIT:
+            if ((md->ctypes[c] & ctype_digit) != 0) RRETURN(MATCH_NOMATCH);
+            break;
+
+            case OP_DIGIT:
+            if ((md->ctypes[c] & ctype_digit) == 0) RRETURN(MATCH_NOMATCH);
+            break;
+
+            case OP_NOT_WHITESPACE:
+            if ((md->ctypes[c] & ctype_space) != 0) RRETURN(MATCH_NOMATCH);
+            break;
+
+            case OP_WHITESPACE:
+            if  ((md->ctypes[c] & ctype_space) == 0) RRETURN(MATCH_NOMATCH);
+            break;
+
+            case OP_NOT_WORDCHAR:
+            if ((md->ctypes[c] & ctype_word) != 0) RRETURN(MATCH_NOMATCH);
+            break;
+
+            case OP_WORDCHAR:
+            if ((md->ctypes[c] & ctype_word) == 0) RRETURN(MATCH_NOMATCH);
+            break;
+
+            default:
+            RRETURN(PCRE_ERROR_INTERNAL);
+            }
+          }
+        }
+      /* Control never gets here */
+      }
+
+    /* If maximizing it is worth using inline code for speed, doing the type
+    test once at the start (i.e. keep it out of the loop). Again, keep the
+    UTF-8 and UCP stuff separate. */
+
+    else
+      {
+      pp = eptr;  /* Remember where we started */
+
+#ifdef SUPPORT_UCP
+      if (prop_type > 0)
+        {
+        for (i = min; i < max; i++)
+          {
+          int len = 1;
+          if (eptr >= md->end_subject) break;
+          GETCHARLEN(c, eptr, len);
+          prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
+          if ((*prop_test_variable == prop_test_against) == prop_fail_result)
+            break;
+          eptr+= len;
+          }
+
+        /* eptr is now past the end of the maximum run */
+
+        for(;;)
+          {
+          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+          if (eptr-- == pp) break;        /* Stop if tried at original pos */
+          BACKCHAR(eptr);
+          }
+        }
+
+      /* Match extended Unicode sequences. We will get here only if the
+      support is in the binary; otherwise a compile-time error occurs. */
+
+      else if (ctype == OP_EXTUNI)
+        {
+        for (i = min; i < max; i++)
+          {
+          if (eptr >= md->end_subject) break;
+          GETCHARINCTEST(c, eptr);
+          prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
+          if (prop_category == ucp_M) break;
+          while (eptr < md->end_subject)
+            {
+            int len = 1;
+            if (!utf8) c = *eptr; else
+              {
+              GETCHARLEN(c, eptr, len);
+              }
+            prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
+            if (prop_category != ucp_M) break;
+            eptr += len;
+            }
+          }
+
+        /* eptr is now past the end of the maximum run */
+
+        for(;;)
+          {
+          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+          if (eptr-- == pp) break;        /* Stop if tried at original pos */
+          for (;;)                        /* Move back over one extended */
+            {
+            int len = 1;
+            BACKCHAR(eptr);
+            if (!utf8) c = *eptr; else
+              {
+              GETCHARLEN(c, eptr, len);
+              }
+            prop_category = ucp_findchar(c, &prop_chartype, &prop_othercase);
+            if (prop_category != ucp_M) break;
+            eptr--;
+            }
+          }
+        }
+
+      else
+#endif   /* SUPPORT_UCP */
+
+#ifdef SUPPORT_UTF8
+      /* UTF-8 mode */
+
+      if (utf8)
+        {
+        switch(ctype)
+          {
+          case OP_ANY:
+
+          /* Special code is required for UTF8, but when the maximum is unlimited
+          we don't need it, so we repeat the non-UTF8 code. This is probably
+          worth it, because .* is quite a common idiom. */
+
+          if (max < INT_MAX)
+            {
+            if ((ims & PCRE_DOTALL) == 0)
+              {
+              for (i = min; i < max; i++)
+                {
+                if (eptr >= md->end_subject || *eptr == NEWLINE) break;
+                eptr++;
+                while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
+                }
+              }
+            else
+              {
+              for (i = min; i < max; i++)
+                {
+                eptr++;
+                while (eptr < md->end_subject && (*eptr & 0xc0) == 0x80) eptr++;
+                }
+              }
+            }
+
+          /* Handle unlimited UTF-8 repeat */
+
+          else
+            {
+            if ((ims & PCRE_DOTALL) == 0)
+              {
+              for (i = min; i < max; i++)
+                {
+                if (eptr >= md->end_subject || *eptr == NEWLINE) break;
+                eptr++;
+                }
+              break;
+              }
+            else
+              {
+              c = max - min;
+              if (c > md->end_subject - eptr) c = md->end_subject - eptr;
+              eptr += c;
+              }
+            }
+          break;
+
+          /* The byte case is the same as non-UTF8 */
+
+          case OP_ANYBYTE:
+          c = max - min;
+          if (c > md->end_subject - eptr) c = md->end_subject - eptr;
+          eptr += c;
+          break;
+
+          case OP_NOT_DIGIT:
+          for (i = min; i < max; i++)
+            {
+            int len = 1;
+            if (eptr >= md->end_subject) break;
+            GETCHARLEN(c, eptr, len);
+            if (c < 256 && (md->ctypes[c] & ctype_digit) != 0) break;
+            eptr+= len;
+            }
+          break;
+
+          case OP_DIGIT:
+          for (i = min; i < max; i++)
+            {
+            int len = 1;
+            if (eptr >= md->end_subject) break;
+            GETCHARLEN(c, eptr, len);
+            if (c >= 256 ||(md->ctypes[c] & ctype_digit) == 0) break;
+            eptr+= len;
+            }
+          break;
+
+          case OP_NOT_WHITESPACE:
+          for (i = min; i < max; i++)
+            {
+            int len = 1;
+            if (eptr >= md->end_subject) break;
+            GETCHARLEN(c, eptr, len);
+            if (c < 256 && (md->ctypes[c] & ctype_space) != 0) break;
+            eptr+= len;
+            }
+          break;
+
+          case OP_WHITESPACE:
+          for (i = min; i < max; i++)
+            {
+            int len = 1;
+            if (eptr >= md->end_subject) break;
+            GETCHARLEN(c, eptr, len);
+            if (c >= 256 ||(md->ctypes[c] & ctype_space) == 0) break;
+            eptr+= len;
+            }
+          break;
+
+          case OP_NOT_WORDCHAR:
+          for (i = min; i < max; i++)
+            {
+            int len = 1;
+            if (eptr >= md->end_subject) break;
+            GETCHARLEN(c, eptr, len);
+            if (c < 256 && (md->ctypes[c] & ctype_word) != 0) break;
+            eptr+= len;
+            }
+          break;
+
+          case OP_WORDCHAR:
+          for (i = min; i < max; i++)
+            {
+            int len = 1;
+            if (eptr >= md->end_subject) break;
+            GETCHARLEN(c, eptr, len);
+            if (c >= 256 || (md->ctypes[c] & ctype_word) == 0) break;
+            eptr+= len;
+            }
+          break;
+
+          default:
+          RRETURN(PCRE_ERROR_INTERNAL);
+          }
+
+        /* eptr is now past the end of the maximum run */
+
+        for(;;)
+          {
+          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+          if (eptr-- == pp) break;        /* Stop if tried at original pos */
+          BACKCHAR(eptr);
+          }
+        }
+      else
+#endif
+
+      /* Not UTF-8 mode */
+        {
+        switch(ctype)
+          {
+          case OP_ANY:
+          if ((ims & PCRE_DOTALL) == 0)
+            {
+            for (i = min; i < max; i++)
+              {
+              if (eptr >= md->end_subject || *eptr == NEWLINE) break;
+              eptr++;
+              }
+            break;
+            }
+          /* For DOTALL case, fall through and treat as \C */
+
+          case OP_ANYBYTE:
+          c = max - min;
+          if (c > md->end_subject - eptr) c = md->end_subject - eptr;
+          eptr += c;
+          break;
+
+          case OP_NOT_DIGIT:
+          for (i = min; i < max; i++)
+            {
+            if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_digit) != 0)
+              break;
+            eptr++;
+            }
+          break;
+
+          case OP_DIGIT:
+          for (i = min; i < max; i++)
+            {
+            if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_digit) == 0)
+              break;
+            eptr++;
+            }
+          break;
+
+          case OP_NOT_WHITESPACE:
+          for (i = min; i < max; i++)
+            {
+            if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_space) != 0)
+              break;
+            eptr++;
+            }
+          break;
+
+          case OP_WHITESPACE:
+          for (i = min; i < max; i++)
+            {
+            if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_space) == 0)
+              break;
+            eptr++;
+            }
+          break;
+
+          case OP_NOT_WORDCHAR:
+          for (i = min; i < max; i++)
+            {
+            if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_word) != 0)
+              break;
+            eptr++;
+            }
+          break;
+
+          case OP_WORDCHAR:
+          for (i = min; i < max; i++)
+            {
+            if (eptr >= md->end_subject || (md->ctypes[*eptr] & ctype_word) == 0)
+              break;
+            eptr++;
+            }
+          break;
+
+          default:
+          RRETURN(PCRE_ERROR_INTERNAL);
+          }
+
+        /* eptr is now past the end of the maximum run */
+
+        while (eptr >= pp)
+          {
+          RMATCH(rrc, eptr, ecode, offset_top, md, ims, eptrb, 0);
+          eptr--;
+          if (rrc != MATCH_NOMATCH) RRETURN(rrc);
+          }
+        }
+
+      /* Get here if we can't make it match with any permitted repetitions */
+
+      RRETURN(MATCH_NOMATCH);
+      }
+    /* Control never gets here */
+
+    /* There's been some horrible disaster. Since all codes > OP_BRA are
+    for capturing brackets, and there shouldn't be any gaps between 0 and
+    OP_BRA, arrival here can only mean there is something seriously wrong
+    in the code above or the OP_xxx definitions. */
+
+    default:
+    DPRINTF(("Unknown opcode %d\n", *ecode));
+    RRETURN(PCRE_ERROR_UNKNOWN_NODE);
+    }
+
+  /* Do not stick any code in here without much thought; it is assumed
+  that "continue" in the code above comes out to here to repeat the main
+  loop. */
+
+  }             /* End of main loop */
+/* Control never reaches here */
+}
+
+
+/***************************************************************************
+****************************************************************************
+                   RECURSION IN THE match() FUNCTION
+
+Undefine all the macros that were defined above to handle this. */
+
+#ifdef NO_RECURSE
+#undef eptr
+#undef ecode
+#undef offset_top
+#undef ims
+#undef eptrb
+#undef flags
+
+#undef callpat
+#undef charptr
+#undef data
+#undef next
+#undef pp
+#undef prev
+#undef saved_eptr
+
+#undef new_recursive
+
+#undef cur_is_word
+#undef condition
+#undef minimize
+#undef prev_is_word
+
+#undef original_ims
+
+#undef ctype
+#undef length
+#undef max
+#undef min
+#undef number
+#undef offset
+#undef op
+#undef save_capture_last
+#undef save_offset1
+#undef save_offset2
+#undef save_offset3
+#undef stacksave
+
+#undef newptrb
+
+#endif
+
+/* These two are defined as macros in both cases */
+
+#undef fc
+#undef fi
+
+/***************************************************************************
+***************************************************************************/
+
+
+
+/*************************************************
+*         Execute a Regular Expression           *
+*************************************************/
+
+/* This function applies a compiled re to a subject string and picks out
+portions of the string if it matches. Two elements in the vector are set for
+each substring: the offsets to the start and end of the substring.
+
+Arguments:
+  argument_re     points to the compiled expression
+  extra_data      points to extra data or is NULL
+  subject         points to the subject string
+  length          length of subject string (may contain binary zeros)
+  start_offset    where to start in the subject string
+  options         option bits
+  offsets         points to a vector of ints to be filled in with offsets
+  offsetcount     the number of elements in the vector
+
+Returns:          > 0 => success; value is the number of elements filled in
+                  = 0 => success, but offsets is not big enough
+                   -1 => failed to match
+                 < -1 => some kind of unexpected problem
+*/
+
+EXPORT int
+pcre_exec(const pcre *argument_re, const pcre_extra *extra_data,
+  const char *subject, int length, int start_offset, int options, int *offsets,
+  int offsetcount)
+{
+int rc, resetcount, ocount;
+int first_byte = -1;
+int req_byte = -1;
+int req_byte2 = -1;
+unsigned long int ims = 0;
+BOOL using_temporary_offsets = FALSE;
+BOOL anchored;
+BOOL startline;
+BOOL firstline;
+BOOL first_byte_caseless = FALSE;
+BOOL req_byte_caseless = FALSE;
+match_data match_block;
+const uschar *tables;
+const uschar *start_bits = NULL;
+const uschar *start_match = (const uschar *)subject + start_offset;
+const uschar *end_subject;
+const uschar *req_byte_ptr = start_match - 1;
+
+pcre_study_data internal_study;
+const pcre_study_data *study;
+
+real_pcre internal_re;
+const real_pcre *external_re = (const real_pcre *)argument_re;
+const real_pcre *re = external_re;
+
+/* Plausibility checks */
+
+if ((options & ~PUBLIC_EXEC_OPTIONS) != 0) return PCRE_ERROR_BADOPTION;
+if (re == NULL || subject == NULL ||
+   (offsets == NULL && offsetcount > 0)) return PCRE_ERROR_NULL;
+if (offsetcount < 0) return PCRE_ERROR_BADCOUNT;
+
+/* Fish out the optional data from the extra_data structure, first setting
+the default values. */
+
+study = NULL;
+match_block.match_limit = MATCH_LIMIT;
+match_block.callout_data = NULL;
+
+/* The table pointer is always in native byte order. */
+
+tables = external_re->tables;
+
+if (extra_data != NULL)
+  {
+  register unsigned int flags = extra_data->flags;
+  if ((flags & PCRE_EXTRA_STUDY_DATA) != 0)
+    study = (const pcre_study_data *)extra_data->study_data;
+  if ((flags & PCRE_EXTRA_MATCH_LIMIT) != 0)
+    match_block.match_limit = extra_data->match_limit;
+  if ((flags & PCRE_EXTRA_CALLOUT_DATA) != 0)
+    match_block.callout_data = extra_data->callout_data;
+  if ((flags & PCRE_EXTRA_TABLES) != 0) tables = extra_data->tables;
+  }
+
+/* If the exec call supplied NULL for tables, use the inbuilt ones. This
+is a feature that makes it possible to save compiled regex and re-use them
+in other programs later. */
+
+if (tables == NULL) tables = _pcre_default_tables;
+
+/* Check that the first field in the block is the magic number. If it is not,
+test for a regex that was compiled on a host of opposite endianness. If this is
+the case, flipped values are put in internal_re and internal_study if there was
+study data too. */
+
+if (re->magic_number != MAGIC_NUMBER)
+  {
+  re = _pcre_try_flipped(re, &internal_re, study, &internal_study);
+  if (re == NULL) return PCRE_ERROR_BADMAGIC;
+  if (study != NULL) study = &internal_study;
+  }
+
+/* Set up other data */
+
+anchored = ((re->options | options) & PCRE_ANCHORED) != 0;
+startline = (re->options & PCRE_STARTLINE) != 0;
+firstline = (re->options & PCRE_FIRSTLINE) != 0;
+
+/* The code starts after the real_pcre block and the capture name table. */
+
+match_block.start_code = (const uschar *)external_re + re->name_table_offset +
+  re->name_count * re->name_entry_size;
+
+match_block.start_subject = (const uschar *)subject;
+match_block.start_offset = start_offset;
+match_block.end_subject = match_block.start_subject + length;
+end_subject = match_block.end_subject;
+
+match_block.endonly = (re->options & PCRE_DOLLAR_ENDONLY) != 0;
+match_block.utf8 = (re->options & PCRE_UTF8) != 0;
+
+match_block.notbol = (options & PCRE_NOTBOL) != 0;
+match_block.noteol = (options & PCRE_NOTEOL) != 0;
+match_block.notempty = (options & PCRE_NOTEMPTY) != 0;
+match_block.partial = (options & PCRE_PARTIAL) != 0;
+match_block.hitend = FALSE;
+
+match_block.recursive = NULL;                   /* No recursion at top level */
+
+match_block.lcc = tables + lcc_offset;
+match_block.ctypes = tables + ctypes_offset;
+
+/* Partial matching is supported only for a restricted set of regexes at the
+moment. */
+
+if (match_block.partial && (re->options & PCRE_NOPARTIAL) != 0)
+  return PCRE_ERROR_BADPARTIAL;
+
+/* Check a UTF-8 string if required. Unfortunately there's no way of passing
+back the character offset. */
+
+#ifdef SUPPORT_UTF8
+if (match_block.utf8 && (options & PCRE_NO_UTF8_CHECK) == 0)
+  {
+  if (_pcre_valid_utf8((uschar *)subject, length) >= 0)
+    return PCRE_ERROR_BADUTF8;
+  if (start_offset > 0 && start_offset < length)
+    {
+    int tb = ((uschar *)subject)[start_offset];
+    if (tb > 127)
+      {
+      tb &= 0xc0;
+      if (tb != 0 && tb != 0xc0) return PCRE_ERROR_BADUTF8_OFFSET;
+      }
+    }
+  }
+#endif
+
+/* The ims options can vary during the matching as a result of the presence
+of (?ims) items in the pattern. They are kept in a local variable so that
+restoring at the exit of a group is easy. */
+
+ims = re->options & (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL);
+
+/* If the expression has got more back references than the offsets supplied can
+hold, we get a temporary chunk of working store to use during the matching.
+Otherwise, we can use the vector supplied, rounding down its size to a multiple
+of 3. */
+
+ocount = offsetcount - (offsetcount % 3);
+
+if (re->top_backref > 0 && re->top_backref >= ocount/3)
+  {
+  ocount = re->top_backref * 3 + 3;
+  match_block.offset_vector = (int *)(pcre_malloc)(ocount * sizeof(int));
+  if (match_block.offset_vector == NULL) return PCRE_ERROR_NOMEMORY;
+  using_temporary_offsets = TRUE;
+  DPRINTF(("Got memory to hold back references\n"));
+  }
+else match_block.offset_vector = offsets;
+
+match_block.offset_end = ocount;
+match_block.offset_max = (2*ocount)/3;
+match_block.offset_overflow = FALSE;
+match_block.capture_last = -1;
+
+/* Compute the minimum number of offsets that we need to reset each time. Doing
+this makes a huge difference to execution time when there aren't many brackets
+in the pattern. */
+
+resetcount = 2 + re->top_bracket * 2;
+if (resetcount > offsetcount) resetcount = ocount;
+
+/* Reset the working variable associated with each extraction. These should
+never be used unless previously set, but they get saved and restored, and so we
+initialize them to avoid reading uninitialized locations. */
+
+if (match_block.offset_vector != NULL)
+  {
+  register int *iptr = match_block.offset_vector + ocount;
+  register int *iend = iptr - resetcount/2 + 1;
+  while (--iptr >= iend) *iptr = -1;
+  }
+
+/* Set up the first character to match, if available. The first_byte value is
+never set for an anchored regular expression, but the anchoring may be forced
+at run time, so we have to test for anchoring. The first char may be unset for
+an unanchored pattern, of course. If there's no first char and the pattern was
+studied, there may be a bitmap of possible first characters. */
+
+if (!anchored)
+  {
+  if ((re->options & PCRE_FIRSTSET) != 0)
+    {
+    first_byte = re->first_byte & 255;
+    if ((first_byte_caseless = ((re->first_byte & REQ_CASELESS) != 0)) == TRUE)
+      first_byte = match_block.lcc[first_byte];
+    }
+  else
+    if (!startline && study != NULL &&
+      (study->options & PCRE_STUDY_MAPPED) != 0)
+        start_bits = study->start_bits;
+  }
+
+/* For anchored or unanchored matches, there may be a "last known required
+character" set. */
+
+if ((re->options & PCRE_REQCHSET) != 0)
+  {
+  req_byte = re->req_byte & 255;
+  req_byte_caseless = (re->req_byte & REQ_CASELESS) != 0;
+  req_byte2 = (tables + fcc_offset)[req_byte];  /* case flipped */
+  }
+
+/* Loop for handling unanchored repeated matching attempts; for anchored regexs
+the loop runs just once. */
+
+do
+  {
+  const uschar *save_end_subject = end_subject;
+
+  /* Reset the maximum number of extractions we might see. */
+
+  if (match_block.offset_vector != NULL)
+    {
+    register int *iptr = match_block.offset_vector;
+    register int *iend = iptr + resetcount;
+    while (iptr < iend) *iptr++ = -1;
+    }
+
+  /* Advance to a unique first char if possible. If firstline is TRUE, the
+  start of the match is constrained to the first line of a multiline string.
+  Implement this by temporarily adjusting end_subject so that we stop scanning
+  at a newline. If the match fails at the newline, later code breaks this loop.
+  */
+
+  if (firstline)
+    {
+    const uschar *t = start_match;
+    while (t < save_end_subject && *t != '\n') t++;
+    end_subject = t;
+    }
+
+  /* Now test for a unique first byte */
+
+  if (first_byte >= 0)
+    {
+    if (first_byte_caseless)
+      while (start_match < end_subject &&
+             match_block.lcc[*start_match] != first_byte)
+        start_match++;
+    else
+      while (start_match < end_subject && *start_match != first_byte)
+        start_match++;
+    }
+
+  /* Or to just after \n for a multiline match if possible */
+
+  else if (startline)
+    {
+    if (start_match > match_block.start_subject + start_offset)
+      {
+      while (start_match < end_subject && start_match[-1] != NEWLINE)
+        start_match++;
+      }
+    }
+
+  /* Or to a non-unique first char after study */
+
+  else if (start_bits != NULL)
+    {
+    while (start_match < end_subject)
+      {
+      register unsigned int c = *start_match;
+      if ((start_bits[c/8] & (1 << (c&7))) == 0) start_match++; else break;
+      }
+    }
+
+  /* Restore fudged end_subject */
+
+  end_subject = save_end_subject;
+
+#ifdef DEBUG  /* Sigh. Some compilers never learn. */
+  printf(">>>> Match against: ");
+  pchars(start_match, end_subject - start_match, TRUE, &match_block);
+  printf("\n");
+#endif
+
+  /* If req_byte is set, we know that that character must appear in the subject
+  for the match to succeed. If the first character is set, req_byte must be
+  later in the subject; otherwise the test starts at the match point. This
+  optimization can save a huge amount of backtracking in patterns with nested
+  unlimited repeats that aren't going to match. Writing separate code for
+  cased/caseless versions makes it go faster, as does using an autoincrement
+  and backing off on a match.
+
+  HOWEVER: when the subject string is very, very long, searching to its end can
+  take a long time, and give bad performance on quite ordinary patterns. This
+  showed up when somebody was matching /^C/ on a 32-megabyte string... so we
+  don't do this when the string is sufficiently long.
+
+  ALSO: this processing is disabled when partial matching is requested.
+  */
+
+  if (req_byte >= 0 &&
+      end_subject - start_match < REQ_BYTE_MAX &&
+      !match_block.partial)
+    {
+    register const uschar *p = start_match + ((first_byte >= 0)? 1 : 0);
+
+    /* We don't need to repeat the search if we haven't yet reached the
+    place we found it at last time. */
+
+    if (p > req_byte_ptr)
+      {
+      if (req_byte_caseless)
+        {
+        while (p < end_subject)
+          {
+          register int pp = *p++;
+          if (pp == req_byte || pp == req_byte2) { p--; break; }
+          }
+        }
+      else
+        {
+        while (p < end_subject)
+          {
+          if (*p++ == req_byte) { p--; break; }
+          }
+        }
+
+      /* If we can't find the required character, break the matching loop */
+
+      if (p >= end_subject) break;
+
+      /* If we have found the required character, save the point where we
+      found it, so that we don't search again next time round the loop if
+      the start hasn't passed this character yet. */
+
+      req_byte_ptr = p;
+      }
+    }
+
+  /* When a match occurs, substrings will be set for all internal extractions;
+  we just need to set up the whole thing as substring 0 before returning. If
+  there were too many extractions, set the return code to zero. In the case
+  where we had to get some local store to hold offsets for backreferences, copy
+  those back references that we can. In this case there need not be overflow
+  if certain parts of the pattern were not used. */
+
+  match_block.start_match = start_match;
+  match_block.match_call_count = 0;
+
+  rc = match(start_match, match_block.start_code, 2, &match_block, ims, NULL,
+    match_isgroup);
+
+  /* When the result is no match, if the subject's first character was a
+  newline and the PCRE_FIRSTLINE option is set, break (which will return
+  PCRE_ERROR_NOMATCH). The option requests that a match occur before the first
+  newline in the subject. Otherwise, advance the pointer to the next character
+  and continue - but the continuation will actually happen only when the
+  pattern is not anchored. */
+
+  if (rc == MATCH_NOMATCH)
+    {
+    if (firstline && *start_match == NEWLINE) break;
+    start_match++;
+#ifdef SUPPORT_UTF8
+    if (match_block.utf8)
+      while(start_match < end_subject && (*start_match & 0xc0) == 0x80)
+        start_match++;
+#endif
+    continue;
+    }
+
+  if (rc != MATCH_MATCH)
+    {
+    DPRINTF((">>>> error: returning %d\n", rc));
+    return rc;
+    }
+
+  /* We have a match! Copy the offset information from temporary store if
+  necessary */
+
+  if (using_temporary_offsets)
+    {
+    if (offsetcount >= 4)
+      {
+      memcpy(offsets + 2, match_block.offset_vector + 2,
+        (offsetcount - 2) * sizeof(int));
+      DPRINTF(("Copied offsets from temporary memory\n"));
+      }
+    if (match_block.end_offset_top > offsetcount)
+      match_block.offset_overflow = TRUE;
+
+    DPRINTF(("Freeing temporary memory\n"));
+    (pcre_free)(match_block.offset_vector);
+    }
+
+  rc = match_block.offset_overflow? 0 : match_block.end_offset_top/2;
+
+  if (offsetcount < 2) rc = 0; else
+    {
+    offsets[0] = start_match - match_block.start_subject;
+    offsets[1] = match_block.end_match_ptr - match_block.start_subject;
+    }
+
+  DPRINTF((">>>> returning %d\n", rc));
+  return rc;
+  }
+
+/* This "while" is the end of the "do" above */
+
+while (!anchored && start_match <= end_subject);
+
+if (using_temporary_offsets)
+  {
+  DPRINTF(("Freeing temporary memory\n"));
+  (pcre_free)(match_block.offset_vector);
+  }
+
+if (match_block.partial && match_block.hitend)
+  {
+  DPRINTF((">>>> returning PCRE_ERROR_PARTIAL\n"));
+  return PCRE_ERROR_PARTIAL;
+  }
+else
+  {
+  DPRINTF((">>>> returning PCRE_ERROR_NOMATCH\n"));
+  return PCRE_ERROR_NOMATCH;
+  }
+}
+
+/* End of pcre_exec.c */
diff --git a/ext/pcre/pcrelib/pcre_fullinfo.c b/ext/pcre/pcrelib/pcre_fullinfo.c
new file mode 100644 (file)
index 0000000..ac80e65
--- /dev/null
@@ -0,0 +1,149 @@
+/*************************************************
+*      Perl-Compatible Regular Expressions       *
+*************************************************/
+
+/*PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+
+/* This module contains the external function pcre_fullinfo(), which returns
+information about a compiled pattern. */
+
+
+#include "pcre_internal.h"
+
+
+/*************************************************
+*        Return info about compiled pattern      *
+*************************************************/
+
+/* This is a newer "info" function which has an extensible interface so
+that additional items can be added compatibly.
+
+Arguments:
+  argument_re      points to compiled code
+  extra_data       points extra data, or NULL
+  what             what information is required
+  where            where to put the information
+
+Returns:           0 if data returned, negative on error
+*/
+
+EXPORT int
+pcre_fullinfo(const pcre *argument_re, const pcre_extra *extra_data, int what,
+  void *where)
+{
+real_pcre internal_re;
+pcre_study_data internal_study;
+const real_pcre *re = (const real_pcre *)argument_re;
+const pcre_study_data *study = NULL;
+
+if (re == NULL || where == NULL) return PCRE_ERROR_NULL;
+
+if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_STUDY_DATA) != 0)
+  study = (const pcre_study_data *)extra_data->study_data;
+
+if (re->magic_number != MAGIC_NUMBER)
+  {
+  re = _pcre_try_flipped(re, &internal_re, study, &internal_study);
+  if (re == NULL) return PCRE_ERROR_BADMAGIC;
+  if (study != NULL) study = &internal_study;
+  }
+
+switch (what)
+  {
+  case PCRE_INFO_OPTIONS:
+  *((unsigned long int *)where) = re->options & PUBLIC_OPTIONS;
+  break;
+
+  case PCRE_INFO_SIZE:
+  *((size_t *)where) = re->size;
+  break;
+
+  case PCRE_INFO_STUDYSIZE:
+  *((size_t *)where) = (study == NULL)? 0 : study->size;
+  break;
+
+  case PCRE_INFO_CAPTURECOUNT:
+  *((int *)where) = re->top_bracket;
+  break;
+
+  case PCRE_INFO_BACKREFMAX:
+  *((int *)where) = re->top_backref;
+  break;
+
+  case PCRE_INFO_FIRSTBYTE:
+  *((int *)where) =
+    ((re->options & PCRE_FIRSTSET) != 0)? re->first_byte :
+    ((re->options & PCRE_STARTLINE) != 0)? -1 : -2;
+  break;
+
+  /* Make sure we pass back the pointer to the bit vector in the external
+  block, not the internal copy (with flipped integer fields). */
+
+  case PCRE_INFO_FIRSTTABLE:
+  *((const uschar **)where) =
+    (study != NULL && (study->options & PCRE_STUDY_MAPPED) != 0)?
+      ((const pcre_study_data *)extra_data->study_data)->start_bits : NULL;
+  break;
+
+  case PCRE_INFO_LASTLITERAL:
+  *((int *)where) =
+    ((re->options & PCRE_REQCHSET) != 0)? re->req_byte : -1;
+  break;
+
+  case PCRE_INFO_NAMEENTRYSIZE:
+  *((int *)where) = re->name_entry_size;
+  break;
+
+  case PCRE_INFO_NAMECOUNT:
+  *((int *)where) = re->name_count;
+  break;
+
+  case PCRE_INFO_NAMETABLE:
+  *((const uschar **)where) = (const uschar *)re + re->name_table_offset;
+  break;
+
+  case PCRE_INFO_DEFAULT_TABLES:
+  *((const uschar **)where) = (const uschar *)(_pcre_default_tables);
+  break;
+
+  default: return PCRE_ERROR_BADOPTION;
+  }
+
+return 0;
+}
+
+/* End of pcre_fullinfo.c */
similarity index 96%
rename from ext/pcre/pcrelib/get.c
rename to ext/pcre/pcrelib/pcre_get.c
index 225843e2e298cee58de533c27e949c3fa48b767a..fc4a14ac14f8ea19fe2a9be58bc97f06c2806a25 100644 (file)
@@ -2,14 +2,11 @@
 *      Perl-Compatible Regular Expressions       *
 *************************************************/
 
-/*
-This is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language. See
-the file Tech.Notes for some information on the internals.
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
 
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
-           Copyright (c) 1997-2003 University of Cambridge
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -40,15 +37,13 @@ POSSIBILITY OF SUCH DAMAGE.
 -----------------------------------------------------------------------------
 */
 
+
 /* This module contains some convenience functions for extracting substrings
 from the subject string after a regex match has succeeded. The original idea
 for these functions came from Scott Wimer. */
 
 
-/* Include the internals header, which itself includes Standard C headers plus
-the external pcre header. */
-
-#include "internal.h"
+#include "pcre_internal.h"
 
 
 /*************************************************
@@ -354,4 +349,4 @@ pcre_free_substring(const char *pointer)
 (pcre_free)((void *)pointer);
 }
 
-/* End of get.c */
+/* End of pcre_get.c */
diff --git a/ext/pcre/pcrelib/pcre_globals.c b/ext/pcre/pcrelib/pcre_globals.c
new file mode 100644 (file)
index 0000000..1a83980
--- /dev/null
@@ -0,0 +1,69 @@
+/*************************************************
+*      Perl-Compatible Regular Expressions       *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+
+/* This module contains global variables that are exported by the PCRE library.
+PCRE is thread-clean and doesn't use any global variables in the normal sense.
+However, it calls memory allocation and freeing functions via the four
+indirections below, and it can optionally do callouts, using the fifth
+indirection. These values can be changed by the caller, but are shared between
+all threads. However, when compiling for Virtual Pascal, things are done
+differently, and global variables are not used (see pcre.in). */
+
+
+#include "pcre_internal.h"
+
+
+#ifndef VPCOMPAT
+#ifdef __cplusplus
+extern "C" void *(*pcre_malloc)(size_t) = malloc;
+extern "C" void  (*pcre_free)(void *) = free;
+extern "C" void *(*pcre_stack_malloc)(size_t) = malloc;
+extern "C" void  (*pcre_stack_free)(void *) = free;
+extern "C" int   (*pcre_callout)(pcre_callout_block *) = NULL;
+#else
+void *(*pcre_malloc)(size_t) = malloc;
+void  (*pcre_free)(void *) = free;
+void *(*pcre_stack_malloc)(size_t) = malloc;
+void  (*pcre_stack_free)(void *) = free;
+int   (*pcre_callout)(pcre_callout_block *) = NULL;
+#endif
+#endif
+
+/* End of pcre_globals.c */
diff --git a/ext/pcre/pcrelib/pcre_info.c b/ext/pcre/pcrelib/pcre_info.c
new file mode 100644 (file)
index 0000000..228949d
--- /dev/null
@@ -0,0 +1,89 @@
+/*************************************************
+*      Perl-Compatible Regular Expressions       *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+
+/* This module contains the external function pcre_info(), which gives some
+information about a compiled pattern. However, use of this function is now
+deprecated, as it has been superseded by pcre_fullinfo(). */
+
+
+#include "pcre_internal.h"
+
+
+/*************************************************
+* (Obsolete) Return info about compiled pattern  *
+*************************************************/
+
+/* This is the original "info" function. It picks potentially useful data out
+of the private structure, but its interface was too rigid. It remains for
+backwards compatibility. The public options are passed back in an int - though
+the re->options field has been expanded to a long int, all the public options
+at the low end of it, and so even on 16-bit systems this will still be OK.
+Therefore, I haven't changed the API for pcre_info().
+
+Arguments:
+  argument_re   points to compiled code
+  optptr        where to pass back the options
+  first_byte    where to pass back the first character,
+                or -1 if multiline and all branches start ^,
+                or -2 otherwise
+
+Returns:        number of capturing subpatterns
+                or negative values on error
+*/
+
+EXPORT int
+pcre_info(const pcre *argument_re, int *optptr, int *first_byte)
+{
+real_pcre internal_re;
+const real_pcre *re = (const real_pcre *)argument_re;
+if (re == NULL) return PCRE_ERROR_NULL;
+if (re->magic_number != MAGIC_NUMBER)
+  {
+  re = _pcre_try_flipped(re, &internal_re, NULL, NULL);
+  if (re == NULL) return PCRE_ERROR_BADMAGIC;
+  }
+if (optptr != NULL) *optptr = (int)(re->options & PUBLIC_OPTIONS);
+if (first_byte != NULL)
+  *first_byte = ((re->options & PCRE_FIRSTSET) != 0)? re->first_byte :
+     ((re->options & PCRE_STARTLINE) != 0)? -1 : -2;
+return re->top_bracket;
+}
+
+/* End of pcre_info.c */
diff --git a/ext/pcre/pcrelib/pcre_internal.h b/ext/pcre/pcrelib/pcre_internal.h
new file mode 100644 (file)
index 0000000..bffab02
--- /dev/null
@@ -0,0 +1,909 @@
+/*************************************************
+*      Perl-Compatible Regular Expressions       *
+*************************************************/
+
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+/* This header contains definitions that are shared between the different
+modules, but which are not relevant to the exported API. This includes some
+functions whose names all begin with "_pcre_". */
+
+
+/* Define DEBUG to get debugging output on stdout. */
+
+/****
+#define DEBUG
+****/
+
+/* Use a macro for debugging printing, 'cause that eliminates the use of #ifdef
+inline, and there are *still* stupid compilers about that don't like indented
+pre-processor statements, or at least there were when I first wrote this. After
+all, it had only been about 10 years then... */
+
+#ifdef DEBUG
+#define DPRINTF(p) printf p
+#else
+#define DPRINTF(p) /*nothing*/
+#endif
+
+
+/* Get the definitions provided by running "configure" */
+
+#ifdef PHP_WIN32
+# include "config.w32.h"
+#else
+# include <php_config.h>
+#endif
+
+/* Standard C headers plus the external interface definition. The only time
+setjmp and stdarg are used is when NO_RECURSE is set. */
+
+#include <ctype.h>
+#include <limits.h>
+#include <setjmp.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef PCRE_SPY
+#define PCRE_DEFINITION       /* Win32 __declspec(export) trigger for .dll */
+#endif
+
+/* We need to have types that specify unsigned 16-bit and 32-bit integers. We
+cannot determine these outside the compilation (e.g. by running a program as
+part of "configure") because PCRE is often cross-compiled for use on other
+systems. Instead we make use of the maximum sizes that are available at
+preprocessor time in standard C environments. */
+
+#if USHRT_MAX == 65535
+  typedef unsigned short pcre_uint16;
+#elif UINT_MAX == 65535
+  typedef unsigned int pcre_uint16;
+#else
+  #error Cannot determine a type for 16-bit unsigned integers
+#endif
+
+#if UINT_MAX == 4294967295
+  typedef unsigned int pcre_uint32;
+#elif ULONG_MAX == 4294967295
+  typedef unsigned long int pcre_uint32;
+#else
+  #error Cannot determine a type for 32-bit unsigned integers
+#endif
+
+/* All character handling must be done as unsigned characters. Otherwise there
+are problems with top-bit-set characters and functions such as isspace().
+However, we leave the interface to the outside world as char *, because that
+should make things easier for callers. We define a short type for unsigned char
+to save lots of typing. I tried "uchar", but it causes problems on Digital
+Unix, where it is defined in sys/types, so use "uschar" instead. */
+
+typedef unsigned char uschar;
+
+/* Include the public PCRE header */
+
+#include "pcre.h"
+
+/* Include the (copy of) the public ucp header, changing the external name into
+a private one. This does no harm, even if we aren't compiling UCP support. */
+
+#define ucp_findchar _pcre_ucp_findchar
+#include "ucp.h"
+
+/* When compiling for use with the Virtual Pascal compiler, these functions
+need to have their names changed. PCRE must be compiled with the -DVPCOMPAT
+option on the command line. */
+
+#ifdef VPCOMPAT
+#define strncmp(s1,s2,m) _strncmp(s1,s2,m)
+#define memcpy(d,s,n)    _memcpy(d,s,n)
+#define memmove(d,s,n)   _memmove(d,s,n)
+#define memset(s,c,n)    _memset(s,c,n)
+#else  /* VPCOMPAT */
+
+/* To cope with SunOS4 and other systems that lack memmove() but have bcopy(),
+define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPY
+is set. Otherwise, include an emulating function for those systems that have
+neither (there some non-Unix environments where this is the case). This assumes
+that all calls to memmove are moving strings upwards in store, which is the
+case in PCRE. */
+
+#if ! HAVE_MEMMOVE
+#undef  memmove        /* some systems may have a macro */
+#if HAVE_BCOPY
+#define memmove(a, b, c) bcopy(b, a, c)
+#else  /* HAVE_BCOPY */
+void *
+pcre_memmove(unsigned char *dest, const unsigned char *src, size_t n)
+{
+int i;
+dest += n;
+src += n;
+for (i = 0; i < n; ++i) *(--dest) =  *(--src);
+}
+#define memmove(a, b, c) pcre_memmove(a, b, c)
+#endif   /* not HAVE_BCOPY */
+#endif   /* not HAVE_MEMMOVE */
+#endif   /* not VPCOMPAT */
+
+
+/* PCRE keeps offsets in its compiled code as 2-byte quantities (always stored
+in big-endian order) by default. These are used, for example, to link from the
+start of a subpattern to its alternatives and its end. The use of 2 bytes per
+offset limits the size of the compiled regex to around 64K, which is big enough
+for almost everybody. However, I received a request for an even bigger limit.
+For this reason, and also to make the code easier to maintain, the storing and
+loading of offsets from the byte string is now handled by the macros that are
+defined here.
+
+The macros are controlled by the value of LINK_SIZE. This defaults to 2 in
+the config.h file, but can be overridden by using -D on the command line. This
+is automated on Unix systems via the "configure" command. */
+
+#if LINK_SIZE == 2
+
+#define PUT(a,n,d)   \
+  (a[n] = (d) >> 8), \
+  (a[(n)+1] = (d) & 255)
+
+#define GET(a,n) \
+  (((a)[n] << 8) | (a)[(n)+1])
+
+#define MAX_PATTERN_SIZE (1 << 16)
+
+
+#elif LINK_SIZE == 3
+
+#define PUT(a,n,d)       \
+  (a[n] = (d) >> 16),    \
+  (a[(n)+1] = (d) >> 8), \
+  (a[(n)+2] = (d) & 255)
+
+#define GET(a,n) \
+  (((a)[n] << 16) | ((a)[(n)+1] << 8) | (a)[(n)+2])
+
+#define MAX_PATTERN_SIZE (1 << 24)
+
+
+#elif LINK_SIZE == 4
+
+#define PUT(a,n,d)        \
+  (a[n] = (d) >> 24),     \
+  (a[(n)+1] = (d) >> 16), \
+  (a[(n)+2] = (d) >> 8),  \
+  (a[(n)+3] = (d) & 255)
+
+#define GET(a,n) \
+  (((a)[n] << 24) | ((a)[(n)+1] << 16) | ((a)[(n)+2] << 8) | (a)[(n)+3])
+
+#define MAX_PATTERN_SIZE (1 << 30)   /* Keep it positive */
+
+
+#else
+#error LINK_SIZE must be either 2, 3, or 4
+#endif
+
+
+/* Convenience macro defined in terms of the others */
+
+#define PUTINC(a,n,d)   PUT(a,n,d), a += LINK_SIZE
+
+
+/* PCRE uses some other 2-byte quantities that do not change when the size of
+offsets changes. There are used for repeat counts and for other things such as
+capturing parenthesis numbers in back references. */
+
+#define PUT2(a,n,d)   \
+  a[n] = (d) >> 8; \
+  a[(n)+1] = (d) & 255
+
+#define GET2(a,n) \
+  (((a)[n] << 8) | (a)[(n)+1])
+
+#define PUT2INC(a,n,d)  PUT2(a,n,d), a += 2
+
+
+/* When UTF-8 encoding is being used, a character is no longer just a single
+byte. The macros for character handling generate simple sequences when used in
+byte-mode, and more complicated ones for UTF-8 characters. */
+
+#ifndef SUPPORT_UTF8
+#define GETCHAR(c, eptr) c = *eptr;
+#define GETCHARTEST(c, eptr) c = *eptr;
+#define GETCHARINC(c, eptr) c = *eptr++;
+#define GETCHARINCTEST(c, eptr) c = *eptr++;
+#define GETCHARLEN(c, eptr, len) c = *eptr;
+#define BACKCHAR(eptr)
+
+#else   /* SUPPORT_UTF8 */
+
+/* Get the next UTF-8 character, not advancing the pointer. This is called when
+we know we are in UTF-8 mode. */
+
+#define GETCHAR(c, eptr) \
+  c = *eptr; \
+  if ((c & 0xc0) == 0xc0) \
+    { \
+    int gcii; \
+    int gcaa = _pcre_utf8_table4[c & 0x3f];  /* Number of additional bytes */ \
+    int gcss = 6*gcaa; \
+    c = (c & _pcre_utf8_table3[gcaa]) << gcss; \
+    for (gcii = 1; gcii <= gcaa; gcii++) \
+      { \
+      gcss -= 6; \
+      c |= (eptr[gcii] & 0x3f) << gcss; \
+      } \
+    }
+
+/* Get the next UTF-8 character, testing for UTF-8 mode, and not advancing the
+pointer. */
+
+#define GETCHARTEST(c, eptr) \
+  c = *eptr; \
+  if (utf8 && (c & 0xc0) == 0xc0) \
+    { \
+    int gcii; \
+    int gcaa = _pcre_utf8_table4[c & 0x3f];  /* Number of additional bytes */ \
+    int gcss = 6*gcaa; \
+    c = (c & _pcre_utf8_table3[gcaa]) << gcss; \
+    for (gcii = 1; gcii <= gcaa; gcii++) \
+      { \
+      gcss -= 6; \
+      c |= (eptr[gcii] & 0x3f) << gcss; \
+      } \
+    }
+
+/* Get the next UTF-8 character, advancing the pointer. This is called when we
+know we are in UTF-8 mode. */
+
+#define GETCHARINC(c, eptr) \
+  c = *eptr++; \
+  if ((c & 0xc0) == 0xc0) \
+    { \
+    int gcaa = _pcre_utf8_table4[c & 0x3f];  /* Number of additional bytes */ \
+    int gcss = 6*gcaa; \
+    c = (c & _pcre_utf8_table3[gcaa]) << gcss; \
+    while (gcaa-- > 0) \
+      { \
+      gcss -= 6; \
+      c |= (*eptr++ & 0x3f) << gcss; \
+      } \
+    }
+
+/* Get the next character, testing for UTF-8 mode, and advancing the pointer */
+
+#define GETCHARINCTEST(c, eptr) \
+  c = *eptr++; \
+  if (utf8 && (c & 0xc0) == 0xc0) \
+    { \
+    int gcaa = _pcre_utf8_table4[c & 0x3f];  /* Number of additional bytes */ \
+    int gcss = 6*gcaa; \
+    c = (c & _pcre_utf8_table3[gcaa]) << gcss; \
+    while (gcaa-- > 0) \
+      { \
+      gcss -= 6; \
+      c |= (*eptr++ & 0x3f) << gcss; \
+      } \
+    }
+
+/* Get the next UTF-8 character, not advancing the pointer, incrementing length
+if there are extra bytes. This is called when we know we are in UTF-8 mode. */
+
+#define GETCHARLEN(c, eptr, len) \
+  c = *eptr; \
+  if ((c & 0xc0) == 0xc0) \
+    { \
+    int gcii; \
+    int gcaa = _pcre_utf8_table4[c & 0x3f];  /* Number of additional bytes */ \
+    int gcss = 6*gcaa; \
+    c = (c & _pcre_utf8_table3[gcaa]) << gcss; \
+    for (gcii = 1; gcii <= gcaa; gcii++) \
+      { \
+      gcss -= 6; \
+      c |= (eptr[gcii] & 0x3f) << gcss; \
+      } \
+    len += gcaa; \
+    }
+
+/* If the pointer is not at the start of a character, move it back until
+it is. Called only in UTF-8 mode. */
+
+#define BACKCHAR(eptr) while((*eptr & 0xc0) == 0x80) eptr--;
+
+#endif
+
+
+/* In case there is no definition of offsetof() provided - though any proper
+Standard C system should have one. */
+
+#ifndef offsetof
+#define offsetof(p_type,field) ((size_t)&(((p_type *)0)->field))
+#endif
+
+
+/* These are the public options that can change during matching. */
+
+#define PCRE_IMS (PCRE_CASELESS|PCRE_MULTILINE|PCRE_DOTALL)
+
+/* Private options flags start at the most significant end of the four bytes,
+but skip the top bit so we can use ints for convenience without getting tangled
+with negative values. The public options defined in pcre.h start at the least
+significant end. Make sure they don't overlap! */
+
+#define PCRE_FIRSTSET      0x40000000  /* first_byte is set */
+#define PCRE_REQCHSET      0x20000000  /* req_byte is set */
+#define PCRE_STARTLINE     0x10000000  /* start after \n for multiline */
+#define PCRE_ICHANGED      0x08000000  /* i option changes within regex */
+#define PCRE_NOPARTIAL     0x04000000  /* can't use partial with this regex */
+
+/* Options for the "extra" block produced by pcre_study(). */
+
+#define PCRE_STUDY_MAPPED   0x01     /* a map of starting chars exists */
+
+/* Masks for identifying the public options that are permitted at compile
+time, run time, or study time, respectively. */
+
+#define PUBLIC_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)
+
+#define PUBLIC_EXEC_OPTIONS \
+  (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \
+   PCRE_PARTIAL)
+
+#define PUBLIC_DFA_EXEC_OPTIONS \
+  (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NO_UTF8_CHECK| \
+   PCRE_PARTIAL|PCRE_DFA_SHORTEST|PCRE_DFA_RESTART)
+
+#define PUBLIC_STUDY_OPTIONS 0   /* None defined */
+
+/* Magic number to provide a small check against being handed junk. Also used
+to detect whether a pattern was compiled on a host of different endianness. */
+
+#define MAGIC_NUMBER  0x50435245UL   /* 'PCRE' */
+
+/* Negative values for the firstchar and reqchar variables */
+
+#define REQ_UNSET (-2)
+#define REQ_NONE  (-1)
+
+/* The maximum remaining length of subject we are prepared to search for a
+req_byte match. */
+
+#define REQ_BYTE_MAX 1000
+
+/* Flags added to firstbyte or reqbyte; a "non-literal" item is either a
+variable-length repeat, or a anything other than literal characters. */
+
+#define REQ_CASELESS 0x0100    /* indicates caselessness */
+#define REQ_VARY     0x0200    /* reqbyte followed non-literal item */
+
+/* Miscellaneous definitions */
+
+typedef int BOOL;
+
+#define FALSE   0
+#define TRUE    1
+
+/* Escape items that are just an encoding of a particular data value. Note that
+ESC_n is defined as yet another macro, which is set in config.h to either \n
+(the default) or \r (which some people want). */
+
+#ifndef ESC_e
+#define ESC_e 27
+#endif
+
+#ifndef ESC_f
+#define ESC_f '\f'
+#endif
+
+#ifndef ESC_n
+#define ESC_n NEWLINE
+#endif
+
+#ifndef ESC_r
+#define ESC_r '\r'
+#endif
+
+/* We can't officially use ESC_t because it is a POSIX reserved identifier
+(presumably because of all the others like size_t). */
+
+#ifndef ESC_tee
+#define ESC_tee '\t'
+#endif
+
+/* 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
+their negation. Also, they must appear in the same order as in the opcode
+definitions below, up to ESC_z. There's a dummy for OP_ANY because it
+corresponds to "." rather than an escape sequence. The final one must be
+ESC_REF as subsequent values are used for \1, \2, \3, etc. There is are two
+tests in the code for an escape greater than ESC_b and less than ESC_Z to
+detect the types that may be repeated. These are the types that consume
+characters. If any new escapes are put in between that don't consume a
+character, that code will have to change. */
+
+enum { ESC_A = 1, ESC_G, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s, ESC_W,
+       ESC_w, ESC_dum1, ESC_C, ESC_P, ESC_p, ESC_X, ESC_Z, ESC_z, ESC_E,
+       ESC_Q, ESC_REF };
+
+/* Flag bits and data types for the extended class (OP_XCLASS) for classes that
+contain UTF-8 characters with values greater than 255. */
+
+#define XCL_NOT    0x01    /* Flag: this is a negative class */
+#define XCL_MAP    0x02    /* Flag: a 32-byte map is present */
+
+#define XCL_END       0    /* Marks end of individual items */
+#define XCL_SINGLE    1    /* Single item (one multibyte char) follows */
+#define XCL_RANGE     2    /* A range (two multibyte chars) follows */
+#define XCL_PROP      3    /* Unicode property (one property code) follows */
+#define XCL_NOTPROP   4    /* Unicode inverted property (ditto) */
+
+
+/* Opcode table: OP_BRA must be last, as all values >= it are used for brackets
+that extract substrings. 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 that whenever this list is updated, the two macro definitions that follow
+must also be updated to match. */
+
+enum {
+  OP_END,            /* 0 End of pattern */
+
+  /* Values corresponding to backslashed metacharacters */
+
+  OP_SOD,            /* 1 Start of data: \A */
+  OP_SOM,            /* 2 Start of match (subject + offset): \G */
+  OP_NOT_WORD_BOUNDARY,  /*  3 \B */
+  OP_WORD_BOUNDARY,      /*  4 \b */
+  OP_NOT_DIGIT,          /*  5 \D */
+  OP_DIGIT,              /*  6 \d */
+  OP_NOT_WHITESPACE,     /*  7 \S */
+  OP_WHITESPACE,         /*  8 \s */
+  OP_NOT_WORDCHAR,       /*  9 \W */
+  OP_WORDCHAR,           /* 10 \w */
+  OP_ANY,            /* 11 Match any character */
+  OP_ANYBYTE,        /* 12 Match any byte (\C); different to OP_ANY for UTF-8 */
+  OP_NOTPROP,        /* 13 \P (not Unicode property) */
+  OP_PROP,           /* 14 \p (Unicode property) */
+  OP_EXTUNI,         /* 15 \X (extended Unicode sequence */
+  OP_EODN,           /* 16 End of data or \n at end of data: \Z. */
+  OP_EOD,            /* 17 End of data: \z */
+
+  OP_OPT,            /* 18 Set runtime options */
+  OP_CIRC,           /* 19 Start of line - varies with multiline switch */
+  OP_DOLL,           /* 20 End of line - varies with multiline switch */
+  OP_CHAR,           /* 21 Match one character, casefully */
+  OP_CHARNC,         /* 22 Match one character, caselessly */
+  OP_NOT,            /* 23 Match anything but the following char */
+
+  OP_STAR,           /* 24 The maximizing and minimizing versions of */
+  OP_MINSTAR,        /* 25 all these opcodes must come in pairs, with */
+  OP_PLUS,           /* 26 the minimizing one second. */
+  OP_MINPLUS,        /* 27 This first set applies to single characters */
+  OP_QUERY,          /* 28 */
+  OP_MINQUERY,       /* 29 */
+  OP_UPTO,           /* 30 From 0 to n matches */
+  OP_MINUPTO,        /* 31 */
+  OP_EXACT,          /* 32 Exactly n matches */
+
+  OP_NOTSTAR,        /* 33 The maximizing and minimizing versions of */
+  OP_NOTMINSTAR,     /* 34 all these opcodes must come in pairs, with */
+  OP_NOTPLUS,        /* 35 the minimizing one second. */
+  OP_NOTMINPLUS,     /* 36 This set applies to "not" single characters */
+  OP_NOTQUERY,       /* 37 */
+  OP_NOTMINQUERY,    /* 38 */
+  OP_NOTUPTO,        /* 39 From 0 to n matches */
+  OP_NOTMINUPTO,     /* 40 */
+  OP_NOTEXACT,       /* 41 Exactly n matches */
+
+  OP_TYPESTAR,       /* 42 The maximizing and minimizing versions of */
+  OP_TYPEMINSTAR,    /* 43 all these opcodes must come in pairs, with */
+  OP_TYPEPLUS,       /* 44 the minimizing one second. These codes must */
+  OP_TYPEMINPLUS,    /* 45 be in exactly the same order as those above. */
+  OP_TYPEQUERY,      /* 46 This set applies to character types such as \d */
+  OP_TYPEMINQUERY,   /* 47 */
+  OP_TYPEUPTO,       /* 48 From 0 to n matches */
+  OP_TYPEMINUPTO,    /* 49 */
+  OP_TYPEEXACT,      /* 50 Exactly n matches */
+
+  OP_CRSTAR,         /* 51 The maximizing and minimizing versions of */
+  OP_CRMINSTAR,      /* 52 all these opcodes must come in pairs, with */
+  OP_CRPLUS,         /* 53 the minimizing one second. These codes must */
+  OP_CRMINPLUS,      /* 54 be in exactly the same order as those above. */
+  OP_CRQUERY,        /* 55 These are for character classes and back refs */
+  OP_CRMINQUERY,     /* 56 */
+  OP_CRRANGE,        /* 57 These are different to the three sets above. */
+  OP_CRMINRANGE,     /* 58 */
+
+  OP_CLASS,          /* 59 Match a character class, chars < 256 only */
+  OP_NCLASS,         /* 60 Same, but the bitmap was created from a negative
+                           class - the difference is relevant only when a UTF-8
+                           character > 255 is encountered. */
+
+  OP_XCLASS,         /* 61 Extended class for handling UTF-8 chars within the
+                           class. This does both positive and negative. */
+
+  OP_REF,            /* 62 Match a back reference */
+  OP_RECURSE,        /* 63 Match a numbered subpattern (possibly recursive) */
+  OP_CALLOUT,        /* 64 Call out to external function if provided */
+
+  OP_ALT,            /* 65 Start of alternation */
+  OP_KET,            /* 66 End of group that doesn't have an unbounded repeat */
+  OP_KETRMAX,        /* 67 These two must remain together and in this */
+  OP_KETRMIN,        /* 68 order. They are for groups the repeat for ever. */
+
+  /* The assertions must come before ONCE and COND */
+
+  OP_ASSERT,         /* 69 Positive lookahead */
+  OP_ASSERT_NOT,     /* 70 Negative lookahead */
+  OP_ASSERTBACK,     /* 71 Positive lookbehind */
+  OP_ASSERTBACK_NOT, /* 72 Negative lookbehind */
+  OP_REVERSE,        /* 73 Move pointer back - used in lookbehind assertions */
+
+  /* ONCE and COND must come after the assertions, with ONCE first, as there's
+  a test for >= ONCE for a subpattern that isn't an assertion. */
+
+  OP_ONCE,           /* 74 Once matched, don't back up into the subpattern */
+  OP_COND,           /* 75 Conditional group */
+  OP_CREF,           /* 76 Used to hold an extraction string number (cond ref) */
+
+  OP_BRAZERO,        /* 77 These two must remain together and in this */
+  OP_BRAMINZERO,     /* 78 order. */
+
+  OP_BRANUMBER,      /* 79 Used for extracting brackets whose number is greater
+                           than can fit into an opcode. */
+
+  OP_BRA             /* 80 This and greater values are used for brackets that
+                           extract substrings up to EXTRACT_BASIC_MAX. After
+                           that, use is made of OP_BRANUMBER. */
+};
+
+/* WARNING WARNING WARNING: There is an implicit assumption in pcre.c and
+study.c that all opcodes are less than 128 in value. This makes handling UTF-8
+character sequences easier. */
+
+/* The highest extraction number before we have to start using additional
+bytes. (Originally PCRE didn't have support for extraction counts highter than
+this number.) The value is limited by the number of opcodes left after OP_BRA,
+i.e. 255 - OP_BRA. We actually set it a bit lower to leave room for additional
+opcodes. */
+
+#define EXTRACT_BASIC_MAX  100
+
+
+/* This macro defines textual names for all the opcodes. These are used only
+for debugging. The macro is referenced only in pcre_printint.c. */
+
+#define OP_NAME_LIST \
+  "End", "\\A", "\\G", "\\B", "\\b", "\\D", "\\d",                \
+  "\\S", "\\s", "\\W", "\\w", "Any", "Anybyte",                   \
+  "notprop", "prop", "extuni",                                    \
+  "\\Z", "\\z",                                                   \
+  "Opt", "^", "$", "char", "charnc", "not",                       \
+  "*", "*?", "+", "+?", "?", "??", "{", "{", "{",                 \
+  "*", "*?", "+", "+?", "?", "??", "{", "{", "{",                 \
+  "*", "*?", "+", "+?", "?", "??", "{", "{", "{",                 \
+  "*", "*?", "+", "+?", "?", "??", "{", "{",                      \
+  "class", "nclass", "xclass", "Ref", "Recurse", "Callout",       \
+  "Alt", "Ket", "KetRmax", "KetRmin", "Assert", "Assert not",     \
+  "AssertB", "AssertB not", "Reverse", "Once", "Cond", "Cond ref",\
+  "Brazero", "Braminzero", "Branumber", "Bra"
+
+
+/* This macro defines the length of fixed length operations in the compiled
+regex. The lengths are used when searching for specific things, and also in the
+debugging printing of a compiled regex. We use a macro so that it can be
+defined close to the definitions of the opcodes themselves.
+
+As things have been extended, some of these are no longer fixed lenths, but are
+minima instead. For example, the length of a single-character repeat may vary
+in UTF-8 mode. The code that uses this table must know about such things. */
+
+#define OP_LENGTHS \
+  1,                             /* End                                    */ \
+  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* \A, \G, \B, \B, \D, \d, \S, \s, \W, \w */ \
+  1, 1,                          /* Any, Anybyte                           */ \
+  2, 2, 1,                       /* NOTPROP, PROP, EXTUNI                  */ \
+  1, 1, 2, 1, 1,                 /* \Z, \z, Opt, ^, $                      */ \
+  2,                             /* Char  - the minimum length             */ \
+  2,                             /* Charnc  - the minimum length           */ \
+  2,                             /* not                                    */ \
+  /* Positive single-char repeats                            ** These are  */ \
+  2, 2, 2, 2, 2, 2,              /* *, *?, +, +?, ?, ??      ** minima in  */ \
+  4, 4, 4,                       /* upto, minupto, exact     ** UTF-8 mode */ \
+  /* Negative single-char repeats - only for chars < 256                   */ \
+  2, 2, 2, 2, 2, 2,              /* NOT *, *?, +, +?, ?, ??                */ \
+  4, 4, 4,                       /* NOT upto, minupto, exact               */ \
+  /* Positive type repeats                                                 */ \
+  2, 2, 2, 2, 2, 2,              /* Type *, *?, +, +?, ?, ??               */ \
+  4, 4, 4,                       /* Type upto, minupto, exact              */ \
+  /* Character class & ref repeats                                         */ \
+  1, 1, 1, 1, 1, 1,              /* *, *?, +, +?, ?, ??                    */ \
+  5, 5,                          /* CRRANGE, CRMINRANGE                    */ \
+ 33,                             /* CLASS                                  */ \
+ 33,                             /* NCLASS                                 */ \
+  0,                             /* XCLASS - variable length               */ \
+  3,                             /* REF                                    */ \
+  1+LINK_SIZE,                   /* RECURSE                                */ \
+  2+2*LINK_SIZE,                 /* CALLOUT                                */ \
+  1+LINK_SIZE,                   /* Alt                                    */ \
+  1+LINK_SIZE,                   /* Ket                                    */ \
+  1+LINK_SIZE,                   /* KetRmax                                */ \
+  1+LINK_SIZE,                   /* KetRmin                                */ \
+  1+LINK_SIZE,                   /* Assert                                 */ \
+  1+LINK_SIZE,                   /* Assert not                             */ \
+  1+LINK_SIZE,                   /* Assert behind                          */ \
+  1+LINK_SIZE,                   /* Assert behind not                      */ \
+  1+LINK_SIZE,                   /* Reverse                                */ \
+  1+LINK_SIZE,                   /* Once                                   */ \
+  1+LINK_SIZE,                   /* COND                                   */ \
+  3,                             /* CREF                                   */ \
+  1, 1,                          /* BRAZERO, BRAMINZERO                    */ \
+  3,                             /* BRANUMBER                              */ \
+  1+LINK_SIZE                    /* BRA                                    */ \
+
+
+/* A magic value for OP_CREF to indicate the "in recursion" condition. */
+
+#define CREF_RECURSE  0xffff
+
+/* Error code numbers. They are given names so that they can more easily be
+tracked. */
+
+enum { ERR0,  ERR1,  ERR2,  ERR3,  ERR4,  ERR5,  ERR6,  ERR7,  ERR8,  ERR9,
+       ERR10, ERR11, ERR12, ERR13, ERR14, ERR15, ERR16, ERR17, ERR18, ERR19,
+       ERR20, ERR21, ERR22, ERR23, ERR24, ERR25, ERR26, ERR27, ERR28, ERR29,
+       ERR30, ERR31, ERR32, ERR33, ERR34, ERR35, ERR36, ERR37, ERR38, ERR39,
+       ERR40, ERR41, ERR42, ERR43, ERR44, ERR45, ERR46, ERR47 };
+
+/* The real format of the start of the pcre block; the index of names and the
+code vector run on as long as necessary after the end. We store an explicit
+offset to the name table so that if a regex is compiled on one host, saved, and
+then run on another where the size of pointers is different, all might still
+be well. For the case of compiled-on-4 and run-on-8, we include an extra
+pointer that is always NULL. For future-proofing, a few dummy fields were
+originally included - even though you can never get this planning right - but
+there is only one left now.
+
+NOTE NOTE NOTE:
+Because people can now save and re-use compiled patterns, any additions to this
+structure should be made at the end, and something earlier (e.g. a new
+flag in the options or one of the dummy fields) should indicate that the new
+fields are present. Currently PCRE always sets the dummy fields to zero.
+NOTE NOTE NOTE:
+*/
+
+typedef struct real_pcre {
+  pcre_uint32 magic_number;
+  pcre_uint32 size;               /* Total that was malloced */
+  pcre_uint32 options;
+  pcre_uint32 dummy1;             /* For future use, maybe */
+
+  pcre_uint16 top_bracket;
+  pcre_uint16 top_backref;
+  pcre_uint16 first_byte;
+  pcre_uint16 req_byte;
+  pcre_uint16 name_table_offset;  /* Offset to name table that follows */
+  pcre_uint16 name_entry_size;    /* Size of any name items */
+  pcre_uint16 name_count;         /* Number of name items */
+  pcre_uint16 ref_count;          /* Reference count */
+
+  const unsigned char *tables;    /* Pointer to tables or NULL for std */
+  const unsigned char *nullpad;   /* NULL padding */
+} real_pcre;
+
+/* The format of the block used to store data from pcre_study(). The same
+remark (see NOTE above) about extending this structure applies. */
+
+typedef struct pcre_study_data {
+  pcre_uint32 size;               /* Total that was malloced */
+  pcre_uint32 options;
+  uschar start_bits[32];
+} pcre_study_data;
+
+/* Structure for passing "static" information around between the functions
+doing the compiling, so that they are thread-safe. */
+
+typedef struct compile_data {
+  const uschar *lcc;            /* Points to lower casing table */
+  const uschar *fcc;            /* Points to case-flipping table */
+  const uschar *cbits;          /* Points to character type table */
+  const uschar *ctypes;         /* Points to table of type maps */
+  const uschar *start_code;     /* The start of the compiled code */
+  const uschar *start_pattern;  /* The start of the pattern */
+  uschar *name_table;           /* The name/number table */
+  int  names_found;             /* Number of entries so far */
+  int  name_entry_size;         /* Size of each entry */
+  int  top_backref;             /* Maximum back reference */
+  unsigned int backref_map;     /* Bitmap of low back refs */
+  int  req_varyopt;             /* "After variable item" flag for reqbyte */
+  BOOL nopartial;               /* Set TRUE if partial won't work */
+} compile_data;
+
+/* Structure for maintaining a chain of pointers to the currently incomplete
+branches, for testing for left recursion. */
+
+typedef struct branch_chain {
+  struct branch_chain *outer;
+  uschar *current;
+} branch_chain;
+
+/* Structure for items in a linked list that represents an explicit recursive
+call within the pattern. */
+
+typedef struct recursion_info {
+  struct recursion_info *prevrec; /* Previous recursion record (or NULL) */
+  int group_num;                /* Number of group that was called */
+  const uschar *after_call;     /* "Return value": points after the call in the expr */
+  const uschar *save_start;     /* Old value of md->start_match */
+  int *offset_save;             /* Pointer to start of saved offsets */
+  int saved_max;                /* Number of saved offsets */
+} recursion_info;
+
+/* When compiling in a mode that doesn't use recursive calls to match(),
+a structure is used to remember local variables on the heap. It is defined in
+pcre.c, close to the match() function, so that it is easy to keep it in step
+with any changes of local variable. However, the pointer to the current frame
+must be saved in some "static" place over a longjmp(). We declare the
+structure here so that we can put a pointer in the match_data structure.
+NOTE: This isn't used for a "normal" compilation of pcre. */
+
+struct heapframe;
+
+/* Structure for passing "static" information around between the functions
+doing traditional NFA matching, so that they are thread-safe. */
+
+typedef struct match_data {
+  unsigned long int match_call_count; /* As it says */
+  unsigned long int match_limit;/* As it says */
+  int   *offset_vector;         /* Offset vector */
+  int    offset_end;            /* One past the end */
+  int    offset_max;            /* The maximum usable for return data */
+  const uschar *lcc;            /* Points to lower casing table */
+  const uschar *ctypes;         /* Points to table of type maps */
+  BOOL   offset_overflow;       /* Set if too many extractions */
+  BOOL   notbol;                /* NOTBOL flag */
+  BOOL   noteol;                /* NOTEOL flag */
+  BOOL   utf8;                  /* UTF8 flag */
+  BOOL   endonly;               /* Dollar not before final \n */
+  BOOL   notempty;              /* Empty string match not wanted */
+  BOOL   partial;               /* PARTIAL flag */
+  BOOL   hitend;                /* Hit the end of the subject at some point */
+  const uschar *start_code;     /* For use when recursing */
+  const uschar *start_subject;  /* Start of the subject string */
+  const uschar *end_subject;    /* End of the subject string */
+  const uschar *start_match;    /* Start of this match attempt */
+  const uschar *end_match_ptr;  /* Subject position at end match */
+  int    end_offset_top;        /* Highwater mark at end of match */
+  int    capture_last;          /* Most recent capture number */
+  int    start_offset;          /* The start offset value */
+  recursion_info *recursive;    /* Linked list of recursion data */
+  void  *callout_data;          /* To pass back to callouts */
+  struct heapframe *thisframe;  /* Used only when compiling for no recursion */
+} match_data;
+
+/* A similar structure is used for the same purpose by the DFA matching
+functions. */
+
+typedef struct dfa_match_data {
+  const uschar *start_code;     /* Start of the compiled pattern */
+  const uschar *start_subject;  /* Start of the subject string */
+  const uschar *end_subject;    /* End of subject string */
+  const uschar *tables;         /* Character tables */
+  int   moptions;               /* Match options */
+  int   poptions;               /* Pattern options */
+  void  *callout_data;          /* To pass back to callouts */
+} dfa_match_data;
+
+/* Bit definitions for entries in the pcre_ctypes table. */
+
+#define ctype_space   0x01
+#define ctype_letter  0x02
+#define ctype_digit   0x04
+#define ctype_xdigit  0x08
+#define ctype_word    0x10   /* alphameric or '_' */
+#define ctype_meta    0x80   /* regexp meta char or zero (end pattern) */
+
+/* Offsets for the bitmap tables in pcre_cbits. Each table contains a set
+of bits for a class map. Some classes are built by combining these tables. */
+
+#define cbit_space     0      /* [:space:] or \s */
+#define cbit_xdigit   32      /* [:xdigit:] */
+#define cbit_digit    64      /* [:digit:] or \d */
+#define cbit_upper    96      /* [:upper:] */
+#define cbit_lower   128      /* [:lower:] */
+#define cbit_word    160      /* [:word:] or \w */
+#define cbit_graph   192      /* [:graph:] */
+#define cbit_print   224      /* [:print:] */
+#define cbit_punct   256      /* [:punct:] */
+#define cbit_cntrl   288      /* [:cntrl:] */
+#define cbit_length  320      /* Length of the cbits table */
+
+/* Offsets of the various tables from the base tables pointer, and
+total length. */
+
+#define lcc_offset      0
+#define fcc_offset    256
+#define cbits_offset  512
+#define ctypes_offset (cbits_offset + cbit_length)
+#define tables_length (ctypes_offset + 256)
+
+/* Layout of the UCP type table that translates property names into codes for
+ucp_findchar(). */
+
+typedef struct {
+  const char *name;
+  int value;
+} ucp_type_table;
+
+
+/* Internal shared data tables. These are tables that are used by more than one
+of the exported public functions. They have to be "external" in the C sense,
+but are not part of the PCRE public API. The data for these tables is in the
+pcre_tables.c module. */
+
+extern const int    _pcre_utf8_table1[];
+extern const int    _pcre_utf8_table2[];
+extern const int    _pcre_utf8_table3[];
+extern const uschar _pcre_utf8_table4[];
+
+extern const int    _pcre_utf8_table1_size;
+
+extern const ucp_type_table _pcre_utt[];
+extern const int _pcre_utt_size;
+
+extern const uschar _pcre_default_tables[];
+
+extern const uschar _pcre_OP_lengths[];
+
+
+/* Internal shared functions. These are functions that are used by more than
+one of the exported public functions. They have to be "external" in the C
+sense, but are not part of the PCRE public API. */
+
+extern int         _pcre_ord2utf8(int, uschar *);
+extern void        _pcre_printint(pcre *, FILE *);
+extern real_pcre * _pcre_try_flipped(const real_pcre *, real_pcre *,
+                     const pcre_study_data *, pcre_study_data *);
+extern int         _pcre_ucp_findchar(const int, int *, int *);
+extern int         _pcre_valid_utf8(const uschar *, int);
+extern BOOL        _pcre_xclass(int, const uschar *);
+
+/* End of pcre_internal.h */
similarity index 89%
rename from ext/pcre/pcrelib/maketables.c
rename to ext/pcre/pcrelib/pcre_maketables.c
index f1c7b9a5c46ebdc27d96cffa02777a506a5a7bba..c4954b2648170735d1efa99b32344e7baab3488f 100644 (file)
@@ -2,13 +2,11 @@
 *      Perl-Compatible Regular Expressions       *
 *************************************************/
 
-/*
-PCRE is a library of functions to support regular expressions whose syntax
+/* PCRE is a library of functions to support regular expressions whose syntax
 and semantics are as close as possible to those of the Perl 5 language.
 
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
-           Copyright (c) 1997-2003 University of Cambridge
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -40,16 +38,17 @@ POSSIBILITY OF SUCH DAMAGE.
 */
 
 
-/* This file is compiled on its own as part of the PCRE library. However,
-it is also included in the compilation of dftables.c, in which case the macro
-DFTABLES is defined. */
+/* This module contains the external function pcre_maketables(), which builds
+character tables for PCRE in the current locale. The file is compiled on its
+own as part of the PCRE library. However, it is also included in the
+compilation of dftables.c, in which case the macro DFTABLES is defined. */
+
 
 #ifndef DFTABLES
-#include "internal.h"
+#include "pcre_internal.h"
 #endif
 
 
-
 /*************************************************
 *           Create PCRE character tables         *
 *************************************************/
@@ -143,4 +142,4 @@ for (i = 0; i < 256; i++)
 return yield;
 }
 
-/* End of maketables.c */
+/* End of pcre_maketables.c */
diff --git a/ext/pcre/pcrelib/pcre_ord2utf8.c b/ext/pcre/pcrelib/pcre_ord2utf8.c
new file mode 100644 (file)
index 0000000..f6a06fc
--- /dev/null
@@ -0,0 +1,78 @@
+/*************************************************
+*      Perl-Compatible Regular Expressions       *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+
+/* This file contains a private PCRE function that converts an ordinal
+character value into a UTF8 string. */
+
+
+#include "pcre_internal.h"
+
+
+/*************************************************
+*       Convert character value to UTF-8         *
+*************************************************/
+
+/* This function takes an integer value in the range 0 - 0x7fffffff
+and encodes it as a UTF-8 character in 0 to 6 bytes.
+
+Arguments:
+  cvalue     the character value
+  buffer     pointer to buffer for result - at least 6 bytes long
+
+Returns:     number of characters placed in the buffer
+*/
+
+EXPORT int
+_pcre_ord2utf8(int cvalue, uschar *buffer)
+{
+register int i, j;
+for (i = 0; i < _pcre_utf8_table1_size; i++)
+  if (cvalue <= _pcre_utf8_table1[i]) break;
+buffer += i;
+for (j = i; j > 0; j--)
+ {
+ *buffer-- = 0x80 | (cvalue & 0x3f);
+ cvalue >>= 6;
+ }
+*buffer = _pcre_utf8_table2[i] | cvalue;
+return i + 1;
+}
+
+/* End of pcre_ord2utf8.c */
diff --git a/ext/pcre/pcrelib/pcre_printint.c b/ext/pcre/pcrelib/pcre_printint.c
new file mode 100644 (file)
index 0000000..d18f399
--- /dev/null
@@ -0,0 +1,451 @@
+/*************************************************
+*      Perl-Compatible Regular Expressions       *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+
+/* This module contains an PCRE private debugging function for printing out the
+internal form of a compiled regular expression, along with some supporting
+local functions. */
+
+
+#include "pcre_internal.h"
+
+
+static const char *OP_names[] = { OP_NAME_LIST };
+
+
+/*************************************************
+*       Print single- or multi-byte character    *
+*************************************************/
+
+static int
+print_char(FILE *f, uschar *ptr, BOOL utf8)
+{
+int c = *ptr;
+
+if (!utf8 || (c & 0xc0) != 0xc0)
+  {
+  if (isprint(c)) fprintf(f, "%c", c); else fprintf(f, "\\x%02x", c);
+  return 0;
+  }
+else
+  {
+  int i;
+  int a = _pcre_utf8_table4[c & 0x3f];  /* Number of additional bytes */
+  int s = 6*a;
+  c = (c & _pcre_utf8_table3[a]) << s;
+  for (i = 1; i <= a; i++)
+    {
+    /* This is a check for malformed UTF-8; it should only occur if the sanity
+    check has been turned off. Rather than swallow random bytes, just stop if
+    we hit a bad one. Print it with \X instead of \x as an indication. */
+
+    if ((ptr[i] & 0xc0) != 0x80)
+      {
+      fprintf(f, "\\X{%x}", c);
+      return i - 1;
+      }
+
+    /* The byte is OK */
+
+    s -= 6;
+    c |= (ptr[i] & 0x3f) << s;
+    }
+  if (c < 128) fprintf(f, "\\x%02x", c); else fprintf(f, "\\x{%x}", c);
+  return a;
+  }
+}
+
+
+
+/*************************************************
+*          Find Unicode property name            *
+*************************************************/
+
+static const char *
+get_ucpname(int property)
+{
+#ifdef SUPPORT_UCP
+int i;
+for (i = _pcre_utt_size; i >= 0; i--)
+  {
+  if (property == _pcre_utt[i].value) break;
+  }
+return (i >= 0)? _pcre_utt[i].name : "??";
+#else
+return "??";
+#endif
+}
+
+
+
+/*************************************************
+*         Print compiled regex                   *
+*************************************************/
+
+/* Make this function work for a regex with integers either byte order.
+However, we assume that what we are passed is a compiled regex. */
+
+EXPORT void
+_pcre_printint(pcre *external_re, FILE *f)
+{
+real_pcre *re = (real_pcre *)external_re;
+uschar *codestart, *code;
+BOOL utf8;
+
+unsigned int options = re->options;
+int offset = re->name_table_offset;
+int count = re->name_count;
+int size = re->name_entry_size;
+
+if (re->magic_number != MAGIC_NUMBER)
+  {
+  offset = ((offset << 8) & 0xff00) | ((offset >> 8) & 0xff);
+  count = ((count << 8) & 0xff00) | ((count >> 8) & 0xff);
+  size = ((size << 8) & 0xff00) | ((size >> 8) & 0xff);
+  options = ((options << 24) & 0xff000000) |
+            ((options <<  8) & 0x00ff0000) |
+            ((options >>  8) & 0x0000ff00) |
+            ((options >> 24) & 0x000000ff);
+  }
+
+code = codestart = (uschar *)re + offset + count * size;
+utf8 = (options & PCRE_UTF8) != 0;
+
+for(;;)
+  {
+  uschar *ccode;
+  int c;
+  int extra = 0;
+
+  fprintf(f, "%3d ", (int)(code - codestart));
+
+  if (*code >= OP_BRA)
+    {
+    if (*code - OP_BRA > EXTRACT_BASIC_MAX)
+      fprintf(f, "%3d Bra extra\n", GET(code, 1));
+    else
+      fprintf(f, "%3d Bra %d\n", GET(code, 1), *code - OP_BRA);
+    code += _pcre_OP_lengths[OP_BRA];
+    continue;
+    }
+
+  switch(*code)
+    {
+    case OP_END:
+    fprintf(f, "    %s\n", OP_names[*code]);
+    fprintf(f, "------------------------------------------------------------------\n");
+    return;
+
+    case OP_OPT:
+    fprintf(f, " %.2x %s", code[1], OP_names[*code]);
+    break;
+
+    case OP_CHAR:
+      {
+      fprintf(f, "    ");
+      do
+        {
+        code++;
+        code += 1 + print_char(f, code, utf8);
+        }
+      while (*code == OP_CHAR);
+      fprintf(f, "\n");
+      continue;
+      }
+    break;
+
+    case OP_CHARNC:
+      {
+      fprintf(f, " NC ");
+      do
+        {
+        code++;
+        code += 1 + print_char(f, code, utf8);
+        }
+      while (*code == OP_CHARNC);
+      fprintf(f, "\n");
+      continue;
+      }
+    break;
+
+    case OP_KETRMAX:
+    case OP_KETRMIN:
+    case OP_ALT:
+    case OP_KET:
+    case OP_ASSERT:
+    case OP_ASSERT_NOT:
+    case OP_ASSERTBACK:
+    case OP_ASSERTBACK_NOT:
+    case OP_ONCE:
+    case OP_COND:
+    case OP_REVERSE:
+    fprintf(f, "%3d %s", GET(code, 1), OP_names[*code]);
+    break;
+
+    case OP_BRANUMBER:
+    printf("%3d %s", GET2(code, 1), OP_names[*code]);
+    break;
+
+    case OP_CREF:
+    if (GET2(code, 1) == CREF_RECURSE)
+      fprintf(f, "    Cond recurse");
+    else
+      fprintf(f, "%3d %s", GET2(code,1), OP_names[*code]);
+    break;
+
+    case OP_STAR:
+    case OP_MINSTAR:
+    case OP_PLUS:
+    case OP_MINPLUS:
+    case OP_QUERY:
+    case OP_MINQUERY:
+    case OP_TYPESTAR:
+    case OP_TYPEMINSTAR:
+    case OP_TYPEPLUS:
+    case OP_TYPEMINPLUS:
+    case OP_TYPEQUERY:
+    case OP_TYPEMINQUERY:
+    fprintf(f, "    ");
+    if (*code >= OP_TYPESTAR)
+      {
+      fprintf(f, "%s", OP_names[code[1]]);
+      if (code[1] == OP_PROP || code[1] == OP_NOTPROP)
+        {
+        fprintf(f, " %s ", get_ucpname(code[2]));
+        extra = 1;
+        }
+      }
+    else extra = print_char(f, code+1, utf8);
+    fprintf(f, "%s", OP_names[*code]);
+    break;
+
+    case OP_EXACT:
+    case OP_UPTO:
+    case OP_MINUPTO:
+    fprintf(f, "    ");
+    extra = print_char(f, code+3, utf8);
+    fprintf(f, "{");
+    if (*code != OP_EXACT) fprintf(f, ",");
+    fprintf(f, "%d}", GET2(code,1));
+    if (*code == OP_MINUPTO) fprintf(f, "?");
+    break;
+
+    case OP_TYPEEXACT:
+    case OP_TYPEUPTO:
+    case OP_TYPEMINUPTO:
+    fprintf(f, "    %s", OP_names[code[3]]);
+    if (code[3] == OP_PROP || code[3] == OP_NOTPROP)
+      {
+      fprintf(f, " %s ", get_ucpname(code[4]));
+      extra = 1;
+      }
+    fprintf(f, "{");
+    if (*code != OP_TYPEEXACT) fprintf(f, "0,");
+    fprintf(f, "%d}", GET2(code,1));
+    if (*code == OP_TYPEMINUPTO) fprintf(f, "?");
+    break;
+
+    case OP_NOT:
+    if (isprint(c = code[1])) fprintf(f, "    [^%c]", c);
+      else fprintf(f, "    [^\\x%02x]", c);
+    break;
+
+    case OP_NOTSTAR:
+    case OP_NOTMINSTAR:
+    case OP_NOTPLUS:
+    case OP_NOTMINPLUS:
+    case OP_NOTQUERY:
+    case OP_NOTMINQUERY:
+    if (isprint(c = code[1])) fprintf(f, "    [^%c]", c);
+      else fprintf(f, "    [^\\x%02x]", c);
+    fprintf(f, "%s", OP_names[*code]);
+    break;
+
+    case OP_NOTEXACT:
+    case OP_NOTUPTO:
+    case OP_NOTMINUPTO:
+    if (isprint(c = code[3])) fprintf(f, "    [^%c]{", c);
+      else fprintf(f, "    [^\\x%02x]{", c);
+    if (*code != OP_NOTEXACT) fprintf(f, "0,");
+    fprintf(f, "%d}", GET2(code,1));
+    if (*code == OP_NOTMINUPTO) fprintf(f, "?");
+    break;
+
+    case OP_RECURSE:
+    fprintf(f, "%3d %s", GET(code, 1), OP_names[*code]);
+    break;
+
+    case OP_REF:
+    fprintf(f, "    \\%d", GET2(code,1));
+    ccode = code + _pcre_OP_lengths[*code];
+    goto CLASS_REF_REPEAT;
+
+    case OP_CALLOUT:
+    fprintf(f, "    %s %d %d %d", OP_names[*code], code[1], GET(code,2),
+      GET(code, 2 + LINK_SIZE));
+    break;
+
+    case OP_PROP:
+    case OP_NOTPROP:
+    fprintf(f, "    %s %s", OP_names[*code], get_ucpname(code[1]));
+    break;
+
+    /* OP_XCLASS can only occur in UTF-8 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:
+    case OP_XCLASS:
+      {
+      int i, min, max;
+      BOOL printmap;
+
+      fprintf(f, "    [");
+
+      if (*code == OP_XCLASS)
+        {
+        extra = GET(code, 1);
+        ccode = code + LINK_SIZE + 1;
+        printmap = (*ccode & XCL_MAP) != 0;
+        if ((*ccode++ & XCL_NOT) != 0) fprintf(f, "^");
+        }
+      else
+        {
+        printmap = TRUE;
+        ccode = code + 1;
+        }
+
+      /* Print a bit map */
+
+      if (printmap)
+        {
+        for (i = 0; i < 256; i++)
+          {
+          if ((ccode[i/8] & (1 << (i&7))) != 0)
+            {
+            int j;
+            for (j = i+1; j < 256; j++)
+              if ((ccode[j/8] & (1 << (j&7))) == 0) break;
+            if (i == '-' || i == ']') fprintf(f, "\\");
+            if (isprint(i)) fprintf(f, "%c", i); else fprintf(f, "\\x%02x", i);
+            if (--j > i)
+              {
+              if (j != i + 1) fprintf(f, "-");
+              if (j == '-' || j == ']') fprintf(f, "\\");
+              if (isprint(j)) fprintf(f, "%c", j); else fprintf(f, "\\x%02x", j);
+              }
+            i = j;
+            }
+          }
+        ccode += 32;
+        }
+
+      /* For an XCLASS there is always some additional data */
+
+      if (*code == OP_XCLASS)
+        {
+        int ch;
+        while ((ch = *ccode++) != XCL_END)
+          {
+          if (ch == XCL_PROP)
+            {
+            fprintf(f, "\\p{%s}", get_ucpname(*ccode++));
+            }
+          else if (ch == XCL_NOTPROP)
+            {
+            fprintf(f, "\\P{%s}", get_ucpname(*ccode++));
+            }
+          else
+            {
+            ccode += 1 + print_char(f, ccode, TRUE);
+            if (ch == XCL_RANGE)
+              {
+              fprintf(f, "-");
+              ccode += 1 + print_char(f, ccode, TRUE);
+              }
+            }
+          }
+        }
+
+      /* Indicate a non-UTF8 class which was created by negation */
+
+      fprintf(f, "]%s", (*code == OP_NCLASS)? " (neg)" : "");
+
+      /* Handle repeats after a class or a back reference */
+
+      CLASS_REF_REPEAT:
+      switch(*ccode)
+        {
+        case OP_CRSTAR:
+        case OP_CRMINSTAR:
+        case OP_CRPLUS:
+        case OP_CRMINPLUS:
+        case OP_CRQUERY:
+        case OP_CRMINQUERY:
+        fprintf(f, "%s", OP_names[*ccode]);
+        extra += _pcre_OP_lengths[*ccode];
+        break;
+
+        case OP_CRRANGE:
+        case OP_CRMINRANGE:
+        min = GET2(ccode,1);
+        max = GET2(ccode,3);
+        if (max == 0) fprintf(f, "{%d,}", min);
+        else fprintf(f, "{%d,%d}", min, max);
+        if (*ccode == OP_CRMINRANGE) fprintf(f, "?");
+        extra += _pcre_OP_lengths[*ccode];
+        break;
+        }
+      }
+    break;
+
+    /* Anything else is just an item with no data*/
+
+    default:
+    fprintf(f, "    %s", OP_names[*code]);
+    break;
+    }
+
+  code += _pcre_OP_lengths[*code] + extra;
+  fprintf(f, "\n");
+  }
+}
+
+/* End of pcre_printint.c */
diff --git a/ext/pcre/pcrelib/pcre_refcount.c b/ext/pcre/pcrelib/pcre_refcount.c
new file mode 100644 (file)
index 0000000..35a7ee8
--- /dev/null
@@ -0,0 +1,77 @@
+/*************************************************
+*      Perl-Compatible Regular Expressions       *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+
+/* This module contains the external function pcre_refcount(), which is an
+auxiliary function that can be used to maintain a reference count in a compiled
+pattern data block. This might be helpful in applications where the block is
+shared by different users. */
+
+#include "pcre_internal.h"
+
+
+/*************************************************
+*           Maintain reference count             *
+*************************************************/
+
+/* The reference count is a 16-bit field, initialized to zero. It is not
+possible to transfer a non-zero count from one host to a different host that
+has a different byte order - though I can't see why anyone in their right mind
+would ever want to do that!
+
+Arguments:
+  argument_re   points to compiled code
+  adjust        value to add to the count
+
+Returns:        the (possibly updated) count value (a non-negative number), or
+                a negative error number
+*/
+
+EXPORT int
+pcre_refcount(pcre *argument_re, int adjust)
+{
+real_pcre *re = (real_pcre *)argument_re;
+if (re == NULL) return PCRE_ERROR_NULL;
+re->ref_count = (-adjust > re->ref_count)? 0 :
+                (adjust + re->ref_count > 65535)? 65535 :
+                re->ref_count + adjust;
+return re->ref_count;
+}
+
+/* End of pcre_refcount.c */
diff --git a/ext/pcre/pcrelib/pcre_scanner.cc b/ext/pcre/pcrelib/pcre_scanner.cc
new file mode 100644 (file)
index 0000000..4a66fdf
--- /dev/null
@@ -0,0 +1,169 @@
+// Copyright (c) 2005, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Sanjay Ghemawat
+
+#include <vector>
+#include <algorithm>     // for count()
+#include <assert.h>
+#include "config.h"
+#include "pcre_scanner.h"
+
+using std::vector;
+
+namespace pcrecpp {
+
+Scanner::Scanner()
+  : data_(),
+    input_(data_),
+    skip_(NULL),
+    should_skip_(false),
+    save_comments_(false),
+    comments_(NULL),
+    comments_offset_(0) {
+}
+
+Scanner::Scanner(const string& in)
+  : data_(in),
+    input_(data_),
+    skip_(NULL),
+    should_skip_(false),
+    save_comments_(false),
+    comments_(NULL),
+    comments_offset_(0) {
+}
+
+Scanner::~Scanner() {
+  delete skip_;
+  delete comments_;
+}
+
+void Scanner::Skip(const char* re) {
+  delete skip_;
+  if (re != NULL) {
+    skip_ = new RE(re);
+    should_skip_ = true;
+    ConsumeSkip();
+  } else {
+    skip_ = NULL;
+    should_skip_ = false;
+  }
+}
+
+void Scanner::DisableSkip() {
+  assert(skip_ != NULL);
+  should_skip_ = false;
+}
+
+void Scanner::EnableSkip() {
+  assert(skip_ != NULL);
+  should_skip_ = true;
+  ConsumeSkip();
+}
+
+int Scanner::LineNumber() const {
+  // TODO: Make it more efficient by keeping track of the last point
+  // where we computed line numbers and counting newlines since then.
+  return 1 + std::count(data_.data(), input_.data(), '\n');
+}
+
+int Scanner::Offset() const {
+  return input_.data() - data_.c_str();
+}
+
+bool Scanner::LookingAt(const RE& re) const {
+  int consumed;
+  return re.DoMatch(input_, RE::ANCHOR_START, &consumed, 0, 0);
+}
+
+
+bool Scanner::Consume(const RE& re,
+                      const Arg& arg0,
+                      const Arg& arg1,
+                      const Arg& arg2) {
+  const bool result = re.Consume(&input_, arg0, arg1, arg2);
+  if (result && should_skip_) ConsumeSkip();
+  return result;
+}
+
+// helper function to consume *skip_ and honour save_comments_
+void Scanner::ConsumeSkip() {
+  if (save_comments_) {
+    if (NULL == comments_) {
+      comments_ = new vector<StringPiece>;
+    }
+    const char *start_data = input_.data();
+    skip_->Consume(&input_);
+    // already pointing one past end, so no need to +1
+    int length = input_.data() - start_data;
+    if (length > 0) {
+      comments_->push_back(StringPiece(start_data, length));
+    }
+  } else {
+    skip_->Consume(&input_);
+  }
+}
+
+
+void Scanner::GetComments(int start, int end, vector<StringPiece> *ranges) {
+  // short circuit out if we've not yet initialized comments_
+  // (e.g., when save_comments is false)
+  if (!comments_) {
+    return;
+  }
+  // TODO: if we guarantee that comments_ will contain StringPieces
+  // that are ordered by their start, then we can do a binary search
+  // for the first StringPiece at or past start and then scan for the
+  // ones contained in the range, quit early (use equal_range or
+  // lower_bound)
+  for (vector<StringPiece>::const_iterator it = comments_->begin();
+       it != comments_->end(); ++it) {
+    if ((it->data() >= data_.c_str() + start &&
+         it->data() + it->size() <= data_.c_str() + end)) {
+      ranges->push_back(*it);
+    }
+  }
+}
+
+
+void Scanner::GetNextComments(vector<StringPiece> *ranges) {
+  // short circuit out if we've not yet initialized comments_
+  // (e.g., when save_comments is false)
+  if (!comments_) {
+    return;
+  }
+  for (vector<StringPiece>::const_iterator it =
+         comments_->begin() + comments_offset_;
+       it != comments_->end(); ++it) {
+    ranges->push_back(*it);
+    ++comments_offset_;
+  }
+}
+
+}   // namespace pcrecpp
diff --git a/ext/pcre/pcrelib/pcre_scanner.h b/ext/pcre/pcrelib/pcre_scanner.h
new file mode 100644 (file)
index 0000000..a73b72f
--- /dev/null
@@ -0,0 +1,163 @@
+// Copyright (c) 2005, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Sanjay Ghemawat
+//
+// Regular-expression based scanner for parsing an input stream.
+//
+// Example 1: parse a sequence of "var = number" entries from input:
+//
+//      Scanner scanner(input);
+//      string var;
+//      int number;
+//      scanner.Skip("\\s+");           // Skip any white space we encounter
+//      while (scanner.Consume("(\\w+) = (\\d+)", &var, &number)) {
+//        ...;
+//      }
+
+#ifndef _PCRE_SCANNER_H
+#define _PCRE_SCANNER_H
+
+#include <assert.h>
+#include <string>
+#include <vector>
+#include <pcrecpp.h>
+#include <pcre_stringpiece.h>
+
+namespace pcrecpp {
+
+class Scanner {
+ public:
+  Scanner();
+  explicit Scanner(const std::string& input);
+  ~Scanner();
+
+  // Return current line number.  The returned line-number is
+  // one-based.  I.e. it returns 1 + the number of consumed newlines.
+  //
+  // Note: this method may be slow.  It may take time proportional to
+  // the size of the input.
+  int LineNumber() const;
+
+  // Return the byte-offset that the scanner is looking in the
+  // input data;
+  int Offset() const;
+
+  // Return true iff the start of the remaining input matches "re"
+  bool LookingAt(const RE& re) const;
+
+  // Return true iff all of the following are true
+  //    a. the start of the remaining input matches "re",
+  //    b. if any arguments are supplied, matched sub-patterns can be
+  //       parsed and stored into the arguments.
+  // If it returns true, it skips over the matched input and any
+  // following input that matches the "skip" regular expression.
+  bool Consume(const RE& re,
+               const Arg& arg0 = no_arg,
+               const Arg& arg1 = no_arg,
+               const Arg& arg2 = no_arg
+               // TODO: Allow more arguments?
+               );
+
+  // Set the "skip" regular expression.  If after consuming some data,
+  // a prefix of the input matches this RE, it is automatically
+  // skipped.  For example, a programming language scanner would use
+  // a skip RE that matches white space and comments.
+  //
+  //    scanner.Skip("(\\s|//.*|/[*](.|\n)*?[*]/)*");
+  //
+  // You can pass NULL for "re" if you do not want any data to be skipped.
+  void Skip(const char* re);
+
+  // Temporarily pause "skip"ing. This
+  //   Skip("Foo"); code ; DisableSkip(); code; EnableSkip()
+  // is similar to
+  //   Skip("Foo"); code ; Skip(NULL); code ; Skip("Foo");
+  // but avoids creating/deleting new RE objects.
+  void DisableSkip();
+
+  // Reenable previously paused skipping.  Any prefix of the input
+  // that matches the skip pattern is immediately dropped.
+  void EnableSkip();
+
+  /***** Special wrappers around SetSkip() for some common idioms *****/
+
+  // Arranges to skip whitespace, C comments, C++ comments.
+  // The overall RE is a repeated disjunction of the following REs:
+  //    \\s                     whitespace
+  //    //.*\n                  C++ comment
+  //    /[*](.|\n)*?[*]/        C comment (x*? means minimal repetitions of x)
+  void SkipCXXComments() {
+    Skip("((\\s|//.*\n|/[*](.|\n)*?[*]/)*)");
+  }
+
+  void set_save_comments(bool comments) {
+    save_comments_ = comments;
+  }
+
+  bool save_comments() {
+    return save_comments_;
+  }
+
+  // Append to vector ranges the comments found in the
+  // byte range [start,end] (inclusive) of the input data.
+  // Only comments that were extracted entirely within that
+  // range are returned: no range splitting of atomically-extracted
+  // comments is performed.
+  void GetComments(int start, int end, std::vector<StringPiece> *ranges);
+
+  // Append to vector ranges the comments added
+  // since the last time this was called. This
+  // functionality is provided for efficiency when
+  // interleaving scanning with parsing.
+  void GetNextComments(std::vector<StringPiece> *ranges);
+
+ private:
+  std::string   data_;          // All the input data
+  StringPiece   input_;         // Unprocessed input
+  RE*           skip_;          // If non-NULL, RE for skipping input
+  bool          should_skip_;   // If true, use skip_
+  bool          save_comments_; // If true, aggregate the skip expression
+
+  // the skipped comments
+  // TODO: later consider requiring that the StringPieces be added
+  // in order by their start position
+  std::vector<StringPiece> *comments_;
+
+  // the offset into comments_ that has been returned by GetNextComments
+  int           comments_offset_;
+
+  // helper function to consume *skip_ and honour
+  // save_comments_
+  void ConsumeSkip();
+};
+
+}   // namespace pcrecpp
+
+#endif /* _PCRE_SCANNER_H */
diff --git a/ext/pcre/pcrelib/pcre_scanner_unittest.cc b/ext/pcre/pcrelib/pcre_scanner_unittest.cc
new file mode 100644 (file)
index 0000000..e000a07
--- /dev/null
@@ -0,0 +1,125 @@
+// Copyright (c) 2005, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Greg J. Badros
+//
+// Unittest for scanner, especially GetNextComments and GetComments()
+// functionality.
+
+#include <stdio.h>
+#include <vector>
+#include <pcre_stringpiece.h>
+#include <pcre_scanner.h>
+
+// Dies with a fatal error if the two values are not equal.
+#define CHECK_EQ(a, b)  do {                                    \
+  if ( (a) != (b) ) {                                           \
+    fprintf(stderr, "%s:%d: Check failed because %s != %s\n",   \
+            __FILE__, __LINE__, #a, #b);                        \
+    exit(1);                                                    \
+  }                                                             \
+} while (0)
+
+using std::vector;
+using pcrecpp::StringPiece;
+using pcrecpp::Scanner;
+
+static void TestScanner() {
+  const char input[] = "\n"
+                       "alpha = 1; // this sets alpha\n"
+                       "bravo = 2; // bravo is set here\n"
+                       "gamma = 33; /* and here is gamma */\n";
+
+  const char *re = "(\\w+) = (\\d+);";
+
+  Scanner s(input);
+  string var;
+  int number;
+  s.SkipCXXComments();
+  s.set_save_comments(true);
+  vector<StringPiece> comments;
+
+  s.Consume(re, &var, &number);
+  CHECK_EQ(var, "alpha");
+  CHECK_EQ(number, 1);
+  s.GetNextComments(&comments);
+  CHECK_EQ(comments.size(), 1);
+  CHECK_EQ(comments[0].as_string(), " // this sets alpha\n");
+  comments.resize(0);
+
+  s.Consume(re, &var, &number);
+  CHECK_EQ(var, "bravo");
+  CHECK_EQ(number, 2);
+  s.GetNextComments(&comments);
+  CHECK_EQ(comments.size(), 1);
+  CHECK_EQ(comments[0].as_string(), " // bravo is set here\n");
+  comments.resize(0);
+
+  s.Consume(re, &var, &number);
+  CHECK_EQ(var, "gamma");
+  CHECK_EQ(number, 33);
+  s.GetNextComments(&comments);
+  CHECK_EQ(comments.size(), 1);
+  CHECK_EQ(comments[0].as_string(), " /* and here is gamma */\n");
+  comments.resize(0);
+
+  s.GetComments(0, sizeof(input), &comments);
+  CHECK_EQ(comments.size(), 3);
+  CHECK_EQ(comments[0].as_string(), " // this sets alpha\n");
+  CHECK_EQ(comments[1].as_string(), " // bravo is set here\n");
+  CHECK_EQ(comments[2].as_string(), " /* and here is gamma */\n");
+  comments.resize(0);
+
+  s.GetComments(0, strchr(input, '/') - input, &comments);
+  CHECK_EQ(comments.size(), 0);
+  comments.resize(0);
+
+  s.GetComments(strchr(input, '/') - input - 1, sizeof(input),
+                &comments);
+  CHECK_EQ(comments.size(), 3);
+  CHECK_EQ(comments[0].as_string(), " // this sets alpha\n");
+  CHECK_EQ(comments[1].as_string(), " // bravo is set here\n");
+  CHECK_EQ(comments[2].as_string(), " /* and here is gamma */\n");
+  comments.resize(0);
+
+  s.GetComments(strchr(input, '/') - input - 1,
+                strchr(input + 1, '\n') - input + 1, &comments);
+  CHECK_EQ(comments.size(), 1);
+  CHECK_EQ(comments[0].as_string(), " // this sets alpha\n");
+  comments.resize(0);
+}
+
+int main(int argc, char** argv) {
+  TestScanner();
+
+  // Done
+  printf("OK\n");
+
+  return 0;
+}
diff --git a/ext/pcre/pcrelib/pcre_stringpiece.cc b/ext/pcre/pcrelib/pcre_stringpiece.cc
new file mode 100644 (file)
index 0000000..dbdb509
--- /dev/null
@@ -0,0 +1,39 @@
+// Copyright (c) 2005, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: wilsonh@google.com (Wilson Hsieh)
+//
+
+#include <iostream>
+#include "config.h"
+#include "pcre_stringpiece.h"
+
+std::ostream& operator<<(std::ostream& o, const pcrecpp::StringPiece& piece) {
+  return (o << piece.as_string());
+}
diff --git a/ext/pcre/pcrelib/pcre_stringpiece.h b/ext/pcre/pcrelib/pcre_stringpiece.h
new file mode 100644 (file)
index 0000000..89d5449
--- /dev/null
@@ -0,0 +1,172 @@
+// Copyright (c) 2005, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Sanjay Ghemawat
+//
+// A string like object that points into another piece of memory.
+// Useful for providing an interface that allows clients to easily
+// pass in either a "const char*" or a "string".
+//
+// Arghh!  I wish C++ literals were automatically of type "string".
+
+#ifndef _PCRE_STRINGPIECE_H
+#define _PCRE_STRINGPIECE_H
+
+#include <string.h>
+#include <string>
+#include <iosfwd>    // for ostream forward-declaration
+
+#if 1
+#define HAVE_TYPE_TRAITS
+#include <type_traits.h>
+#elif 0
+#define HAVE_TYPE_TRAITS
+#include <bits/type_traits.h>
+#endif
+
+using std::string;
+
+namespace pcrecpp {
+
+class StringPiece {
+ private:
+  const char*   ptr_;
+  int           length_;
+
+ public:
+  // We provide non-explicit singleton constructors so users can pass
+  // in a "const char*" or a "string" wherever a "StringPiece" is
+  // expected.
+  StringPiece()
+    : ptr_(NULL), length_(0) { }
+  StringPiece(const char* str)
+    : ptr_(str), length_(static_cast<int>(strlen(str))) { }
+  StringPiece(const string& str)
+    : ptr_(str.data()), length_(static_cast<int>(str.size())) { }
+  StringPiece(const char* offset, int len)
+    : ptr_(offset), length_(len) { }
+
+  // data() may return a pointer to a buffer with embedded NULs, and the
+  // returned buffer may or may not be null terminated.  Therefore it is
+  // typically a mistake to pass data() to a routine that expects a NUL
+  // terminated string.  Use "as_string().c_str()" if you really need to do
+  // this.  Or better yet, change your routine so it does not rely on NUL
+  // termination.
+  const char* data() const { return ptr_; }
+  int size() const { return length_; }
+  bool empty() const { return length_ == 0; }
+
+  void clear() { ptr_ = NULL; length_ = 0; }
+  void set(const char* buffer, int len) { ptr_ = buffer; length_ = len; }
+  void set(const char* str) {
+    ptr_ = str;
+    length_ = static_cast<int>(strlen(str));
+  }
+  void set(const void* buffer, int len) {
+    ptr_ = reinterpret_cast<const char*>(buffer);
+    length_ = len;
+  }
+
+  char operator[](int i) const { return ptr_[i]; }
+
+  void remove_prefix(int n) {
+    ptr_ += n;
+    length_ -= n;
+  }
+
+  void remove_suffix(int n) {
+    length_ -= n;
+  }
+
+  bool operator==(const StringPiece& x) const {
+    return ((length_ == x.length_) &&
+            (memcmp(ptr_, x.ptr_, length_) == 0));
+  }
+  bool operator!=(const StringPiece& x) const {
+    return !(*this == x);
+  }
+
+#define STRINGPIECE_BINARY_PREDICATE(cmp,auxcmp)                             \
+  bool operator cmp (const StringPiece& x) const {                           \
+    int r = memcmp(ptr_, x.ptr_, length_ < x.length_ ? length_ : x.length_); \
+    return ((r auxcmp 0) || ((r == 0) && (length_ cmp x.length_)));          \
+  }
+  STRINGPIECE_BINARY_PREDICATE(<,  <);
+  STRINGPIECE_BINARY_PREDICATE(<=, <);
+  STRINGPIECE_BINARY_PREDICATE(>=, >);
+  STRINGPIECE_BINARY_PREDICATE(>,  >);
+#undef STRINGPIECE_BINARY_PREDICATE
+
+  int compare(const StringPiece& x) const {
+    int r = memcmp(ptr_, x.ptr_, length_ < x.length_ ? length_ : x.length_);
+    if (r == 0) {
+      if (length_ < x.length_) r = -1;
+      else if (length_ > x.length_) r = +1;
+    }
+    return r;
+  }
+
+  string as_string() const {
+    return string(data(), size());
+  }
+
+  void CopyToString(string* target) const {
+    target->assign(ptr_, length_);
+  }
+
+  // Does "this" start with "x"
+  bool starts_with(const StringPiece& x) const {
+    return ((length_ >= x.length_) && (memcmp(ptr_, x.ptr_, x.length_) == 0));
+  }
+};
+
+}   // namespace pcrecpp
+
+// ------------------------------------------------------------------
+// Functions used to create STL containers that use StringPiece
+//  Remember that a StringPiece's lifetime had better be less than
+//  that of the underlying string or char*.  If it is not, then you
+//  cannot safely store a StringPiece into an STL container
+// ------------------------------------------------------------------
+
+#ifdef HAVE_TYPE_TRAITS
+// This makes vector<StringPiece> really fast for some STL implementations
+template<> struct __type_traits<pcrecpp::StringPiece> {
+  typedef __true_type    has_trivial_default_constructor;
+  typedef __true_type    has_trivial_copy_constructor;
+  typedef __true_type    has_trivial_assignment_operator;
+  typedef __true_type    has_trivial_destructor;
+  typedef __true_type    is_POD_type;
+};
+#endif
+
+// allow StringPiece to be logged
+std::ostream& operator<<(std::ostream& o, const pcrecpp::StringPiece& piece);
+
+#endif /* _PCRE_STRINGPIECE_H */
diff --git a/ext/pcre/pcrelib/pcre_stringpiece_unittest.cc b/ext/pcre/pcrelib/pcre_stringpiece_unittest.cc
new file mode 100644 (file)
index 0000000..d6a89e8
--- /dev/null
@@ -0,0 +1,145 @@
+// Copyright 2003 and onwards Google Inc.
+// Author: Sanjay Ghemawat
+
+#include <stdio.h>
+#include <map>
+#include <algorithm>    // for make_pair
+#include <pcre_stringpiece.h>
+
+// CHECK dies with a fatal error if condition is not true.  It is *not*
+// controlled by NDEBUG, so the check will be executed regardless of
+// compilation mode.  Therefore, it is safe to do things like:
+//    CHECK(fp->Write(x) == 4)
+#define CHECK(condition) do {                           \
+  if (!(condition)) {                                   \
+    fprintf(stderr, "%s:%d: Check failed: %s\n",        \
+            __FILE__, __LINE__, #condition);            \
+    exit(1);                                            \
+  }                                                     \
+} while (0)
+
+using std::map;
+using std::make_pair;
+using pcrecpp::StringPiece;
+
+static void CheckSTLComparator() {
+  string s1("foo");
+  string s2("bar");
+  string s3("baz");
+
+  StringPiece p1(s1);
+  StringPiece p2(s2);
+  StringPiece p3(s3);
+
+  typedef map<StringPiece, int> TestMap;
+  TestMap map;
+
+  map.insert(make_pair(p1, 0));
+  map.insert(make_pair(p2, 1));
+  map.insert(make_pair(p3, 2));
+  CHECK(map.size() == 3);
+
+  TestMap::const_iterator iter = map.begin();
+  CHECK(iter->second == 1);
+  ++iter;
+  CHECK(iter->second == 2);
+  ++iter;
+  CHECK(iter->second == 0);
+  ++iter;
+  CHECK(iter == map.end());
+
+  TestMap::iterator new_iter = map.find("zot");
+  CHECK(new_iter == map.end());
+
+  new_iter = map.find("bar");
+  CHECK(new_iter != map.end());
+
+  map.erase(new_iter);
+  CHECK(map.size() == 2);
+
+  iter = map.begin();
+  CHECK(iter->second == 2);
+  ++iter;
+  CHECK(iter->second == 0);
+  ++iter;
+  CHECK(iter == map.end());
+}
+
+static void CheckComparisonOperators() {
+#define CMP_Y(op, x, y)                                         \
+  CHECK( (StringPiece((x)) op StringPiece((y))));               \
+  CHECK( (StringPiece((x)).compare(StringPiece((y))) op 0))
+
+#define CMP_N(op, x, y)                                         \
+  CHECK(!(StringPiece((x)) op StringPiece((y))));               \
+  CHECK(!(StringPiece((x)).compare(StringPiece((y))) op 0))
+
+  CMP_Y(==, "",   "");
+  CMP_Y(==, "a",  "a");
+  CMP_Y(==, "aa", "aa");
+  CMP_N(==, "a",  "");
+  CMP_N(==, "",   "a");
+  CMP_N(==, "a",  "b");
+  CMP_N(==, "a",  "aa");
+  CMP_N(==, "aa", "a");
+
+  CMP_N(!=, "",   "");
+  CMP_N(!=, "a",  "a");
+  CMP_N(!=, "aa", "aa");
+  CMP_Y(!=, "a",  "");
+  CMP_Y(!=, "",   "a");
+  CMP_Y(!=, "a",  "b");
+  CMP_Y(!=, "a",  "aa");
+  CMP_Y(!=, "aa", "a");
+
+  CMP_Y(<, "a",  "b");
+  CMP_Y(<, "a",  "aa");
+  CMP_Y(<, "aa", "b");
+  CMP_Y(<, "aa", "bb");
+  CMP_N(<, "a",  "a");
+  CMP_N(<, "b",  "a");
+  CMP_N(<, "aa", "a");
+  CMP_N(<, "b",  "aa");
+  CMP_N(<, "bb", "aa");
+
+  CMP_Y(<=, "a",  "a");
+  CMP_Y(<=, "a",  "b");
+  CMP_Y(<=, "a",  "aa");
+  CMP_Y(<=, "aa", "b");
+  CMP_Y(<=, "aa", "bb");
+  CMP_N(<=, "b",  "a");
+  CMP_N(<=, "aa", "a");
+  CMP_N(<=, "b",  "aa");
+  CMP_N(<=, "bb", "aa");
+
+  CMP_N(>=, "a",  "b");
+  CMP_N(>=, "a",  "aa");
+  CMP_N(>=, "aa", "b");
+  CMP_N(>=, "aa", "bb");
+  CMP_Y(>=, "a",  "a");
+  CMP_Y(>=, "b",  "a");
+  CMP_Y(>=, "aa", "a");
+  CMP_Y(>=, "b",  "aa");
+  CMP_Y(>=, "bb", "aa");
+
+  CMP_N(>, "a",  "a");
+  CMP_N(>, "a",  "b");
+  CMP_N(>, "a",  "aa");
+  CMP_N(>, "aa", "b");
+  CMP_N(>, "aa", "bb");
+  CMP_Y(>, "b",  "a");
+  CMP_Y(>, "aa", "a");
+  CMP_Y(>, "b",  "aa");
+  CMP_Y(>, "bb", "aa");
+
+#undef CMP_Y
+#undef CMP_N
+}
+
+int main(int argc, char** argv) {
+  CheckComparisonOperators();
+  CheckSTLComparator();
+
+  printf("OK\n");
+  return 0;
+}
similarity index 97%
rename from ext/pcre/pcrelib/study.c
rename to ext/pcre/pcrelib/pcre_study.c
index d99b8a992ecba23de0f95b4d0fd316fe5953a46c..7c10c049171ad119243bfa7277466c85888b6479 100644 (file)
@@ -2,14 +2,11 @@
 *      Perl-Compatible Regular Expressions       *
 *************************************************/
 
-/*
-This is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language. See
-the file Tech.Notes for some information on the internals.
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
 
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
-           Copyright (c) 1997-2004 University of Cambridge
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -41,11 +38,11 @@ POSSIBILITY OF SUCH DAMAGE.
 */
 
 
-/* Include the internals header, which itself includes Standard C headers plus
-the external pcre header. */
+/* This module contains the external function pcre_study(), along with local
+supporting functions. */
 
-#include "internal.h"
 
+#include "pcre_internal.h"
 
 
 /*************************************************
@@ -441,7 +438,8 @@ if ((re->options & (PCRE_ANCHORED|PCRE_FIRSTSET|PCRE_STARTLINE)) != 0)
 
 tables = re->tables;
 if (tables == NULL)
-  (void)pcre_fullinfo(external_re, NULL, PCRE_INFO_DEFAULT_TABLES, &tables);
+  (void)pcre_fullinfo(external_re, NULL, PCRE_INFO_DEFAULT_TABLES,
+  (void *)(&tables));
 
 compile_block.lcc = tables + lcc_offset;
 compile_block.fcc = tables + fcc_offset;
@@ -481,4 +479,4 @@ memcpy(study->start_bits, start_bits, sizeof(start_bits));
 return extra;
 }
 
-/* End of study.c */
+/* End of pcre_study.c */
similarity index 58%
rename from ext/pcre/pcrelib/ucptypetable.c
rename to ext/pcre/pcrelib/pcre_tables.c
index 129529b5d6b3a97060df1df847a07c2db10cf413..4f442eae033e97adbd3ec2c50840bde912fe7f21 100644 (file)
@@ -2,14 +2,11 @@
 *      Perl-Compatible Regular Expressions       *
 *************************************************/
 
-/*
-This is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language. See
-the file Tech.Notes for some information on the internals.
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
 
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
-           Copyright (c) 1997-2004 University of Cambridge
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -40,17 +37,54 @@ POSSIBILITY OF SUCH DAMAGE.
 -----------------------------------------------------------------------------
 */
 
-/* This module contains a table for translating Unicode property names into
-code values for the ucp_findchar function. It is in a separate module so that
-it can be included both in the main pcre library, and into pcretest (for
-printing out internals). */
 
-typedef struct {
-  const char *name;
-  int value;
-} ucp_type_table;
+/* This module contains some fixed tables that are used by more than one of the
+PCRE code modules. */
+
+
+#include "pcre_internal.h"
+
+
+/* Table of sizes for the fixed-length opcodes. It's defined in a macro so that
+the definition is next to the definition of the opcodes in internal.h. */
+
+const uschar _pcre_OP_lengths[] = { OP_LENGTHS };
+
+
+
+/*************************************************
+*           Tables for UTF-8 support             *
+*************************************************/
+
+/* These are the breakpoints for different numbers of bytes in a UTF-8
+character. */
+
+const int _pcre_utf8_table1[] =
+  { 0x7f, 0x7ff, 0xffff, 0x1fffff, 0x3ffffff, 0x7fffffff};
+
+const int _pcre_utf8_table1_size = sizeof(_pcre_utf8_table1)/sizeof(int);
+
+/* These are the indicator bits and the mask for the data bits to set in the
+first byte of a character, indexed by the number of additional bytes. */
 
-static ucp_type_table utt[] = {
+const int _pcre_utf8_table2[] = { 0,    0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
+const int _pcre_utf8_table3[] = { 0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
+
+/* Table of the number of extra characters, indexed by the first character
+masked with 0x3f. The highest number for a valid UTF-8 character is in fact
+0x3d. */
+
+const uschar _pcre_utf8_table4[] = {
+  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,1,1,1,1,1,
+  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+  3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 };
+
+/* This table translates Unicode property names into code values for the
+ucp_findchar() function. It is used by pcretest as well as by the library
+functions. */
+
+const ucp_type_table _pcre_utt[] = {
   { "C",  128 + ucp_C },
   { "Cc", ucp_Cc },
   { "Cf", ucp_Cf },
@@ -90,4 +124,6 @@ static ucp_type_table utt[] = {
   { "Zs", ucp_Zs }
 };
 
-/* End of ucptypetable.c */
+const int _pcre_utt_size = sizeof(_pcre_utt)/sizeof(ucp_type_table);
+
+/* End of pcre_tables.c */
diff --git a/ext/pcre/pcrelib/pcre_try_flipped.c b/ext/pcre/pcrelib/pcre_try_flipped.c
new file mode 100644 (file)
index 0000000..a07bb23
--- /dev/null
@@ -0,0 +1,132 @@
+/*************************************************
+*      Perl-Compatible Regular Expressions       *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+
+/* This module contains an internal function that tests a compiled pattern to
+see if it was compiled with the opposite endianness. If so, it uses an
+auxiliary local function to flip the appropriate bytes. */
+
+
+#include "pcre_internal.h"
+
+
+/*************************************************
+*         Flip bytes in an integer               *
+*************************************************/
+
+/* This function is called when the magic number in a regex doesn't match, in
+order to flip its bytes to see if we are dealing with a pattern that was
+compiled on a host of different endianness. If so, this function is used to
+flip other byte values.
+
+Arguments:
+  value        the number to flip
+  n            the number of bytes to flip (assumed to be 2 or 4)
+
+Returns:       the flipped value
+*/
+
+static long int
+byteflip(long int value, int n)
+{
+if (n == 2) return ((value & 0x00ff) << 8) | ((value & 0xff00) >> 8);
+return ((value & 0x000000ff) << 24) |
+       ((value & 0x0000ff00) <<  8) |
+       ((value & 0x00ff0000) >>  8) |
+       ((value & 0xff000000) >> 24);
+}
+
+
+
+/*************************************************
+*       Test for a byte-flipped compiled regex   *
+*************************************************/
+
+/* This function is called from pcre_exec(), pcre_dfa_exec(), and also from
+pcre_fullinfo(). Its job is to test whether the regex is byte-flipped - that
+is, it was compiled on a system of opposite endianness. The function is called
+only when the native MAGIC_NUMBER test fails. If the regex is indeed flipped,
+we flip all the relevant values into a different data block, and return it.
+
+Arguments:
+  re               points to the regex
+  study            points to study data, or NULL
+  internal_re      points to a new regex block
+  internal_study   points to a new study block
+
+Returns:           the new block if is is indeed a byte-flipped regex
+                   NULL if it is not
+*/
+
+EXPORT real_pcre *
+_pcre_try_flipped(const real_pcre *re, real_pcre *internal_re,
+  const pcre_study_data *study, pcre_study_data *internal_study)
+{
+if (byteflip(re->magic_number, sizeof(re->magic_number)) != MAGIC_NUMBER)
+  return NULL;
+
+*internal_re = *re;           /* To copy other fields */
+internal_re->size = byteflip(re->size, sizeof(re->size));
+internal_re->options = byteflip(re->options, sizeof(re->options));
+internal_re->top_bracket =
+  (pcre_uint16)byteflip(re->top_bracket, sizeof(re->top_bracket));
+internal_re->top_backref =
+  (pcre_uint16)byteflip(re->top_backref, sizeof(re->top_backref));
+internal_re->first_byte =
+  (pcre_uint16)byteflip(re->first_byte, sizeof(re->first_byte));
+internal_re->req_byte =
+  (pcre_uint16)byteflip(re->req_byte, sizeof(re->req_byte));
+internal_re->name_table_offset =
+  (pcre_uint16)byteflip(re->name_table_offset, sizeof(re->name_table_offset));
+internal_re->name_entry_size =
+  (pcre_uint16)byteflip(re->name_entry_size, sizeof(re->name_entry_size));
+internal_re->name_count =
+  (pcre_uint16)byteflip(re->name_count, sizeof(re->name_count));
+
+if (study != NULL)
+  {
+  *internal_study = *study;   /* To copy other fields */
+  internal_study->size = byteflip(study->size, sizeof(study->size));
+  internal_study->options = byteflip(study->options, sizeof(study->options));
+  }
+
+return internal_re;
+}
+
+/* End of pcre_tryflipped.c */
diff --git a/ext/pcre/pcrelib/pcre_ucp_findchar.c b/ext/pcre/pcrelib/pcre_ucp_findchar.c
new file mode 100644 (file)
index 0000000..9f8de06
--- /dev/null
@@ -0,0 +1,53 @@
+/*************************************************
+*      Perl-Compatible Regular Expressions       *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+
+/* This module compiles code for supporting the use of Unicode character
+properties. We use the (embryonic at the time of writing) UCP library, by
+including some of its files, copies of which have been put in the PCRE
+distribution. There is a macro in pcre_internal.h that changes the name
+ucp_findchar into _pcre_ucp_findchar. */
+
+
+#include "pcre_internal.h"
+
+#include "ucp_findchar.c"
+
+
+/* End of pcre_ucp_findchar.c */
diff --git a/ext/pcre/pcrelib/pcre_valid_utf8.c b/ext/pcre/pcrelib/pcre_valid_utf8.c
new file mode 100644 (file)
index 0000000..72f0f5e
--- /dev/null
@@ -0,0 +1,130 @@
+/*************************************************
+*      Perl-Compatible Regular Expressions       *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+
+/* This module contains an internal function for validating UTF-8 character
+strings. */
+
+
+#include "pcre_internal.h"
+
+
+/*************************************************
+*         Validate a UTF-8 string                *
+*************************************************/
+
+/* This function is called (optionally) at the start of compile or match, to
+validate that a supposed UTF-8 string is actually valid. The early check means
+that subsequent code can assume it is dealing with a valid string. The check
+can be turned off for maximum performance, but the consequences of supplying
+an invalid string are then undefined.
+
+Arguments:
+  string       points to the string
+  length       length of string, or -1 if the string is zero-terminated
+
+Returns:       < 0    if the string is a valid UTF-8 string
+               >= 0   otherwise; the value is the offset of the bad byte
+*/
+
+EXPORT int
+_pcre_valid_utf8(const uschar *string, int length)
+{
+register const uschar *p;
+
+if (length < 0)
+  {
+  for (p = string; *p != 0; p++);
+  length = p - string;
+  }
+
+for (p = string; length-- > 0; p++)
+  {
+  register int ab;
+  register int c = *p;
+  if (c < 128) continue;
+  if ((c & 0xc0) != 0xc0) return p - string;
+  ab = _pcre_utf8_table4[c & 0x3f];  /* Number of additional bytes */
+  if (length < ab) return p - string;
+  length -= ab;
+
+  /* Check top bits in the second byte */
+  if ((*(++p) & 0xc0) != 0x80) return p - string;
+
+  /* Check for overlong sequences for each different length */
+  switch (ab)
+    {
+    /* Check for xx00 000x */
+    case 1:
+    if ((c & 0x3e) == 0) return p - string;
+    continue;   /* We know there aren't any more bytes to check */
+
+    /* Check for 1110 0000, xx0x xxxx */
+    case 2:
+    if (c == 0xe0 && (*p & 0x20) == 0) return p - string;
+    break;
+
+    /* Check for 1111 0000, xx00 xxxx */
+    case 3:
+    if (c == 0xf0 && (*p & 0x30) == 0) return p - string;
+    break;
+
+    /* Check for 1111 1000, xx00 0xxx */
+    case 4:
+    if (c == 0xf8 && (*p & 0x38) == 0) return p - string;
+    break;
+
+    /* Check for leading 0xfe or 0xff, and then for 1111 1100, xx00 00xx */
+    case 5:
+    if (c == 0xfe || c == 0xff ||
+       (c == 0xfc && (*p & 0x3c) == 0)) return p - string;
+    break;
+    }
+
+  /* Check for valid bytes after the 2nd, if any; all must start 10 */
+  while (--ab > 0)
+    {
+    if ((*(++p) & 0xc0) != 0x80) return p - string;
+    }
+  }
+
+return -1;
+}
+
+/* End of pcre_valid_utf8.c */
diff --git a/ext/pcre/pcrelib/pcre_version.c b/ext/pcre/pcrelib/pcre_version.c
new file mode 100644 (file)
index 0000000..d296eea
--- /dev/null
@@ -0,0 +1,61 @@
+/*************************************************
+*      Perl-Compatible Regular Expressions       *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+
+/* This module contains the external function pcre_version(), which returns a
+string that identifies the PCRE version that is in use. */
+
+
+#include "pcre_internal.h"
+
+
+/*************************************************
+*          Return version string                 *
+*************************************************/
+
+#define STRING(a)  # a
+#define XSTRING(s) STRING(s)
+
+EXPORT const char *
+pcre_version(void)
+{
+return XSTRING(PCRE_MAJOR) "." XSTRING(PCRE_MINOR) " " XSTRING(PCRE_DATE);
+}
+
+/* End of pcre_version.c */
diff --git a/ext/pcre/pcrelib/pcre_xclass.c b/ext/pcre/pcrelib/pcre_xclass.c
new file mode 100644 (file)
index 0000000..40d2654
--- /dev/null
@@ -0,0 +1,121 @@
+/*************************************************
+*      Perl-Compatible Regular Expressions       *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+    * Neither the name of the University of Cambridge nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+
+/* This module contains an internal function that is used to match an extended
+class (one that contains characters whose values are > 255). It is used by both
+pcre_exec() and pcre_def_exec(). */
+
+
+#include "pcre_internal.h"
+
+
+/*************************************************
+*       Match character against an XCLASS        *
+*************************************************/
+
+/* This function is called to match a character against an extended class that
+might contain values > 255.
+
+Arguments:
+  c           the character
+  data        points to the flag byte of the XCLASS data
+
+Returns:      TRUE if character matches, else FALSE
+*/
+
+EXPORT BOOL
+_pcre_xclass(int c, const uschar *data)
+{
+int t;
+BOOL negated = (*data & XCL_NOT) != 0;
+
+/* Character values < 256 are matched against a bitmap, if one is present. If
+not, we still carry on, because there may be ranges that start below 256 in the
+additional data. */
+
+if (c < 256)
+  {
+  if ((*data & XCL_MAP) != 0 && (data[1 + c/8] & (1 << (c&7))) != 0)
+    return !negated;   /* char found */
+  }
+
+/* First skip the bit map if present. Then match against the list of Unicode
+properties or large chars or ranges that end with a large char. We won't ever
+encounter XCL_PROP or XCL_NOTPROP when UCP support is not compiled. */
+
+if ((*data++ & XCL_MAP) != 0) data += 32;
+
+while ((t = *data++) != XCL_END)
+  {
+  int x, y;
+  if (t == XCL_SINGLE)
+    {
+    GETCHARINC(x, data);
+    if (c == x) return !negated;
+    }
+  else if (t == XCL_RANGE)
+    {
+    GETCHARINC(x, data);
+    GETCHARINC(y, data);
+    if (c >= x && c <= y) return !negated;
+    }
+
+#ifdef SUPPORT_UCP
+  else  /* XCL_PROP & XCL_NOTPROP */
+    {
+    int chartype, othercase;
+    int rqdtype = *data++;
+    int category = ucp_findchar(c, &chartype, &othercase);
+    if (rqdtype >= 128)
+      {
+      if ((rqdtype - 128 == category) == (t == XCL_PROP)) return !negated;
+      }
+    else
+      {
+      if ((rqdtype == chartype) == (t == XCL_PROP)) return !negated;
+      }
+    }
+#endif  /* SUPPORT_UCP */
+  }
+
+return negated;   /* char did not match */
+}
+
+/* End of pcre_xclass.c */
diff --git a/ext/pcre/pcrelib/pcrecpp.cc b/ext/pcre/pcrelib/pcrecpp.cc
new file mode 100644 (file)
index 0000000..0ffd221
--- /dev/null
@@ -0,0 +1,770 @@
+// Copyright (c) 2005, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Sanjay Ghemawat
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <limits.h>      /* for SHRT_MIN, USHRT_MAX, etc */
+#include <assert.h>
+#include <errno.h>
+#include <string>
+#include <algorithm>
+#include "config.h"
+// We need this to compile the proper dll on windows/msys.  This is copied
+// from pcre_internal.h.  It would probably be better just to include that.
+#define PCRE_DEFINITION  /* Win32 __declspec(export) trigger for .dll */
+#include "pcre.h"
+#include "pcre_stringpiece.h"
+#include "pcrecpp.h"
+
+
+namespace pcrecpp {
+
+// Maximum number of args we can set
+static const int kMaxArgs = 16;
+static const int kVecSize = (1 + kMaxArgs) * 3;  // results + PCRE workspace
+
+// Special object that stands-in for no argument
+Arg no_arg((void*)NULL);
+
+// If a regular expression has no error, its error_ field points here
+static const string empty_string;
+
+// If the user doesn't ask for any options, we just use this one
+static RE_Options default_options;
+
+void RE::Init(const char* pat, const RE_Options* options) {
+  pattern_ = pat;
+  if (options == NULL) {
+    options_ = default_options;
+  } else {
+    options_ = *options;
+  }
+  error_ = &empty_string;
+  re_full_ = NULL;
+  re_partial_ = NULL;
+
+  re_partial_ = Compile(UNANCHORED);
+  if (re_partial_ != NULL) {
+    // Check for complicated patterns.  The following change is
+    // conservative in that it may treat some "simple" patterns
+    // as "complex" (e.g., if the vertical bar is in a character
+    // class or is escaped).  But it seems good enough.
+    if (strchr(pat, '|') == NULL) {
+      // Simple pattern: we can use position-based checks to perform
+      // fully anchored matches
+      re_full_ = re_partial_;
+    } else {
+      // We need a special pattern for anchored matches
+      re_full_ = Compile(ANCHOR_BOTH);
+    }
+  }
+}
+
+RE::~RE() {
+  if (re_full_ != NULL && re_full_ != re_partial_) (*pcre_free)(re_full_);
+  if (re_partial_ != NULL)                         (*pcre_free)(re_partial_);
+  if (error_ != &empty_string)                     delete error_;
+}
+
+pcre* RE::Compile(Anchor anchor) {
+  // First, convert RE_Options into pcre options
+  int pcre_options = 0;
+  pcre_options = options_.all_options();
+
+  // Special treatment for anchoring.  This is needed because at
+  // runtime pcre only provides an option for anchoring at the
+  // beginning of a string (unless you use offset).
+  //
+  // There are three types of anchoring we want:
+  //    UNANCHORED      Compile the original pattern, and use
+  //                    a pcre unanchored match.
+  //    ANCHOR_START    Compile the original pattern, and use
+  //                    a pcre anchored match.
+  //    ANCHOR_BOTH     Tack a "\z" to the end of the original pattern
+  //                    and use a pcre anchored match.
+
+  const char* compile_error;
+  int eoffset;
+  pcre* re;
+  if (anchor != ANCHOR_BOTH) {
+    re = pcre_compile(pattern_.c_str(), pcre_options,
+                      &compile_error, &eoffset, NULL);
+  } else {
+    // Tack a '\z' at the end of RE.  Parenthesize it first so that
+    // the '\z' applies to all top-level alternatives in the regexp.
+    string wrapped = "(?:";  // A non-counting grouping operator
+    wrapped += pattern_;
+    wrapped += ")\\z";
+    re = pcre_compile(wrapped.c_str(), pcre_options,
+                      &compile_error, &eoffset, NULL);
+  }
+  if (re == NULL) {
+    if (error_ == &empty_string) error_ = new string(compile_error);
+  }
+  return re;
+}
+
+/***** Matching interfaces *****/
+
+bool RE::FullMatch(const StringPiece& text,
+                   const Arg& ptr1,
+                   const Arg& ptr2,
+                   const Arg& ptr3,
+                   const Arg& ptr4,
+                   const Arg& ptr5,
+                   const Arg& ptr6,
+                   const Arg& ptr7,
+                   const Arg& ptr8,
+                   const Arg& ptr9,
+                   const Arg& ptr10,
+                   const Arg& ptr11,
+                   const Arg& ptr12,
+                   const Arg& ptr13,
+                   const Arg& ptr14,
+                   const Arg& ptr15,
+                   const Arg& ptr16) const {
+  const Arg* args[kMaxArgs];
+  int n = 0;
+  if (&ptr1  == &no_arg) goto done; args[n++] = &ptr1;
+  if (&ptr2  == &no_arg) goto done; args[n++] = &ptr2;
+  if (&ptr3  == &no_arg) goto done; args[n++] = &ptr3;
+  if (&ptr4  == &no_arg) goto done; args[n++] = &ptr4;
+  if (&ptr5  == &no_arg) goto done; args[n++] = &ptr5;
+  if (&ptr6  == &no_arg) goto done; args[n++] = &ptr6;
+  if (&ptr7  == &no_arg) goto done; args[n++] = &ptr7;
+  if (&ptr8  == &no_arg) goto done; args[n++] = &ptr8;
+  if (&ptr9  == &no_arg) goto done; args[n++] = &ptr9;
+  if (&ptr10 == &no_arg) goto done; args[n++] = &ptr10;
+  if (&ptr11 == &no_arg) goto done; args[n++] = &ptr11;
+  if (&ptr12 == &no_arg) goto done; args[n++] = &ptr12;
+  if (&ptr13 == &no_arg) goto done; args[n++] = &ptr13;
+  if (&ptr14 == &no_arg) goto done; args[n++] = &ptr14;
+  if (&ptr15 == &no_arg) goto done; args[n++] = &ptr15;
+  if (&ptr16 == &no_arg) goto done; args[n++] = &ptr16;
+ done:
+
+  int consumed;
+  int vec[kVecSize];
+  return DoMatchImpl(text, ANCHOR_BOTH, &consumed, args, n, vec, kVecSize);
+}
+
+bool RE::PartialMatch(const StringPiece& text,
+                      const Arg& ptr1,
+                      const Arg& ptr2,
+                      const Arg& ptr3,
+                      const Arg& ptr4,
+                      const Arg& ptr5,
+                      const Arg& ptr6,
+                      const Arg& ptr7,
+                      const Arg& ptr8,
+                      const Arg& ptr9,
+                      const Arg& ptr10,
+                      const Arg& ptr11,
+                      const Arg& ptr12,
+                      const Arg& ptr13,
+                      const Arg& ptr14,
+                      const Arg& ptr15,
+                      const Arg& ptr16) const {
+  const Arg* args[kMaxArgs];
+  int n = 0;
+  if (&ptr1  == &no_arg) goto done; args[n++] = &ptr1;
+  if (&ptr2  == &no_arg) goto done; args[n++] = &ptr2;
+  if (&ptr3  == &no_arg) goto done; args[n++] = &ptr3;
+  if (&ptr4  == &no_arg) goto done; args[n++] = &ptr4;
+  if (&ptr5  == &no_arg) goto done; args[n++] = &ptr5;
+  if (&ptr6  == &no_arg) goto done; args[n++] = &ptr6;
+  if (&ptr7  == &no_arg) goto done; args[n++] = &ptr7;
+  if (&ptr8  == &no_arg) goto done; args[n++] = &ptr8;
+  if (&ptr9  == &no_arg) goto done; args[n++] = &ptr9;
+  if (&ptr10 == &no_arg) goto done; args[n++] = &ptr10;
+  if (&ptr11 == &no_arg) goto done; args[n++] = &ptr11;
+  if (&ptr12 == &no_arg) goto done; args[n++] = &ptr12;
+  if (&ptr13 == &no_arg) goto done; args[n++] = &ptr13;
+  if (&ptr14 == &no_arg) goto done; args[n++] = &ptr14;
+  if (&ptr15 == &no_arg) goto done; args[n++] = &ptr15;
+  if (&ptr16 == &no_arg) goto done; args[n++] = &ptr16;
+ done:
+
+  int consumed;
+  int vec[kVecSize];
+  return DoMatchImpl(text, UNANCHORED, &consumed, args, n, vec, kVecSize);
+}
+
+bool RE::Consume(StringPiece* input,
+                 const Arg& ptr1,
+                 const Arg& ptr2,
+                 const Arg& ptr3,
+                 const Arg& ptr4,
+                 const Arg& ptr5,
+                 const Arg& ptr6,
+                 const Arg& ptr7,
+                 const Arg& ptr8,
+                 const Arg& ptr9,
+                 const Arg& ptr10,
+                 const Arg& ptr11,
+                 const Arg& ptr12,
+                 const Arg& ptr13,
+                 const Arg& ptr14,
+                 const Arg& ptr15,
+                 const Arg& ptr16) const {
+  const Arg* args[kMaxArgs];
+  int n = 0;
+  if (&ptr1  == &no_arg) goto done; args[n++] = &ptr1;
+  if (&ptr2  == &no_arg) goto done; args[n++] = &ptr2;
+  if (&ptr3  == &no_arg) goto done; args[n++] = &ptr3;
+  if (&ptr4  == &no_arg) goto done; args[n++] = &ptr4;
+  if (&ptr5  == &no_arg) goto done; args[n++] = &ptr5;
+  if (&ptr6  == &no_arg) goto done; args[n++] = &ptr6;
+  if (&ptr7  == &no_arg) goto done; args[n++] = &ptr7;
+  if (&ptr8  == &no_arg) goto done; args[n++] = &ptr8;
+  if (&ptr9  == &no_arg) goto done; args[n++] = &ptr9;
+  if (&ptr10 == &no_arg) goto done; args[n++] = &ptr10;
+  if (&ptr11 == &no_arg) goto done; args[n++] = &ptr11;
+  if (&ptr12 == &no_arg) goto done; args[n++] = &ptr12;
+  if (&ptr13 == &no_arg) goto done; args[n++] = &ptr13;
+  if (&ptr14 == &no_arg) goto done; args[n++] = &ptr14;
+  if (&ptr15 == &no_arg) goto done; args[n++] = &ptr15;
+  if (&ptr16 == &no_arg) goto done; args[n++] = &ptr16;
+ done:
+
+  int consumed;
+  int vec[kVecSize];
+  if (DoMatchImpl(*input, ANCHOR_START, &consumed,
+                  args, n, vec, kVecSize)) {
+    input->remove_prefix(consumed);
+    return true;
+  } else {
+    return false;
+  }
+}
+
+bool RE::FindAndConsume(StringPiece* input,
+                        const Arg& ptr1,
+                        const Arg& ptr2,
+                        const Arg& ptr3,
+                        const Arg& ptr4,
+                        const Arg& ptr5,
+                        const Arg& ptr6,
+                        const Arg& ptr7,
+                        const Arg& ptr8,
+                        const Arg& ptr9,
+                        const Arg& ptr10,
+                        const Arg& ptr11,
+                        const Arg& ptr12,
+                        const Arg& ptr13,
+                        const Arg& ptr14,
+                        const Arg& ptr15,
+                        const Arg& ptr16) const {
+  const Arg* args[kMaxArgs];
+  int n = 0;
+  if (&ptr1  == &no_arg) goto done; args[n++] = &ptr1;
+  if (&ptr2  == &no_arg) goto done; args[n++] = &ptr2;
+  if (&ptr3  == &no_arg) goto done; args[n++] = &ptr3;
+  if (&ptr4  == &no_arg) goto done; args[n++] = &ptr4;
+  if (&ptr5  == &no_arg) goto done; args[n++] = &ptr5;
+  if (&ptr6  == &no_arg) goto done; args[n++] = &ptr6;
+  if (&ptr7  == &no_arg) goto done; args[n++] = &ptr7;
+  if (&ptr8  == &no_arg) goto done; args[n++] = &ptr8;
+  if (&ptr9  == &no_arg) goto done; args[n++] = &ptr9;
+  if (&ptr10 == &no_arg) goto done; args[n++] = &ptr10;
+  if (&ptr11 == &no_arg) goto done; args[n++] = &ptr11;
+  if (&ptr12 == &no_arg) goto done; args[n++] = &ptr12;
+  if (&ptr13 == &no_arg) goto done; args[n++] = &ptr13;
+  if (&ptr14 == &no_arg) goto done; args[n++] = &ptr14;
+  if (&ptr15 == &no_arg) goto done; args[n++] = &ptr15;
+  if (&ptr16 == &no_arg) goto done; args[n++] = &ptr16;
+ done:
+
+  int consumed;
+  int vec[kVecSize];
+  if (DoMatchImpl(*input, UNANCHORED, &consumed,
+                  args, n, vec, kVecSize)) {
+    input->remove_prefix(consumed);
+    return true;
+  } else {
+    return false;
+  }
+}
+
+bool RE::Replace(const StringPiece& rewrite,
+                 string *str) const {
+  int vec[kVecSize];
+  int matches = TryMatch(*str, 0, UNANCHORED, vec, kVecSize);
+  if (matches == 0)
+    return false;
+
+  string s;
+  if (!Rewrite(&s, rewrite, *str, vec, matches))
+    return false;
+
+  assert(vec[0] >= 0);
+  assert(vec[1] >= 0);
+  str->replace(vec[0], vec[1] - vec[0], s);
+  return true;
+}
+
+int RE::GlobalReplace(const StringPiece& rewrite,
+                      string *str) const {
+  int count = 0;
+  int vec[kVecSize];
+  string out;
+  int start = 0;
+  int lastend = -1;
+
+  for (; start <= static_cast<int>(str->length()); count++) {
+    int matches = TryMatch(*str, start, UNANCHORED, vec, kVecSize);
+    if (matches <= 0)
+      break;
+    int matchstart = vec[0], matchend = vec[1];
+    assert(matchstart >= start);
+    assert(matchend >= matchstart);
+    if (matchstart == matchend && matchstart == lastend) {
+      // advance one character if we matched an empty string at the same
+      // place as the last match occurred
+      if (start < static_cast<int>(str->length()))
+        out.push_back((*str)[start]);
+      start++;
+    } else {
+      out.append(*str, start, matchstart - start);
+      Rewrite(&out, rewrite, *str, vec, matches);
+      start = matchend;
+      lastend = matchend;
+      count++;
+    }
+  }
+
+  if (count == 0)
+    return 0;
+
+  if (start < static_cast<int>(str->length()))
+    out.append(*str, start, str->length() - start);
+  swap(out, *str);
+  return count;
+}
+
+bool RE::Extract(const StringPiece& rewrite,
+                 const StringPiece& text,
+                 string *out) const {
+  int vec[kVecSize];
+  int matches = TryMatch(text, 0, UNANCHORED, vec, kVecSize);
+  if (matches == 0)
+    return false;
+  out->erase();
+  return Rewrite(out, rewrite, text, vec, matches);
+}
+
+/***** Actual matching and rewriting code *****/
+
+int RE::TryMatch(const StringPiece& text,
+                 int startpos,
+                 Anchor anchor,
+                 int *vec,
+                 int vecsize) const {
+  pcre* re = (anchor == ANCHOR_BOTH) ? re_full_ : re_partial_;
+  if (re == NULL) {
+    //fprintf(stderr, "Matching against invalid re: %s\n", error_->c_str());
+    return 0;
+  }
+
+  pcre_extra extra = { 0 };
+  if (options_.match_limit() > 0) {
+    extra.flags = PCRE_EXTRA_MATCH_LIMIT;
+    extra.match_limit = options_.match_limit();
+  }
+  int rc = pcre_exec(re,              // The regular expression object
+                     &extra,
+                     text.data(),
+                     text.size(),
+                     startpos,
+                     (anchor == UNANCHORED) ? 0 : PCRE_ANCHORED,
+                     vec,
+                     vecsize);
+
+  // Handle errors
+  if (rc == PCRE_ERROR_NOMATCH) {
+    return 0;
+  } else if (rc < 0) {
+    //fprintf(stderr, "Unexpected return code: %d when matching '%s'\n",
+    //        re, pattern_.c_str());
+    return 0;
+  } else if (rc == 0) {
+    // pcre_exec() returns 0 as a special case when the number of
+    // capturing subpatterns exceeds the size of the vector.
+    // When this happens, there is a match and the output vector
+    // is filled, but we miss out on the positions of the extra subpatterns.
+    rc = vecsize / 2;
+  }
+
+  if ((anchor == ANCHOR_BOTH) && (re_full_ == re_partial_)) {
+    // We need an extra check to make sure that the match extended
+    // to the end of the input string
+    assert(vec[0] == 0);                 // PCRE_ANCHORED forces starting match
+    if (vec[1] != text.size()) return 0; // Did not get ending match
+  }
+
+  return rc;
+}
+
+bool RE::DoMatchImpl(const StringPiece& text,
+                     Anchor anchor,
+                     int* consumed,
+                     const Arg* const* args,
+                     int n,
+                     int* vec,
+                     int vecsize) const {
+  assert((1 + n) * 3 <= vecsize);  // results + PCRE workspace
+  int matches = TryMatch(text, 0, anchor, vec, vecsize);
+  assert(matches >= 0);  // TryMatch never returns negatives
+  if (matches == 0)
+    return false;
+
+  *consumed = vec[1];
+
+  if (args == NULL) {
+    // We are not interested in results
+    return true;
+  }
+
+  // If we got here, we must have matched the whole pattern.
+  // We do not need (can not do) any more checks on the value of 'matches' here
+  // -- see the comment for TryMatch.
+  for (int i = 0; i < n; i++) {
+    const int start = vec[2*(i+1)];
+    const int limit = vec[2*(i+1)+1];
+    if (!args[i]->Parse(text.data() + start, limit-start)) {
+      // TODO: Should we indicate what the error was?
+      return false;
+    }
+  }
+
+  return true;
+}
+
+bool RE::DoMatch(const StringPiece& text,
+                 Anchor anchor,
+                 int* consumed,
+                 const Arg* const args[],
+                 int n) const {
+  assert(n >= 0);
+  size_t const vecsize = (1 + n) * 3;  // results + PCRE workspace
+                                       // (as for kVecSize)
+  int space[21];   // use stack allocation for small vecsize (common case)
+  int* vec = vecsize <= 21 ? space : new int[vecsize];
+  bool retval = DoMatchImpl(text, anchor, consumed, args, n, vec, vecsize);
+  if (vec != space) delete [] vec;
+  return retval;
+}
+
+bool RE::Rewrite(string *out, const StringPiece &rewrite,
+                 const StringPiece &text, int *vec, int veclen) const {
+  for (const char *s = rewrite.data(), *end = s + rewrite.size();
+       s < end; s++) {
+    int c = *s;
+    if (c == '\\') {
+      c = *++s;
+      if (isdigit(c)) {
+        int n = (c - '0');
+        if (n >= veclen) {
+          //fprintf(stderr, requested group %d in regexp %.*s\n",
+          //        n, rewrite.size(), rewrite.data());
+          return false;
+        }
+        int start = vec[2 * n];
+        if (start >= 0)
+          out->append(text.data() + start, vec[2 * n + 1] - start);
+      } else if (c == '\\') {
+        out->push_back('\\');
+      } else {
+        //fprintf(stderr, "invalid rewrite pattern: %.*s\n",
+        //        rewrite.size(), rewrite.data());
+        return false;
+      }
+    } else {
+      out->push_back(c);
+    }
+  }
+  return true;
+}
+
+// Return the number of capturing subpatterns, or -1 if the
+// regexp wasn't valid on construction.
+int RE::NumberOfCapturingGroups() {
+  if (re_partial_ == NULL) return -1;
+
+  int result;
+  int pcre_retval = pcre_fullinfo(re_partial_,  // The regular expression object
+                                  NULL,         // We did not study the pattern
+                                  PCRE_INFO_CAPTURECOUNT,
+                                  &result);
+  assert(pcre_retval == 0);
+  return result;
+}
+
+/***** Parsers for various types *****/
+
+bool Arg::parse_null(const char* str, int n, void* dest) {
+  // We fail if somebody asked us to store into a non-NULL void* pointer
+  return (dest == NULL);
+}
+
+bool Arg::parse_string(const char* str, int n, void* dest) {
+  reinterpret_cast<string*>(dest)->assign(str, n);
+  return true;
+}
+
+bool Arg::parse_stringpiece(const char* str, int n, void* dest) {
+  reinterpret_cast<StringPiece*>(dest)->set(str, n);
+  return true;
+}
+
+bool Arg::parse_char(const char* str, int n, void* dest) {
+  if (n != 1) return false;
+  *(reinterpret_cast<char*>(dest)) = str[0];
+  return true;
+}
+
+bool Arg::parse_uchar(const char* str, int n, void* dest) {
+  if (n != 1) return false;
+  *(reinterpret_cast<unsigned char*>(dest)) = str[0];
+  return true;
+}
+
+// Largest number spec that we are willing to parse
+static const int kMaxNumberLength = 32;
+
+// REQUIRES "buf" must have length at least kMaxNumberLength+1
+// REQUIRES "n > 0"
+// Copies "str" into "buf" and null-terminates if necessary.
+// Returns one of:
+//      a. "str" if no termination is needed
+//      b. "buf" if the string was copied and null-terminated
+//      c. "" if the input was invalid and has no hope of being parsed
+static const char* TerminateNumber(char* buf, const char* str, int n) {
+  if ((n > 0) && isspace(*str)) {
+    // We are less forgiving than the strtoxxx() routines and do not
+    // allow leading spaces.
+    return "";
+  }
+
+  // See if the character right after the input text may potentially
+  // look like a digit.
+  if (isdigit(str[n]) ||
+      ((str[n] >= 'a') && (str[n] <= 'f')) ||
+      ((str[n] >= 'A') && (str[n] <= 'F'))) {
+    if (n > kMaxNumberLength) return ""; // Input too big to be a valid number
+    memcpy(buf, str, n);
+    buf[n] = '\0';
+    return buf;
+  } else {
+    // We can parse right out of the supplied string, so return it.
+    return str;
+  }
+}
+
+bool Arg::parse_long_radix(const char* str,
+                           int n,
+                           void* dest,
+                           int radix) {
+  if (n == 0) return false;
+  char buf[kMaxNumberLength+1];
+  str = TerminateNumber(buf, str, n);
+  char* end;
+  errno = 0;
+  long r = strtol(str, &end, radix);
+  if (end != str + n) return false;   // Leftover junk
+  if (errno) return false;
+  *(reinterpret_cast<long*>(dest)) = r;
+  return true;
+}
+
+bool Arg::parse_ulong_radix(const char* str,
+                            int n,
+                            void* dest,
+                            int radix) {
+  if (n == 0) return false;
+  char buf[kMaxNumberLength+1];
+  str = TerminateNumber(buf, str, n);
+  char* end;
+  errno = 0;
+  unsigned long r = strtoul(str, &end, radix);
+  if (end != str + n) return false;   // Leftover junk
+  if (errno) return false;
+  *(reinterpret_cast<unsigned long*>(dest)) = r;
+  return true;
+}
+
+bool Arg::parse_short_radix(const char* str,
+                            int n,
+                            void* dest,
+                            int radix) {
+  long r;
+  if (!parse_long_radix(str, n, &r, radix)) return false; // Could not parse
+  if (r < SHRT_MIN || r > SHRT_MAX) return false;       // Out of range
+  *(reinterpret_cast<short*>(dest)) = r;
+  return true;
+}
+
+bool Arg::parse_ushort_radix(const char* str,
+                             int n,
+                             void* dest,
+                             int radix) {
+  unsigned long r;
+  if (!parse_ulong_radix(str, n, &r, radix)) return false; // Could not parse
+  if (r > USHRT_MAX) return false;                      // Out of range
+  *(reinterpret_cast<unsigned short*>(dest)) = r;
+  return true;
+}
+
+bool Arg::parse_int_radix(const char* str,
+                          int n,
+                          void* dest,
+                          int radix) {
+  long r;
+  if (!parse_long_radix(str, n, &r, radix)) return false; // Could not parse
+  if (r < INT_MIN || r > INT_MAX) return false;         // Out of range
+  *(reinterpret_cast<int*>(dest)) = r;
+  return true;
+}
+
+bool Arg::parse_uint_radix(const char* str,
+                           int n,
+                           void* dest,
+                           int radix) {
+  unsigned long r;
+  if (!parse_ulong_radix(str, n, &r, radix)) return false; // Could not parse
+  if (r > UINT_MAX) return false;                       // Out of range
+  *(reinterpret_cast<unsigned int*>(dest)) = r;
+  return true;
+}
+
+bool Arg::parse_longlong_radix(const char* str,
+                               int n,
+                               void* dest,
+                               int radix) {
+#ifndef HAVE_LONG_LONG
+  return false;
+#else
+  if (n == 0) return false;
+  char buf[kMaxNumberLength+1];
+  str = TerminateNumber(buf, str, n);
+  char* end;
+  errno = 0;
+#if defined HAVE_STRTOQ
+  long long r = strtoq(str, &end, radix);
+#elif defined HAVE_STRTOLL
+  long long r = strtoll(str, &end, radix);
+#else
+#error parse_longlong_radix: cannot convert input to a long-long
+#endif
+  if (end != str + n) return false;   // Leftover junk
+  if (errno) return false;
+  *(reinterpret_cast<long long*>(dest)) = r;
+  return true;
+#endif   /* HAVE_LONG_LONG */
+}
+
+bool Arg::parse_ulonglong_radix(const char* str,
+                                int n,
+                                void* dest,
+                                int radix) {
+#ifndef HAVE_UNSIGNED_LONG_LONG
+  return false;
+#else
+  if (n == 0) return false;
+  char buf[kMaxNumberLength+1];
+  str = TerminateNumber(buf, str, n);
+  char* end;
+  errno = 0;
+#if defined HAVE_STRTOQ
+  unsigned long long r = strtouq(str, &end, radix);
+#elif defined HAVE_STRTOLL
+  unsigned long long r = strtoull(str, &end, radix);
+#else
+#error parse_ulonglong_radix: cannot convert input to a long-long
+#endif
+  if (end != str + n) return false;   // Leftover junk
+  if (errno) return false;
+  *(reinterpret_cast<unsigned long long*>(dest)) = r;
+  return true;
+#endif   /* HAVE_UNSIGNED_LONG_LONG */
+}
+
+bool Arg::parse_double(const char* str, int n, void* dest) {
+  if (n == 0) return false;
+  static const int kMaxLength = 200;
+  char buf[kMaxLength];
+  if (n >= kMaxLength) return false;
+  memcpy(buf, str, n);
+  buf[n] = '\0';
+  errno = 0;
+  char* end;
+  double r = strtod(buf, &end);
+  if (end != buf + n) return false;   // Leftover junk
+  if (errno) return false;
+  *(reinterpret_cast<double*>(dest)) = r;
+  return true;
+}
+
+bool Arg::parse_float(const char* str, int n, void* dest) {
+  double r;
+  if (!parse_double(str, n, &r)) return false;
+  *(reinterpret_cast<float*>(dest)) = static_cast<float>(r);
+  return true;
+}
+
+
+#define DEFINE_INTEGER_PARSERS(name)                                    \
+  bool Arg::parse_##name(const char* str, int n, void* dest) {          \
+    return parse_##name##_radix(str, n, dest, 10);                      \
+  }                                                                     \
+  bool Arg::parse_##name##_hex(const char* str, int n, void* dest) {    \
+    return parse_##name##_radix(str, n, dest, 16);                      \
+  }                                                                     \
+  bool Arg::parse_##name##_octal(const char* str, int n, void* dest) {  \
+    return parse_##name##_radix(str, n, dest, 8);                       \
+  }                                                                     \
+  bool Arg::parse_##name##_cradix(const char* str, int n, void* dest) { \
+    return parse_##name##_radix(str, n, dest, 0);                       \
+  }
+
+DEFINE_INTEGER_PARSERS(short);
+DEFINE_INTEGER_PARSERS(ushort);
+DEFINE_INTEGER_PARSERS(int);
+DEFINE_INTEGER_PARSERS(uint);
+DEFINE_INTEGER_PARSERS(long);
+DEFINE_INTEGER_PARSERS(ulong);
+DEFINE_INTEGER_PARSERS(longlong);
+DEFINE_INTEGER_PARSERS(ulonglong);
+
+#undef DEFINE_INTEGER_PARSERS
+
+}   // namespace pcrecpp
diff --git a/ext/pcre/pcrelib/pcrecpp.h b/ext/pcre/pcrelib/pcrecpp.h
new file mode 100644 (file)
index 0000000..ef9d9b2
--- /dev/null
@@ -0,0 +1,786 @@
+// Copyright (c) 2005, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Sanjay Ghemawat
+// Support for PCRE_XXX modifiers added by Giuseppe Maxia, July 2005
+
+#ifndef _PCRE_REGEXP_H
+#define _PCRE_REGEXP_H
+
+// C++ interface to the pcre regular-expression library.  RE supports
+// Perl-style regular expressions (with extensions like \d, \w, \s,
+// ...).
+//
+// -----------------------------------------------------------------------
+// REGEXP SYNTAX:
+//
+// This module is part of the pcre library and hence supports its syntax
+// for regular expressions.
+//
+// The syntax is pretty similar to Perl's.  For those not familiar
+// with Perl's regular expressions, here are some examples of the most
+// commonly used extensions:
+//
+//   "hello (\\w+) world"  -- \w matches a "word" character
+//   "version (\\d+)"      -- \d matches a digit
+//   "hello\\s+world"      -- \s matches any whitespace character
+//   "\\b(\\w+)\\b"        -- \b matches empty string at a word boundary
+//   "(?i)hello"           -- (?i) turns on case-insensitive matching
+//   "/\\*(.*?)\\*/"       -- .*? matches . minimum no. of times possible
+//
+// -----------------------------------------------------------------------
+// MATCHING INTERFACE:
+//
+// The "FullMatch" operation checks that supplied text matches a
+// supplied pattern exactly.
+//
+// Example: successful match
+//    pcrecpp::RE re("h.*o");
+//    re.FullMatch("hello");
+//
+// Example: unsuccessful match (requires full match):
+//    pcrecpp::RE re("e");
+//    !re.FullMatch("hello");
+//
+// Example: creating a temporary RE object:
+//    pcrecpp::RE("h.*o").FullMatch("hello");
+//
+// You can pass in a "const char*" or a "string" for "text".  The
+// examples below tend to use a const char*.
+//
+// You can, as in the different examples above, store the RE object
+// explicitly in a variable or use a temporary RE object.  The
+// examples below use one mode or the other arbitrarily.  Either
+// could correctly be used for any of these examples.
+//
+// -----------------------------------------------------------------------
+// MATCHING WITH SUB-STRING EXTRACTION:
+//
+// You can supply extra pointer arguments to extract matched subpieces.
+//
+// Example: extracts "ruby" into "s" and 1234 into "i"
+//    int i;
+//    string s;
+//    pcrecpp::RE re("(\\w+):(\\d+)");
+//    re.FullMatch("ruby:1234", &s, &i);
+//
+// Example: does not try to extract any extra sub-patterns
+//    re.FullMatch("ruby:1234", &s);
+//
+// Example: does not try to extract into NULL
+//    re.FullMatch("ruby:1234", NULL, &i);
+//
+// Example: integer overflow causes failure
+//    !re.FullMatch("ruby:1234567891234", NULL, &i);
+//
+// Example: fails because there aren't enough sub-patterns:
+//    !pcrecpp::RE("\\w+:\\d+").FullMatch("ruby:1234", &s);
+//
+// Example: fails because string cannot be stored in integer
+//    !pcrecpp::RE("(.*)").FullMatch("ruby", &i);
+//
+// The provided pointer arguments can be pointers to any scalar numeric
+// type, or one of
+//    string        (matched piece is copied to string)
+//    StringPiece   (StringPiece is mutated to point to matched piece)
+//    T             (where "bool T::ParseFrom(const char*, int)" exists)
+//    NULL          (the corresponding matched sub-pattern is not copied)
+//
+// -----------------------------------------------------------------------
+// DO_MATCH
+//
+// The matching interface supports at most 16 arguments per call.
+// If you need more, consider using the more general interface
+// pcrecpp::RE::DoMatch().  See pcrecpp.h for the signature for DoMatch.
+//
+// -----------------------------------------------------------------------
+// PARTIAL MATCHES
+//
+// You can use the "PartialMatch" operation when you want the pattern
+// to match any substring of the text.
+//
+// Example: simple search for a string:
+//    pcrecpp::RE("ell").PartialMatch("hello");
+//
+// Example: find first number in a string:
+//    int number;
+//    pcrecpp::RE re("(\\d+)");
+//    re.PartialMatch("x*100 + 20", &number);
+//    assert(number == 100);
+//
+// -----------------------------------------------------------------------
+// UTF-8 AND THE MATCHING INTERFACE:
+//
+// By default, pattern and text are plain text, one byte per character.
+// The UTF8 flag, passed to the constructor, causes both pattern
+// and string to be treated as UTF-8 text, still a byte stream but
+// potentially multiple bytes per character. In practice, the text
+// is likelier to be UTF-8 than the pattern, but the match returned
+// may depend on the UTF8 flag, so always use it when matching
+// UTF8 text.  E.g., "." will match one byte normally but with UTF8
+// set may match up to three bytes of a multi-byte character.
+//
+// Example:
+//    pcrecpp::RE_Options options;
+//    options.set_utf8();
+//    pcrecpp::RE re(utf8_pattern, options);
+//    re.FullMatch(utf8_string);
+//
+// Example: using the convenience function UTF8():
+//    pcrecpp::RE re(utf8_pattern, pcrecpp::UTF8());
+//    re.FullMatch(utf8_string);
+//
+// NOTE: The UTF8 option is ignored if pcre was not configured with the
+//       --enable-utf8 flag.
+//
+// -----------------------------------------------------------------------
+// PASSING MODIFIERS TO THE REGULAR EXPRESSION ENGINE
+//
+// PCRE defines some modifiers to change the behavior of the regular
+// expression engine.
+// The C++ wrapper defines an auxiliary class, RE_Options, as a vehicle
+// to pass such modifiers to a RE class.
+//
+// Currently, the following modifiers are supported
+//
+//    modifier              description               Perl corresponding
+//
+//    PCRE_CASELESS         case insensitive match    /i
+//    PCRE_MULTILINE        multiple lines match      /m
+//    PCRE_DOTALL           dot matches newlines      /s
+//    PCRE_DOLLAR_ENDONLY   $ matches only at end     N/A
+//    PCRE_EXTRA            strict escape parsing     N/A
+//    PCRE_EXTENDED         ignore whitespaces        /x
+//    PCRE_UTF8             handles UTF8 chars        built-in
+//    PCRE_UNGREEDY         reverses * and *?         N/A
+//    PCRE_NO_AUTO_CAPTURE  disables matching parens  N/A (*)
+//
+// (For a full account on how each modifier works, please check the
+// PCRE API reference manual).
+//
+// (*) Both Perl and PCRE allow non matching parentheses by means of the
+// "?:" modifier within the pattern itself. e.g. (?:ab|cd) does not
+// capture, while (ab|cd) does.
+//
+// For each modifier, there are two member functions whose name is made
+// out of the modifier in lowercase, without the "PCRE_" prefix. For
+// instance, PCRE_CASELESS is handled by
+//    bool caseless(),
+// which returns true if the modifier is set, and
+//    RE_Options & set_caseless(bool),
+// which sets or unsets the modifier.
+//
+// Moreover, PCRE_CONFIG_MATCH_LIMIT can be accessed through the
+// set_match_limit() and match_limit() member functions.
+// Setting match_limit to a non-zero value will limit the executation of
+// pcre to keep it from doing bad things like blowing the stack or taking
+// an eternity to return a result.  A value of 5000 is good enough to stop
+// stack blowup in a 2MB thread stack.  Setting match_limit to zero will
+// disable match limiting.
+//
+// Normally, to pass one or more modifiers to a RE class, you declare
+// a RE_Options object, set the appropriate options, and pass this
+// object to a RE constructor. Example:
+//
+//    RE_options opt;
+//    opt.set_caseless(true);
+//
+//    if (RE("HELLO", opt).PartialMatch("hello world")) ...
+//
+// RE_options has two constructors. The default constructor takes no
+// arguments and creates a set of flags that are off by default.
+//
+// The optional parameter 'option_flags' is to facilitate transfer
+// of legacy code from C programs.  This lets you do
+//    RE(pattern, RE_Options(PCRE_CASELESS|PCRE_MULTILINE)).PartialMatch(str);
+//
+// But new code is better off doing
+//    RE(pattern,
+//      RE_Options().set_caseless(true).set_multiline(true)).PartialMatch(str);
+// (See below)
+//
+// If you are going to pass one of the most used modifiers, there are some
+// convenience functions that return a RE_Options class with the
+// appropriate modifier already set:
+// CASELESS(), UTF8(), MULTILINE(), DOTALL(), EXTENDED()
+//
+// If you need to set several options at once, and you don't want to go
+// through the pains of declaring a RE_Options object and setting several
+// options, there is a parallel method that give you such ability on the
+// fly. You can concatenate several set_xxxxx member functions, since each
+// of them returns a reference to its class object.  e.g.: to pass
+// PCRE_CASELESS, PCRE_EXTENDED, and PCRE_MULTILINE to a RE with one
+// statement, you may write
+//
+//    RE(" ^ xyz \\s+ .* blah$", RE_Options()
+//                            .set_caseless(true)
+//                            .set_extended(true)
+//                            .set_multiline(true)).PartialMatch(sometext);
+//
+// -----------------------------------------------------------------------
+// SCANNING TEXT INCREMENTALLY
+//
+// The "Consume" operation may be useful if you want to repeatedly
+// match regular expressions at the front of a string and skip over
+// them as they match.  This requires use of the "StringPiece" type,
+// which represents a sub-range of a real string.  Like RE, StringPiece
+// is defined in the pcrecpp namespace.
+//
+// Example: read lines of the form "var = value" from a string.
+//    string contents = ...;                 // Fill string somehow
+//    pcrecpp::StringPiece input(contents);  // Wrap in a StringPiece
+//
+//    string var;
+//    int value;
+//    pcrecpp::RE re("(\\w+) = (\\d+)\n");
+//    while (re.Consume(&input, &var, &value)) {
+//      ...;
+//    }
+//
+// Each successful call to "Consume" will set "var/value", and also
+// advance "input" so it points past the matched text.
+//
+// The "FindAndConsume" operation is similar to "Consume" but does not
+// anchor your match at the beginning of the string.  For example, you
+// could extract all words from a string by repeatedly calling
+//     pcrecpp::RE("(\\w+)").FindAndConsume(&input, &word)
+//
+// -----------------------------------------------------------------------
+// PARSING HEX/OCTAL/C-RADIX NUMBERS
+//
+// By default, if you pass a pointer to a numeric value, the
+// corresponding text is interpreted as a base-10 number.  You can
+// instead wrap the pointer with a call to one of the operators Hex(),
+// Octal(), or CRadix() to interpret the text in another base.  The
+// CRadix operator interprets C-style "0" (base-8) and "0x" (base-16)
+// prefixes, but defaults to base-10.
+//
+// Example:
+//   int a, b, c, d;
+//   pcrecpp::RE re("(.*) (.*) (.*) (.*)");
+//   re.FullMatch("100 40 0100 0x40",
+//                pcrecpp::Octal(&a), pcrecpp::Hex(&b),
+//                pcrecpp::CRadix(&c), pcrecpp::CRadix(&d));
+// will leave 64 in a, b, c, and d.
+//
+// -----------------------------------------------------------------------
+// REPLACING PARTS OF STRINGS
+//
+// You can replace the first match of "pattern" in "str" with
+// "rewrite".  Within "rewrite", backslash-escaped digits (\1 to \9)
+// can be used to insert text matching corresponding parenthesized
+// group from the pattern.  \0 in "rewrite" refers to the entire
+// matching text.  E.g.,
+//
+//   string s = "yabba dabba doo";
+//   pcrecpp::RE("b+").Replace("d", &s);
+//
+// will leave "s" containing "yada dabba doo".  The result is true if
+// the pattern matches and a replacement occurs, or false otherwise.
+//
+// GlobalReplace() is like Replace(), except that it replaces all
+// occurrences of the pattern in the string with the rewrite.
+// Replacements are not subject to re-matching.  E.g.,
+//
+//   string s = "yabba dabba doo";
+//   pcrecpp::RE("b+").GlobalReplace("d", &s);
+//
+// will leave "s" containing "yada dada doo".  It returns the number
+// of replacements made.
+//
+// Extract() is like Replace(), except that if the pattern matches,
+// "rewrite" is copied into "out" (an additional argument) with
+// substitutions.  The non-matching portions of "text" are ignored.
+// Returns true iff a match occurred and the extraction happened
+// successfully.  If no match occurs, the string is left unaffected.
+
+
+#include <string>
+// These aren't technically needed here, but we include them
+// anyway so folks who include pcrecpp.h don't have to include
+// all these other header files as well.
+#include <pcre.h>
+#include <pcre_stringpiece.h>
+
+namespace pcrecpp {
+
+#define PCRE_SET_OR_CLEAR(b, o) \
+    if (b) all_options_ |= (o); else all_options_ &= ~(o); \
+    return *this
+
+#define PCRE_IS_SET(o)  \
+        (all_options_ & o) == o
+
+// We convert user-passed pointers into special Arg objects
+class Arg;
+extern Arg no_arg;
+
+/***** Compiling regular expressions: the RE class *****/
+
+// RE_Options allow you to set options to be passed along to pcre,
+// along with other options we put on top of pcre.
+// Only 9 modifiers, plus match_limit are supported now.
+class RE_Options {
+ public:
+  // constructor
+  RE_Options() : match_limit_(0), all_options_(0) {}
+
+  // alternative constructor.
+  // To facilitate transfer of legacy code from C programs
+  //
+  // This lets you do
+  //    RE(pattern, RE_Options(PCRE_CASELESS|PCRE_MULTILINE)).PartialMatch(str);
+  // But new code is better off doing
+  //    RE(pattern,
+  //      RE_Options().set_caseless(true).set_multiline(true)).PartialMatch(str);
+  RE_Options(int option_flags) : match_limit_(0), all_options_ (option_flags) {}
+  // we're fine with the default destructor, copy constructor, etc.
+
+  // accessors and mutators
+  int match_limit() const { return match_limit_; };
+  RE_Options &set_match_limit(int limit) {
+    match_limit_ = limit;
+    return *this;
+  }
+
+  bool caseless() const {
+    return PCRE_IS_SET(PCRE_CASELESS);
+  }
+  RE_Options &set_caseless(bool x) {
+    PCRE_SET_OR_CLEAR(x, PCRE_CASELESS);
+  }
+
+  bool multiline() const {
+    return PCRE_IS_SET(PCRE_MULTILINE);
+  }
+  RE_Options &set_multiline(bool x) {
+    PCRE_SET_OR_CLEAR(x, PCRE_MULTILINE);
+  }
+
+  bool dotall() const {
+    return PCRE_IS_SET(PCRE_DOTALL);
+  }
+  RE_Options &set_dotall(bool x) {
+    PCRE_SET_OR_CLEAR(x,PCRE_DOTALL);
+  }
+
+  bool extended() const {
+    return PCRE_IS_SET(PCRE_EXTENDED);
+  }
+  RE_Options &set_extended(bool x) {
+    PCRE_SET_OR_CLEAR(x,PCRE_EXTENDED);
+  }
+
+  bool dollar_endonly() const {
+    return PCRE_IS_SET(PCRE_DOLLAR_ENDONLY);
+  }
+  RE_Options &set_dollar_endonly(bool x) {
+    PCRE_SET_OR_CLEAR(x,PCRE_DOLLAR_ENDONLY);
+  }
+
+  bool extra() const {
+    return PCRE_IS_SET( PCRE_EXTRA);
+  }
+  RE_Options &set_extra(bool x) {
+    PCRE_SET_OR_CLEAR(x, PCRE_EXTRA);
+  }
+
+  bool ungreedy() const {
+    return PCRE_IS_SET(PCRE_UNGREEDY);
+  }
+  RE_Options &set_ungreedy(bool x) {
+    PCRE_SET_OR_CLEAR(x, PCRE_UNGREEDY);
+  }
+
+  bool utf8() const {
+    return PCRE_IS_SET(PCRE_UTF8);
+  }
+  RE_Options &set_utf8(bool x) {
+    PCRE_SET_OR_CLEAR(x, PCRE_UTF8);
+  }
+
+  bool no_auto_capture() const {
+    return PCRE_IS_SET(PCRE_NO_AUTO_CAPTURE);
+  }
+  RE_Options &set_no_auto_capture(bool x) {
+    PCRE_SET_OR_CLEAR(x, PCRE_NO_AUTO_CAPTURE);
+  }
+
+  RE_Options &set_all_options(int opt) {
+    all_options_ = opt;
+    return *this;
+  }
+  int all_options() const {
+    return all_options_ ;
+  }
+
+  // TODO: add other pcre flags
+
+ private:
+  int match_limit_;
+  int all_options_;
+};
+
+// These functions return some common RE_Options
+static inline RE_Options UTF8() {
+  return RE_Options().set_utf8(true);
+}
+
+static inline RE_Options CASELESS() {
+  return RE_Options().set_caseless(true);
+}
+static inline RE_Options MULTILINE() {
+  return RE_Options().set_multiline(true);
+}
+
+static inline RE_Options DOTALL() {
+  return RE_Options().set_dotall(true);
+}
+
+static inline RE_Options EXTENDED() {
+  return RE_Options().set_extended(true);
+}
+
+// Interface for regular expression matching.  Also corresponds to a
+// pre-compiled regular expression.  An "RE" object is safe for
+// concurrent use by multiple threads.
+class RE {
+ public:
+  // We provide implicit conversions from strings so that users can
+  // pass in a string or a "const char*" wherever an "RE" is expected.
+  RE(const char* pat) { Init(pat, NULL); }
+  RE(const char *pat, const RE_Options& option) { Init(pat, &option); }
+  RE(const string& pat) { Init(pat.c_str(), NULL); }
+  RE(const string& pat, const RE_Options& option) { Init(pat.c_str(), &option); }
+
+  ~RE();
+
+  // The string specification for this RE.  E.g.
+  //   RE re("ab*c?d+");
+  //   re.pattern();    // "ab*c?d+"
+  const string& pattern() const { return pattern_; }
+
+  // If RE could not be created properly, returns an error string.
+  // Else returns the empty string.
+  const string& error() const { return *error_; }
+
+  /***** The useful part: the matching interface *****/
+
+  // This is provided so one can do pattern.ReplaceAll() just as
+  // easily as ReplaceAll(pattern-text, ....)
+
+  bool FullMatch(const StringPiece& text,
+                 const Arg& ptr1 = no_arg,
+                 const Arg& ptr2 = no_arg,
+                 const Arg& ptr3 = no_arg,
+                 const Arg& ptr4 = no_arg,
+                 const Arg& ptr5 = no_arg,
+                 const Arg& ptr6 = no_arg,
+                 const Arg& ptr7 = no_arg,
+                 const Arg& ptr8 = no_arg,
+                 const Arg& ptr9 = no_arg,
+                 const Arg& ptr10 = no_arg,
+                 const Arg& ptr11 = no_arg,
+                 const Arg& ptr12 = no_arg,
+                 const Arg& ptr13 = no_arg,
+                 const Arg& ptr14 = no_arg,
+                 const Arg& ptr15 = no_arg,
+                 const Arg& ptr16 = no_arg) const;
+
+  bool PartialMatch(const StringPiece& text,
+                    const Arg& ptr1 = no_arg,
+                    const Arg& ptr2 = no_arg,
+                    const Arg& ptr3 = no_arg,
+                    const Arg& ptr4 = no_arg,
+                    const Arg& ptr5 = no_arg,
+                    const Arg& ptr6 = no_arg,
+                    const Arg& ptr7 = no_arg,
+                    const Arg& ptr8 = no_arg,
+                    const Arg& ptr9 = no_arg,
+                    const Arg& ptr10 = no_arg,
+                    const Arg& ptr11 = no_arg,
+                    const Arg& ptr12 = no_arg,
+                    const Arg& ptr13 = no_arg,
+                    const Arg& ptr14 = no_arg,
+                    const Arg& ptr15 = no_arg,
+                    const Arg& ptr16 = no_arg) const;
+
+  bool Consume(StringPiece* input,
+               const Arg& ptr1 = no_arg,
+               const Arg& ptr2 = no_arg,
+               const Arg& ptr3 = no_arg,
+               const Arg& ptr4 = no_arg,
+               const Arg& ptr5 = no_arg,
+               const Arg& ptr6 = no_arg,
+               const Arg& ptr7 = no_arg,
+               const Arg& ptr8 = no_arg,
+               const Arg& ptr9 = no_arg,
+               const Arg& ptr10 = no_arg,
+               const Arg& ptr11 = no_arg,
+               const Arg& ptr12 = no_arg,
+               const Arg& ptr13 = no_arg,
+               const Arg& ptr14 = no_arg,
+               const Arg& ptr15 = no_arg,
+               const Arg& ptr16 = no_arg) const;
+
+  bool FindAndConsume(StringPiece* input,
+                      const Arg& ptr1 = no_arg,
+                      const Arg& ptr2 = no_arg,
+                      const Arg& ptr3 = no_arg,
+                      const Arg& ptr4 = no_arg,
+                      const Arg& ptr5 = no_arg,
+                      const Arg& ptr6 = no_arg,
+                      const Arg& ptr7 = no_arg,
+                      const Arg& ptr8 = no_arg,
+                      const Arg& ptr9 = no_arg,
+                      const Arg& ptr10 = no_arg,
+                      const Arg& ptr11 = no_arg,
+                      const Arg& ptr12 = no_arg,
+                      const Arg& ptr13 = no_arg,
+                      const Arg& ptr14 = no_arg,
+                      const Arg& ptr15 = no_arg,
+                      const Arg& ptr16 = no_arg) const;
+
+  bool Replace(const StringPiece& rewrite,
+               string *str) const;
+
+  int GlobalReplace(const StringPiece& rewrite,
+                    string *str) const;
+
+  bool Extract(const StringPiece &rewrite,
+               const StringPiece &text,
+               string *out) const;
+
+  /***** Generic matching interface *****/
+
+  // Type of match (TODO: Should be restructured as part of RE_Options)
+  enum Anchor {
+    UNANCHORED,         // No anchoring
+    ANCHOR_START,       // Anchor at start only
+    ANCHOR_BOTH         // Anchor at start and end
+  };
+
+  // General matching routine.  Stores the length of the match in
+  // "*consumed" if successful.
+  bool DoMatch(const StringPiece& text,
+               Anchor anchor,
+               int* consumed,
+               const Arg* const* args, int n) const;
+
+  // Return the number of capturing subpatterns, or -1 if the
+  // regexp wasn't valid on construction.
+  int NumberOfCapturingGroups();
+
+ private:
+
+  void Init(const char* pattern, const RE_Options* options);
+
+  // Match against "text", filling in "vec" (up to "vecsize" * 2/3) with
+  // pairs of integers for the beginning and end positions of matched
+  // text.  The first pair corresponds to the entire matched text;
+  // subsequent pairs correspond, in order, to parentheses-captured
+  // matches.  Returns the number of pairs (one more than the number of
+  // the last subpattern with a match) if matching was successful
+  // and zero if the match failed.
+  // I.e. for RE("(foo)|(bar)|(baz)") it will return 2, 3, and 4 when matching
+  // against "foo", "bar", and "baz" respectively.
+  // When matching RE("(foo)|hello") against "hello", it will return 1.
+  // But the values for all subpattern are filled in into "vec".
+  int TryMatch(const StringPiece& text,
+               int startpos,
+               Anchor anchor,
+               int *vec,
+               int vecsize) const;
+
+  // Append the "rewrite" string, with backslash subsitutions from "text"
+  // and "vec", to string "out".
+  bool Rewrite(string *out,
+               const StringPiece& rewrite,
+               const StringPiece& text,
+               int *vec,
+               int veclen) const;
+
+  // internal implementation for DoMatch
+  bool DoMatchImpl(const StringPiece& text,
+                   Anchor anchor,
+                   int* consumed,
+                   const Arg* const args[],
+                   int n,
+                   int* vec,
+                   int vecsize) const;
+
+  // Compile the regexp for the specified anchoring mode
+  pcre* Compile(Anchor anchor);
+
+  string        pattern_;
+  RE_Options    options_;
+  pcre*         re_full_;       // For full matches
+  pcre*         re_partial_;    // For partial matches
+  const string* error_;         // Error indicator (or points to empty string)
+  int           match_limit_;   // limit on execution resources
+
+  // Don't allow the default copy or assignment constructors --
+  // they're expensive and too easy to do by accident.
+  RE(const RE&);
+  void operator=(const RE&);
+};
+
+
+/***** Implementation details *****/
+
+// Hex/Octal/Binary?
+
+// Special class for parsing into objects that define a ParseFrom() method
+template <class T>
+class _RE_MatchObject {
+ public:
+  static inline bool Parse(const char* str, int n, void* dest) {
+    T* object = reinterpret_cast<T*>(dest);
+    return object->ParseFrom(str, n);
+  }
+};
+
+class Arg {
+ public:
+  // Empty constructor so we can declare arrays of Arg
+  Arg();
+
+  // Constructor specially designed for NULL arguments
+  Arg(void*);
+
+  typedef bool (*Parser)(const char* str, int n, void* dest);
+
+// Type-specific parsers
+#define PCRE_MAKE_PARSER(type,name)                             \
+  Arg(type* p) : arg_(p), parser_(name) { }                     \
+  Arg(type* p, Parser parser) : arg_(p), parser_(parser) { }
+
+
+  PCRE_MAKE_PARSER(char,               parse_char);
+  PCRE_MAKE_PARSER(unsigned char,      parse_uchar);
+  PCRE_MAKE_PARSER(short,              parse_short);
+  PCRE_MAKE_PARSER(unsigned short,     parse_ushort);
+  PCRE_MAKE_PARSER(int,                parse_int);
+  PCRE_MAKE_PARSER(unsigned int,       parse_uint);
+  PCRE_MAKE_PARSER(long,               parse_long);
+  PCRE_MAKE_PARSER(unsigned long,      parse_ulong);
+#if 1
+  PCRE_MAKE_PARSER(long long,          parse_longlong);
+#endif
+#if 1
+  PCRE_MAKE_PARSER(unsigned long long, parse_ulonglong);
+#endif
+  PCRE_MAKE_PARSER(float,              parse_float);
+  PCRE_MAKE_PARSER(double,             parse_double);
+  PCRE_MAKE_PARSER(string,             parse_string);
+  PCRE_MAKE_PARSER(StringPiece,        parse_stringpiece);
+
+#undef PCRE_MAKE_PARSER
+
+  // Generic constructor
+  template <class T> Arg(T*, Parser parser);
+  // Generic constructor template
+  template <class T> Arg(T* p)
+    : arg_(p), parser_(_RE_MatchObject<T>::Parse) {
+  }
+
+  // Parse the data
+  bool Parse(const char* str, int n) const;
+
+ private:
+  void*         arg_;
+  Parser        parser_;
+
+  static bool parse_null          (const char* str, int n, void* dest);
+  static bool parse_char          (const char* str, int n, void* dest);
+  static bool parse_uchar         (const char* str, int n, void* dest);
+  static bool parse_float         (const char* str, int n, void* dest);
+  static bool parse_double        (const char* str, int n, void* dest);
+  static bool parse_string        (const char* str, int n, void* dest);
+  static bool parse_stringpiece   (const char* str, int n, void* dest);
+
+#define PCRE_DECLARE_INTEGER_PARSER(name)                                   \
+ private:                                                                   \
+  static bool parse_ ## name(const char* str, int n, void* dest);           \
+  static bool parse_ ## name ## _radix(                                     \
+    const char* str, int n, void* dest, int radix);                         \
+ public:                                                                    \
+  static bool parse_ ## name ## _hex(const char* str, int n, void* dest);   \
+  static bool parse_ ## name ## _octal(const char* str, int n, void* dest); \
+  static bool parse_ ## name ## _cradix(const char* str, int n, void* dest)
+
+  PCRE_DECLARE_INTEGER_PARSER(short);
+  PCRE_DECLARE_INTEGER_PARSER(ushort);
+  PCRE_DECLARE_INTEGER_PARSER(int);
+  PCRE_DECLARE_INTEGER_PARSER(uint);
+  PCRE_DECLARE_INTEGER_PARSER(long);
+  PCRE_DECLARE_INTEGER_PARSER(ulong);
+  PCRE_DECLARE_INTEGER_PARSER(longlong);
+  PCRE_DECLARE_INTEGER_PARSER(ulonglong);
+
+#undef PCRE_DECLARE_INTEGER_PARSER
+};
+
+inline Arg::Arg() : arg_(NULL), parser_(parse_null) { }
+inline Arg::Arg(void* p) : arg_(p), parser_(parse_null) { }
+
+inline bool Arg::Parse(const char* str, int n) const {
+  return (*parser_)(str, n, arg_);
+}
+
+// This part of the parser, appropriate only for ints, deals with bases
+#define MAKE_INTEGER_PARSER(type, name) \
+  inline Arg Hex(type* ptr) { \
+    return Arg(ptr, Arg::parse_ ## name ## _hex); } \
+  inline Arg Octal(type* ptr) { \
+    return Arg(ptr, Arg::parse_ ## name ## _octal); } \
+  inline Arg CRadix(type* ptr) { \
+    return Arg(ptr, Arg::parse_ ## name ## _cradix); }
+
+MAKE_INTEGER_PARSER(short,              short);
+MAKE_INTEGER_PARSER(unsigned short,     ushort);
+MAKE_INTEGER_PARSER(int,                int);
+MAKE_INTEGER_PARSER(unsigned int,       uint);
+MAKE_INTEGER_PARSER(long,               long);
+MAKE_INTEGER_PARSER(unsigned long,      ulong);
+#if 1
+MAKE_INTEGER_PARSER(long long,          longlong);
+#endif
+#if 1
+MAKE_INTEGER_PARSER(unsigned long long, ulonglong);
+#endif
+
+#undef PCRE_IS_SET
+#undef PCRE_SET_OR_CLEAR
+#undef MAKE_INTEGER_PARSER
+
+}   // namespace pcrecpp
+
+
+#endif /* _PCRE_REGEXP_H */
diff --git a/ext/pcre/pcrelib/pcrecpp_unittest.cc b/ext/pcre/pcrelib/pcrecpp_unittest.cc
new file mode 100644 (file)
index 0000000..6a03744
--- /dev/null
@@ -0,0 +1,1042 @@
+// Copyright (c) 2005, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: Sanjay Ghemawat
+//
+// TODO: Test extractions for PartialMatch/Consume
+
+#include <stdio.h>
+#include <vector>
+#include "config.h"
+#include "pcrecpp.h"
+
+using pcrecpp::StringPiece;
+using pcrecpp::RE;
+using pcrecpp::RE_Options;
+using pcrecpp::Hex;
+using pcrecpp::Octal;
+using pcrecpp::CRadix;
+
+static bool VERBOSE_TEST  = false;
+
+// CHECK dies with a fatal error if condition is not true.  It is *not*
+// controlled by NDEBUG, so the check will be executed regardless of
+// compilation mode.  Therefore, it is safe to do things like:
+//    CHECK_EQ(fp->Write(x), 4)
+#define CHECK(condition) do {                           \
+  if (!(condition)) {                                   \
+    fprintf(stderr, "%s:%d: Check failed: %s\n",        \
+            __FILE__, __LINE__, #condition);            \
+    exit(1);                                            \
+  }                                                     \
+} while (0)
+
+#define CHECK_EQ(a, b)   CHECK(a == b)
+
+static void Timing1(int num_iters) {
+  // Same pattern lots of times
+  RE pattern("ruby:\\d+");
+  StringPiece p("ruby:1234");
+  for (int j = num_iters; j > 0; j--) {
+    CHECK(pattern.FullMatch(p));
+  }
+}
+
+static void Timing2(int num_iters) {
+  // Same pattern lots of times
+  RE pattern("ruby:(\\d+)");
+  int i;
+  for (int j = num_iters; j > 0; j--) {
+    CHECK(pattern.FullMatch("ruby:1234", &i));
+    CHECK_EQ(i, 1234);
+  }
+}
+
+static void Timing3(int num_iters) {
+  string text_string;
+  for (int j = num_iters; j > 0; j--) {
+    text_string += "this is another line\n";
+  }
+
+  RE line_matcher(".*\n");
+  string line;
+  StringPiece text(text_string);
+  int counter = 0;
+  while (line_matcher.Consume(&text)) {
+    counter++;
+  }
+  printf("Matched %d lines\n", counter);
+}
+
+#if 0  // uncomment this if you have a way of defining VirtualProcessSize()
+
+static void LeakTest() {
+  // Check for memory leaks
+  unsigned long long initial_size = 0;
+  for (int i = 0; i < 100000; i++) {
+    if (i == 50000) {
+      initial_size = VirtualProcessSize();
+      printf("Size after 50000: %llu\n", initial_size);
+    }
+    char buf[100];
+    snprintf(buf, sizeof(buf), "pat%09d", i);
+    RE newre(buf);
+  }
+  uint64 final_size = VirtualProcessSize();
+  printf("Size after 100000: %llu\n", final_size);
+  const double growth = double(final_size - initial_size) / final_size;
+  printf("Growth: %0.2f%%", growth * 100);
+  CHECK(growth < 0.02);       // Allow < 2% growth
+}
+
+#endif
+
+static void RadixTests() {
+  printf("Testing hex\n");
+
+#define CHECK_HEX(type, value) \
+  do { \
+    type v; \
+    CHECK(RE("([0-9a-fA-F]+)[uUlL]*").FullMatch(#value, Hex(&v))); \
+    CHECK_EQ(v, 0x ## value); \
+    CHECK(RE("([0-9a-fA-FxX]+)[uUlL]*").FullMatch("0x" #value, CRadix(&v))); \
+    CHECK_EQ(v, 0x ## value); \
+  } while(0)
+
+  CHECK_HEX(short,              2bad);
+  CHECK_HEX(unsigned short,     2badU);
+  CHECK_HEX(int,                dead);
+  CHECK_HEX(unsigned int,       deadU);
+  CHECK_HEX(long,               7eadbeefL);
+  CHECK_HEX(unsigned long,      deadbeefUL);
+#ifdef HAVE_LONG_LONG
+  CHECK_HEX(long long,          12345678deadbeefLL);
+#endif
+#ifdef HAVE_UNSIGNED_LONG_LONG
+  CHECK_HEX(unsigned long long, cafebabedeadbeefULL);
+#endif
+
+#undef CHECK_HEX
+
+  printf("Testing octal\n");
+
+#define CHECK_OCTAL(type, value) \
+  do { \
+    type v; \
+    CHECK(RE("([0-7]+)[uUlL]*").FullMatch(#value, Octal(&v))); \
+    CHECK_EQ(v, 0 ## value); \
+    CHECK(RE("([0-9a-fA-FxX]+)[uUlL]*").FullMatch("0" #value, CRadix(&v))); \
+    CHECK_EQ(v, 0 ## value); \
+  } while(0)
+
+  CHECK_OCTAL(short,              77777);
+  CHECK_OCTAL(unsigned short,     177777U);
+  CHECK_OCTAL(int,                17777777777);
+  CHECK_OCTAL(unsigned int,       37777777777U);
+  CHECK_OCTAL(long,               17777777777L);
+  CHECK_OCTAL(unsigned long,      37777777777UL);
+#ifdef HAVE_LONG_LONG
+  CHECK_OCTAL(long long,          777777777777777777777LL);
+#endif
+#ifdef HAVE_UNSIGNED_LONG_LONG
+  CHECK_OCTAL(unsigned long long, 1777777777777777777777ULL);
+#endif
+
+#undef CHECK_OCTAL
+
+  printf("Testing decimal\n");
+
+#define CHECK_DECIMAL(type, value) \
+  do { \
+    type v; \
+    CHECK(RE("(-?[0-9]+)[uUlL]*").FullMatch(#value, &v)); \
+    CHECK_EQ(v, value); \
+    CHECK(RE("(-?[0-9a-fA-FxX]+)[uUlL]*").FullMatch(#value, CRadix(&v))); \
+    CHECK_EQ(v, value); \
+  } while(0)
+
+  CHECK_DECIMAL(short,              -1);
+  CHECK_DECIMAL(unsigned short,     9999);
+  CHECK_DECIMAL(int,                -1000);
+  CHECK_DECIMAL(unsigned int,       12345U);
+  CHECK_DECIMAL(long,               -10000000L);
+  CHECK_DECIMAL(unsigned long,      3083324652U);
+#ifdef HAVE_LONG_LONG
+  CHECK_DECIMAL(long long,          -100000000000000LL);
+#endif
+#ifdef HAVE_UNSIGNED_LONG_LONG
+  CHECK_DECIMAL(unsigned long long, 1234567890987654321ULL);
+#endif
+
+#undef CHECK_DECIMAL
+
+}
+
+static void TestReplace() {
+  printf("Testing Replace\n");
+
+  struct ReplaceTest {
+    const char *regexp;
+    const char *rewrite;
+    const char *original;
+    const char *single;
+    const char *global;
+  };
+  static const ReplaceTest tests[] = {
+    { "(qu|[b-df-hj-np-tv-z]*)([a-z]+)",
+      "\\2\\1ay",
+      "the quick brown fox jumps over the lazy dogs.",
+      "ethay quick brown fox jumps over the lazy dogs.",
+      "ethay ickquay ownbray oxfay umpsjay overay ethay azylay ogsday." },
+    { "\\w+",
+      "\\0-NOSPAM",
+      "paul.haahr@google.com",
+      "paul-NOSPAM.haahr@google.com",
+      "paul-NOSPAM.haahr-NOSPAM@google-NOSPAM.com-NOSPAM" },
+    { "^",
+      "(START)",
+      "foo",
+      "(START)foo",
+      "(START)foo" },
+    { "^",
+      "(START)",
+      "",
+      "(START)",
+      "(START)" },
+    { "$",
+      "(END)",
+      "",
+      "(END)",
+      "(END)" },
+    { "b",
+      "bb",
+      "ababababab",
+      "abbabababab",
+      "abbabbabbabbabb" },
+    { "b",
+      "bb",
+      "bbbbbb",
+      "bbbbbbb",
+      "bbbbbbbbbbbb" },
+    { "b+",
+      "bb",
+      "bbbbbb",
+      "bb",
+      "bb" },
+    { "b*",
+      "bb",
+      "bbbbbb",
+      "bb",
+      "bb" },
+    { "b*",
+      "bb",
+      "aaaaa",
+      "bbaaaaa",
+      "bbabbabbabbabbabb" },
+    { "", NULL, NULL, NULL, NULL }
+  };
+
+  for (const ReplaceTest *t = tests; t->original != NULL; ++t) {
+    string one(t->original);
+    CHECK(RE(t->regexp).Replace(t->rewrite, &one));
+    CHECK_EQ(one, t->single);
+    string all(t->original);
+    CHECK(RE(t->regexp).GlobalReplace(t->rewrite, &all) > 0);
+    CHECK_EQ(all, t->global);
+  }
+}
+
+static void TestExtract() {
+  printf("Testing Extract\n");
+
+  string s;
+
+  CHECK(RE("(.*)@([^.]*)").Extract("\\2!\\1", "boris@kremvax.ru", &s));
+  CHECK_EQ(s, "kremvax!boris");
+
+  // check the RE interface as well
+  CHECK(RE(".*").Extract("'\\0'", "foo", &s));
+  CHECK_EQ(s, "'foo'");
+  CHECK(!RE("bar").Extract("'\\0'", "baz", &s));
+  CHECK_EQ(s, "'foo'");
+}
+
+static void TestConsume() {
+  printf("Testing Consume\n");
+
+  string word;
+
+  string s("   aaa b!@#$@#$cccc");
+  StringPiece input(s);
+
+  RE r("\\s*(\\w+)");    // matches a word, possibly proceeded by whitespace
+  CHECK(r.Consume(&input, &word));
+  CHECK_EQ(word, "aaa");
+  CHECK(r.Consume(&input, &word));
+  CHECK_EQ(word, "b");
+  CHECK(! r.Consume(&input, &word));
+}
+
+static void TestFindAndConsume() {
+  printf("Testing FindAndConsume\n");
+
+  string word;
+
+  string s("   aaa b!@#$@#$cccc");
+  StringPiece input(s);
+
+  RE r("(\\w+)");      // matches a word
+  CHECK(r.FindAndConsume(&input, &word));
+  CHECK_EQ(word, "aaa");
+  CHECK(r.FindAndConsume(&input, &word));
+  CHECK_EQ(word, "b");
+  CHECK(r.FindAndConsume(&input, &word));
+  CHECK_EQ(word, "cccc");
+  CHECK(! r.FindAndConsume(&input, &word));
+}
+
+static void TestMatchNumberPeculiarity() {
+  printf("Testing match-number peculiaraity\n");
+
+  string word1;
+  string word2;
+  string word3;
+
+  RE r("(foo)|(bar)|(baz)");
+  CHECK(r.PartialMatch("foo", &word1, &word2, &word3));
+  CHECK_EQ(word1, "foo");
+  CHECK_EQ(word2, "");
+  CHECK_EQ(word3, "");
+  CHECK(r.PartialMatch("bar", &word1, &word2, &word3));
+  CHECK_EQ(word1, "");
+  CHECK_EQ(word2, "bar");
+  CHECK_EQ(word3, "");
+  CHECK(r.PartialMatch("baz", &word1, &word2, &word3));
+  CHECK_EQ(word1, "");
+  CHECK_EQ(word2, "");
+  CHECK_EQ(word3, "baz");
+  CHECK(!r.PartialMatch("f", &word1, &word2, &word3));
+
+  string a;
+  CHECK(RE("(foo)|hello").FullMatch("hello", &a));
+  CHECK_EQ(a, "");
+}
+
+static void TestRecursion(int size, const char *pattern, int match_limit) {
+  printf("Testing recursion\n");
+
+  // Fill up a string repeating the pattern given
+  string domain;
+  domain.resize(size);
+  int patlen = strlen(pattern);
+  for (int i = 0; i < size; ++i) {
+    domain[i] = pattern[i % patlen];
+  }
+  // Just make sure it doesn't crash due to too much recursion.
+  RE_Options options;
+  options.set_match_limit(match_limit);
+  RE re("([a-zA-Z0-9]|-)+(\\.([a-zA-Z0-9]|-)+)*(\\.)?", options);
+  re.FullMatch(domain);
+}
+
+//
+// Options tests contributed by
+// Giuseppe Maxia, CTO, Stardata s.r.l.
+// July 2005
+//
+static void GetOneOptionResult(
+                const char *option_name,
+                const char *regex,
+                const char *str,
+                RE_Options options,
+                bool full,
+                string expected) {
+
+  printf("Testing Option <%s>\n", option_name);
+  if(VERBOSE_TEST)
+    printf("/%s/ finds \"%s\" within \"%s\" \n",
+                    regex,
+                    expected.c_str(),
+                    str);
+  string captured("");
+  if (full)
+    RE(regex,options).FullMatch(str, &captured);
+  else
+    RE(regex,options).PartialMatch(str, &captured);
+  CHECK_EQ(captured, expected);
+}
+
+static void TestOneOption(
+                const char *option_name,
+                const char *regex,
+                const char *str,
+                RE_Options options,
+                bool full,
+                bool assertive = true) {
+
+  printf("Testing Option <%s>\n", option_name);
+  if (VERBOSE_TEST)
+    printf("'%s' %s /%s/ \n",
+                  str,
+                  (assertive? "matches" : "doesn't match"),
+                  regex);
+  if (assertive) {
+    if (full)
+      CHECK(RE(regex,options).FullMatch(str));
+    else
+      CHECK(RE(regex,options).PartialMatch(str));
+  } else {
+    if (full)
+      CHECK(!RE(regex,options).FullMatch(str));
+    else
+      CHECK(!RE(regex,options).PartialMatch(str));
+  }
+}
+
+static void Test_CASELESS() {
+  RE_Options options;
+  RE_Options options2;
+
+  options.set_caseless(true);
+  TestOneOption("CASELESS (class)",  "HELLO",    "hello", options, false);
+  TestOneOption("CASELESS (class2)", "HELLO",    "hello", options2.set_caseless(true), false);
+  TestOneOption("CASELESS (class)",  "^[A-Z]+$", "Hello", options, false);
+
+  TestOneOption("CASELESS (function)", "HELLO",    "hello", pcrecpp::CASELESS(), false);
+  TestOneOption("CASELESS (function)", "^[A-Z]+$", "Hello", pcrecpp::CASELESS(), false);
+  options.set_caseless(false);
+  TestOneOption("no CASELESS", "HELLO",    "hello", options, false, false);
+}
+
+static void Test_MULTILINE() {
+  RE_Options options;
+  RE_Options options2;
+  const char *str = "HELLO\n" "cruel\n" "world\n";
+
+  options.set_multiline(true);
+  TestOneOption("MULTILINE (class)",    "^cruel$", str, options, false);
+  TestOneOption("MULTILINE (class2)",   "^cruel$", str, options2.set_multiline(true), false);
+  TestOneOption("MULTILINE (function)", "^cruel$", str, pcrecpp::MULTILINE(), false);
+  options.set_multiline(false);
+  TestOneOption("no MULTILINE", "^cruel$", str, options, false, false);
+}
+
+static void Test_DOTALL() {
+  RE_Options options;
+  RE_Options options2;
+  const char *str = "HELLO\n" "cruel\n" "world";
+
+  options.set_dotall(true);
+  TestOneOption("DOTALL (class)",    "HELLO.*world", str, options, true);
+  TestOneOption("DOTALL (class2)",   "HELLO.*world", str, options2.set_dotall(true), true);
+  TestOneOption("DOTALL (function)",    "HELLO.*world", str, pcrecpp::DOTALL(), true);
+  options.set_dotall(false);
+  TestOneOption("no DOTALL", "HELLO.*world", str, options, true, false);
+}
+
+static void Test_DOLLAR_ENDONLY() {
+  RE_Options options;
+  RE_Options options2;
+  const char *str = "HELLO world\n";
+
+  TestOneOption("no DOLLAR_ENDONLY", "world$", str, options, false);
+  options.set_dollar_endonly(true);
+  TestOneOption("DOLLAR_ENDONLY 1",    "world$", str, options, false, false);
+  TestOneOption("DOLLAR_ENDONLY 2",    "world$", str, options2.set_dollar_endonly(true), false, false);
+}
+
+static void Test_EXTRA() {
+  RE_Options options;
+  const char *str = "HELLO";
+
+  options.set_extra(true);
+  TestOneOption("EXTRA 1", "\\HELL\\O", str, options, true, false );
+  TestOneOption("EXTRA 2", "\\HELL\\O", str, RE_Options().set_extra(true), true, false );
+  options.set_extra(false);
+  TestOneOption("no EXTRA", "\\HELL\\O", str, options, true );
+}
+
+static void Test_EXTENDED() {
+  RE_Options options;
+  RE_Options options2;
+  const char *str = "HELLO world";
+
+  options.set_extended(true);
+  TestOneOption("EXTENDED (class)",    "HELLO world", str, options, false, false);
+  TestOneOption("EXTENDED (class2)",   "HELLO world", str, options2.set_extended(true), false, false);
+  TestOneOption("EXTENDED (class)",
+                    "^ HE L{2} O "
+                    "\\s+        "
+                    "\\w+ $      ",
+                    str,
+                    options,
+                    false);
+
+  TestOneOption("EXTENDED (function)",    "HELLO world", str, pcrecpp::EXTENDED(), false, false);
+  TestOneOption("EXTENDED (function)",
+                    "^ HE L{2} O "
+                    "\\s+        "
+                    "\\w+ $      ",
+                    str,
+                    pcrecpp::EXTENDED(),
+                    false);
+
+  options.set_extended(false);
+  TestOneOption("no EXTENDED", "HELLO world", str, options, false);
+}
+
+static void Test_NO_AUTO_CAPTURE() {
+  RE_Options options;
+  const char *str = "HELLO world";
+  string captured;
+
+  printf("Testing Option <no NO_AUTO_CAPTURE>\n");
+  if (VERBOSE_TEST)
+    printf("parentheses capture text\n");
+  RE re("(world|universe)$", options);
+  CHECK(re.Extract("\\1", str , &captured));
+  CHECK_EQ(captured, "world");
+  options.set_no_auto_capture(true);
+  printf("testing Option <NO_AUTO_CAPTURE>\n");
+  if (VERBOSE_TEST)
+    printf("parentheses do not capture text\n");
+  re.Extract("\\1",str, &captured );
+  CHECK_EQ(captured, "world");
+}
+
+static void Test_UNGREEDY() {
+  RE_Options options;
+  const char *str = "HELLO, 'this' is the 'world'";
+
+  options.set_ungreedy(true);
+  GetOneOptionResult("UNGREEDY 1", "('.*')", str, options, false, "'this'" );
+  GetOneOptionResult("UNGREEDY 2", "('.*')", str, RE_Options().set_ungreedy(true), false, "'this'" );
+  GetOneOptionResult("UNGREEDY", "('.*?')", str, options, false, "'this' is the 'world'" );
+
+  options.set_ungreedy(false);
+  GetOneOptionResult("no UNGREEDY", "('.*')", str, options, false, "'this' is the 'world'" );
+  GetOneOptionResult("no UNGREEDY", "('.*?')", str, options, false, "'this'" );
+}
+
+static void Test_all_options() {
+  const char *str = "HELLO\n" "cruel\n" "world";
+  RE_Options options;
+  options.set_all_options(PCRE_CASELESS | PCRE_DOTALL);
+
+  TestOneOption("all_options (CASELESS|DOTALL)", "^hello.*WORLD", str , options, false);
+  options.set_all_options(0);
+  TestOneOption("all_options (0)", "^hello.*WORLD", str , options, false, false);
+  options.set_all_options(PCRE_MULTILINE | PCRE_EXTENDED);
+
+  TestOneOption("all_options (MULTILINE|EXTENDED)", " ^ c r u e l $ ", str, options, false);
+  TestOneOption("all_options (MULTILINE|EXTENDED) with constructor",
+                  " ^ c r u e l $ ",
+                  str,
+                  RE_Options(PCRE_MULTILINE | PCRE_EXTENDED),
+                  false);
+
+  TestOneOption("all_options (MULTILINE|EXTENDED) with concatenation",
+                  " ^ c r u e l $ ",
+                  str,
+                  RE_Options()
+                       .set_multiline(true)
+                       .set_extended(true),
+                  false);
+
+  options.set_all_options(0);
+  TestOneOption("all_options (0)", "^ c r u e l $", str, options, false, false);
+
+}
+
+static void TestOptions() {
+  printf("Testing Options\n");
+  Test_CASELESS();
+  Test_MULTILINE();
+  Test_DOTALL();
+  Test_DOLLAR_ENDONLY();
+  Test_EXTENDED();
+  Test_NO_AUTO_CAPTURE();
+  Test_UNGREEDY();
+  Test_EXTRA();
+  Test_all_options();
+}
+
+int main(int argc, char** argv) {
+  // Treat any flag as --help
+  if (argc > 1 && argv[1][0] == '-') {
+    printf("Usage: %s [timing1|timing2|timing3 num-iters]\n"
+           "       If 'timingX ###' is specified, run the given timing test\n"
+           "       with the given number of iterations, rather than running\n"
+           "       the default corectness test.\n", argv[0]);
+    return 0;
+  }
+
+  if (argc > 1) {
+    if ( argc == 2 || atoi(argv[2]) == 0) {
+      printf("timing mode needs a num-iters argument\n");
+      return 1;
+    }
+    if (!strcmp(argv[1], "timing1"))
+      Timing1(atoi(argv[2]));
+    else if (!strcmp(argv[1], "timing2"))
+      Timing2(atoi(argv[2]));
+    else if (!strcmp(argv[1], "timing3"))
+      Timing3(atoi(argv[2]));
+    else
+      printf("Unknown argument '%s'\n", argv[1]);
+    return 0;
+  }
+
+  printf("Testing FullMatch\n");
+
+  int i;
+  string s;
+
+  /***** FullMatch with no args *****/
+
+  CHECK(RE("h.*o").FullMatch("hello"));
+  CHECK(!RE("h.*o").FullMatch("othello"));
+  CHECK(!RE("h.*o").FullMatch("hello!"));
+
+  /***** FullMatch with args *****/
+
+  // Zero-arg
+  CHECK(RE("\\d+").FullMatch("1001"));
+
+  // Single-arg
+  CHECK(RE("(\\d+)").FullMatch("1001",   &i));
+  CHECK_EQ(i, 1001);
+  CHECK(RE("(-?\\d+)").FullMatch("-123", &i));
+  CHECK_EQ(i, -123);
+  CHECK(!RE("()\\d+").FullMatch("10", &i));
+  CHECK(!RE("(\\d+)").FullMatch("1234567890123456789012345678901234567890",
+                                &i));
+
+  // Digits surrounding integer-arg
+  CHECK(RE("1(\\d*)4").FullMatch("1234", &i));
+  CHECK_EQ(i, 23);
+  CHECK(RE("(\\d)\\d+").FullMatch("1234", &i));
+  CHECK_EQ(i, 1);
+  CHECK(RE("(-\\d)\\d+").FullMatch("-1234", &i));
+  CHECK_EQ(i, -1);
+  CHECK(RE("(\\d)").PartialMatch("1234", &i));
+  CHECK_EQ(i, 1);
+  CHECK(RE("(-\\d)").PartialMatch("-1234", &i));
+  CHECK_EQ(i, -1);
+
+  // String-arg
+  CHECK(RE("h(.*)o").FullMatch("hello", &s));
+  CHECK_EQ(s, string("ell"));
+
+  // StringPiece-arg
+  StringPiece sp;
+  CHECK(RE("(\\w+):(\\d+)").FullMatch("ruby:1234", &sp, &i));
+  CHECK_EQ(sp.size(), 4);
+  CHECK(memcmp(sp.data(), "ruby", 4) == 0);
+  CHECK_EQ(i, 1234);
+
+  // Multi-arg
+  CHECK(RE("(\\w+):(\\d+)").FullMatch("ruby:1234", &s, &i));
+  CHECK_EQ(s, string("ruby"));
+  CHECK_EQ(i, 1234);
+
+  // Ignored arg
+  CHECK(RE("(\\w+)(:)(\\d+)").FullMatch("ruby:1234", &s, (void*)NULL, &i));
+  CHECK_EQ(s, string("ruby"));
+  CHECK_EQ(i, 1234);
+
+  // Type tests
+  {
+    char c;
+    CHECK(RE("(H)ello").FullMatch("Hello", &c));
+    CHECK_EQ(c, 'H');
+  }
+  {
+    unsigned char c;
+    CHECK(RE("(H)ello").FullMatch("Hello", &c));
+    CHECK_EQ(c, static_cast<unsigned char>('H'));
+  }
+  {
+    short v;
+    CHECK(RE("(-?\\d+)").FullMatch("100",     &v));    CHECK_EQ(v, 100);
+    CHECK(RE("(-?\\d+)").FullMatch("-100",    &v));    CHECK_EQ(v, -100);
+    CHECK(RE("(-?\\d+)").FullMatch("32767",   &v));    CHECK_EQ(v, 32767);
+    CHECK(RE("(-?\\d+)").FullMatch("-32768",  &v));    CHECK_EQ(v, -32768);
+    CHECK(!RE("(-?\\d+)").FullMatch("-32769", &v));
+    CHECK(!RE("(-?\\d+)").FullMatch("32768",  &v));
+  }
+  {
+    unsigned short v;
+    CHECK(RE("(\\d+)").FullMatch("100",     &v));    CHECK_EQ(v, 100);
+    CHECK(RE("(\\d+)").FullMatch("32767",   &v));    CHECK_EQ(v, 32767);
+    CHECK(RE("(\\d+)").FullMatch("65535",   &v));    CHECK_EQ(v, 65535);
+    CHECK(!RE("(\\d+)").FullMatch("65536",  &v));
+  }
+  {
+    int v;
+    static const int max_value = 0x7fffffff;
+    static const int min_value = -max_value - 1;
+    CHECK(RE("(-?\\d+)").FullMatch("100",         &v)); CHECK_EQ(v, 100);
+    CHECK(RE("(-?\\d+)").FullMatch("-100",        &v)); CHECK_EQ(v, -100);
+    CHECK(RE("(-?\\d+)").FullMatch("2147483647",  &v)); CHECK_EQ(v, max_value);
+    CHECK(RE("(-?\\d+)").FullMatch("-2147483648", &v)); CHECK_EQ(v, min_value);
+    CHECK(!RE("(-?\\d+)").FullMatch("-2147483649", &v));
+    CHECK(!RE("(-?\\d+)").FullMatch("2147483648",  &v));
+  }
+  {
+    unsigned int v;
+    static const unsigned int max_value = 0xfffffffful;
+    CHECK(RE("(\\d+)").FullMatch("100",         &v)); CHECK_EQ(v, 100);
+    CHECK(RE("(\\d+)").FullMatch("4294967295",  &v)); CHECK_EQ(v, max_value);
+    CHECK(!RE("(\\d+)").FullMatch("4294967296", &v));
+  }
+#ifdef HAVE_LONG_LONG
+  {
+    long long v;
+    static const long long max_value = 0x7fffffffffffffffLL;
+    static const long long min_value = -max_value - 1;
+    char buf[32];
+
+    CHECK(RE("(-?\\d+)").FullMatch("100", &v)); CHECK_EQ(v, 100);
+    CHECK(RE("(-?\\d+)").FullMatch("-100",&v)); CHECK_EQ(v, -100);
+
+    snprintf(buf, sizeof(buf), "%lld", max_value);
+    CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, max_value);
+
+    snprintf(buf, sizeof(buf), "%lld", min_value);
+    CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, min_value);
+
+    snprintf(buf, sizeof(buf), "%lld", max_value);
+    assert(buf[strlen(buf)-1] != '9');
+    buf[strlen(buf)-1]++;
+    CHECK(!RE("(-?\\d+)").FullMatch(buf, &v));
+
+    snprintf(buf, sizeof(buf), "%lld", min_value);
+    assert(buf[strlen(buf)-1] != '9');
+    buf[strlen(buf)-1]++;
+    CHECK(!RE("(-?\\d+)").FullMatch(buf, &v));
+  }
+#endif
+#if defined HAVE_UNSIGNED_LONG_LONG && defined HAVE_LONG_LONG
+  {
+    unsigned long long v;
+    long long v2;
+    static const unsigned long long max_value = 0xffffffffffffffffULL;
+    char buf[32];
+
+    CHECK(RE("(-?\\d+)").FullMatch("100",&v)); CHECK_EQ(v, 100);
+    CHECK(RE("(-?\\d+)").FullMatch("-100",&v2)); CHECK_EQ(v2, -100);
+
+    snprintf(buf, sizeof(buf), "%llu", max_value);
+    CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, max_value);
+
+    assert(buf[strlen(buf)-1] != '9');
+    buf[strlen(buf)-1]++;
+    CHECK(!RE("(-?\\d+)").FullMatch(buf, &v));
+  }
+#endif
+  {
+    float v;
+    CHECK(RE("(.*)").FullMatch("100", &v));
+    CHECK(RE("(.*)").FullMatch("-100.", &v));
+    CHECK(RE("(.*)").FullMatch("1e23", &v));
+  }
+  {
+    double v;
+    CHECK(RE("(.*)").FullMatch("100", &v));
+    CHECK(RE("(.*)").FullMatch("-100.", &v));
+    CHECK(RE("(.*)").FullMatch("1e23", &v));
+  }
+
+  // Check that matching is fully anchored
+  CHECK(!RE("(\\d+)").FullMatch("x1001",  &i));
+  CHECK(!RE("(\\d+)").FullMatch("1001x",  &i));
+  CHECK(RE("x(\\d+)").FullMatch("x1001", &i)); CHECK_EQ(i, 1001);
+  CHECK(RE("(\\d+)x").FullMatch("1001x", &i)); CHECK_EQ(i, 1001);
+
+  // Braces
+  CHECK(RE("[0-9a-f+.-]{5,}").FullMatch("0abcd"));
+  CHECK(RE("[0-9a-f+.-]{5,}").FullMatch("0abcde"));
+  CHECK(!RE("[0-9a-f+.-]{5,}").FullMatch("0abc"));
+
+  // Complicated RE
+  CHECK(RE("foo|bar|[A-Z]").FullMatch("foo"));
+  CHECK(RE("foo|bar|[A-Z]").FullMatch("bar"));
+  CHECK(RE("foo|bar|[A-Z]").FullMatch("X"));
+  CHECK(!RE("foo|bar|[A-Z]").FullMatch("XY"));
+
+  // Check full-match handling (needs '$' tacked on internally)
+  CHECK(RE("fo|foo").FullMatch("fo"));
+  CHECK(RE("fo|foo").FullMatch("foo"));
+  CHECK(RE("fo|foo$").FullMatch("fo"));
+  CHECK(RE("fo|foo$").FullMatch("foo"));
+  CHECK(RE("foo$").FullMatch("foo"));
+  CHECK(!RE("foo\\$").FullMatch("foo$bar"));
+  CHECK(!RE("fo|bar").FullMatch("fox"));
+
+  // Uncomment the following if we change the handling of '$' to
+  // prevent it from matching a trailing newline
+  if (false) {
+    // Check that we don't get bitten by pcre's special handling of a
+    // '\n' at the end of the string matching '$'
+    CHECK(!RE("foo$").PartialMatch("foo\n"));
+  }
+
+  // Number of args
+  int a[16];
+  CHECK(RE("").FullMatch(""));
+
+  memset(a, 0, sizeof(0));
+  CHECK(RE("(\\d){1}").FullMatch("1",
+                                 &a[0]));
+  CHECK_EQ(a[0], 1);
+
+  memset(a, 0, sizeof(0));
+  CHECK(RE("(\\d)(\\d)").FullMatch("12",
+                                   &a[0],  &a[1]));
+  CHECK_EQ(a[0], 1);
+  CHECK_EQ(a[1], 2);
+
+  memset(a, 0, sizeof(0));
+  CHECK(RE("(\\d)(\\d)(\\d)").FullMatch("123",
+                                        &a[0],  &a[1],  &a[2]));
+  CHECK_EQ(a[0], 1);
+  CHECK_EQ(a[1], 2);
+  CHECK_EQ(a[2], 3);
+
+  memset(a, 0, sizeof(0));
+  CHECK(RE("(\\d)(\\d)(\\d)(\\d)").FullMatch("1234",
+                                             &a[0],  &a[1],  &a[2],  &a[3]));
+  CHECK_EQ(a[0], 1);
+  CHECK_EQ(a[1], 2);
+  CHECK_EQ(a[2], 3);
+  CHECK_EQ(a[3], 4);
+
+  memset(a, 0, sizeof(0));
+  CHECK(RE("(\\d)(\\d)(\\d)(\\d)(\\d)").FullMatch("12345",
+                                                  &a[0],  &a[1],  &a[2],
+                                                  &a[3],  &a[4]));
+  CHECK_EQ(a[0], 1);
+  CHECK_EQ(a[1], 2);
+  CHECK_EQ(a[2], 3);
+  CHECK_EQ(a[3], 4);
+  CHECK_EQ(a[4], 5);
+
+  memset(a, 0, sizeof(0));
+  CHECK(RE("(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)").FullMatch("123456",
+                                                       &a[0],  &a[1],  &a[2],
+                                                       &a[3],  &a[4],  &a[5]));
+  CHECK_EQ(a[0], 1);
+  CHECK_EQ(a[1], 2);
+  CHECK_EQ(a[2], 3);
+  CHECK_EQ(a[3], 4);
+  CHECK_EQ(a[4], 5);
+  CHECK_EQ(a[5], 6);
+
+  memset(a, 0, sizeof(0));
+  CHECK(RE("(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)").FullMatch("1234567",
+                                                            &a[0],  &a[1],  &a[2],  &a[3],
+                                                            &a[4],  &a[5],  &a[6]));
+  CHECK_EQ(a[0], 1);
+  CHECK_EQ(a[1], 2);
+  CHECK_EQ(a[2], 3);
+  CHECK_EQ(a[3], 4);
+  CHECK_EQ(a[4], 5);
+  CHECK_EQ(a[5], 6);
+  CHECK_EQ(a[6], 7);
+
+  memset(a, 0, sizeof(0));
+  CHECK(RE("(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)"
+           "(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)").FullMatch(
+               "1234567890123456",
+               &a[0],  &a[1],  &a[2],  &a[3],
+               &a[4],  &a[5],  &a[6],  &a[7],
+               &a[8],  &a[9],  &a[10], &a[11],
+               &a[12], &a[13], &a[14], &a[15]));
+  CHECK_EQ(a[0], 1);
+  CHECK_EQ(a[1], 2);
+  CHECK_EQ(a[2], 3);
+  CHECK_EQ(a[3], 4);
+  CHECK_EQ(a[4], 5);
+  CHECK_EQ(a[5], 6);
+  CHECK_EQ(a[6], 7);
+  CHECK_EQ(a[7], 8);
+  CHECK_EQ(a[8], 9);
+  CHECK_EQ(a[9], 0);
+  CHECK_EQ(a[10], 1);
+  CHECK_EQ(a[11], 2);
+  CHECK_EQ(a[12], 3);
+  CHECK_EQ(a[13], 4);
+  CHECK_EQ(a[14], 5);
+  CHECK_EQ(a[15], 6);
+
+  /***** PartialMatch *****/
+
+  printf("Testing PartialMatch\n");
+
+  CHECK(RE("h.*o").PartialMatch("hello"));
+  CHECK(RE("h.*o").PartialMatch("othello"));
+  CHECK(RE("h.*o").PartialMatch("hello!"));
+  CHECK(RE("((((((((((((((((((((x))))))))))))))))))))").PartialMatch("x"));
+
+  RadixTests();
+  TestReplace();
+  TestExtract();
+  TestConsume();
+  TestFindAndConsume();
+  TestMatchNumberPeculiarity();
+
+  // Check the pattern() accessor
+  {
+    const string kPattern = "http://([^/]+)/.*";
+    const RE re(kPattern);
+    CHECK_EQ(kPattern, re.pattern());
+  }
+
+  // Check RE error field.
+  {
+    RE re("foo");
+    CHECK(re.error().empty());  // Must have no error
+  }
+
+#ifdef SUPPORT_UTF8
+  // Check UTF-8 handling
+  {
+    printf("Testing UTF-8 handling\n");
+
+    // Three Japanese characters (nihongo)
+    const char utf8_string[] = {
+         0xe6, 0x97, 0xa5, // 65e5
+         0xe6, 0x9c, 0xac, // 627c
+         0xe8, 0xaa, 0x9e, // 8a9e
+         0
+    };
+    const char utf8_pattern[] = {
+         '.',
+         0xe6, 0x9c, 0xac, // 627c
+         '.',
+         0
+    };
+
+    // Both should match in either mode, bytes or UTF-8
+    RE re_test1(".........");
+    CHECK(re_test1.FullMatch(utf8_string));
+    RE re_test2("...", pcrecpp::UTF8());
+    CHECK(re_test2.FullMatch(utf8_string));
+
+    // Check that '.' matches one byte or UTF-8 character
+    // according to the mode.
+    string ss;
+    RE re_test3("(.)");
+    CHECK(re_test3.PartialMatch(utf8_string, &ss));
+    CHECK_EQ(ss, string("\xe6"));
+    RE re_test4("(.)", pcrecpp::UTF8());
+    CHECK(re_test4.PartialMatch(utf8_string, &ss));
+    CHECK_EQ(ss, string("\xe6\x97\xa5"));
+
+    // Check that string matches itself in either mode
+    RE re_test5(utf8_string);
+    CHECK(re_test5.FullMatch(utf8_string));
+    RE re_test6(utf8_string, pcrecpp::UTF8());
+    CHECK(re_test6.FullMatch(utf8_string));
+
+    // Check that pattern matches string only in UTF8 mode
+    RE re_test7(utf8_pattern);
+    CHECK(!re_test7.FullMatch(utf8_string));
+    RE re_test8(utf8_pattern, pcrecpp::UTF8());
+    CHECK(re_test8.FullMatch(utf8_string));
+  }
+
+  // Check that ungreedy, UTF8 regular expressions don't match when they
+  // oughtn't -- see bug 82246.
+  {
+    // This code always worked.
+    const char* pattern = "\\w+X";
+    const string target = "a aX";
+    RE match_sentence(pattern);
+    RE match_sentence_re(pattern, pcrecpp::UTF8());
+
+    CHECK(!match_sentence.FullMatch(target));
+    CHECK(!match_sentence_re.FullMatch(target));
+  }
+
+  {
+    const char* pattern = "(?U)\\w+X";
+    const string target = "a aX";
+    RE match_sentence(pattern);
+    RE match_sentence_re(pattern, pcrecpp::UTF8());
+
+    CHECK(!match_sentence.FullMatch(target));
+    CHECK(!match_sentence_re.FullMatch(target));
+  }
+#endif  /* def SUPPORT_UTF8 */
+
+  printf("Testing error reporting\n");
+
+  { RE re("a\\1"); CHECK(!re.error().empty()); }
+  {
+    RE re("a[x");
+    CHECK(!re.error().empty());
+  }
+  {
+    RE re("a[z-a]");
+    CHECK(!re.error().empty());
+  }
+  {
+    RE re("a[[:foobar:]]");
+    CHECK(!re.error().empty());
+  }
+  {
+    RE re("a(b");
+    CHECK(!re.error().empty());
+  }
+  {
+    RE re("a\\");
+    CHECK(!re.error().empty());
+  }
+
+  // Test that recursion is stopped: there will be some errors reported
+  int matchlimit = 5000;
+  int bytes = 15 * 1024;  // enough to crash if there was no match limit
+  TestRecursion(bytes, ".", matchlimit);
+  TestRecursion(bytes, "a", matchlimit);
+  TestRecursion(bytes, "a.", matchlimit);
+  TestRecursion(bytes, "ab.", matchlimit);
+  TestRecursion(bytes, "abc.", matchlimit);
+
+  // Test Options
+  if (getenv("VERBOSE_TEST") != NULL)
+    VERBOSE_TEST  = true;
+  TestOptions();
+
+  // Done
+  printf("OK\n");
+
+  return 0;
+}
index 21b2a9bbae5b6d6060808a1d6638a3fe1d84b4bd..f6e5180557e5c2f84b3a7724e0615ff7b6bceb2c 100644 (file)
@@ -6,7 +6,7 @@
 its pattern matching. On a Unix or Win32 system it can recurse into
 directories.
 
-           Copyright (c) 1997-2004 University of Cambridge
+           Copyright (c) 1997-2005 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -42,6 +42,11 @@ POSSIBILITY OF SUCH DAMAGE.
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
 #include "config.h"
 #include "pcre.h"
 
@@ -50,51 +55,89 @@ POSSIBILITY OF SUCH DAMAGE.
 
 typedef int BOOL;
 
-#define VERSION "3.0 14-Jan-2003"
+#define VERSION "4.0 07-Jun-2005"
 #define MAX_PATTERN_COUNT 100
 
+#if BUFSIZ > 8192
+#define MBUFTHIRD BUFSIZ
+#else
+#define MBUFTHIRD 8192
+#endif
+
+
 
 /*************************************************
 *               Global variables                 *
 *************************************************/
 
 static char *pattern_filename = NULL;
+static char *stdin_name = (char *)"(standard input)";
 static int  pattern_count = 0;
 static pcre **pattern_list;
 static pcre_extra **hints_list;
 
+static char *include_pattern = NULL;
+static char *exclude_pattern = NULL;
+
+static pcre *include_compiled = NULL;
+static pcre *exclude_compiled = NULL;
+
+static int after_context = 0;
+static int before_context = 0;
+static int both_context = 0;
+
 static BOOL count_only = FALSE;
 static BOOL filenames = TRUE;
 static BOOL filenames_only = FALSE;
+static BOOL filenames_nomatch_only = FALSE;
+static BOOL hyphenpending = FALSE;
 static BOOL invert = FALSE;
+static BOOL multiline = FALSE;
 static BOOL number = FALSE;
+static BOOL quiet = FALSE;
 static BOOL recurse = FALSE;
 static BOOL silent = FALSE;
 static BOOL whole_lines = FALSE;
+static BOOL word_match = FALSE;
 
 /* Structure for options and list of them */
 
+enum { OP_NODATA, OP_STRING, OP_NUMBER };
+
 typedef struct option_item {
+  int type;
   int one_char;
+  void *dataptr;
   const char *long_name;
   const char *help_text;
 } option_item;
 
 static option_item optionlist[] = {
-  { -1,  "help",         "display this help and exit" },
-  { 'c', "count",        "print only a count of matching lines per FILE" },
-  { 'h', "no-filename",  "suppress the prefixing filename on output" },
-  { 'i', "ignore-case",  "ignore case distinctions" },
-  { 'l', "files-with-matches", "print only FILE names containing matches" },
-  { 'n', "line-number",  "print line number with output lines" },
-  { 'r', "recursive",    "recursively scan sub-directories" },
-  { 's', "no-messages",  "suppress error messages" },
-  { 'u', "utf-8",        "use UTF-8 mode" },
-  { 'V', "version",      "print version information and exit" },
-  { 'v', "invert-match", "select non-matching lines" },
-  { 'x', "line-regex",   "force PATTERN to match only whole lines" },
-  { 'x', "line-regexp",  "force PATTERN to match only whole lines" },
-  { 0,    NULL,           NULL }
+  { OP_NODATA, -1,  NULL,              "",              "  terminate options" },
+  { OP_NODATA, -1,  NULL,              "help",          "display this help and exit" },
+  { OP_NUMBER, 'A', &after_context,    "after-context=number", "set number of following context lines" },
+  { OP_NUMBER, 'B', &before_context,   "before-context=number", "set number of prior context lines" },
+  { OP_NUMBER, 'C', &both_context,     "context=number", "set number of context lines, before & after" },
+  { OP_NODATA, 'c', NULL,              "count",         "print only a count of matching lines per FILE" },
+  { OP_STRING, 'f', &pattern_filename, "file=path",     "read patterns from file" },
+  { OP_NODATA, 'h', NULL,              "no-filename",   "suppress the prefixing filename on output" },
+  { OP_NODATA, 'i', NULL,              "ignore-case",   "ignore case distinctions" },
+  { OP_NODATA, 'l', NULL,              "files-with-matches", "print only FILE names containing matches" },
+  { OP_NODATA, 'L', NULL,              "files-without-match","print only FILE names not containing matches" },
+  { OP_STRING, -1,  &stdin_name,       "label=name",    "set name for standard input" },
+  { OP_NODATA, 'M', NULL,              "multiline",     "run in multiline mode" },
+  { OP_NODATA, 'n', NULL,              "line-number",   "print line number with output lines" },
+  { OP_NODATA, 'q', NULL,              "quiet",         "suppress output, just set return code" },
+  { OP_NODATA, 'r', NULL,              "recursive",     "recursively scan sub-directories" },
+  { OP_STRING, -1,  &exclude_pattern,  "exclude=pattern","exclude matching files when recursing" },
+  { OP_STRING, -1,  &include_pattern,  "include=pattern","include matching files when recursing" },
+  { OP_NODATA, 's', NULL,              "no-messages",   "suppress error messages" },
+  { OP_NODATA, 'u', NULL,              "utf-8",         "use UTF-8 mode" },
+  { OP_NODATA, 'V', NULL,              "version",       "print version information and exit" },
+  { OP_NODATA, 'v', NULL,              "invert-match",  "select non-matching lines" },
+  { OP_NODATA, 'w', NULL,              "word-regex(p)", "force PATTERN to match only as a word"  },
+  { OP_NODATA, 'x', NULL,              "line-regex(p)", "force PATTERN to match only whole lines" },
+  { OP_NODATA, 0,   NULL,               NULL,            NULL }
 };
 
 
@@ -154,7 +197,8 @@ closedir(dir);
 /************* Directory scanning in Win32 ***********/
 
 /* I (Philip Hazel) have no means of testing this code. It was contributed by
-Lionel Fourquaux. */
+Lionel Fourquaux. David Burgess added a patch to define INVALID_FILE_ATTRIBUTES
+when it did not exist. */
 
 
 #elif HAVE_WIN32API
@@ -165,6 +209,10 @@ Lionel Fourquaux. */
 #ifndef WIN32_LEAN_AND_MEAN
 # define WIN32_LEAN_AND_MEAN
 #endif
+#ifndef INVALID_FILE_ATTRIBUTES
+#define INVALID_FILE_ATTRIBUTES 0xFFFFFFFF
+#endif
+
 #include <windows.h>
 
 typedef struct directory_type
@@ -284,59 +332,290 @@ return sys_errlist[n];
 
 
 /*************************************************
-*              Grep an individual file           *
+*       Print the previous "after" lines         *
 *************************************************/
 
+/* This is called if we are about to lose said lines because of buffer filling,
+and at the end of the file.
+
+Arguments:
+  lastmatchnumber   the number of the last matching line, plus one
+  lastmatchrestart  where we restarted after the last match
+  endptr            end of available data
+  printname         filename for printing
+
+Returns:            nothing
+*/
+
+static void do_after_lines(int lastmatchnumber, char *lastmatchrestart,
+  char *endptr, char *printname)
+{
+if (after_context > 0 && lastmatchnumber > 0)
+  {
+  int count = 0;
+  while (lastmatchrestart < endptr && count++ < after_context)
+    {
+    char *pp = lastmatchrestart;
+    if (printname != NULL) fprintf(stdout, "%s-", printname);
+    if (number) fprintf(stdout, "%d-", lastmatchnumber++);
+    while (*pp != '\n') pp++;
+    fprintf(stdout, "%.*s", pp - lastmatchrestart + 1, lastmatchrestart);
+    lastmatchrestart = pp + 1;
+    }
+  hyphenpending = TRUE;
+  }
+}
+
+
+
+/*************************************************
+*            Grep an individual file             *
+*************************************************/
+
+/* This is called from grep_or_recurse() below. It uses a buffer that is three
+times the value of MBUFTHIRD. The matching point is never allowed to stray into
+the top third of the buffer, thus keeping more of the file available for
+context printing or for multiline scanning. For large files, the pointer will
+be in the middle third most of the time, so the bottom third is available for
+"before" context printing.
+
+Arguments:
+  in           the fopened FILE stream
+  printname    the file name if it is to be printed for each match
+               or NULL if the file name is not to be printed
+               it cannot be NULL if filenames[_nomatch]_only is set
+
+Returns:       0 if there was at least one match
+               1 otherwise (no matches)
+*/
+
 static int
-pcregrep(FILE *in, char *name)
+pcregrep(FILE *in, char *printname)
 {
 int rc = 1;
-int linenumber = 0;
+int linenumber = 1;
+int lastmatchnumber = 0;
 int count = 0;
 int offsets[99];
-char buffer[BUFSIZ];
+char *lastmatchrestart = NULL;
+char buffer[3*MBUFTHIRD];
+char *ptr = buffer;
+char *endptr;
+size_t bufflength;
+BOOL endhyphenpending = FALSE;
+
+/* Do the first read into the start of the buffer and set up the pointer to
+end of what we have. */
 
-while (fgets(buffer, sizeof(buffer), in) != NULL)
+bufflength = fread(buffer, 1, 3*MBUFTHIRD, in);
+endptr = buffer + bufflength;
+
+/* Loop while the current pointer is not at the end of the file. For large
+files, endptr will be at the end of the buffer when we are in the middle of the
+file, but ptr will never get there, because as soon as it gets over 2/3 of the
+way, the buffer is shifted left and re-filled. */
+
+while (ptr < endptr)
   {
-  BOOL match = FALSE;
   int i;
-  int length = (int)strlen(buffer);
-  if (length > 0 && buffer[length-1] == '\n') buffer[--length] = 0;
-  linenumber++;
+  BOOL match = FALSE;
+  char *t = ptr;
+  size_t length, linelength;
+
+  /* At this point, ptr is at the start of a line. We need to find the length
+  of the subject string to pass to pcre_exec(). In multiline mode, it is the
+  length remainder of the data in the buffer. Otherwise, it is the length of
+  the next line. After matching, we always advance by the length of the next
+  line. In multiline mode the PCRE_FIRSTLINE option is used for compiling, so
+  that any match is constrained to be in the first line. */
+
+  linelength = 0;
+  while (t < endptr && *t++ != '\n') linelength++;
+  length = multiline? endptr - ptr : linelength;
+
+  /* Run through all the patterns until one matches. Note that we don't include
+  the final newline in the subject string. */
 
   for (i = 0; !match && i < pattern_count; i++)
     {
-    match = pcre_exec(pattern_list[i], hints_list[i], buffer, length, 0, 0,
+    match = pcre_exec(pattern_list[i], hints_list[i], ptr, length, 0, 0,
       offsets, 99) >= 0;
-    if (match && whole_lines && offsets[1] != length) match = FALSE;
     }
 
+  /* If it's a match or a not-match (as required), print what's wanted. */
+
   if (match != invert)
     {
+    BOOL hyphenprinted = FALSE;
+
+    if (filenames_nomatch_only) return 1;
+
     if (count_only) count++;
 
     else if (filenames_only)
       {
-      fprintf(stdout, "%s\n", (name == NULL)? "<stdin>" : name);
+      fprintf(stdout, "%s\n", printname);
       return 0;
       }
 
-    else if (silent) return 0;
+    else if (quiet) return 0;
 
     else
       {
-      if (name != NULL) fprintf(stdout, "%s:", name);
+      /* See if there is a requirement to print some "after" lines from a
+      previous match. We never print any overlaps. */
+
+      if (after_context > 0 && lastmatchnumber > 0)
+        {
+        int linecount = 0;
+        char *p = lastmatchrestart;
+
+        while (p < ptr && linecount < after_context)
+          {
+          while (*p != '\n') p++;
+          p++;
+          linecount++;
+          }
+
+        /* It is important to advance lastmatchrestart during this printing so
+        that it interacts correctly with any "before" printing below. */
+
+        while (lastmatchrestart < p)
+          {
+          char *pp = lastmatchrestart;
+          if (printname != NULL) fprintf(stdout, "%s-", printname);
+          if (number) fprintf(stdout, "%d-", lastmatchnumber++);
+          while (*pp != '\n') pp++;
+          fprintf(stdout, "%.*s", pp - lastmatchrestart + 1, lastmatchrestart);
+          lastmatchrestart = pp + 1;
+          }
+        if (lastmatchrestart != ptr) hyphenpending = TRUE;
+        }
+
+      /* If there were non-contiguous lines printed above, insert hyphens. */
+
+      if (hyphenpending)
+        {
+        fprintf(stdout, "--\n");
+        hyphenpending = FALSE;
+        hyphenprinted = TRUE;
+        }
+
+      /* See if there is a requirement to print some "before" lines for this
+      match. Again, don't print overlaps. */
+
+      if (before_context > 0)
+        {
+        int linecount = 0;
+        char *p = ptr;
+
+        while (p > buffer && (lastmatchnumber == 0 || p > lastmatchrestart) &&
+               linecount++ < before_context)
+          {
+          p--;
+          while (p > buffer && p[-1] != '\n') p--;
+          }
+
+        if (lastmatchnumber > 0 && p > lastmatchrestart && !hyphenprinted)
+          fprintf(stdout, "--\n");
+
+        while (p < ptr)
+          {
+          char *pp = p;
+          if (printname != NULL) fprintf(stdout, "%s-", printname);
+          if (number) fprintf(stdout, "%d-", linenumber - linecount--);
+          while (*pp != '\n') pp++;
+          fprintf(stdout, "%.*s", pp - p + 1, p);
+          p = pp + 1;
+          }
+        }
+
+      /* Now print the matching line(s); ensure we set hyphenpending at the end
+      of the file. */
+
+      endhyphenpending = TRUE;
+      if (printname != NULL) fprintf(stdout, "%s:", printname);
       if (number) fprintf(stdout, "%d:", linenumber);
-      fprintf(stdout, "%s\n", buffer);
+
+      /* In multiline mode, we want to print to the end of the line in which
+      the end of the matched string is found, so we adjust linelength and the
+      line number appropriately. Because the PCRE_FIRSTLINE option is set, the
+      start of the match will always be before the first \n character. */
+
+      if (multiline)
+        {
+        char *endmatch = ptr + offsets[1];
+        t = ptr;
+        while (t < endmatch) { if (*t++ == '\n') linenumber++; }
+        while (endmatch < endptr && *endmatch != '\n') endmatch++;
+        linelength = endmatch - ptr;
+        }
+
+      fprintf(stdout, "%.*s\n", linelength, ptr);
       }
 
-    rc = 0;
+    rc = 0;    /* Had some success */
+
+    /* Remember where the last match happened for after_context. We remember
+    where we are about to restart, and that line's number. */
+
+    lastmatchrestart = ptr + linelength + 1;
+    lastmatchnumber = linenumber + 1;
     }
+
+  /* Advance to after the newline and increment the line number. */
+
+  ptr += linelength + 1;
+  linenumber++;
+
+  /* If we haven't yet reached the end of the file (the buffer is full), and
+  the current point is in the top 1/3 of the buffer, slide the buffer down by
+  1/3 and refill it. Before we do this, if some unprinted "after" lines are
+  about to be lost, print them. */
+
+  if (bufflength >= sizeof(buffer) && ptr > buffer + 2*MBUFTHIRD)
+    {
+    if (after_context > 0 &&
+        lastmatchnumber > 0 &&
+        lastmatchrestart < buffer + MBUFTHIRD)
+      {
+      do_after_lines(lastmatchnumber, lastmatchrestart, endptr, printname);
+      lastmatchnumber = 0;
+      }
+
+    /* Now do the shuffle */
+
+    memmove(buffer, buffer + MBUFTHIRD, 2*MBUFTHIRD);
+    ptr -= MBUFTHIRD;
+    bufflength = 2*MBUFTHIRD + fread(buffer + 2*MBUFTHIRD, 1, MBUFTHIRD, in);
+    endptr = buffer + bufflength;
+
+    /* Adjust any last match point */
+
+    if (lastmatchnumber > 0) lastmatchrestart -= MBUFTHIRD;
+    }
+  }     /* Loop through the whole file */
+
+/* End of file; print final "after" lines if wanted; do_after_lines sets
+hyphenpending if it prints something. */
+
+do_after_lines(lastmatchnumber, lastmatchrestart, endptr, printname);
+hyphenpending |= endhyphenpending;
+
+/* Print the file name if we are looking for those without matches and there
+were none. If we found a match, we won't have got this far. */
+
+if (filenames_nomatch_only)
+  {
+  fprintf(stdout, "%s\n", printname);
+  return 0;
   }
 
+/* Print the match count if wanted */
+
 if (count_only)
   {
-  if (name != NULL) fprintf(stdout, "%s:", name);
+  if (printname != NULL) fprintf(stdout, "%s:", printname);
   fprintf(stdout, "%d\n", count);
   }
 
@@ -345,41 +624,81 @@ return rc;
 
 
 
-
 /*************************************************
 *     Grep a file or recurse into a directory    *
 *************************************************/
 
+/* Given a path name, if it's a directory, scan all the files if we are
+recursing; if it's a file, grep it.
+
+Arguments:
+  pathname          the path to investigate
+  dir_recurse       TRUE if recursing is wanted (-r)
+  show_filenames    TRUE if file names are wanted for multiple files, except
+                      for the only file at top level when not filenames_only
+  only_one_at_top   TRUE if the path is the only one at toplevel
+
+Returns:   0 if there was at least one match
+           1 if there were no matches
+           2 there was some kind of error
+
+However, file opening failures are suppressed if "silent" is set.
+*/
+
 static int
-grep_or_recurse(char *filename, BOOL dir_recurse, BOOL show_filenames,
+grep_or_recurse(char *pathname, BOOL dir_recurse, BOOL show_filenames,
   BOOL only_one_at_top)
 {
 int rc = 1;
 int sep;
 FILE *in;
+char *printname;
+
+/* If the file name is "-" we scan stdin */
+
+if (strcmp(pathname, "-") == 0)
+  {
+  return pcregrep(stdin,
+    (filenames_only || filenames_nomatch_only ||
+    (show_filenames && !only_one_at_top))?
+      stdin_name : NULL);
+  }
 
-/* If the file is a directory and we are recursing, scan each file within it.
-The scanning code is localized so it can be made system-specific. */
+/* If the file is a directory and we are recursing, scan each file within it,
+subject to any include or exclude patterns that were set. The scanning code is
+localized so it can be made system-specific. */
 
-if ((sep = isdirectory(filename)) != 0 && dir_recurse)
+if ((sep = isdirectory(pathname)) != 0 && dir_recurse)
   {
   char buffer[1024];
   char *nextfile;
-  directory_type *dir = opendirectory(filename);
+  directory_type *dir = opendirectory(pathname);
 
   if (dir == NULL)
     {
-    fprintf(stderr, "pcregrep: Failed to open directory %s: %s\n", filename,
-      strerror(errno));
+    if (!silent)
+      fprintf(stderr, "pcregrep: Failed to open directory %s: %s\n", pathname,
+        strerror(errno));
     return 2;
     }
 
   while ((nextfile = readdirectory(dir)) != NULL)
     {
-    int frc;
-    sprintf(buffer, "%.512s%c%.128s", filename, sep, nextfile);
+    int frc, blen;
+    sprintf(buffer, "%.512s%c%.128s", pathname, sep, nextfile);
+    blen = strlen(buffer);
+
+    if (exclude_compiled != NULL &&
+        pcre_exec(exclude_compiled, NULL, buffer, blen, 0, 0, NULL, 0) >= 0)
+      continue;
+
+    if (include_compiled != NULL &&
+        pcre_exec(include_compiled, NULL, buffer, blen, 0, 0, NULL, 0) < 0)
+      continue;
+
     frc = grep_or_recurse(buffer, dir_recurse, TRUE, FALSE);
-    if (frc == 0 && rc == 1) rc = 0;
+    if (frc > 1) rc = frc;
+     else if (frc == 0 && rc == 1) rc = 0;
     }
 
   closedirectory(dir);
@@ -391,15 +710,20 @@ the first and only argument at top level, we don't show the file name (unless
 we are only showing the file name). Otherwise, control is via the
 show_filenames variable. */
 
-in = fopen(filename, "r");
+in = fopen(pathname, "r");
 if (in == NULL)
   {
-  fprintf(stderr, "pcregrep: Failed to open %s: %s\n", filename, strerror(errno));
+  if (!silent)
+    fprintf(stderr, "pcregrep: Failed to open %s: %s\n", pathname,
+      strerror(errno));
   return 2;
   }
 
-rc = pcregrep(in, (filenames_only || (show_filenames && !only_one_at_top))?
-  filename : NULL);
+printname =  (filenames_only || filenames_nomatch_only ||
+  (show_filenames && !only_one_at_top))? pathname : NULL;
+
+rc = pcregrep(in, printname);
+
 fclose(in);
 return rc;
 }
@@ -414,7 +738,7 @@ return rc;
 static int
 usage(int rc)
 {
-fprintf(stderr, "Usage: pcregrep [-Vcfhilnrsvx] [long-options] [pattern] [file1 file2 ...]\n");
+fprintf(stderr, "Usage: pcregrep [-LMVcfhilnqrsvwx] [long-options] [pattern] [file1 file2 ...]\n");
 fprintf(stderr, "Type `pcregrep --help' for more information.\n");
 return rc;
 }
@@ -434,6 +758,7 @@ option_item *op;
 printf("Usage: pcregrep [OPTION]... [PATTERN] [FILE1 FILE2 ...]\n");
 printf("Search for PATTERN in each FILE or standard input.\n");
 printf("PATTERN must be present if -f is not used.\n");
+printf("\"-\" can be used as a file name to mean STDIN.\n");
 printf("Example: pcregrep -i 'hello.*world' menu.h main.c\n\n");
 
 printf("Options:\n");
@@ -449,12 +774,11 @@ for (op = optionlist; op->one_char != 0; op++)
   printf("%.*s%s\n", n, "                    ", op->help_text);
   }
 
-printf("\n  -f<filename>  or  --file=<filename>\n");
-printf("    Read patterns from <filename> instead of using a command line option.\n");
-printf("    Trailing white space is removed; blanks lines are ignored.\n");
-printf("    There is a maximum of %d patterns.\n", MAX_PATTERN_COUNT);
+printf("\nWhen reading patterns from a file instead of using a command line option,\n");
+printf("trailing white space is removed and blank lines are ignored.\n");
+printf("There is a maximum of %d patterns.\n", MAX_PATTERN_COUNT);
 
-printf("\nWith no FILE, read standard input. If fewer than two FILEs given, assume -h.\n");
+printf("\nWith no FILEs, read standard input. If fewer than two FILEs given, assume -h.\n");
 printf("Exit status is 0 if any matches, 1 if no matches, and 2 if trouble.\n");
 }
 
@@ -462,7 +786,7 @@ printf("Exit status is 0 if any matches, 1 if no matches, and 2 if trouble.\n");
 
 
 /*************************************************
-*                Handle an option                *
+*    Handle a single-letter, no data option      *
 *************************************************/
 
 static int
@@ -474,13 +798,17 @@ switch(letter)
   case 'c': count_only = TRUE; break;
   case 'h': filenames = FALSE; break;
   case 'i': options |= PCRE_CASELESS; break;
-  case 'l': filenames_only = TRUE;
+  case 'l': filenames_only = TRUE; break;
+  case 'L': filenames_nomatch_only = TRUE; break;
+  case 'M': multiline = TRUE; options |= PCRE_MULTILINE|PCRE_FIRSTLINE; break;
   case 'n': number = TRUE; break;
+  case 'q': quiet = TRUE; break;
   case 'r': recurse = TRUE; break;
   case 's': silent = TRUE; break;
   case 'u': options |= PCRE_UTF8; break;
   case 'v': invert = TRUE; break;
-  case 'x': whole_lines = TRUE; options |= PCRE_ANCHORED; break;
+  case 'w': word_match = TRUE; break;
+  case 'x': whole_lines = TRUE; break;
 
   case 'V':
   fprintf(stderr, "pcregrep version %s using ", VERSION);
@@ -503,6 +831,8 @@ return options;
 *                Main program                    *
 *************************************************/
 
+/* Returns 0 if something matched, 1 if nothing matched, 2 after an error. */
+
 int
 main(int argc, char **argv)
 {
@@ -517,32 +847,83 @@ BOOL only_one_at_top;
 
 for (i = 1; i < argc; i++)
   {
+  option_item *op = NULL;
+  char *option_data = (char *)"";    /* default to keep compiler happy */
+  BOOL longop;
+  BOOL longopwasequals = FALSE;
+
   if (argv[i][0] != '-') break;
 
-  /* Missing options */
+  /* If we hit an argument that is just "-", it may be a reference to STDIN,
+  but only if we have previously had -f to define the patterns. */
 
-  if (argv[i][1] == 0) exit(usage(2));
+  if (argv[i][1] == 0)
+    {
+    if (pattern_filename != NULL) break;
+      else exit(usage(2));
+    }
 
-  /* Long name options */
+  /* Handle a long name option, or -- to terminate the options */
 
   if (argv[i][1] == '-')
     {
-    option_item *op;
+    char *arg = argv[i] + 2;
+    char *argequals = strchr(arg, '=');
 
-    if (strncmp(argv[i]+2, "file=", 5) == 0)
+    if (*arg == 0)    /* -- terminates options */
       {
-      pattern_filename = argv[i] + 7;
-      continue;
+      i++;
+      break;                /* out of the options-handling loop */
       }
 
+    longop = TRUE;
+
+    /* Some long options have data that follows after =, for example file=name.
+    Some options have variations in the long name spelling: specifically, we
+    allow "regexp" because GNU grep allows it, though I personally go along
+    with Jeff Friedl in preferring "regex" without the "p". These options are
+    entered in the table as "regex(p)". No option is in both these categories,
+    fortunately. */
+
     for (op = optionlist; op->one_char != 0; op++)
       {
-      if (strcmp(argv[i]+2, op->long_name) == 0)
+      char *opbra = strchr(op->long_name, '(');
+      char *equals = strchr(op->long_name, '=');
+      if (opbra == NULL)     /* Not a (p) case */
         {
-        options = handle_option(op->one_char, options);
-        break;
+        if (equals == NULL)  /* Not thing=data case */
+          {
+          if (strcmp(arg, op->long_name) == 0) break;
+          }
+        else                 /* Special case xxx=data */
+          {
+          int oplen = equals - op->long_name;
+          int arglen = (argequals == NULL)? strlen(arg) : argequals - arg;
+          if (oplen == arglen && strncmp(arg, op->long_name, oplen) == 0)
+            {
+            option_data = arg + arglen;
+            if (*option_data == '=')
+              {
+              option_data++;
+              longopwasequals = TRUE;
+              }
+            break;
+            }
+          }
+        }
+      else                   /* Special case xxxx(p) */
+        {
+        char buff1[24];
+        char buff2[24];
+        int baselen = opbra - op->long_name;
+        sprintf(buff1, "%.*s", baselen, op->long_name);
+        sprintf(buff2, "%s%.*s", buff1, strlen(op->long_name) - baselen - 2,
+          opbra + 1);
+        if (strcmp(arg, buff1) == 0 || strcmp(arg, buff2) == 0)
+          break;
         }
       }
+
     if (op->one_char == 0)
       {
       fprintf(stderr, "pcregrep: Unknown option %s\n", argv[i]);
@@ -550,30 +931,74 @@ for (i = 1; i < argc; i++)
       }
     }
 
-  /* One-char options */
+  /* One-char options; many that have no data may be in a single argument; we
+  continue till we hit the last one or one that needs data. */
 
   else
     {
     char *s = argv[i] + 1;
+    longop = FALSE;
     while (*s != 0)
       {
-      if (*s == 'f')
+      for (op = optionlist; op->one_char != 0; op++)
+        { if (*s == op->one_char) break; }
+      if (op->one_char == 0)
         {
-        pattern_filename = s + 1;
-        if (pattern_filename[0] == 0)
-          {
-          if (i >= argc - 1)
-            {
-            fprintf(stderr, "pcregrep: File name missing after -f\n");
-            exit(usage(2));
-            }
-          pattern_filename = argv[++i];
-          }
+        fprintf(stderr, "pcregrep: Unknown option letter '%c' in \"%s\"\n",
+          *s, argv[i]);
+        exit(usage(2));
+        }
+      if (op->type != OP_NODATA || s[1] == 0)
+        {
+        option_data = s+1;
         break;
         }
-      else options = handle_option(*s++, options);
+      options = handle_option(*s++, options);
       }
     }
+
+  /* At this point we should have op pointing to a matched option */
+
+  if (op->type == OP_NODATA)
+    options = handle_option(op->one_char, options);
+  else
+    {
+    if (*option_data == 0)
+      {
+      if (i >= argc - 1 || longopwasequals)
+        {
+        fprintf(stderr, "pcregrep: Data missing after %s\n", argv[i]);
+        exit(usage(2));
+        }
+      option_data = argv[++i];
+      }
+
+    if (op->type == OP_STRING) *((char **)op->dataptr) = option_data; else
+      {
+      char *endptr;
+      int n = strtoul(option_data, &endptr, 10);
+      if (*endptr != 0)
+        {
+        if (longop)
+          fprintf(stderr, "pcregrep: Malformed number \"%s\" after --%s\n",
+            option_data, op->long_name);
+        else
+          fprintf(stderr, "pcregrep: Malformed number \"%s\" after -%c\n",
+            option_data, op->one_char);
+        exit(usage(2));
+        }
+      *((int *)op->dataptr) = n;
+      }
+    }
+  }
+
+/* Options have been decoded. If -C was used, its value is used as a default
+for -A and -B. */
+
+if (both_context > 0)
+  {
+  if (after_context == 0) after_context = both_context;
+  if (before_context == 0) before_context = both_context;
   }
 
 pattern_list = (pcre **)malloc(MAX_PATTERN_COUNT * sizeof(pcre *));
@@ -590,53 +1015,91 @@ if (pattern_list == NULL || hints_list == NULL)
 if (pattern_filename != NULL)
   {
   FILE *f = fopen(pattern_filename, "r");
-  char buffer[BUFSIZ];
+  char buffer[MBUFTHIRD + 16];
+  char *rdstart;
+  int adjust = 0;
+
   if (f == NULL)
     {
     fprintf(stderr, "pcregrep: Failed to open %s: %s\n", pattern_filename,
       strerror(errno));
     return 2;
     }
-  while (fgets(buffer, sizeof(buffer), f) != NULL)
+
+  if (whole_lines)
+    {
+    strcpy(buffer, "^(?:");
+    adjust = 4;
+    }
+  else if (word_match)
+    {
+    strcpy(buffer, "\\b");
+    adjust = 2;
+    }
+
+  rdstart = buffer + adjust;
+  while (fgets(rdstart, MBUFTHIRD, f) != NULL)
     {
-    char *s = buffer + (int)strlen(buffer);
+    char *s = rdstart + (int)strlen(rdstart);
     if (pattern_count >= MAX_PATTERN_COUNT)
       {
       fprintf(stderr, "pcregrep: Too many patterns in file (max %d)\n",
         MAX_PATTERN_COUNT);
       return 2;
       }
-    while (s > buffer && isspace((unsigned char)(s[-1]))) s--;
-    if (s == buffer) continue;
-    *s = 0;
+    while (s > rdstart && isspace((unsigned char)(s[-1]))) s--;
+    if (s == rdstart) continue;
+    if (whole_lines) strcpy(s, ")$");
+      else if (word_match)strcpy(s, "\\b");
+        else *s = 0;
     pattern_list[pattern_count] = pcre_compile(buffer, options, &error,
       &errptr, NULL);
     if (pattern_list[pattern_count++] == NULL)
       {
       fprintf(stderr, "pcregrep: Error in regex number %d at offset %d: %s\n",
-        pattern_count, errptr, error);
+        pattern_count, errptr - adjust, error);
       return 2;
       }
     }
   fclose(f);
   }
 
-/* If no file name, a single regex must be given inline */
+/* If no file name, a single regex must be given inline. */
 
 else
   {
+  char buffer[MBUFTHIRD + 16];
+  char *pat;
+  int adjust = 0;
+
   if (i >= argc) return usage(2);
-  pattern_list[0] = pcre_compile(argv[i++], options, &error, &errptr, NULL);
+
+  if (whole_lines)
+    {
+    sprintf(buffer, "^(?:%.*s)$", MBUFTHIRD, argv[i++]);
+    pat = buffer;
+    adjust = 4;
+    }
+  else if (word_match)
+    {
+    sprintf(buffer, "\\b%.*s\\b", MBUFTHIRD, argv[i++]);
+    pat = buffer;
+    adjust = 2;
+    }
+  else pat = argv[i++];
+
+  pattern_list[0] = pcre_compile(pat, options, &error, &errptr, NULL);
+
   if (pattern_list[0] == NULL)
     {
-    fprintf(stderr, "pcregrep: Error in regex at offset %d: %s\n", errptr,
-      error);
+    fprintf(stderr, "pcregrep: Error in regex at offset %d: %s\n",
+      errptr - adjust, error);
     return 2;
     }
   pattern_count++;
   }
 
-/* Study the regular expressions, as we will be running them may times */
+/* Study the regular expressions, as we will be running them many times */
 
 for (j = 0; j < pattern_count; j++)
   {
@@ -650,24 +1113,50 @@ for (j = 0; j < pattern_count; j++)
     }
   }
 
+/* If there are include or exclude patterns, compile them. */
+
+if (exclude_pattern != NULL)
+  {
+  exclude_compiled = pcre_compile(exclude_pattern, 0, &error, &errptr, NULL);
+  if (exclude_compiled == NULL)
+    {
+    fprintf(stderr, "pcregrep: Error in 'exclude' regex at offset %d: %s\n",
+      errptr, error);
+    return 2;
+    }
+  }
+
+if (include_pattern != NULL)
+  {
+  include_compiled = pcre_compile(include_pattern, 0, &error, &errptr, NULL);
+  if (include_compiled == NULL)
+    {
+    fprintf(stderr, "pcregrep: Error in 'include' regex at offset %d: %s\n",
+      errptr, error);
+    return 2;
+    }
+  }
+
 /* If there are no further arguments, do the business on stdin and exit */
 
-if (i >= argc) return pcregrep(stdin, NULL);
+if (i >= argc) return pcregrep(stdin,
+  (filenames_only || filenames_nomatch_only)? stdin_name : NULL);
 
 /* Otherwise, work through the remaining arguments as files or directories.
 Pass in the fact that there is only one argument at top level - this suppresses
-the file name if the argument is not a directory. */
+the file name if the argument is not a directory and filenames_only is not set.
+*/
 
 only_one_at_top = (i == argc - 1);
-if (filenames_only) filenames = TRUE;
 
 for (; i < argc; i++)
   {
   int frc = grep_or_recurse(argv[i], recurse, filenames, only_one_at_top);
-  if (frc == 0 && rc == 1) rc = 0;
+  if (frc > 1) rc = frc;
+    else if (frc == 0 && rc == 1) rc = 0;
   }
 
 return rc;
 }
 
-/* End */
+/* End of pcregrep */
index 1e8b6a72b1191ea56ef97c1daa480d44c3af7692..06fd58bcbf55236c40afb8e296cf27ad1da4180f 100644 (file)
@@ -2,17 +2,11 @@
 *      Perl-Compatible Regular Expressions       *
 *************************************************/
 
-/*
-This is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language. See
-the file Tech.Notes for some information on the internals.
-
-This module is a wrapper that provides a POSIX API to the underlying PCRE
-functions.
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
 
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
-           Copyright (c) 1997-2004 University of Cambridge
+                       Written by Philip Hazel
+           Copyright (c) 1997-2005 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -43,69 +37,68 @@ POSSIBILITY OF SUCH DAMAGE.
 -----------------------------------------------------------------------------
 */
 
-#include "internal.h"
+
+/* This module is a wrapper that provides a POSIX API to the underlying PCRE
+functions. */
+
+
+#include "pcre_internal.h"
 #include "pcreposix.h"
 #include "stdlib.h"
 
 
 
-/* Corresponding tables of PCRE error messages and POSIX error codes. */
-
-static const char *const estring[] = {
-  ERR1,  ERR2,  ERR3,  ERR4,  ERR5,  ERR6,  ERR7,  ERR8,  ERR9,  ERR10,
-  ERR11, ERR12, ERR13, ERR14, ERR15, ERR16, ERR17, ERR18, ERR19, ERR20,
-  ERR21, ERR22, ERR23, ERR24, ERR25, ERR26, ERR27, ERR29, ERR29, ERR30,
-  ERR31, ERR32, ERR33, ERR34, ERR35, ERR36, ERR37, ERR38, ERR39, ERR40,
-  ERR41, ERR42, ERR43, ERR44, ERR45, ERR46, ERR47 };
+/* Table to translate PCRE compile time error codes into POSIX error codes. */
 
 static const int eint[] = {
-  REG_EESCAPE, /* "\\ at end of pattern" */
-  REG_EESCAPE, /* "\\c at end of pattern" */
-  REG_EESCAPE, /* "unrecognized character follows \\" */
-  REG_BADBR,   /* "numbers out of order in {} quantifier" */
-  REG_BADBR,   /* "number too big in {} quantifier" */
-  REG_EBRACK,  /* "missing terminating ] for character class" */
-  REG_ECTYPE,  /* "invalid escape sequence in character class" */
-  REG_ERANGE,  /* "range out of order in character class" */
-  REG_BADRPT,  /* "nothing to repeat" */
-  REG_BADRPT,  /* "operand of unlimited repeat could match the empty string" */
-  REG_ASSERT,  /* "internal error: unexpected repeat" */
-  REG_BADPAT,  /* "unrecognized character after (?" */
-  REG_BADPAT,  /* "POSIX named classes are supported only within a class" */
-  REG_EPAREN,  /* "missing )" */
-  REG_ESUBREG, /* "reference to non-existent subpattern" */
-  REG_INVARG,  /* "erroffset passed as NULL" */
-  REG_INVARG,  /* "unknown option bit(s) set" */
-  REG_EPAREN,  /* "missing ) after comment" */
-  REG_ESIZE,   /* "parentheses nested too deeply" */
-  REG_ESIZE,   /* "regular expression too large" */
-  REG_ESPACE,  /* "failed to get memory" */
-  REG_EPAREN,  /* "unmatched brackets" */
-  REG_ASSERT,  /* "internal error: code overflow" */
-  REG_BADPAT,  /* "unrecognized character after (?<" */
-  REG_BADPAT,  /* "lookbehind assertion is not fixed length" */
-  REG_BADPAT,  /* "malformed number after (?(" */
-  REG_BADPAT,  /* "conditional group containe more than two branches" */
-  REG_BADPAT,  /* "assertion expected after (?(" */
-  REG_BADPAT,  /* "(?R or (?digits must be followed by )" */
-  REG_ECTYPE,  /* "unknown POSIX class name" */
-  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,  /* "invalid condition (?(0)" */
-  REG_BADPAT,  /* "\\C not allowed in lookbehind assertion" */
-  REG_EESCAPE, /* "PCRE does not support \\L, \\l, \\N, \\U, or \\u" */
-  REG_BADPAT,  /* "number after (?C is > 255" */
-  REG_BADPAT,  /* "closing ) for (?C expected" */
-  REG_BADPAT,  /* "recursive call could loop indefinitely" */
-  REG_BADPAT,  /* "unrecognized character after (?P" */
-  REG_BADPAT,  /* "syntax error after (?P" */
-  REG_BADPAT,  /* "two named groups have the same name" */
-  REG_BADPAT,  /* "invalid UTF-8 string" */
-  REG_BADPAT,  /* "support for \\P, \\p, and \\X has not been compiled" */
-  REG_BADPAT,  /* "malformed \\P or \\p sequence" */
-  REG_BADPAT   /* "unknown property name after \\P or \\p" */
+  0,           /* no error */
+  REG_EESCAPE, /* \ at end of pattern */
+  REG_EESCAPE, /* \c at end of pattern */
+  REG_EESCAPE, /* unrecognized character follows \ */
+  REG_BADBR,   /* numbers out of order in {} quantifier */
+  REG_BADBR,   /* number too big in {} quantifier */
+  REG_EBRACK,  /* missing terminating ] for character class */
+  REG_ECTYPE,  /* invalid escape sequence in character class */
+  REG_ERANGE,  /* range out of order in character class */
+  REG_BADRPT,  /* nothing to repeat */
+  REG_BADRPT,  /* operand of unlimited repeat could match the empty string */
+  REG_ASSERT,  /* internal error: unexpected repeat */
+  REG_BADPAT,  /* unrecognized character after (? */
+  REG_BADPAT,  /* POSIX named classes are supported only within a class */
+  REG_EPAREN,  /* missing ) */
+  REG_ESUBREG, /* reference to non-existent subpattern */
+  REG_INVARG,  /* erroffset passed as NULL */
+  REG_INVARG,  /* unknown option bit(s) set */
+  REG_EPAREN,  /* missing ) after comment */
+  REG_ESIZE,   /* parentheses nested too deeply */
+  REG_ESIZE,   /* regular expression too large */
+  REG_ESPACE,  /* failed to get memory */
+  REG_EPAREN,  /* unmatched brackets */
+  REG_ASSERT,  /* internal error: code overflow */
+  REG_BADPAT,  /* unrecognized character after (?< */
+  REG_BADPAT,  /* lookbehind assertion is not fixed length */
+  REG_BADPAT,  /* malformed number after (?( */
+  REG_BADPAT,  /* conditional group containe more than two branches */
+  REG_BADPAT,  /* assertion expected after (?( */
+  REG_BADPAT,  /* (?R or (?digits must be followed by ) */
+  REG_ECTYPE,  /* unknown POSIX class name */
+  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,  /* invalid condition (?(0) */
+  REG_BADPAT,  /* \C not allowed in lookbehind assertion */
+  REG_EESCAPE, /* PCRE does not support \L, \l, \N, \U, or \u */
+  REG_BADPAT,  /* number after (?C is > 255 */
+  REG_BADPAT,  /* closing ) for (?C expected */
+  REG_BADPAT,  /* recursive call could loop indefinitely */
+  REG_BADPAT,  /* unrecognized character after (?P */
+  REG_BADPAT,  /* syntax error after (?P */
+  REG_BADPAT,  /* two named groups have the same name */
+  REG_BADPAT,  /* invalid UTF-8 string */
+  REG_BADPAT,  /* support for \P, \p, and \X has not been compiled */
+  REG_BADPAT,  /* malformed \P or \p sequence */
+  REG_BADPAT   /* unknown property name after \P or \p */
 };
 
 /* Table of texts corresponding to POSIX error codes */
@@ -134,24 +127,6 @@ static const char *const pstring[] = {
 
 
 
-/*************************************************
-*          Translate PCRE text code to int       *
-*************************************************/
-
-/* PCRE compile-time errors are given as strings defined as macros. We can just
-look them up in a table to turn them into POSIX-style error codes. */
-
-static int
-pcre_posix_error_code(const char *s)
-{
-size_t i;
-for (i = 0; i < sizeof(estring)/sizeof(char *); i++)
-  if (strcmp(s, estring[i]) == 0) return eint[i];
-return REG_ASSERT;
-}
-
-
-
 /*************************************************
 *          Translate error code to string        *
 *************************************************/
@@ -219,15 +194,18 @@ regcomp(regex_t *preg, const char *pattern, int cflags)
 {
 const char *errorptr;
 int erroffset;
+int errorcode;
 int options = 0;
 
 if ((cflags & REG_ICASE) != 0) options |= PCRE_CASELESS;
 if ((cflags & REG_NEWLINE) != 0) options |= PCRE_MULTILINE;
+if ((cflags & REG_DOTALL) != 0) options |= PCRE_DOTALL;
 
-preg->re_pcre = pcre_compile(pattern, options, &errorptr, &erroffset, NULL);
+preg->re_pcre = pcre_compile2(pattern, options, &errorcode, &errorptr,
+  &erroffset, NULL);
 preg->re_erroffset = erroffset;
 
-if (preg->re_pcre == NULL) return pcre_posix_error_code(errorptr);
+if (preg->re_pcre == NULL) return eint[errorcode];
 
 preg->re_nsub = pcre_info((const pcre *)preg->re_pcre, NULL, NULL);
 return 0;
index a8056bd77c8ea4f945af6b35d537b4cea42df35e..4f1b1abd4515d329d9b2c9c1d34b74bec6332a3c 100644 (file)
@@ -9,7 +9,7 @@
 Compatible Regular Expression library. It defines the things POSIX says should
 be there. I hope.
 
-            Copyright (c) 1997-2004 University of Cambridge
+            Copyright (c) 1997-2005 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -57,6 +57,10 @@ extern "C" {
 #define REG_NOTBOL    0x04
 #define REG_NOTEOL    0x08
 
+/* Additional options, not defined by POSIX, but somebody wanted them. */
+
+#define REG_DOTALL    0x10
+
 /* These are not used by PCRE, but by defining them we make it easier
 to slot PCRE into existing programs that make POSIX calls. */
 
index e531cc134eab4d0666389ca3b460e4fef74577e1..9b63470863883d56c9af3b230914b44eb2c407e1 100644 (file)
@@ -4,7 +4,7 @@
 
 /* This program was hacked up as a tester for PCRE. I really should have
 written it more tidily in the first place. Will I ever learn? It has grown and
-been extended and consequently is now rather untidy in places.
+been extended and consequently is now rather, er, *very* untidy in places.
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -44,11 +44,15 @@ POSSIBILITY OF SUCH DAMAGE.
 #include <locale.h>
 #include <errno.h>
 
-/* We need the internal info for displaying the results of pcre_study(). Also
-for getting the opcodes for showing compiled code. */
-
 #define PCRE_SPY        /* For Win32 build, import data, not export */
-#include "internal.h"
+
+/* We need the internal info for displaying the results of pcre_study() and
+other internal data; pcretest also uses some of the fixed tables, and generally
+has "inside information" compared to a program that strictly follows the PCRE
+API. */
+
+#include "pcre_internal.h"
+
 
 /* It is possible to compile this test program without including support for
 testing the POSIX interface, though this is not available via the standard
@@ -58,6 +62,12 @@ Makefile. */
 #include "pcreposix.h"
 #endif
 
+/* It is also possible, for the benefit of the version imported into Exim, to
+build pcretest without support for UTF8 (define NOUTF8), without the interface
+to the DFA matcher (NODFA), and without the doublecheck of the old "info"
+function (define NOINFOCHECK). */
+
+
 #ifndef CLOCKS_PER_SEC
 #ifdef CLK_TCK
 #define CLOCKS_PER_SEC CLK_TCK
@@ -87,34 +97,6 @@ static size_t gotten_store;
 static uschar *pbuffer = NULL;
 
 
-static const int utf8_table1[] = {
-  0x0000007f, 0x000007ff, 0x0000ffff, 0x001fffff, 0x03ffffff, 0x7fffffff};
-
-static const int utf8_table2[] = {
-  0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc};
-
-static const int utf8_table3[] = {
-  0xff, 0x1f, 0x0f, 0x07, 0x03, 0x01};
-
-
-
-/*************************************************
-*         Print compiled regex                   *
-*************************************************/
-
-/* The code for doing this is held in a separate file that is also included in
-pcre.c when it is compiled with the debug switch. It defines a function called
-print_internals(), which uses a table of opcode lengths defined by the macro
-OP_LENGTHS, whose name must be OP_lengths. It also uses a table that translates
-Unicode property names to numbers; this is kept in a separate file. */
-
-static uschar OP_lengths[] = { OP_LENGTHS };
-
-#include "ucp.h"
-#include "ucptypetable.c"
-#include "printint.c"
-
-
 
 /*************************************************
 *          Read number from string               *
@@ -143,42 +125,6 @@ return(result);
 
 
 
-/*************************************************
-*       Convert character value to UTF-8         *
-*************************************************/
-
-/* This function takes an integer value in the range 0 - 0x7fffffff
-and encodes it as a UTF-8 character in 0 to 6 bytes.
-
-Arguments:
-  cvalue     the character value
-  buffer     pointer to buffer for result - at least 6 bytes long
-
-Returns:     number of characters placed in the buffer
-             -1 if input character is negative
-             0 if input character is positive but too big (only when
-             int is longer than 32 bits)
-*/
-
-static int
-ord2utf8(int cvalue, unsigned char *buffer)
-{
-register int i, j;
-for (i = 0; i < sizeof(utf8_table1)/sizeof(int); i++)
-  if (cvalue <= utf8_table1[i]) break;
-if (i >= sizeof(utf8_table1)/sizeof(int)) return 0;
-if (cvalue < 0) return -1;
-
-buffer += i;
-for (j = i; j > 0; j--)
- {
- *buffer-- = 0x80 | (cvalue & 0x3f);
- cvalue >>= 6;
- }
-*buffer = utf8_table2[i] | cvalue;
-return i + 1;
-}
-
 
 /*************************************************
 *            Convert UTF-8 string to value       *
@@ -195,6 +141,8 @@ Returns:   >  0 => the number of bytes consumed
            -6 to 0 => malformed UTF-8 character at offset = (-return)
 */
 
+#if !defined NOUTF8
+
 static int
 utf82ord(unsigned char *buffer, int *vptr)
 {
@@ -214,7 +162,7 @@ if (i == 0 || i == 6) return 0;        /* invalid UTF-8 */
 /* i now has a value in the range 1-5 */
 
 s = 6*i;
-d = (c & utf8_table3[i]) << s;
+d = (c & _pcre_utf8_table3[i]) << s;
 
 for (j = 0; j < i; j++)
   {
@@ -226,8 +174,8 @@ for (j = 0; j < i; j++)
 
 /* Check that encoding was the correct unique one */
 
-for (j = 0; j < sizeof(utf8_table1)/sizeof(int); j++)
-  if (d <= utf8_table1[j]) break;
+for (j = 0; j < _pcre_utf8_table1_size; j++)
+  if (d <= _pcre_utf8_table1[j]) break;
 if (j != i) return -(i+1);
 
 /* Valid value */
@@ -236,6 +184,8 @@ if (j != i) return -(i+1);
 return i+1;
 }
 
+#endif
+
 
 
 /*************************************************
@@ -253,6 +203,7 @@ int yield = 0;
 
 while (length-- > 0)
   {
+#if !defined NOUTF8
   if (use_utf8)
     {
     int rc = utf82ord(p, &c);
@@ -275,6 +226,7 @@ while (length-- > 0)
       continue;
       }
     }
+#endif
 
    /* Not UTF-8, or malformed UTF-8  */
 
@@ -403,7 +355,7 @@ static void *new_malloc(size_t size)
 void *block = malloc(size);
 gotten_store = size;
 if (show_malloc)
-  fprintf(outfile, "malloc       %3d %p\n", size, block);
+  fprintf(outfile, "malloc       %3d %p\n", (int)size, block);
 return block;
 }
 
@@ -421,7 +373,7 @@ static void *stack_malloc(size_t size)
 {
 void *block = malloc(size);
 if (show_malloc)
-  fprintf(outfile, "stack_malloc %3d %p\n", size, block);
+  fprintf(outfile, "stack_malloc %3d %p\n", (int)size, block);
 return block;
 }
 
@@ -484,12 +436,14 @@ int showinfo = 0;
 int showstore = 0;
 int size_offsets = 45;
 int size_offsets_max;
-int *offsets;
+int *offsets = NULL;
 #if !defined NOPOSIX
 int posix = 0;
 #endif
 int debug = 0;
 int done = 0;
+int all_use_dfa = 0;
+int yield = 0;
 
 unsigned char *buffer;
 unsigned char *dbuffer;
@@ -522,6 +476,9 @@ while (argc > 1 && argv[op][0] == '-')
   else if (strcmp(argv[op], "-t") == 0) timeit = 1;
   else if (strcmp(argv[op], "-i") == 0) showinfo = 1;
   else if (strcmp(argv[op], "-d") == 0) showinfo = debug = 1;
+#if !defined NODFA
+  else if (strcmp(argv[op], "-dfa") == 0) all_use_dfa = 1;
+#endif
   else if (strcmp(argv[op], "-o") == 0 && argc > 2 &&
       ((size_offsets = get_value((unsigned char *)argv[op+1], &endptr)),
         *endptr == 0))
@@ -558,8 +515,11 @@ while (argc > 1 && argv[op][0] == '-')
     printf("** Unknown or malformed option %s\n", argv[op]);
     printf("Usage:   pcretest [-d] [-i] [-o <n>] [-p] [-s] [-t] [<input> [<output>]]\n");
     printf("  -C     show PCRE compile-time options and exit\n");
-    printf("  -d     debug: show compiled code; implies -i\n"
-           "  -i     show information about compiled pattern\n"
+    printf("  -d     debug: show compiled code; implies -i\n");
+#if !defined NODFA
+    printf("  -dfa   force DFA matching for all subjects\n");
+#endif
+    printf("  -i     show information about compiled pattern\n"
            "  -m     output memory used information\n"
            "  -o <n> set size of offsets vector to <n>\n");
 #if !defined NOPOSIX
@@ -567,7 +527,8 @@ while (argc > 1 && argv[op][0] == '-')
 #endif
     printf("  -s     output store (memory) used information\n"
            "  -t     time compilation and execution\n");
-    return 1;
+    yield = 1;
+    goto EXIT;
     }
   op++;
   argc--;
@@ -581,7 +542,8 @@ if (offsets == NULL)
   {
   printf("** Failed to get %d bytes of memory for offsets vector\n",
     size_offsets_max * sizeof(int));
-  return 1;
+  yield = 1;
+  goto EXIT;
   }
 
 /* Sort out the input and output files */
@@ -592,7 +554,8 @@ if (argc > 1)
   if (infile == NULL)
     {
     printf("** Failed to open %s\n", argv[op]);
-    return 1;
+    yield = 1;
+    goto EXIT;
     }
   }
 
@@ -602,7 +565,8 @@ if (argc > 2)
   if (outfile == NULL)
     {
     printf("** Failed to open %s\n", argv[op+1]);
-    return 1;
+    yield = 1;
+    goto EXIT;
     }
   }
 
@@ -802,6 +766,7 @@ while (!done)
     {
     switch (*pp++)
       {
+      case 'f': options |= PCRE_FIRSTLINE; break;
       case 'g': do_g = 1; break;
       case 'i': options |= PCRE_CASELESS; break;
       case 'm': options |= PCRE_MULTILINE; break;
@@ -831,7 +796,8 @@ while (!done)
 
       case 'L':
       ppp = pp;
-      while (*ppp != '\n' && *ppp != ' ') ppp++;
+      /* The '\r' test here is so that it works on Windows */
+      while (*ppp != '\n' && *ppp != '\r' && *ppp != ' ') ppp++;
       *ppp = 0;
       if (setlocale(LC_CTYPE, (const char *)pp) == NULL)
         {
@@ -849,7 +815,10 @@ while (!done)
       *pp = 0;
       break;
 
-      case '\n': case ' ': break;
+      case '\r':                      /* So that it works in Windows */
+      case '\n':
+      case ' ':
+      break;
 
       default:
       fprintf(outfile, "** Unknown option '%c'\n", pp[-1]);
@@ -869,6 +838,7 @@ while (!done)
 
     if ((options & PCRE_CASELESS) != 0) cflags |= REG_ICASE;
     if ((options & PCRE_MULTILINE) != 0) cflags |= REG_NEWLINE;
+    if ((options & PCRE_DOTALL) != 0) cflags |= REG_DOTALL;
     rc = regcomp(&preg, (char *)p, cflags);
 
     /* Compilation failed; go back for another re, skipping to blank line
@@ -1008,7 +978,9 @@ while (!done)
     if (do_showinfo)
       {
       unsigned long int get_options, all_options;
+#if !defined NOINFOCHECK
       int old_first_char, old_options, old_count;
+#endif
       int count, backrefmax, first_char, need_char;
       int nameentrysize, namecount;
       const uschar *nametable;
@@ -1016,7 +988,7 @@ while (!done)
       if (do_debug)
         {
         fprintf(outfile, "------------------------------------------------------------------\n");
-        print_internals(re, outfile);
+        _pcre_printint(re, outfile);
         }
 
       new_info(re, NULL, PCRE_INFO_OPTIONS, &get_options);
@@ -1029,6 +1001,7 @@ while (!done)
       new_info(re, NULL, PCRE_INFO_NAMECOUNT, &namecount);
       new_info(re, NULL, PCRE_INFO_NAMETABLE, (void *)&nametable);
 
+#if !defined NOINFOCHECK
       old_count = pcre_info(re, &old_options, &old_first_char);
       if (count < 0) fprintf(outfile,
         "Error %d from pcre_info()\n", count);
@@ -1046,10 +1019,11 @@ while (!done)
           "Options disagreement: pcre_fullinfo=%ld pcre_info=%d\n",
             get_options, old_options);
         }
+#endif
 
       if (size != regex_gotten_store) fprintf(outfile,
         "Size disagreement: pcre_fullinfo=%d call to malloc for %d\n",
-        size, regex_gotten_store);
+        (int)size, (int)regex_gotten_store);
 
       fprintf(outfile, "Capturing subpattern count = %d\n", count);
       if (backrefmax > 0)
@@ -1080,11 +1054,12 @@ while (!done)
         fprintf(outfile, "Partial matching not supported\n");
 
       if (get_options == 0) fprintf(outfile, "No options\n");
-        else fprintf(outfile, "Options:%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\n",
           ((get_options & PCRE_ANCHORED) != 0)? " anchored" : "",
           ((get_options & PCRE_CASELESS) != 0)? " caseless" : "",
           ((get_options & PCRE_EXTENDED) != 0)? " extended" : "",
           ((get_options & PCRE_MULTILINE) != 0)? " multiline" : "",
+          ((get_options & PCRE_FIRSTLINE) != 0)? " firstline" : "",
           ((get_options & PCRE_DOTALL) != 0)? " dotall" : "",
           ((get_options & PCRE_DOLLAR_ENDONLY) != 0)? " dollar_endonly" : "",
           ((get_options & PCRE_EXTRA) != 0)? " extra" : "",
@@ -1222,6 +1197,10 @@ while (!done)
           }
         fclose(f);
         }
+
+      new_free(re);
+      if (extra != NULL) new_free(extra);
+      if (tables != NULL) new_free((void *)tables);
       continue;  /* With next regex */
       }
     }        /* End of non-POSIX compile */
@@ -1244,6 +1223,7 @@ while (!done)
     int gmatched = 0;
     int start_offset = 0;
     int g_notempty = 0;
+    int use_dfa = 0;
 
     options = 0;
 
@@ -1299,6 +1279,7 @@ while (!done)
 
         /* Handle \x{..} specially - new Perl thing for utf8 */
 
+#if !defined NOUTF8
         if (*p == '{')
           {
           unsigned char *pt = p;
@@ -1309,7 +1290,7 @@ while (!done)
             {
             unsigned char buff8[8];
             int ii, utn;
-            utn = ord2utf8(c, buff8);
+            utn = _pcre_ord2utf8(c, buff8);
             for (ii = 0; ii < utn - 1; ii++) *q++ = buff8[ii];
             c = buff8[ii];   /* Last byte */
             p = pt + 1;
@@ -1317,6 +1298,7 @@ while (!done)
             }
           /* Not correct form; fall through */
           }
+#endif
 
         /* Ordinary \x */
 
@@ -1397,6 +1379,21 @@ while (!done)
           }
         continue;
 
+#if !defined NODFA
+        case 'D':
+#if !defined NOPOSIX
+        if (posix || do_posix)
+          printf("** Can't use dfa matching in POSIX mode: \\D ignored\n");
+        else
+#endif
+          use_dfa = 1;
+        continue;
+
+        case 'F':
+        options |= PCRE_DFA_SHORTEST;
+        continue;
+#endif
+
         case 'G':
         if (isdigit(*p))
           {
@@ -1439,7 +1436,8 @@ while (!done)
             {
             printf("** Failed to get %d bytes of memory for offsets vector\n",
               size_offsets_max * sizeof(int));
-            return 1;
+            yield = 1;
+            goto EXIT;
             }
           }
         use_size_offsets = n;
@@ -1450,6 +1448,12 @@ while (!done)
         options |= PCRE_PARTIAL;
         continue;
 
+#if !defined NODFA
+        case 'R':
+        options |= PCRE_DFA_RESTART;
+        continue;
+#endif
+
         case 'S':
         show_malloc = 1;
         continue;
@@ -1467,6 +1471,12 @@ while (!done)
     *q = 0;
     len = q - dbuffer;
 
+    if ((all_use_dfa || use_dfa) && find_match_limit)
+      {
+      printf("**Match limit not relevant for DFA matching: ignored\n");
+      find_match_limit = 0;
+      }
+
     /* Handle matching via the POSIX interface, which does not
     support timing or playing with the match limit or callout data. */
 
@@ -1524,9 +1534,23 @@ while (!done)
         register int i;
         clock_t time_taken;
         clock_t start_time = clock();
+
+#if !defined NODFA
+        if (all_use_dfa || use_dfa)
+          {
+          int workspace[1000];
+          for (i = 0; i < LOOPREPEAT; i++)
+            count = pcre_dfa_exec(re, NULL, (char *)bptr, len, start_offset,
+              options | g_notempty, use_offsets, use_size_offsets, workspace,
+              sizeof(workspace)/sizeof(int));
+          }
+        else
+#endif
+
         for (i = 0; i < LOOPREPEAT; i++)
           count = pcre_exec(re, extra, (char *)bptr, len,
             start_offset, options | g_notempty, use_offsets, use_size_offsets);
+
         time_taken = clock() - start_time;
         fprintf(outfile, "Execute time %.3f milliseconds\n",
           (((double)time_taken * 1000.0) / (double)LOOPREPEAT) /
@@ -1597,16 +1621,30 @@ while (!done)
       /* The normal case is just to do the match once, with the default
       value of match_limit. */
 
-      else
+#if !defined NODFA
+      else if (all_use_dfa || use_dfa)
         {
-        count = pcre_exec(re, extra, (char *)bptr, len,
-          start_offset, options | g_notempty, use_offsets, use_size_offsets);
+        int workspace[1000];
+        count = pcre_dfa_exec(re, NULL, (char *)bptr, len, start_offset,
+          options | g_notempty, use_offsets, use_size_offsets, workspace,
+          sizeof(workspace)/sizeof(int));
+        if (count == 0)
+          {
+          fprintf(outfile, "Matched, but too many subsidiary matches\n");
+          count = use_size_offsets/2;
+          }
         }
+#endif
 
-      if (count == 0)
+      else
         {
-        fprintf(outfile, "Matched, but too many substrings\n");
-        count = use_size_offsets/3;
+        count = pcre_exec(re, extra, (char *)bptr, len,
+          start_offset, options | g_notempty, use_offsets, use_size_offsets);
+        if (count == 0)
+          {
+          fprintf(outfile, "Matched, but too many substrings\n");
+          count = use_size_offsets/3;
+          }
         }
 
       /* Matched */
@@ -1692,7 +1730,13 @@ while (!done)
 
       else if (count == PCRE_ERROR_PARTIAL)
         {
-        fprintf(outfile, "Partial match\n");
+        fprintf(outfile, "Partial match");
+#if !defined NODFA
+        if ((all_use_dfa || use_dfa) && use_size_offsets > 2)
+          fprintf(outfile, ": %.*s", use_offsets[1] - use_offsets[0],
+            bptr + use_offsets[0]);
+#endif
+        fprintf(outfile, "\n");
         break;  /* Out of the /g loop */
         }
 
@@ -1770,17 +1814,28 @@ while (!done)
   if (posix || do_posix) regfree(&preg);
 #endif
 
-  if (re != NULL) free(re);
-  if (extra != NULL) free(extra);
+  if (re != NULL) new_free(re);
+  if (extra != NULL) new_free(extra);
   if (tables != NULL)
     {
-    free((void *)tables);
+    new_free((void *)tables);
     setlocale(LC_CTYPE, "C");
     }
   }
 
 if (infile == stdin) fprintf(outfile, "\n");
-return 0;
+
+EXIT:
+
+if (infile != NULL && infile != stdin) fclose(infile);
+if (outfile != NULL && outfile != stdout) fclose(outfile);
+
+free(buffer);
+free(dbuffer);
+free(pbuffer);
+free(offsets);
+
+return yield;
 }
 
-/* End */
+/* End of pcretest.c */
diff --git a/ext/pcre/pcrelib/testdata/grepinput b/ext/pcre/pcrelib/testdata/grepinput
new file mode 100644 (file)
index 0000000..2a89c2e
--- /dev/null
@@ -0,0 +1,588 @@
+This is a file of miscellaneous text that is used as test data for checking
+that the pcregrep command is working correctly. The file must be more than 24K
+long so that it needs more than a single read() call to process it. New
+features should be added at the end, because some of the tests involve the
+output of line numbers, and we don't want these to change.
+
+PATTERN at the start of a line.
+In the middle of a line, PATTERN appears.
+
+This pattern is in lower case.
+
+Here follows a whole lot of stuff that makes the file over 24K long.
+
+-------------------------------------------------------------------------------
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+
+The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the
+lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox
+jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick
+brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+-------------------------------------------------------------------------------
+
+Check up on PATTERN near the end.
+
+This is the last line of this file.
diff --git a/ext/pcre/pcrelib/testdata/grepinputx b/ext/pcre/pcrelib/testdata/grepinputx
new file mode 100644 (file)
index 0000000..aebba02
--- /dev/null
@@ -0,0 +1,42 @@
+This is a second file of input for the pcregrep tests.
+
+Here is the pattern again.
+
+Pattern
+That time it was on a line by itself.
+
+To pat or not to pat, that is the question.
+
+complete pair
+of lines
+
+That was a complete pair
+of lines all by themselves.
+
+complete pair
+of lines
+
+And there they were again, to check line numbers.
+
+one
+two
+three
+four
+five
+six
+seven
+eight
+nine
+ten
+eleven
+twelve
+thirteen
+fourteen
+fifteen
+sixteen
+seventeen
+eighteen
+nineteen
+twenty
+
+This is the last line of this file.
diff --git a/ext/pcre/pcrelib/testdata/greplist b/ext/pcre/pcrelib/testdata/greplist
new file mode 100644 (file)
index 0000000..bb2705e
--- /dev/null
@@ -0,0 +1,4 @@
+This is a file of patterns for testing the -f option. Don't include any blank
+lines because they will match everything!
+pattern
+line by itself
diff --git a/ext/pcre/pcrelib/testdata/grepoutput b/ext/pcre/pcrelib/testdata/grepoutput
new file mode 100644 (file)
index 0000000..27ab7e4
--- /dev/null
@@ -0,0 +1,336 @@
+pcregrep version 4.0 07-Jun-2005 using PCRE version 6.2 01-Aug-2005
+---------------------------- Test 1 ------------------------------
+PATTERN at the start of a line.
+In the middle of a line, PATTERN appears.
+Check up on PATTERN near the end.
+---------------------------- Test 2 ------------------------------
+PATTERN at the start of a line.
+---------------------------- Test 3 ------------------------------
+7:PATTERN at the start of a line.
+8:In the middle of a line, PATTERN appears.
+10:This pattern is in lower case.
+586:Check up on PATTERN near the end.
+---------------------------- Test 4 ------------------------------
+4
+---------------------------- Test 5 ------------------------------
+./testdata/grepinput:7:PATTERN at the start of a line.
+./testdata/grepinput:8:In the middle of a line, PATTERN appears.
+./testdata/grepinput:10:This pattern is in lower case.
+./testdata/grepinput:586:Check up on PATTERN near the end.
+--
+./testdata/grepinputx:3:Here is the pattern again.
+./testdata/grepinputx:5:Pattern
+---------------------------- Test 6 ------------------------------
+7:PATTERN at the start of a line.
+8:In the middle of a line, PATTERN appears.
+10:This pattern is in lower case.
+586:Check up on PATTERN near the end.
+--
+3:Here is the pattern again.
+5:Pattern
+---------------------------- Test 7 ------------------------------
+./testdata/grepinput
+./testdata/grepinputx
+---------------------------- Test 8 ------------------------------
+./testdata/grepinput
+---------------------------- Test 9 ------------------------------
+RC=0
+---------------------------- Test 10 -----------------------------
+RC=1
+---------------------------- Test 11 -----------------------------
+1:This is a second file of input for the pcregrep tests.
+2:
+4:
+5:Pattern
+6:That time it was on a line by itself.
+7:
+8:To pat or not to pat, that is the question.
+9:
+10:complete pair
+11:of lines
+12:
+13:That was a complete pair
+14:of lines all by themselves.
+15:
+16:complete pair
+17:of lines
+18:
+19:And there they were again, to check line numbers.
+20:
+21:one
+22:two
+23:three
+24:four
+25:five
+26:six
+27:seven
+28:eight
+29:nine
+30:ten
+31:eleven
+32:twelve
+33:thirteen
+34:fourteen
+35:fifteen
+36:sixteen
+37:seventeen
+38:eighteen
+39:nineteen
+40:twenty
+41:
+42:This is the last line of this file.
+---------------------------- Test 12 -----------------------------
+Pattern
+---------------------------- Test 13 -----------------------------
+Here is the pattern again.
+That time it was on a line by itself.
+---------------------------- Test 14 -----------------------------
+./testdata/grepinputx:To pat or not to pat, that is the question.
+---------------------------- Test 15 -----------------------------
+pcregrep: Error in regex at offset 4: nothing to repeat
+---------------------------- Test 16 -----------------------------
+pcregrep: Failed to open ./testdata/nonexistfile: No such file or directory
+---------------------------- Test 17 -----------------------------
+features should be added at the end, because some of the tests involve the
+output of line numbers, and we don't want these to change.
+---------------------------- Test 18 -----------------------------
+4:features should be added at the end, because some of the tests involve the
+output of line numbers, and we don't want these to change.
+583:brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+-------------------------------------------------------------------------------
+---------------------------- Test 19 -----------------------------
+Pattern
+---------------------------- Test 20 -----------------------------
+10:complete pair
+of lines
+16:complete pair
+of lines
+---------------------------- Test 21 -----------------------------
+24:four
+25-five
+26-six
+27-seven
+--
+34:fourteen
+35-fifteen
+36-sixteen
+37-seventeen
+---------------------------- Test 22 -----------------------------
+20-one
+21-two
+22-three
+24:four
+--
+30-eleven
+31-twelve
+32-thirteen
+34:fourteen
+---------------------------- Test 23 -----------------------------
+one
+two
+three
+four
+five
+six
+seven
+--
+eleven
+twelve
+thirteen
+fourteen
+fifteen
+sixteen
+seventeen
+---------------------------- Test 24 -----------------------------
+four
+five
+six
+seven
+eight
+nine
+ten
+eleven
+twelve
+thirteen
+fourteen
+fifteen
+sixteen
+seventeen
+eighteen
+nineteen
+twenty
+
+This is the last line of this file.
+---------------------------- Test 25 -----------------------------
+14-
+15-complete pair
+16-of lines
+17-
+18-And there they were again, to check line numbers.
+19-
+20-one
+21-two
+22-three
+24:four
+25-five
+26-six
+27-seven
+28-eight
+29-nine
+30-ten
+31-eleven
+32-twelve
+33-thirteen
+34:fourteen
+---------------------------- Test 26 -----------------------------
+
+complete pair
+of lines
+
+And there they were again, to check line numbers.
+
+one
+two
+three
+four
+five
+six
+seven
+eight
+nine
+ten
+eleven
+twelve
+thirteen
+fourteen
+fifteen
+sixteen
+seventeen
+eighteen
+nineteen
+twenty
+
+This is the last line of this file.
+---------------------------- Test 27 -----------------------------
+four
+five
+six
+seven
+eight
+nine
+ten
+eleven
+twelve
+thirteen
+fourteen
+fifteen
+sixteen
+seventeen
+eighteen
+nineteen
+twenty
+
+This is the last line of this file.
+---------------------------- Test 28 -----------------------------
+13-of lines all by themselves.
+14-
+15-complete pair
+16-of lines
+17-
+18-And there they were again, to check line numbers.
+19-
+20-one
+21-two
+22-three
+24:four
+25-five
+26-six
+27-seven
+28-eight
+29-nine
+30-ten
+31-eleven
+32-twelve
+33-thirteen
+34:fourteen
+---------------------------- Test 29 -----------------------------
+of lines all by themselves.
+
+complete pair
+of lines
+
+And there they were again, to check line numbers.
+
+one
+two
+three
+four
+five
+six
+seven
+eight
+nine
+ten
+eleven
+twelve
+thirteen
+fourteen
+fifteen
+sixteen
+seventeen
+eighteen
+nineteen
+twenty
+
+This is the last line of this file.
+---------------------------- Test 30 -----------------------------
+./testdata/grepinput-3-features should be added at the end, because some of the tests involve the
+./testdata/grepinput-4-output of line numbers, and we don't want these to change.
+./testdata/grepinput-5-
+./testdata/grepinput:7:PATTERN at the start of a line.
+./testdata/grepinput:8:In the middle of a line, PATTERN appears.
+./testdata/grepinput-9-
+./testdata/grepinput:10:This pattern is in lower case.
+--
+./testdata/grepinput-582-brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
+./testdata/grepinput-583--------------------------------------------------------------------------------
+./testdata/grepinput-584-
+./testdata/grepinput:586:Check up on PATTERN near the end.
+--
+./testdata/grepinputx-1-This is a second file of input for the pcregrep tests.
+./testdata/grepinputx-2-
+./testdata/grepinputx:3:Here is the pattern again.
+./testdata/grepinputx-4-
+./testdata/grepinputx:5:Pattern
+---------------------------- Test 31 -----------------------------
+./testdata/grepinput:7:PATTERN at the start of a line.
+./testdata/grepinput:8:In the middle of a line, PATTERN appears.
+./testdata/grepinput-9-
+./testdata/grepinput:10:This pattern is in lower case.
+./testdata/grepinput-11-
+./testdata/grepinput-12-Here follows a whole lot of stuff that makes the file over 24K long.
+./testdata/grepinput-13-
+--
+./testdata/grepinput:586:Check up on PATTERN near the end.
+./testdata/grepinput-587-
+./testdata/grepinput-588-This is the last line of this file.
+--
+./testdata/grepinputx:3:Here is the pattern again.
+./testdata/grepinputx-4-
+./testdata/grepinputx:5:Pattern
+./testdata/grepinputx-6-That time it was on a line by itself.
+./testdata/grepinputx-7-
+./testdata/grepinputx-8-To pat or not to pat, that is the question.
+---------------------------- Test 32 -----------------------------
+./testdata/grepinputx
+---------------------------- Test 33 -----------------------------
+pcregrep: Failed to open ./testdata/grepnonexist: No such file or directory
+RC=2
+---------------------------- Test 34 -----------------------------
+RC=2
+---------------------------- Test 35 -----------------------------
+./testdata/grepinputx
+RC=0
+---------------------------- Test 36 -----------------------------
+./testdata/grepinputx
+RC=0
index c64257685be8e2c55e9347d37c60d58a6452c942..88ff5bf8e7dde2c4fe60e7c7c0c80c69f5e96195 100644 (file)
 
 /^[W-c]+$/
     WXY_^abc
-    ***Failers
+    *** Failers
     wxy
 
 /^[W-c]+$/i
     the.quick.brown.fox
     a100.b200.300c  
     12-ab.1245 
-    ***Failers
+    *** Failers
     \
     .a
     -a
     :1
     1:  
 
+/[z\Qa-d]\E]/
+    z
+    a
+    -
+    d
+    ] 
+    *** Failers
+    b     
+
+/[\z\C]/
+    z
+    C 
+    
+/\M/
+    M 
+    
+/(a+)*b/
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
+    
+/(?i)reg(?:ul(?:[aä]|ae)r|ex)/
+    REGular
+    regulaer
+    Regex  
+    regulär 
+
+/Åæåä[à-ÿÀ-ß]+/
+    Åæåäà
+    Åæåäÿ
+    ÅæåäÀ
+    Åæåäß
+
+/(?<=Z)X./
+  \x84XAZXB
+
+/ab cd (?x) de fg/
+    ab cd defg
+
+/ab cd(?x) de fg/
+    ab cddefg
+    ** Failers 
+    abcddefg
+
 / End of testinput1 /
index 2dd498a713be25368e247569404652fc2691981a..befb65a4412f408a1cccf3828f640db26b11ab5e 100644 (file)
@@ -38,7 +38,7 @@
 
 /[abcd/
 
-/[\B]/
+/(?X)[\B]/
 
 /[z-a]/
 
 /(?!alphabet)[ab]/S
 
 /(?<=foo\n)^bar/m
+    foo\nbarbar 
+    ***Failers
+    rhubarb 
+    barbell
+    abc\nbarton 
+
+/^(?<=foo\n)bar/m
+    foo\nbarbar 
+    ***Failers
+    rhubarb 
+    barbell
+    abc\nbarton 
 
 /(?>^abc)/m
     abc
 
 /^[[:alnum:]]/D
 
+/^[[:^alnum:]]/D
+
 /^[[:alpha:]]/D
+
+/^[[:^alpha:]]/D
              
 /^[[:ascii:]]/D
 
+/^[[:^ascii:]]/D
+
 /^[[:blank:]]/D
 
 /^[[:cntrl:]]/D
 /\Q\Eabc/D
 
 /x*+\w/D
-    ****Failers
+    *** Failers
     xxxxx
     
 /x?+/D
 
 /\N{name}/
 
-/\pP/
-
-/\PP/
-
-/\p{prop}/
-
-/\P{prop}/
-
 /\u/
 
 /\U/
 
-/\X/
-
 /[/
 
 /[a-/
 /(?<=(abc)(?C))xyz/
    abcxyz\C+
    
+/a(b+)(c*)(?C1)/
+    abbbbbccc\C*1
+
+/a(b+?)(c*?)(?C1)/
+    abbbbbccc\C*1
+   
 /(?C)abc/ 
 
 /(?C)^abc/
 
 /(?P<a>a)...(?P=a)bbb(?P>a)d/D
 
+/^\W*(?:(?P<one>(?P<two>.)\W*(?P>one)\W*(?P=two)|)|(?P<three>(?P<four>.)\W*(?P>three)\W*(?P=four)|\W*.\W*))\W*$/i
+    1221
+    Satan, oscillate my metallic sonatas!
+    A man, a plan, a canal: Panama!
+    Able was I ere I saw Elba. 
+    *** Failers
+    The quick brown fox  
+    
+/((?(R)a|b))\1(?1)?/
+  bb
+  bbaa 
+
+/(.*)a/sI
+
+/(.*)a\1/sI
+
+/(.*)a(b)\2/sI
+
+/((.*)a|(.*)b)z/sI
+
+/((.*)a|(.*)b)z\1/sI
+
+/((.*)a|(.*)b)z\2/sI
+
+/((.*)a|(.*)b)z\3/sI
+
+/((.*)a|^(.*)b)z\3/sI
+
+/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/sI
+
+/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/sI
+
+/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/sI
+
+/(a)(bc)/ND
+  abc
+
+/(?P<one>a)(bc)/ND
+  abc
+
+/(a)(?P<named>bc)/ND
+
+/(a+)*zz/
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazzbbbbbb\M
+  aaaaaaaaaaaaaz\M
+
+/(aaa(?C1)bbb|ab)/
+   aaabbb
+   aaabbb\C*0
+   aaabbb\C*1
+   aaabbb\C*-1
+
+/ab(?P<one>cd)ef(?P<two>gh)/
+    abcdefgh
+    abcdefgh\C1\Gtwo
+    abcdefgh\Cone\Ctwo
+    abcdefgh\Cthree  
+
+/(?P<Tes>)(?P<Test>)/D
+
+/(?P<Test>)(?P<Tes>)/D
+
+/(?P<Z>zz)(?P<A>aa)/
+    zzaa\CZ
+    zzaa\CA
+
+/(?P<x>eks)(?P<x>eccs)/
+
+/(?P<abc>abc(?P<def>def)(?P<abc>xyz))/
+
+"\[((?P<elem>\d+)(,(?P>elem))*)\]"
+    [10,20,30,5,5,4,4,2,43,23,4234]
+    *** Failers
+    []  
+
+"\[((?P<elem>\d+)(,(?P>elem))*)?\]"
+    [10,20,30,5,5,4,4,2,43,23,4234]
+    [] 
+
+/(a(b(?2)c))?/D
+
+/(a(b(?2)c))*/D
+
+/(a(b(?2)c)){0,2}/D
+
+/[ab]{1}+/D
+
+/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/i
+     Baby Bjorn Active Carrier - With free SHIPPING!!
+
+/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/iS
+     Baby Bjorn Active Carrier - With free SHIPPING!!
+     
+/a*.*b/SD
+
+/(a|b)*.?c/SD 
+
+/abc(?C255)de(?C)f/D
+
+/abcde/CD
+  abcde
+  abcdfe 
+  
+/a*b/CD
+  ab
+  aaaab
+  aaaacb   
+
+/a+b/CD
+  ab
+  aaaab
+  aaaacb   
+
+/(abc|def)x/CD
+  abcx
+  defx
+  abcdefzx
+
+/(ab|cd){3,4}/C
+  ababab
+  abcdabcd
+  abcdcdcdcdcd  
+
+/([ab]{,4}c|xy)/CD
+    Note: that { does NOT introduce a quantifier
+
+/([ab]{1,4}c|xy){4,5}?123/CD
+    aacaacaacaacaac123
+
+/\b.*/I
+  ab cd\>1
+  
+/\b.*/Is 
+  ab cd\>1
+  
+/(?!.bcd).*/I
+  Xbcd12345 
+
+/abcde/
+    ab\P
+    abc\P
+    abcd\P
+    abcde\P   
+    the quick brown abc\P
+    ** Failers\P
+    the quick brown abxyz fox\P
+    
+"^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/(20)?\d\d$"
+    13/05/04\P
+    13/5/2004\P
+    02/05/09\P 
+    1\P
+    1/2\P
+    1/2/0\P
+    1/2/04\P    
+    0\P
+    02/\P
+    02/0\P   
+    02/1\P
+    ** Failers\P
+    \P
+    123\P
+    33/4/04\P
+    3/13/04\P
+    0/1/2003\P
+    0/\P 
+    02/0/\P 
+    02/13\P  
+
+/0{0,2}ABC/I
+    
+/\d{3,}ABC/I
+    
+/\d*ABC/I
+
+/[abc]+DE/I
+
+/[abc]?123/
+    123\P
+    a\P
+    b\P
+    c\P
+    c12\P
+    c123\P      
+
+/^(?:\d){3,5}X/
+    1\P
+    123\P
+    123X
+    1234\P
+    1234X
+    12345\P
+    12345X      
+    *** Failers 
+    1X 
+    123456\P 
+
+/abc/>testsavedregex
+<testsavedregex
+    abc
+    ** Failers
+    bca
+    
+/abc/F>testsavedregex
+<testsavedregex
+    abc
+    ** Failers
+    bca
+
+/(a|b)/S>testsavedregex
+<testsavedregex
+    abc
+    ** Failers
+    def  
+    
+/(a|b)/SF>testsavedregex
+<testsavedregex
+    abc
+    ** Failers
+    def  
+    
+~<(\w+)/?>(.)*</(\1)>~smg
+    <!DOCTYPE seite SYSTEM "http://www.lco.lineas.de/xmlCms.dtd">\n<seite>\n<dokumenteninformation>\n<seitentitel>Partner der LCO</seitentitel>\n<sprache>de</sprache>\n<seitenbeschreibung>Partner der LINEAS Consulting\nGmbH</seitenbeschreibung>\n<schluesselworte>LINEAS Consulting GmbH Hamburg\nPartnerfirmen</schluesselworte>\n<revisit>30 days</revisit>\n<robots>index,follow</robots>\n<menueinformation>\n<aktiv>ja</aktiv>\n<menueposition>3</menueposition>\n<menuetext>Partner</menuetext>\n</menueinformation>\n<lastedited>\n<autor>LCO</autor>\n<firma>LINEAS Consulting</firma>\n<datum>15.10.2003</datum>\n</lastedited>\n</dokumenteninformation>\n<inhalt>\n\n<absatzueberschrift>Die Partnerfirmen der LINEAS Consulting\nGmbH</absatzueberschrift>\n\n<absatz><link ziel="http://www.ca.com/" zielfenster="_blank">\n<bild name="logo_ca.gif" rahmen="no"/></link> <link\nziel="http://www.ey.com/" zielfenster="_blank"><bild\nname="logo_euy.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><link ziel="http://www.cisco.de/" zielfenster="_blank">\n<bild name="logo_cisco.gif" rahmen="ja"/></link></absatz>\n\n<absatz><link ziel="http://www.atelion.de/"\nzielfenster="_blank"><bild\nname="logo_atelion.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><link ziel="http://www.line-information.de/"\nzielfenster="_blank">\n<bild name="logo_line_information.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><bild name="logo_aw.gif" rahmen="no"/></absatz>\n\n<absatz><link ziel="http://www.incognis.de/"\nzielfenster="_blank"><bild\nname="logo_incognis.gif" rahmen="no"/></link></absatz>\n\n<absatz><link ziel="http://www.addcraft.com/"\nzielfenster="_blank"><bild\nname="logo_addcraft.gif" rahmen="no"/></link></absatz>\n\n<absatz><link ziel="http://www.comendo.com/"\nzielfenster="_blank"><bild\nname="logo_comendo.gif" rahmen="no"/></link></absatz>\n\n</inhalt>\n</seite>
+
+/^a/IF
+
+/line\nbreak/
+    this is a line\nbreak
+    line one\nthis is a line\nbreak in the second line 
+
+/line\nbreak/f
+    this is a line\nbreak
+    ** Failers 
+    line one\nthis is a line\nbreak in the second line 
+
+/line\nbreak/mf
+    this is a line\nbreak
+    ** Failers 
+    line one\nthis is a line\nbreak in the second line 
+
+/ab.cd/P
+    ab-cd
+    ab=cd 
+    ** Failers
+    ab\ncd
+
+/ab.cd/Ps
+    ab-cd
+    ab=cd 
+    ab\ncd
+
+/(?i)(?-i)AbCd/
+    AbCd
+    ** Failers
+    abcd  
+    
+/a{11111111111111111111}/
+
+/(){64294967295}/
+
+/(){2,4294967295}/
+
+"(?i:a)(?i:b)(?i:c)(?i:d)(?i:e)(?i:f)(?i:g)(?i:h)(?i:i)(?i:j)(k)(?i:l)A\1B"
+    abcdefghijklAkB
+
+"(?P<n0>a)(?P<n1>b)(?P<n2>c)(?P<n3>d)(?P<n4>e)(?P<n5>f)(?P<n6>g)(?P<n7>h)(?P<n8>i)(?P<n9>j)(?P<n10>k)(?P<n11>l)A\11B"
+    abcdefghijklAkB
+
+"(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)A\11B"
+    abcdefghijklAkB
+
+"(?P<name0>a)(?P<name1>a)(?P<name2>a)(?P<name3>a)(?P<name4>a)(?P<name5>a)(?P<name6>a)(?P<name7>a)(?P<name8>a)(?P<name9>a)(?P<name10>a)(?P<name11>a)(?P<name12>a)(?P<name13>a)(?P<name14>a)(?P<name15>a)(?P<name16>a)(?P<name17>a)(?P<name18>a)(?P<name19>a)(?P<name20>a)(?P<name21>a)(?P<name22>a)(?P<name23>a)(?P<name24>a)(?P<name25>a)(?P<name26>a)(?P<name27>a)(?P<name28>a)(?P<name29>a)(?P<name30>a)(?P<name31>a)(?P<name32>a)(?P<name33>a)(?P<name34>a)(?P<name35>a)(?P<name36>a)(?P<name37>a)(?P<name38>a)(?P<name39>a)(?P<name40>a)(?P<name41>a)(?P<name42>a)(?P<name43>a)(?P<name44>a)(?P<name45>a)(?P<name46>a)(?P<name47>a)(?P<name48>a)(?P<name49>a)(?P<name50>a)(?P<name51>a)(?P<name52>a)(?P<name53>a)(?P<name54>a)(?P<name55>a)(?P<name56>a)(?P<name57>a)(?P<name58>a)(?P<name59>a)(?P<name60>a)(?P<name61>a)(?P<name62>a)(?P<name63>a)(?P<name64>a)(?P<name65>a)(?P<name66>a)(?P<name67>a)(?P<name68>a)(?P<name69>a)(?P<name70>a)(?P<name71>a)(?P<name72>a)(?P<name73>a)(?P<name74>a)(?P<name75>a)(?P<name76>a)(?P<name77>a)(?P<name78>a)(?P<name79>a)(?P<name80>a)(?P<name81>a)(?P<name82>a)(?P<name83>a)(?P<name84>a)(?P<name85>a)(?P<name86>a)(?P<name87>a)(?P<name88>a)(?P<name89>a)(?P<name90>a)(?P<name91>a)(?P<name92>a)(?P<name93>a)(?P<name94>a)(?P<name95>a)(?P<name96>a)(?P<name97>a)(?P<name98>a)(?P<name99>a)(?P<name100>a)"
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+
+"(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)"
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+
 / End of testinput2 /
index 391aa620696f243e131fa44bfc37e314590cb99b..c2abdbfdb55c18c9dcfbb2cc1c3e90c8e3632828 100644 (file)
@@ -2,7 +2,7 @@
     *** Failers
     École
 
-/^[\w]+/Lfr
+/^[\w]+/Lfr_FR
     École
 
 /^[\w]+/
@@ -12,7 +12,7 @@
 /^[\W]+/
     École
 
-/^[\W]+/Lfr
+/^[\W]+/Lfr_FR
     *** Failers
     École
 
@@ -21,7 +21,7 @@
     *** Failers
     a
 
-/[\b]/Lfr
+/[\b]/Lfr_FR
     \b
     *** Failers
     a
     *** Failers
     École
 
-/^\w+/Lfr
+/^\w+/Lfr_FR
     École
 
 /(.+)\b(.+)/
     École
 
-/(.+)\b(.+)/Lfr
+/(.+)\b(.+)/Lfr_FR
     *** Failers
     École
 
     *** Failers
     école
 
-/École/iLfr
+/École/iLfr_FR
     École
     école
 
 /\w/IS
 
-/\w/ISLfr
+/\w/ISLfr_FR
 
-/^[\xc8-\xc9]/iLfr
+/^[\xc8-\xc9]/iLfr_FR
     École
     école
 
-/^[\xc8-\xc9]/Lfr
+/^[\xc8-\xc9]/Lfr_FR
     École
     *** Failers 
     école
index 51d6b976328fd224d9320529631a8d442607b762..c16e9d9983bbdfedc63a0985e8cb8afd776cf6f0 100644 (file)
     X\x{1234}YZ
     X\x{1234}\x{512}  
 
+/[^a]+/8g
+    bcd
+    \x{100}aY\x{256}Z 
+    
+/^[^a]{2}/8
+    \x{100}bc
+/^[^a]{2,}/8
+    \x{100}bcAa
+
+/^[^a]{2,}?/8
+    \x{100}bca
+
+/[^a]+/8ig
+    bcd
+    \x{100}aY\x{256}Z 
+    
+/^[^a]{2}/8i
+    \x{100}bc
+/^[^a]{2,}/8i
+    \x{100}bcAa
+
+/^[^a]{2,}?/8i
+    \x{100}bca
+
+/\x{100}{0,0}/8
+    abcd
+/\x{100}?/8
+    abcd
+    \x{100}\x{100} 
+
+/\x{100}{0,3}/8 
+    \x{100}\x{100} 
+    \x{100}\x{100}\x{100}\x{100} 
+    
+/\x{100}*/8
+    abce
+    \x{100}\x{100}\x{100}\x{100} 
+
+/\x{100}{1,1}/8
+    abcd\x{100}\x{100}\x{100}\x{100} 
+
+/\x{100}{1,3}/8
+    abcd\x{100}\x{100}\x{100}\x{100} 
+
+/\x{100}+/8
+    abcd\x{100}\x{100}\x{100}\x{100} 
+
+/\x{100}{3}/8
+    abcd\x{100}\x{100}\x{100}XX
+
+/\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
+    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
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+
+/\D*/8
+  \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\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
+    1X2
+    1\x{100}2 
+  
+/>\S/8
+    > >X Y
+    > >\x{100} Y
+  
+/\d/8
+    \x{100}3
+    
+/\s/8
+    \x{100} X
+    
+/\D+/8
+    12abcd34
+    *** Failers
+    1234  
+
+/\D{2,3}/8
+    12abcd34
+    12ab34
+    *** Failers  
+    1234
+    12a34  
+
+/\D{2,3}?/8
+    12abcd34
+    12ab34
+    *** Failers  
+    1234
+    12a34  
+
+/\d+/8
+    12abcd34
+    *** Failers
+
+/\d{2,3}/8
+    12abcd34
+    1234abcd
+    *** Failers  
+    1.4 
+
+/\d{2,3}?/8
+    12abcd34
+    1234abcd
+    *** Failers  
+    1.4 
+
+/\S+/8
+    12abcd34
+    *** Failers
+    \    \ 
+
+/\S{2,3}/8
+    12abcd34
+    1234abcd
+    *** Failers
+    \     \  
+
+/\S{2,3}?/8
+    12abcd34
+    1234abcd
+    *** Failers
+    \     \  
+
+/>\s+</8+
+    12>      <34
+    *** Failers
+
+/>\s{2,3}</8+
+    ab>  <cd
+    ab>   <ce
+    *** Failers
+    ab>    <cd 
+
+/>\s{2,3}?</8+
+    ab>  <cd
+    ab>   <ce
+    *** Failers
+    ab>    <cd 
+
+/\w+/8
+    12      34
+    *** Failers
+    +++=*! 
+
+/\w{2,3}/8
+    ab  cd
+    abcd ce
+    *** Failers
+    a.b.c
+
+/\w{2,3}?/8
+    ab  cd
+    abcd ce
+    *** Failers
+    a.b.c
+
+/\W+/8
+    12====34
+    *** Failers
+    abcd 
+
+/\W{2,3}/8
+    ab====cd
+    ab==cd
+    *** Failers
+    a.b.c
+
+/\W{2,3}?/8
+    ab====cd
+    ab==cd
+    *** Failers
+    a.b.c
+
+/[\x{100}]/8
+    \x{100}
+    Z\x{100}
+    \x{100}Z
+    *** Failers 
+
+/[Z\x{100}]/8
+    Z\x{100}
+    \x{100}
+    \x{100}Z
+    *** Failers 
+
+/[\x{100}\x{200}]/8
+   ab\x{100}cd
+   ab\x{200}cd
+   *** Failers  
+
+/[\x{100}-\x{200}]/8
+   ab\x{100}cd
+   ab\x{200}cd
+   ab\x{111}cd 
+   *** Failers  
+
+/[z-\x{200}]/8
+   ab\x{100}cd
+   ab\x{200}cd
+   ab\x{111}cd 
+   abzcd
+   ab|cd  
+   *** Failers  
+
+/[Q\x{100}\x{200}]/8
+   ab\x{100}cd
+   ab\x{200}cd
+   Q? 
+   *** Failers  
+
+/[Q\x{100}-\x{200}]/8
+   ab\x{100}cd
+   ab\x{200}cd
+   ab\x{111}cd 
+   Q? 
+   *** Failers  
+
+/[Qz-\x{200}]/8
+   ab\x{100}cd
+   ab\x{200}cd
+   ab\x{111}cd 
+   abzcd
+   ab|cd  
+   Q? 
+   *** Failers  
+
+/[\x{100}\x{200}]{1,3}/8
+   ab\x{100}cd
+   ab\x{200}cd
+   ab\x{200}\x{100}\x{200}\x{100}cd
+   *** Failers  
+
+/[\x{100}\x{200}]{1,3}?/8
+   ab\x{100}cd
+   ab\x{200}cd
+   ab\x{200}\x{100}\x{200}\x{100}cd
+   *** Failers  
+
+/[Q\x{100}\x{200}]{1,3}/8
+   ab\x{100}cd
+   ab\x{200}cd
+   ab\x{200}\x{100}\x{200}\x{100}cd
+   *** Failers  
+
+/[Q\x{100}\x{200}]{1,3}?/8
+   ab\x{100}cd
+   ab\x{200}cd
+   ab\x{200}\x{100}\x{200}\x{100}cd
+   *** Failers  
+
+/(?<=[\x{100}\x{200}])X/8
+    abc\x{200}X
+    abc\x{100}X 
+    *** Failers
+    X  
+
+/(?<=[Q\x{100}\x{200}])X/8
+    abc\x{200}X
+    abc\x{100}X 
+    abQX 
+    *** Failers
+    X  
+
+/(?<=[\x{100}\x{200}]{3})X/8
+    abc\x{100}\x{200}\x{100}X
+    *** Failers
+    abc\x{200}X
+    X  
+
+/[^\x{100}\x{200}]X/8
+    AX
+    \x{150}X
+    \x{500}X 
+    *** Failers
+    \x{100}X
+    \x{200}X   
+
+/[^Q\x{100}\x{200}]X/8
+    AX
+    \x{150}X
+    \x{500}X 
+    *** Failers
+    \x{100}X
+    \x{200}X   
+    QX 
+
+/[^\x{100}-\x{200}]X/8
+    AX
+    \x{500}X 
+    *** Failers
+    \x{100}X
+    \x{150}X
+    \x{200}X   
+
+/a\Cb/
+    aXb
+    a\nb
+  
+/a\Cb/8
+    aXb
+    a\nb
+    *** Failers 
+    a\x{100}b 
+
+/[z-\x{100}]/8i
+    z
+    Z 
+    \x{100}
+    *** Failers
+    \x{102}
+    y    
+
+/[\xFF]/
+    >\xff<
+
+/[\xff]/8
+    >\x{ff}<
+
+/[^\xFF]/
+    XYZ
+
+/[^\xff]/8
+    XYZ
+    \x{123} 
+
+/^[ac]*b/8
+  xb
+
+/^[ac\x{100}]*b/8
+  xb
+
+/^[^x]*b/8i
+  xb
+
+/^[^x]*b/8
+  xb
+  
+/^\d*b/8
+  xb 
+
+/(|a)/g8
+    catac
+    a\x{256}a 
+
+/^\x{85}$/8i
+    \x{85}
+
 / End of testinput4 /
index 81fe233e6ba10cda17d853103cdc138832fddf3c..fe6ee3e65652b3da3543d0dc810e7c811ff4bd62 100644 (file)
 /X(\C)(.*)/8
     X\x{1234}
     X\nabc 
+    
+/^[ab]/8D
+    bar
+    *** Failers
+    c
+    \x{ff}
+    \x{100}  
+
+/^[^ab]/8D
+    c
+    \x{ff}
+    \x{100}  
+    *** Failers 
+    aaa
+  
+/[^ab\xC0-\xF0]/8SD
+    \x{f1}
+    \x{bf}
+    \x{100}
+    \x{1000}   
+    *** Failers
+    \x{c0} 
+    \x{f0} 
+
+/Ā{3,4}/8SD
+  \x{100}\x{100}\x{100}\x{100\x{100}
+
+/(\x{100}+|x)/8SD
+
+/(\x{100}*a|x)/8SD
+
+/(\x{100}{0,2}a|x)/8SD
+
+/(\x{100}{1,2}a|x)/8SD
+
+/\x{100}*(\d+|"(?1)")/8
+    1234
+    "1234" 
+    \x{100}1234
+    "\x{100}1234"  
+    \x{100}\x{100}12ab 
+    \x{100}\x{100}"12" 
+    *** Failers 
+    \x{100}\x{100}abcd
+
+/\x{100}/8D
+
+/\x{100}*/8D
+
+/a\x{100}*/8D
+
+/ab\x{100}*/8D
+
+/a\x{100}\x{101}*/8D
+
+/a\x{100}\x{101}+/8D
+
+/\x{100}*A/8D
+    A
+
+/\x{100}*\d(?R)/8D
+
+/[^\x{c4}]/D
+
+/[^\x{c4}]/8D
+
+/[\x{100}]/8DM
+    \x{100}
+    Z\x{100}
+    \x{100}Z
+    *** Failers 
+
+/[Z\x{100}]/8DM
+    Z\x{100}
+    \x{100}
+    \x{100}Z
+    *** Failers 
+
+/[\x{200}-\x{100}]/8
+
+/[Ā-Ą]/8
+    \x{100}
+    \x{104}
+    *** Failers
+    \x{105}
+    \x{ff}    
+
+/[z-\x{100}]/8D
+
+/[z\Qa-d]Ā\E]/8D
+    \x{100}
+    Ā 
+
+/[\xFF]/D
+    >\xff<
+
+/[\xff]/D8
+    >\x{ff}<
+
+/[^\xFF]/D
+
+/[^\xff]/8D
+
+/[Ä-Ü]/8
+    Ö # Matches without Study
+    \x{d6}
+    
+/[Ä-Ü]/8S
+    Ö <-- Same with Study
+    \x{d6}
+    
+/[\x{c4}-\x{dc}]/8 
+    Ö # Matches without Study
+    \x{d6} 
+
+/[\x{c4}-\x{dc}]/8S
+    Ö <-- Same with Study
+    \x{d6} 
+
+/[Ã]/8
+
+/Ã/8
+
+/ÃÃÃxxx/8
+
+/ÃÃÃxxx/8?D
+
+/abc/8
+    Ã]
+    Ã
+    ÃÃÃ
+    ÃÃÃ\?
+
+/anything/8
+    \xc0\x80
+    \xc1\x8f 
+    \xe0\x9f\x80
+    \xf0\x8f\x80\x80 
+    \xf8\x87\x80\x80\x80  
+    \xfc\x83\x80\x80\x80\x80
+    \xfe\x80\x80\x80\x80\x80  
+    \xff\x80\x80\x80\x80\x80  
+    \xc3\x8f
+    \xe0\xaf\x80
+    \xe1\x80\x80
+    \xf0\x9f\x80\x80 
+    \xf1\x8f\x80\x80 
+    \xf8\x88\x80\x80\x80  
+    \xf9\x87\x80\x80\x80  
+    \xfc\x84\x80\x80\x80\x80
+    \xfd\x83\x80\x80\x80\x80
+
+/\x{100}abc(xyz(?1))/8D
+
+/[^\x{100}]abc(xyz(?1))/8D
+
+/[ab\x{100}]abc(xyz(?1))/8D
+
+/(\x{100}(b(?2)c))?/D8
+
+/(\x{100}(b(?2)c)){0,2}/D8
+
+/(\x{100}(b(?1)c))?/D8
+
+/(\x{100}(b(?1)c)){0,2}/D8
+
+/\W/8
+    A.B
+    A\x{100}B 
+  
+/\w/8
+    \x{100}X   
 
 / End of testinput5 /
index 00748513c65cdff0425a87c22c932861c0bd205a..01a39477ac45a1033744c80c71515d9d2a2d6e0e 100644 (file)
-/\x{100}/8DM
+/^\pC\pL\pM\pN\pP\pS\pZ</8
+    \x7f\x{c0}\x{30f}\x{660}\x{66c}\x{f01}\x{1680}<
+    \np\x{300}9!\$ < 
+    ** Failers 
+    ap\x{300}9!\$ < 
+  
+/^\PC/8
+    X
+    ** Failers 
+    \x7f
+  
+/^\PL/8
+    9
+    ** Failers 
+    \x{c0}
+  
+/^\PM/8
+    X
+    ** Failers 
+    \x{30f}
+  
+/^\PN/8
+    X
+    ** Failers 
+    \x{660}
+  
+/^\PP/8
+    X
+    ** Failers 
+    \x{66c}
+  
+/^\PS/8
+    X
+    ** Failers 
+    \x{f01}
+  
+/^\PZ/8
+    X
+    ** Failers 
+    \x{1680}
+    
+/^\p{Cc}/8
+    \x{017}
+    \x{09f} 
+    ** Failers
+    \x{0600} 
+  
+/^\p{Cf}/8
+    \x{601}
+    ** Failers
+    \x{09f} 
+  
+/^\p{Cn}/8
+    ** Failers
+    \x{09f} 
+  
+/^\p{Co}/8
+    \x{f8ff}
+    ** Failers
+    \x{09f} 
+  
+/^\p{Cs}/8
+    \x{dfff}
+    ** Failers
+    \x{09f} 
+  
+/^\p{Ll}/8
+    a
+    ** Failers 
+    Z
+    \x{dfff}  
+  
+/^\p{Lm}/8
+    \x{2b0}
+    ** Failers
+    a 
+  
+/^\p{Lo}/8
+    \x{1bb}
+    ** Failers
+    a 
+    \x{2b0}
+  
+/^\p{Lt}/8
+    \x{1c5}
+    ** Failers
+    a 
+    \x{2b0}
+  
+/^\p{Lu}/8
+    A
+    ** Failers
+    \x{2b0}
+  
+/^\p{Mc}/8
+    \x{903}
+    ** Failers
+    X
+    \x{300}
+       
+/^\p{Me}/8
+    \x{488}
+    ** Failers
+    X
+    \x{903}
+    \x{300}
+  
+/^\p{Mn}/8
+    \x{300}
+    ** Failers
+    X
+    \x{903}
+  
+/^\p{Nd}+/8
+    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}
+    ** Failers
+    X
+  
+/^\p{Nl}/8
+    \x{16ee}
+    ** Failers
+    X
+    \x{966}
+  
+/^\p{No}/8
+    \x{b2}
+    \x{b3}
+    ** Failers
+    X
+    \x{16ee}
+  
+/^\p{Pc}/8
+    \x5f
+    \x{203f}
+    ** Failers
+    X
+    -
+    \x{58a}
+  
+/^\p{Pd}/8
+    -
+    \x{58a}
+    ** Failers
+    X
+    \x{203f}
+  
+/^\p{Pe}/8
+    )
+    ]
+    }
+    \x{f3b}
+    ** Failers
+    X
+    \x{203f}
+    (
+    [
+    {
+    \x{f3c}
+  
+/^\p{Pf}/8
+    \x{bb}
+    \x{2019}
+    ** Failers
+    X
+    \x{203f}
+  
+/^\p{Pi}/8
+    \x{ab}
+    \x{2018}
+    ** Failers
+    X
+    \x{203f}
+  
+/^\p{Po}/8
+    !
+    \x{37e}
+    ** Failers
+    X
+    \x{203f}
+  
+/^\p{Ps}/8
+    (
+    [
+    {
+    \x{f3c}
+    ** Failers
+    X
+    )
+    ]
+    }
+    \x{f3b}
+  
+/^\p{Sc}+/8
+    $\x{a2}\x{a3}\x{a4}\x{a5}\x{a6}
+    \x{9f2}
+    ** Failers
+    X
+    \x{2c2}
+  
+/^\p{Sk}/8
+    \x{2c2}
+    ** Failers
+    X
+    \x{9f2}
+  
+/^\p{Sm}+/8
+    +<|~\x{ac}\x{2044}
+    ** Failers
+    X
+    \x{9f2}
+  
+/^\p{So}/8
+    \x{a6}
+    \x{482} 
+    ** Failers
+    X
+    \x{9f2}
+  
+/^\p{Zl}/8
+    \x{2028}
+    ** Failers
+    X
+    \x{2029}
+  
+/^\p{Zp}/8
+    \x{2029}
+    ** Failers
+    X
+    \x{2028}
+  
+/^\p{Zs}/8
+    \ \
+    \x{a0}
+    \x{1680}
+    \x{180e}
+    \x{2000}
+    \x{2001}     
+    ** Failers
+    \x{2028}
+    \x{200d} 
+  
+/\p{Nd}+(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}+?(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}{2,}(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}{2,}?(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}*(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}*?(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}{2}(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}{2,3}(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}{2,3}?(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}?(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}??(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}*+(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}*+(...)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}*+(....)/8
+      ** Failers
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Lu}/8i
+    A
+    a\x{10a0}B 
+    ** Failers 
+    a
+    \x{1d00}  
+
+/\p{^Lu}/8i
+    1234
+    ** Failers
+    ABC 
+
+/\P{Lu}/8i
+    1234
+    ** Failers
+    ABC 
+
+/(?<=A\p{Nd})XYZ/8
+    A2XYZ
+    123A5XYZPQR
+    ABA\x{660}XYZpqr
+    ** Failers
+    AXYZ
+    XYZ     
+    
+/(?<!\pL)XYZ/8
+    1XYZ
+    AB=XYZ.. 
+    XYZ 
+    ** Failers
+    WXYZ 
 
-/\x{1000}/8DM
+/[\p{L}]/D
 
-/\x{10000}/8DM
+/[\p{^L}]/D
 
-/\x{100000}/8DM
+/[\P{L}]/D
 
-/\x{1000000}/8DM
+/[\P{^L}]/D
 
-/\x{4000000}/8DM
+/[abc\p{L}\x{0660}]/8D
 
-/\x{7fffFFFF}/8DM
+/[\p{Nd}]/8DM
+    1234
 
-/[\x{ff}]/8DM
+/[\p{Nd}+-]+/8DM
+    1234
+    12-34
+    12+\x{661}-34  
+    ** Failers
+    abcd  
 
-/[\x{100}]/8DM
+/[\P{Nd}]+/8
+    abcd
+    ** Failers
+    1234
 
-/\x{ffffffff}/8
+/\D+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+     
+/\P{Nd}+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
-/\x{100000000}/8
+/[\D]+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
-/^\x{100}a\x{1234}/8
-    \x{100}a\x{1234}bcd
+/[\P{Nd}]+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
-/\x80/8D
+/[\D\P{Nd}]+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
-/\xff/8D
+/\pL/8
+    a
+    A 
 
-/\x{0041}\x{2262}\x{0391}\x{002e}/D8
-    \x{0041}\x{2262}\x{0391}\x{002e}
+/\pL/8i
+    a
+    A 
     
-/\x{D55c}\x{ad6d}\x{C5B4}/D8 
-    \x{D55c}\x{ad6d}\x{C5B4} 
+/\p{Lu}/8 
+    A
+    aZ
+    ** Failers
+    abc   
+
+/\p{Lu}/8i
+    A
+    aZ
+    ** Failers
+    abc   
+
+/\p{Ll}/8 
+    a
+    Az
+    ** Failers
+    ABC   
+
+/\p{Ll}/8i 
+    a
+    Az
+    ** Failers
+    ABC   
+
+/^\x{c0}$/8i
+    \x{c0}
+    \x{e0} 
 
-/\x{65e5}\x{672c}\x{8a9e}/D8
-    \x{65e5}\x{672c}\x{8a9e}
+/^\x{e0}$/8i
+    \x{c0}
+    \x{e0} 
 
-/\x{80}/D8
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8
+    A\x{391}\x{10427}\x{ff3a}\x{1fb0}
+    ** Failers
+    a\x{391}\x{10427}\x{ff3a}\x{1fb0}   
+    A\x{3b1}\x{10427}\x{ff3a}\x{1fb0}
+    A\x{391}\x{1044F}\x{ff3a}\x{1fb0}
+    A\x{391}\x{10427}\x{ff5a}\x{1fb0}
+    A\x{391}\x{10427}\x{ff3a}\x{1fb8}
 
-/\x{084}/D8
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8i
+    A\x{391}\x{10427}\x{ff3a}\x{1fb0}
+    a\x{391}\x{10427}\x{ff3a}\x{1fb0}   
+    A\x{3b1}\x{10427}\x{ff3a}\x{1fb0}
+    A\x{391}\x{1044F}\x{ff3a}\x{1fb0}
+    A\x{391}\x{10427}\x{ff5a}\x{1fb0}
+    A\x{391}\x{10427}\x{ff3a}\x{1fb8}
 
-/\x{104}/D8
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8iD
 
-/\x{861}/D8
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8D
 
-/\x{212ab}/D8
+/AB\x{1fb0}/8D
 
-/.{3,5}X/D8
-    \x{212ab}\x{212ab}\x{212ab}\x{861}X
+/AB\x{1fb0}/8Di
 
+/\x{391}+/8i
+    \x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}
 
-/.{3,5}?/D8
-    \x{212ab}\x{212ab}\x{212ab}\x{861}
+/\x{391}{3,5}(.)/8i
+    \x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}X
 
-/-- These tests are here rather than in testinput5 because Perl 5.6 has --/
-/-- some problems with UTF-8 support, in the area of \x{..} where the   --/
-/-- value is < 255. It grumbles about invalid UTF-8 strings.            --/
+/\x{391}{3,5}?(.)/8i
+    \x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}X
 
-/^[a\x{c0}]b/8
-    \x{c0}b
+/[\x{391}\x{ff3a}]/8i
+    \x{391}
+    \x{ff3a}
+    \x{3b1}
+    \x{ff5a}   
     
-/^([a\x{c0}]*?)aa/8
-    a\x{c0}aaaa/ 
+/[\x{c0}\x{391}]/8i
+    \x{c0}
+    \x{e0} 
 
-/^([a\x{c0}]*?)aa/8
-    a\x{c0}aaaa/ 
-    a\x{c0}a\x{c0}aaa/ 
+/[\x{105}-\x{109}]/8iD
+    \x{104}
+    \x{105}
+    \x{109}  
+    ** Failers
+    \x{100}
+    \x{10a} 
+    
+/[z-\x{100}]/8iD 
+    Z
+    z
+    \x{39c}
+    \x{178}
+    |
+    \x{80}
+    \x{ff}
+    \x{100}
+    \x{101} 
+    ** Failers
+    \x{102}
+    Y
+    y           
+
+/[z-\x{100}]/8Di
+
+/^\X/8
+    A
+    A\x{300}BC 
+    A\x{300}\x{301}\x{302}BC 
+    *** Failers
+    \x{300}  
+
+/^[\X]/8
+    X123
+    *** Failers
+    AXYZ
+
+/^(\X*)C/8
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301} 
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C 
 
-/^([a\x{c0}]*)aa/8
-    a\x{c0}aaaa/ 
-    a\x{c0}a\x{c0}aaa/ 
+/^(\X*?)C/8
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301} 
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C 
 
-/^([a\x{c0}]*)a\x{c0}/8
-    a\x{c0}aaaa/ 
-    a\x{c0}a\x{c0}aaa/ 
+/^(\X*)(.)/8
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301} 
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C 
 
+/^(\X*?)(.)/8
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301} 
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C 
+
+/^\X(.)/8
+    *** Failers
+    A\x{300}\x{301}\x{302}
+
+/^\X{2,3}(.)/8
+    A\x{300}\x{301}B\x{300}X
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}X
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}DA\x{300}X
+    
+/^\X{2,3}?(.)/8
+    A\x{300}\x{301}B\x{300}X
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}X
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}DA\x{300}X
+    
 / End of testinput6 /
diff --git a/ext/pcre/pcrelib/testdata/testinput7 b/ext/pcre/pcrelib/testdata/testinput7
new file mode 100644 (file)
index 0000000..cecbc00
--- /dev/null
@@ -0,0 +1,4014 @@
+/abc/
+    abc
+    
+/ab*c/
+    abc
+    abbbbc
+    ac
+    
+/ab+c/
+    abc
+    abbbbbbc
+    *** Failers 
+    ac
+    ab
+    
+/a*/
+    a
+    aaaaaaaaaaaaaaaaa
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\F 
+    
+/(a|abcd|african)/
+    a
+    abcd
+    african
+    
+/^abc/
+    abcdef
+    *** Failers
+    xyzabc
+    xyz\nabc    
+    
+/^abc/m
+    abcdef
+    xyz\nabc    
+    *** Failers
+    xyzabc
+    
+/\Aabc/
+    abcdef
+    *** Failers
+    xyzabc
+    xyz\nabc    
+    
+/\Aabc/m
+    abcdef
+    *** Failers
+    xyzabc
+    xyz\nabc    
+    
+/\Gabc/
+    abcdef
+    xyzabc\>3
+    *** Failers
+    xyzabc    
+    xyzabc\>2 
+    
+/x\dy\Dz/
+    x9yzz
+    x0y+z
+    *** Failers
+    xyz
+    xxy0z     
+    
+/x\sy\Sz/
+    x yzz
+    x y+z
+    *** Failers
+    xyz
+    xxyyz
+    
+/x\wy\Wz/
+    xxy+z
+    *** Failers
+    xxy0z
+    x+y+z         
+    
+/x.y/
+    x+y
+    x-y
+    *** Failers
+    x\ny
+    
+/x.y/s
+    x+y
+    x-y
+    x\ny
+
+/(a.b(?s)c.d|x.y)p.q/
+    a+bc+dp+q
+    a+bc\ndp+q
+    x\nyp+q 
+    *** Failers 
+    a\nbc\ndp+q
+    a+bc\ndp\nq
+    x\nyp\nq 
+
+/a\d\z/
+    ba0
+    *** Failers
+    ba0\n
+    ba0\ncd   
+
+/a\d\z/m
+    ba0
+    *** Failers
+    ba0\n
+    ba0\ncd   
+
+/a\d\Z/
+    ba0
+    ba0\n
+    *** Failers
+    ba0\ncd   
+
+/a\d\Z/m
+    ba0
+    ba0\n
+    *** Failers
+    ba0\ncd   
+
+/a\d$/
+    ba0
+    ba0\n
+    *** Failers
+    ba0\ncd   
+
+/a\d$/m
+    ba0
+    ba0\n
+    ba0\ncd   
+    *** Failers
+
+/abc/i
+    abc
+    aBc
+    ABC
+    
+/[^a]/
+    abcd
+    
+/ab?\w/
+    abz
+    abbz
+    azz  
+
+/x{0,3}yz/
+    ayzq
+    axyzq
+    axxyz
+    axxxyzq
+    axxxxyzq
+    *** Failers
+    ax
+    axx     
+      
+/x{3}yz/
+    axxxyzq
+    axxxxyzq
+    *** Failers
+    ax
+    axx     
+    ayzq
+    axyzq
+    axxyz
+      
+/x{2,3}yz/
+    axxyz
+    axxxyzq
+    axxxxyzq
+    *** Failers
+    ax
+    axx     
+    ayzq
+    axyzq
+      
+/[^a]+/
+    bac
+    bcdefax
+    *** Failers
+    aaaaa   
+
+/[^a]*/
+    bac
+    bcdefax
+    *** Failers
+    aaaaa   
+    
+/[^a]{3,5}/
+    xyz
+    awxyza
+    abcdefa
+    abcdefghijk
+    *** Failers
+    axya
+    axa
+    aaaaa         
+
+/\d*/
+    1234b567
+    xyz
+    
+/\D*/
+    a1234b567
+    xyz
+     
+/\d+/
+    ab1234c56
+    *** Failers
+    xyz
+    
+/\D+/
+    ab123c56
+    *** Failers
+    789
+    
+/\d?A/
+    045ABC
+    ABC
+    *** Failers
+    XYZ
+    
+/\D?A/
+    ABC
+    BAC
+    9ABC             
+    *** Failers
+
+/a+/
+    aaaa
+
+/^.*xyz/
+    xyz
+    ggggggggxyz
+    
+/^.+xyz/
+    abcdxyz
+    axyz
+    *** Failers
+    xyz
+    
+/^.?xyz/
+    xyz
+    cxyz       
+
+/^\d{2,3}X/
+    12X
+    123X
+    *** Failers
+    X
+    1X
+    1234X     
+
+/^[abcd]\d/
+    a45
+    b93
+    c99z
+    d04
+    *** Failers
+    e45
+    abcd      
+    abcd1234
+    1234  
+
+/^[abcd]*\d/
+    a45
+    b93
+    c99z
+    d04
+    abcd1234
+    1234  
+    *** Failers
+    e45
+    abcd      
+
+/^[abcd]+\d/
+    a45
+    b93
+    c99z
+    d04
+    abcd1234
+    *** Failers
+    1234  
+    e45
+    abcd      
+
+/^a+X/
+    aX
+    aaX 
+
+/^[abcd]?\d/
+    a45
+    b93
+    c99z
+    d04
+    1234  
+    *** Failers
+    abcd1234
+    e45
+
+/^[abcd]{2,3}\d/
+    ab45
+    bcd93
+    *** Failers
+    1234 
+    a36 
+    abcd1234
+    ee45
+
+/^(abc)*\d/
+    abc45
+    abcabcabc45
+    42xyz 
+    *** Failers
+
+/^(abc)+\d/
+    abc45
+    abcabcabc45
+    *** Failers
+    42xyz 
+
+/^(abc)?\d/
+    abc45
+    42xyz 
+    *** Failers
+    abcabcabc45
+
+/^(abc){2,3}\d/
+    abcabc45
+    abcabcabc45
+    *** Failers
+    abcabcabcabc45
+    abc45
+    42xyz 
+
+/1(abc|xyz)2(?1)3/
+    1abc2abc3456
+    1abc2xyz3456 
+
+/^(a*\w|ab)=(a*\w|ab)/
+    ab=ab
+
+/^(a*\w|ab)=(?1)/
+    ab=ab
+
+/^([^()]|\((?1)*\))*$/
+    abc
+    a(b)c
+    a(b(c))d  
+    *** Failers)
+    a(b(c)d  
+
+/^>abc>([^()]|\((?1)*\))*<xyz<$/
+    >abc>123<xyz<
+    >abc>1(2)3<xyz<
+    >abc>(1(2)3)<xyz<
+
+/^(?>a*)\d/
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa9876
+    *** Failers 
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+
+/< (?: (?(R) \d++  | [^<>]*+) | (?R)) * >/x
+    <>
+    <abcd>
+    <abc <123> hij>
+    <abc <def> hij>
+    <abc<>def> 
+    <abc<>      
+    *** Failers
+    <abc
+
+/^(?(?=abc)\w{3}:|\d\d)$/        
+    abc:                          
+    12                             
+    *** Failers                     
+    123                       
+    xyz                        
+                                
+/^(?(?!abc)\d\d|\w{3}:)$/      
+    abc:                        
+    12         
+    *** Failers
+    123
+    xyz    
+
+/^(?=abc)\w{5}:$/        
+    abcde:                          
+    *** Failers                     
+    abc.. 
+    123                       
+    vwxyz                        
+                                
+/^(?!abc)\d\d$/      
+    12         
+    *** Failers
+    abcde:
+    abc..  
+    123
+    vwxyz    
+
+/(?<=abc|xy)123/
+    abc12345
+    wxy123z
+    *** Failers
+    123abc
+
+/(?<!abc|xy)123/
+    123abc
+    mno123456 
+    *** Failers
+    abc12345
+    wxy123z
+
+/abc(?C1)xyz/
+    abcxyz
+    123abcxyz999 
+
+/(ab|cd){3,4}/C
+  ababab
+  abcdabcd
+  abcdcdcdcdcd  
+
+/^abc/
+    abcdef
+    *** Failers
+    abcdef\B  
+
+/^(a*|xyz)/
+    bcd
+    aaabcd
+    xyz
+    xyz\N  
+    *** Failers
+    bcd\N   
+    
+/xyz$/
+    xyz
+    xyz\n
+    *** Failers
+    xyz\Z
+    xyz\n\Z    
+    
+/xyz$/m
+    xyz
+    xyz\n 
+    abcxyz\npqr 
+    abcxyz\npqr\Z 
+    xyz\n\Z    
+    *** Failers
+    xyz\Z
+
+/\Gabc/
+    abcdef
+    defabcxyz\>3 
+    *** Failers 
+    defabcxyz
+
+/^abcdef/
+    ab\P
+    abcde\P
+    abcdef\P
+    *** Failers
+    abx\P    
+
+/^a{2,4}\d+z/
+    a\P
+    aa\P
+    aa2\P 
+    aaa\P
+    aaa23\P 
+    aaaa12345\P
+    aa0z\P
+    aaaa4444444444444z\P 
+    *** Failers
+    az\P 
+    aaaaa\P 
+    a56\P 
+
+/^abcdef/
+   abc\P
+   def\R 
+   
+/(?<=foo)bar/
+   xyzfo\P 
+   foob\R\P\>2 
+   foobar...\R\P\>4 
+   xyzfo\P
+   foobar\R\>2  
+   *** Failers
+   xyzfo\P
+   obar\R   
+
+/(ab*(cd|ef))+X/
+    adfadadaklhlkalkajhlkjahdfasdfasdfladsfjkj\P\Z
+    lkjhlkjhlkjhlkjhabbbbbbcdaefabbbbbbbefa\P\B\Z
+    cdabbbbbbbb\P\R\B\Z
+    efabbbbbbbbbbbbbbbb\P\R\B\Z
+    bbbbbbbbbbbbcdXyasdfadf\P\R\B\Z    
+
+/(a|b)/SF>testsavedregex
+<testsavedregex
+    abc
+    ** Failers
+    def  
+    
+/the quick brown fox/
+    the quick brown fox
+    The quick brown FOX
+    What do you know about the quick brown fox?
+    What do you know about THE QUICK BROWN FOX?
+
+/The quick brown fox/i
+    the quick brown fox
+    The quick brown FOX
+    What do you know about the quick brown fox?
+    What do you know about THE QUICK BROWN FOX?
+
+/abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
+    abcd\t\n\r\f\a\e9;\$\\?caxyz
+
+/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
+    abxyzpqrrrabbxyyyypqAzz
+    abxyzpqrrrabbxyyyypqAzz
+    aabxyzpqrrrabbxyyyypqAzz
+    aaabxyzpqrrrabbxyyyypqAzz
+    aaaabxyzpqrrrabbxyyyypqAzz
+    abcxyzpqrrrabbxyyyypqAzz
+    aabcxyzpqrrrabbxyyyypqAzz
+    aaabcxyzpqrrrabbxyyyypAzz
+    aaabcxyzpqrrrabbxyyyypqAzz
+    aaabcxyzpqrrrabbxyyyypqqAzz
+    aaabcxyzpqrrrabbxyyyypqqqAzz
+    aaabcxyzpqrrrabbxyyyypqqqqAzz
+    aaabcxyzpqrrrabbxyyyypqqqqqAzz
+    aaabcxyzpqrrrabbxyyyypqqqqqqAzz
+    aaaabcxyzpqrrrabbxyyyypqAzz
+    abxyzzpqrrrabbxyyyypqAzz
+    aabxyzzzpqrrrabbxyyyypqAzz
+    aaabxyzzzzpqrrrabbxyyyypqAzz
+    aaaabxyzzzzpqrrrabbxyyyypqAzz
+    abcxyzzpqrrrabbxyyyypqAzz
+    aabcxyzzzpqrrrabbxyyyypqAzz
+    aaabcxyzzzzpqrrrabbxyyyypqAzz
+    aaaabcxyzzzzpqrrrabbxyyyypqAzz
+    aaaabcxyzzzzpqrrrabbbxyyyypqAzz
+    aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
+    aaabcxyzpqrrrabbxyyyypABzz
+    aaabcxyzpqrrrabbxyyyypABBzz
+    >>>aaabxyzpqrrrabbxyyyypqAzz
+    >aaaabxyzpqrrrabbxyyyypqAzz
+    >>>>abcxyzpqrrrabbxyyyypqAzz
+    *** Failers
+    abxyzpqrrabbxyyyypqAzz
+    abxyzpqrrrrabbxyyyypqAzz
+    abxyzpqrrrabxyyyypqAzz
+    aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
+    aaaabcxyzzzzpqrrrabbbxyyypqAzz
+    aaabcxyzpqrrrabbxyyyypqqqqqqqAzz
+
+/^(abc){1,2}zz/
+    abczz
+    abcabczz
+    *** Failers
+    zz
+    abcabcabczz
+    >>abczz
+
+/^(b+?|a){1,2}?c/
+    bc
+    bbc
+    bbbc
+    bac
+    bbac
+    aac
+    abbbbbbbbbbbc
+    bbbbbbbbbbbac
+    *** Failers
+    aaac
+    abbbbbbbbbbbac
+
+/^(b+|a){1,2}c/
+    bc
+    bbc
+    bbbc
+    bac
+    bbac
+    aac
+    abbbbbbbbbbbc
+    bbbbbbbbbbbac
+    *** Failers
+    aaac
+    abbbbbbbbbbbac
+
+/^(b+|a){1,2}?bc/
+    bbc
+
+/^(b*|ba){1,2}?bc/
+    babc
+    bbabc
+    bababc
+    *** Failers
+    bababbc
+    babababc
+
+/^(ba|b*){1,2}?bc/
+    babc
+    bbabc
+    bababc
+    *** Failers
+    bababbc
+    babababc
+
+/^\ca\cA\c[\c{\c:/
+    \x01\x01\e;z
+
+/^[ab\]cde]/
+    athing
+    bthing
+    ]thing
+    cthing
+    dthing
+    ething
+    *** Failers
+    fthing
+    [thing
+    \\thing
+
+/^[]cde]/
+    ]thing
+    cthing
+    dthing
+    ething
+    *** Failers
+    athing
+    fthing
+
+/^[^ab\]cde]/
+    fthing
+    [thing
+    \\thing
+    *** Failers
+    athing
+    bthing
+    ]thing
+    cthing
+    dthing
+    ething
+
+/^[^]cde]/
+    athing
+    fthing
+    *** Failers
+    ]thing
+    cthing
+    dthing
+    ething
+
+/^\\81/
+    \81
+
+/^ÿ/
+    ÿ
+
+/^[0-9]+$/
+    0
+    1
+    2
+    3
+    4
+    5
+    6
+    7
+    8
+    9
+    10
+    100
+    *** Failers
+    abc
+
+/^.*nter/
+    enter
+    inter
+    uponter
+
+/^xxx[0-9]+$/
+    xxx0
+    xxx1234
+    *** Failers
+    xxx
+
+/^.+[0-9][0-9][0-9]$/
+    x123
+    xx123
+    123456
+    *** Failers
+    123
+    x1234
+
+/^.+?[0-9][0-9][0-9]$/
+    x123
+    xx123
+    123456
+    *** Failers
+    123
+    x1234
+
+/^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
+    abc!pqr=apquxz.ixr.zzz.ac.uk
+    *** Failers
+    !pqr=apquxz.ixr.zzz.ac.uk
+    abc!=apquxz.ixr.zzz.ac.uk
+    abc!pqr=apquxz:ixr.zzz.ac.uk
+    abc!pqr=apquxz.ixr.zzz.ac.ukk
+
+/:/
+    Well, we need a colon: somewhere
+    *** Fail if we don't
+
+/([\da-f:]+)$/i
+    0abc
+    abc
+    fed
+    E
+    ::
+    5f03:12C0::932e
+    fed def
+    Any old stuff
+    *** Failers
+    0zzz
+    gzzz
+    fed\x20
+    Any old rubbish
+
+/^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
+    .1.2.3
+    A.12.123.0
+    *** Failers
+    .1.2.3333
+    1.2.3
+    1234.2.3
+
+/^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
+    1 IN SOA non-sp1 non-sp2(
+    1    IN    SOA    non-sp1    non-sp2   (
+    *** Failers
+    1IN SOA non-sp1 non-sp2(
+
+/^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/
+    a.
+    Z.
+    2.
+    ab-c.pq-r.
+    sxk.zzz.ac.uk.
+    x-.y-.
+    *** Failers
+    -abc.peq.
+
+/^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/
+    *.a
+    *.b0-a
+    *.c3-b.c
+    *.c-a.b-c
+    *** Failers
+    *.0
+    *.a-
+    *.a-b.c-
+    *.c-a.0-c
+
+/^(?=ab(de))(abd)(e)/
+    abde
+
+/^(?!(ab)de|x)(abd)(f)/
+    abdf
+
+/^(?=(ab(cd)))(ab)/
+    abcd
+
+/^[\da-f](\.[\da-f])*$/i
+    a.b.c.d
+    A.B.C.D
+    a.b.c.1.2.3.C
+
+/^\".*\"\s*(;.*)?$/
+    \"1234\"
+    \"abcd\" ;
+    \"\" ; rhubarb
+    *** Failers
+    \"1234\" : things
+
+/^$/
+    \
+    *** Failers
+
+/   ^    a   (?# begins with a)  b\sc (?# then b c) $ (?# then end)/x
+    ab c
+    *** Failers
+    abc
+    ab cde
+
+/(?x)   ^    a   (?# begins with a)  b\sc (?# then b c) $ (?# then end)/
+    ab c
+    *** Failers
+    abc
+    ab cde
+
+/^   a\ b[c ]d       $/x
+    a bcd
+    a b d
+    *** Failers
+    abcd
+    ab d
+
+/^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
+    abcdefhijklm
+
+/^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/
+    abcdefhijklm
+
+/^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/
+    a+ Z0+\x08\n\x1d\x12
+
+/^[.^$|()*+?{,}]+/
+    .^\$(*+)|{?,?}
+
+/^a*\w/
+    z
+    az
+    aaaz
+    a
+    aa
+    aaaa
+    a+
+    aa+
+
+/^a*?\w/
+    z
+    az
+    aaaz
+    a
+    aa
+    aaaa
+    a+
+    aa+
+
+/^a+\w/
+    az
+    aaaz
+    aa
+    aaaa
+    aa+
+
+/^a+?\w/
+    az
+    aaaz
+    aa
+    aaaa
+    aa+
+
+/^\d{8}\w{2,}/
+    1234567890
+    12345678ab
+    12345678__
+    *** Failers
+    1234567
+
+/^[aeiou\d]{4,5}$/
+    uoie
+    1234
+    12345
+    aaaaa
+    *** Failers
+    123456
+
+/^[aeiou\d]{4,5}?/
+    uoie
+    1234
+    12345
+    aaaaa
+    123456
+
+/^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/
+    From abcd  Mon Sep 01 12:33:02 1997
+
+/^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/
+    From abcd  Mon Sep 01 12:33:02 1997
+    From abcd  Mon Sep  1 12:33:02 1997
+    *** Failers
+    From abcd  Sep 01 12:33:02 1997
+
+/^12.34/s
+    12\n34
+    12\r34
+
+/\w+(?=\t)/
+    the quick brown\t fox
+
+/foo(?!bar)(.*)/
+    foobar is foolish see?
+
+/(?:(?!foo)...|^.{0,2})bar(.*)/
+    foobar crowbar etc
+    barrel
+    2barrel
+    A barrel
+
+/^(\D*)(?=\d)(?!123)/
+    abc456
+    *** Failers
+    abc123
+
+/^1234(?# test newlines
+  inside)/
+    1234
+
+/^1234 #comment in extended re
+  /x
+    1234
+
+/#rhubarb
+  abcd/x
+    abcd
+
+/^abcd#rhubarb/x
+    abcd
+
+/(?!^)abc/
+    the abc
+    *** Failers
+    abc
+
+/(?=^)abc/
+    abc
+    *** Failers
+    the abc
+
+/^[ab]{1,3}(ab*|b)/
+    aabbbbb
+
+/^[ab]{1,3}?(ab*|b)/
+    aabbbbb
+
+/^[ab]{1,3}?(ab*?|b)/
+    aabbbbb
+
+/^[ab]{1,3}(ab*?|b)/
+    aabbbbb
+
+/  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*                          # optional leading comment
+(?:    (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+" (?:                      # opening quote...
+[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
+|                     #    or
+\\ [^\x80-\xff]           #   Escaped something (something != CR)
+)* "  # closing quote
+)                    # initial word
+(?:  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  \.  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*   (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+" (?:                      # opening quote...
+[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
+|                     #    or
+\\ [^\x80-\xff]           #   Escaped something (something != CR)
+)* "  # closing quote
+)  )* # further okay, if led by a period
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  @  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*    (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|   \[                         # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
+\]                        #           ]
+)                           # initial subdomain
+(?:                                  #
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  \.                        # if led by a period...
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*   (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|   \[                         # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
+\]                        #           ]
+)                     #   ...further okay
+)*
+# address
+|                     #  or
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+" (?:                      # opening quote...
+[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
+|                     #    or
+\\ [^\x80-\xff]           #   Escaped something (something != CR)
+)* "  # closing quote
+)             # one word, optionally followed by....
+(?:
+[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037]  |  # atom and space parts, or...
+\(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)       |  # comments, or...
+
+" (?:                      # opening quote...
+[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
+|                     #    or
+\\ [^\x80-\xff]           #   Escaped something (something != CR)
+)* "  # closing quote
+# quoted strings
+)*
+<  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*                     # leading <
+(?:  @  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*    (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|   \[                         # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
+\]                        #           ]
+)                           # initial subdomain
+(?:                                  #
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  \.                        # if led by a period...
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*   (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|   \[                         # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
+\]                        #           ]
+)                     #   ...further okay
+)*
+
+(?:  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  ,  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  @  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*    (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|   \[                         # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
+\]                        #           ]
+)                           # initial subdomain
+(?:                                  #
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  \.                        # if led by a period...
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*   (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|   \[                         # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
+\]                        #           ]
+)                     #   ...further okay
+)*
+)* # further okay, if led by comma
+:                                # closing colon
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  )? #       optional route
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+" (?:                      # opening quote...
+[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
+|                     #    or
+\\ [^\x80-\xff]           #   Escaped something (something != CR)
+)* "  # closing quote
+)                    # initial word
+(?:  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  \.  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*   (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+" (?:                      # opening quote...
+[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
+|                     #    or
+\\ [^\x80-\xff]           #   Escaped something (something != CR)
+)* "  # closing quote
+)  )* # further okay, if led by a period
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  @  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*    (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|   \[                         # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
+\]                        #           ]
+)                           # initial subdomain
+(?:                                  #
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  \.                        # if led by a period...
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*   (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|   \[                         # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
+\]                        #           ]
+)                     #   ...further okay
+)*
+#       address spec
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  > #                  trailing >
+# name and address
+)  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*                       # optional trailing comment
+/x
+    Alan Other <user\@dom.ain>
+    <user\@dom.ain>
+    user\@dom.ain
+    \"A. Other\" <user.1234\@dom.ain> (a comment)
+    A. Other <user.1234\@dom.ain> (a comment)
+    \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
+    A missing angle <user\@some.where
+    *** Failers
+    The quick brown fox
+
+/[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional leading comment
+(?:
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+# Atom
+|                       #  or
+"                                     # "
+[^\\\x80-\xff\n\015"] *                            #   normal
+(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
+"                                     #        "
+# Quoted string
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+\.
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+# Atom
+|                       #  or
+"                                     # "
+[^\\\x80-\xff\n\015"] *                            #   normal
+(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
+"                                     #        "
+# Quoted string
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# additional words
+)*
+@
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+\[                            # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
+\]                           #           ]
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional trailing comments
+(?:
+\.
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+\[                            # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
+\]                           #           ]
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional trailing comments
+)*
+# address
+|                             #  or
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+# Atom
+|                       #  or
+"                                     # "
+[^\\\x80-\xff\n\015"] *                            #   normal
+(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
+"                                     #        "
+# Quoted string
+)
+# leading word
+[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] *               # "normal" atoms and or spaces
+(?:
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+|
+"                                     # "
+[^\\\x80-\xff\n\015"] *                            #   normal
+(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
+"                                     #        "
+) # "special" comment or quoted string
+[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] *            #  more "normal"
+)*
+<
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# <
+(?:
+@
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+\[                            # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
+\]                           #           ]
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional trailing comments
+(?:
+\.
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+\[                            # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
+\]                           #           ]
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional trailing comments
+)*
+(?: ,
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+@
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+\[                            # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
+\]                           #           ]
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional trailing comments
+(?:
+\.
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+\[                            # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
+\]                           #           ]
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional trailing comments
+)*
+)*  # additional domains
+:
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional trailing comments
+)?     #       optional route
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+# Atom
+|                       #  or
+"                                     # "
+[^\\\x80-\xff\n\015"] *                            #   normal
+(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
+"                                     #        "
+# Quoted string
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+\.
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+# Atom
+|                       #  or
+"                                     # "
+[^\\\x80-\xff\n\015"] *                            #   normal
+(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
+"                                     #        "
+# Quoted string
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# additional words
+)*
+@
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+\[                            # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
+\]                           #           ]
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional trailing comments
+(?:
+\.
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+\[                            # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
+\]                           #           ]
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional trailing comments
+)*
+#       address spec
+>                    #                 >
+# name and address
+)
+/x
+    Alan Other <user\@dom.ain>
+    <user\@dom.ain>
+    user\@dom.ain
+    \"A. Other\" <user.1234\@dom.ain> (a comment)
+    A. Other <user.1234\@dom.ain> (a comment)
+    \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
+    A missing angle <user\@some.where
+    *** Failers
+    The quick brown fox
+
+/abc\0def\00pqr\000xyz\0000AB/
+    abc\0def\00pqr\000xyz\0000AB
+    abc456 abc\0def\00pqr\000xyz\0000ABCDE
+
+/abc\x0def\x00pqr\x000xyz\x0000AB/
+    abc\x0def\x00pqr\x000xyz\x0000AB
+    abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE
+
+/^[\000-\037]/
+    \0A
+    \01B
+    \037C
+
+/\0*/
+    \0\0\0\0
+
+/A\x0{2,3}Z/
+    The A\x0\x0Z
+    An A\0\x0\0Z
+    *** Failers
+    A\0Z
+    A\0\x0\0\x0Z
+
+/^\s/
+    \040abc
+    \x0cabc
+    \nabc
+    \rabc
+    \tabc
+    *** Failers
+    abc
+
+/^a    b
+  
+  \f  c/x
+    abc
+
+/ab{1,3}bc/
+    abbbbc
+    abbbc
+    abbc
+    *** Failers
+    abc
+    abbbbbc
+
+/([^.]*)\.([^:]*):[T ]+(.*)/
+    track1.title:TBlah blah blah
+
+/([^.]*)\.([^:]*):[T ]+(.*)/i
+    track1.title:TBlah blah blah
+
+/([^.]*)\.([^:]*):[t ]+(.*)/i
+    track1.title:TBlah blah blah
+
+/^[W-c]+$/
+    WXY_^abc
+    *** Failers
+    wxy
+
+/^[W-c]+$/i
+    WXY_^abc
+    wxy_^ABC
+
+/^[\x3f-\x5F]+$/i
+    WXY_^abc
+    wxy_^ABC
+
+/^abc$/m
+    abc
+    qqq\nabc
+    abc\nzzz
+    qqq\nabc\nzzz
+
+/^abc$/
+    abc
+    *** Failers
+    qqq\nabc
+    abc\nzzz
+    qqq\nabc\nzzz
+
+/\Aabc\Z/m
+    abc
+    abc\n 
+    *** Failers
+    qqq\nabc
+    abc\nzzz
+    qqq\nabc\nzzz
+    
+/\A(.)*\Z/s
+    abc\ndef
+
+/\A(.)*\Z/m
+    *** Failers
+    abc\ndef
+
+/(?:b)|(?::+)/
+    b::c
+    c::b
+
+/[-az]+/
+    az-
+    *** Failers
+    b
+
+/[az-]+/
+    za-
+    *** Failers
+    b
+
+/[a\-z]+/
+    a-z
+    *** Failers
+    b
+
+/[a-z]+/
+    abcdxyz
+
+/[\d-]+/
+    12-34
+    *** Failers
+    aaa
+
+/[\d-z]+/
+    12-34z
+    *** Failers
+    aaa
+
+/\x5c/
+    \\
+
+/\x20Z/
+    the Zoo
+    *** Failers
+    Zulu
+
+/ab{3cd/
+    ab{3cd
+
+/ab{3,cd/
+    ab{3,cd
+
+/ab{3,4a}cd/
+    ab{3,4a}cd
+
+/{4,5a}bc/
+    {4,5a}bc
+
+/^a.b/
+    a\rb
+    *** Failers
+    a\nb
+
+/abc$/
+    abc
+    abc\n
+    *** Failers
+    abc\ndef
+
+/(abc)\123/
+    abc\x53
+
+/(abc)\223/
+    abc\x93
+
+/(abc)\323/
+    abc\xd3
+
+/(abc)\500/
+    abc\x40
+    abc\100
+
+/(abc)\5000/
+    abc\x400
+    abc\x40\x30
+    abc\1000
+    abc\100\x30
+    abc\100\060
+    abc\100\60
+
+/abc\81/
+    abc\081
+    abc\0\x38\x31
+
+/abc\91/
+    abc\091
+    abc\0\x39\x31
+
+/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
+    abcdefghijk\12S
+
+/ab\gdef/
+    abgdef
+
+/a{0}bc/
+    bc
+
+/(a|(bc)){0,0}?xyz/
+    xyz
+
+/abc[\10]de/
+    abc\010de
+
+/abc[\1]de/
+    abc\1de
+
+/(abc)[\1]de/
+    abc\1de
+
+/(?s)a.b/
+    a\nb
+
+/^([^a])([^\b])([^c]*)([^d]{3,4})/
+    baNOTccccd
+    baNOTcccd
+    baNOTccd
+    bacccd
+    *** Failers
+    anything
+    b\bc   
+    baccd
+
+/[^a]/
+    Abc
+  
+/[^a]/i
+    Abc 
+
+/[^a]+/
+    AAAaAbc
+  
+/[^a]+/i
+    AAAaAbc 
+
+/[^a]+/
+    bbb\nccc
+   
+/[^k]$/
+    abc
+    *** Failers
+    abk   
+   
+/[^k]{2,3}$/
+    abc
+    kbc
+    kabc 
+    *** Failers
+    abk
+    akb
+    akk 
+
+/^\d{8,}\@.+[^k]$/
+    12345678\@a.b.c.d
+    123456789\@x.y.z
+    *** Failers
+    12345678\@x.y.uk
+    1234567\@a.b.c.d       
+
+/[^a]/
+    aaaabcd
+    aaAabcd 
+
+/[^a]/i
+    aaaabcd
+    aaAabcd 
+
+/[^az]/
+    aaaabcd
+    aaAabcd 
+
+/[^az]/i
+    aaaabcd
+    aaAabcd 
+
+/\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377/
+ \000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377
+
+/P[^*]TAIRE[^*]{1,6}?LL/
+    xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
+
+/P[^*]TAIRE[^*]{1,}?LL/
+    xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
+
+/(\.\d\d[1-9]?)\d+/
+    1.230003938
+    1.875000282   
+    1.235  
+                  
+/(\.\d\d((?=0)|\d(?=\d)))/
+    1.230003938      
+    1.875000282
+    *** Failers 
+    1.235 
+    
+/a(?)b/
+    ab 
+/\b(foo)\s+(\w+)/i
+    Food is on the foo table
+    
+/foo(.*)bar/
+    The food is under the bar in the barn.
+    
+/foo(.*?)bar/  
+    The food is under the bar in the barn.
+
+/(.*)(\d*)/
+    I have 2 numbers: 53147
+    
+/(.*)(\d+)/
+    I have 2 numbers: 53147
+/(.*?)(\d*)/
+    I have 2 numbers: 53147
+
+/(.*?)(\d+)/
+    I have 2 numbers: 53147
+
+/(.*)(\d+)$/
+    I have 2 numbers: 53147
+
+/(.*?)(\d+)$/
+    I have 2 numbers: 53147
+
+/(.*)\b(\d+)$/
+    I have 2 numbers: 53147
+
+/(.*\D)(\d+)$/
+    I have 2 numbers: 53147
+
+/^\D*(?!123)/
+    ABC123
+     
+/^(\D*)(?=\d)(?!123)/
+    ABC445
+    *** Failers
+    ABC123
+    
+/^[W-]46]/
+    W46]789 
+    -46]789
+    *** Failers
+    Wall
+    Zebra
+    42
+    [abcd] 
+    ]abcd[
+       
+/^[W-\]46]/
+    W46]789 
+    Wall
+    Zebra
+    Xylophone  
+    42
+    [abcd] 
+    ]abcd[
+    \\backslash 
+    *** Failers
+    -46]789
+    well
+    
+/\d\d\/\d\d\/\d\d\d\d/
+    01/01/2000
+
+/word (?:[a-zA-Z0-9]+ ){0,10}otherword/
+  word cat dog elephant mussel cow horse canary baboon snake shark otherword
+  word cat dog elephant mussel cow horse canary baboon snake shark
+
+/word (?:[a-zA-Z0-9]+ ){0,300}otherword/
+  word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
+
+/^(a){0,0}/
+    bcd
+    abc
+    aab     
+
+/^(a){0,1}/
+    bcd
+    abc
+    aab  
+
+/^(a){0,2}/
+    bcd
+    abc
+    aab  
+
+/^(a){0,3}/
+    bcd
+    abc
+    aab
+    aaa   
+
+/^(a){0,}/
+    bcd
+    abc
+    aab
+    aaa
+    aaaaaaaa    
+
+/^(a){1,1}/
+    bcd
+    abc
+    aab  
+
+/^(a){1,2}/
+    bcd
+    abc
+    aab  
+
+/^(a){1,3}/
+    bcd
+    abc
+    aab
+    aaa   
+
+/^(a){1,}/
+    bcd
+    abc
+    aab
+    aaa
+    aaaaaaaa    
+
+/.*\.gif/
+    borfle\nbib.gif\nno
+
+/.{0,}\.gif/
+    borfle\nbib.gif\nno
+
+/.*\.gif/m
+    borfle\nbib.gif\nno
+
+/.*\.gif/s
+    borfle\nbib.gif\nno
+
+/.*\.gif/ms
+    borfle\nbib.gif\nno
+    
+/.*$/
+    borfle\nbib.gif\nno
+
+/.*$/m
+    borfle\nbib.gif\nno
+
+/.*$/s
+    borfle\nbib.gif\nno
+
+/.*$/ms
+    borfle\nbib.gif\nno
+    
+/.*$/
+    borfle\nbib.gif\nno\n
+
+/.*$/m
+    borfle\nbib.gif\nno\n
+
+/.*$/s
+    borfle\nbib.gif\nno\n
+
+/.*$/ms
+    borfle\nbib.gif\nno\n
+    
+/(.*X|^B)/
+    abcde\n1234Xyz
+    BarFoo 
+    *** Failers
+    abcde\nBar  
+
+/(.*X|^B)/m
+    abcde\n1234Xyz
+    BarFoo 
+    abcde\nBar  
+
+/(.*X|^B)/s
+    abcde\n1234Xyz
+    BarFoo 
+    *** Failers
+    abcde\nBar  
+
+/(.*X|^B)/ms
+    abcde\n1234Xyz
+    BarFoo 
+    abcde\nBar  
+
+/(?s)(.*X|^B)/
+    abcde\n1234Xyz
+    BarFoo 
+    *** Failers 
+    abcde\nBar  
+
+/(?s:.*X|^B)/
+    abcde\n1234Xyz
+    BarFoo 
+    *** Failers 
+    abcde\nBar  
+
+/^.*B/
+    **** Failers
+    abc\nB
+     
+/(?s)^.*B/
+    abc\nB
+
+/(?m)^.*B/
+    abc\nB
+     
+/(?ms)^.*B/
+    abc\nB
+
+/(?ms)^B/
+    abc\nB
+
+/(?s)B$/
+    B\n
+
+/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
+    123456654321
+  
+/^\d\d\d\d\d\d\d\d\d\d\d\d/
+    123456654321 
+
+/^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
+    123456654321
+  
+/^[abc]{12}/
+    abcabcabcabc
+    
+/^[a-c]{12}/
+    abcabcabcabc
+    
+/^(a|b|c){12}/
+    abcabcabcabc 
+
+/^[abcdefghijklmnopqrstuvwxy0123456789]/
+    n
+    *** Failers 
+    z 
+
+/abcde{0,0}/
+    abcd
+    *** Failers
+    abce  
+
+/ab[cd]{0,0}e/
+    abe
+    *** Failers
+    abcde 
+    
+/ab(c){0,0}d/
+    abd
+    *** Failers
+    abcd   
+
+/a(b*)/
+    a
+    ab
+    abbbb
+    *** Failers
+    bbbbb    
+    
+/ab\d{0}e/
+    abe
+    *** Failers
+    ab1e   
+    
+/"([^\\"]+|\\.)*"/
+    the \"quick\" brown fox
+    \"the \\\"quick\\\" brown fox\" 
+
+/.*?/g+
+    abc
+  
+/\b/g+
+    abc 
+
+/\b/+g
+    abc 
+
+//g
+    abc
+
+/<tr([\w\W\s\d][^<>]{0,})><TD([\w\W\s\d][^<>]{0,})>([\d]{0,}\.)(.*)((<BR>([\w\W\s\d][^<>]{0,})|[\s]{0,}))<\/a><\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><\/TR>/is
+  <TR BGCOLOR='#DBE9E9'><TD align=left valign=top>43.<a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)</a></TD><TD align=left valign=top>Lega lstaff.com</TD><TD align=left valign=top>CA - Statewide</TD></TR>
+
+/a[^a]b/
+    acb
+    a\nb
+    
+/a.b/
+    acb
+    *** Failers 
+    a\nb   
+    
+/a[^a]b/s
+    acb
+    a\nb  
+    
+/a.b/s
+    acb
+    a\nb  
+
+/^(b+?|a){1,2}?c/
+    bac
+    bbac
+    bbbac
+    bbbbac
+    bbbbbac 
+
+/^(b+|a){1,2}?c/
+    bac
+    bbac
+    bbbac
+    bbbbac
+    bbbbbac 
+    
+/(?!\A)x/m
+    x\nb\n
+    a\bx\n  
+    
+/\x0{ab}/
+    \0{ab} 
+
+/(A|B)*?CD/
+    CD 
+    
+/(A|B)*CD/
+    CD 
+
+/(?<!bar)foo/
+    foo
+    catfood
+    arfootle
+    rfoosh
+    *** Failers
+    barfoo
+    towbarfoo
+
+/\w{3}(?<!bar)foo/
+    catfood
+    *** Failers
+    foo
+    barfoo
+    towbarfoo
+
+/(?<=(foo)a)bar/
+    fooabar
+    *** Failers
+    bar
+    foobbar
+      
+/\Aabc\z/m
+    abc
+    *** Failers
+    abc\n   
+    qqq\nabc
+    abc\nzzz
+    qqq\nabc\nzzz
+
+"(?>.*/)foo"
+    /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
+
+"(?>.*/)foo"
+    /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
+
+/(?>(\.\d\d[1-9]?))\d+/
+    1.230003938
+    1.875000282
+    *** Failers 
+    1.235 
+
+/^((?>\w+)|(?>\s+))*$/
+    now is the time for all good men to come to the aid of the party
+    *** Failers
+    this is not a line with only words and spaces!
+    
+/(\d+)(\w)/
+    12345a
+    12345+ 
+
+/((?>\d+))(\w)/
+    12345a
+    *** Failers
+    12345+ 
+
+/(?>a+)b/
+    aaab
+
+/((?>a+)b)/
+    aaab
+
+/(?>(a+))b/
+    aaab
+
+/(?>b)+/
+    aaabbbccc
+
+/(?>a+|b+|c+)*c/
+    aaabbbbccccd
+    
+/(a+|b+|c+)*c/
+    aaabbbbccccd
+
+/((?>[^()]+)|\([^()]*\))+/
+    ((abc(ade)ufh()()x
+    
+/\(((?>[^()]+)|\([^()]+\))+\)/ 
+    (abc)
+    (abc(def)xyz)
+    *** Failers
+    ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa   
+
+/a(?-i)b/i
+    ab
+    Ab
+    *** Failers 
+    aB
+    AB
+        
+/(a (?x)b c)d e/
+    a bcd e
+    *** Failers
+    a b cd e
+    abcd e   
+    a bcde 
+/(a b(?x)c d (?-x)e f)/
+    a bcde f
+    *** Failers
+    abcdef  
+
+/(a(?i)b)c/
+    abc
+    aBc
+    *** Failers
+    abC
+    aBC  
+    Abc
+    ABc
+    ABC
+    AbC
+    
+/a(?i:b)c/
+    abc
+    aBc
+    *** Failers 
+    ABC
+    abC
+    aBC
+    
+/a(?i:b)*c/
+    aBc
+    aBBc
+    *** Failers 
+    aBC
+    aBBC
+    
+/a(?=b(?i)c)\w\wd/
+    abcd
+    abCd
+    *** Failers
+    aBCd
+    abcD     
+    
+/(?s-i:more.*than).*million/i
+    more than million
+    more than MILLION
+    more \n than Million 
+    *** Failers
+    MORE THAN MILLION    
+    more \n than \n million 
+
+/(?:(?s-i)more.*than).*million/i
+    more than million
+    more than MILLION
+    more \n than Million 
+    *** Failers
+    MORE THAN MILLION    
+    more \n than \n million 
+    
+/(?>a(?i)b+)+c/ 
+    abc
+    aBbc
+    aBBc 
+    *** Failers
+    Abc
+    abAb    
+    abbC 
+    
+/(?=a(?i)b)\w\wc/
+    abc
+    aBc
+    *** Failers
+    Ab 
+    abC
+    aBC     
+    
+/(?<=a(?i)b)(\w\w)c/
+    abxxc
+    aBxxc
+    *** Failers
+    Abxxc
+    ABxxc
+    abxxC      
+
+/^(?(?=abc)\w{3}:|\d\d)$/
+    abc:
+    12
+    *** Failers
+    123
+    xyz    
+
+/^(?(?!abc)\d\d|\w{3}:)$/
+    abc:
+    12
+    *** Failers
+    123
+    xyz    
+    
+/(?(?<=foo)bar|cat)/
+    foobar
+    cat
+    fcat
+    focat   
+    *** Failers
+    foocat  
+
+/(?(?<!foo)cat|bar)/
+    foobar
+    cat
+    fcat
+    focat   
+    *** Failers
+    foocat  
+
+/(?>a*)*/
+    a
+    aa
+    aaaa
+    
+/(abc|)+/
+    abc
+    abcabc
+    abcabcabc
+    xyz      
+
+/([a]*)*/
+    a
+    aaaaa 
+/([ab]*)*/
+    a
+    b
+    ababab
+    aaaabcde
+    bbbb    
+/([^a]*)*/
+    b
+    bbbb
+    aaa   
+/([^ab]*)*/
+    cccc
+    abab  
+/([a]*?)*/
+    a
+    aaaa 
+/([ab]*?)*/
+    a
+    b
+    abab
+    baba   
+/([^a]*?)*/
+    b
+    bbbb
+    aaa   
+/([^ab]*?)*/
+    c
+    cccc
+    baba   
+/(?>a*)*/
+    a
+    aaabcde 
+/((?>a*))*/
+    aaaaa
+    aabbaa 
+/((?>a*?))*/
+    aaaaa
+    aabbaa 
+
+/(?(?=[^a-z]+[a-z])  \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} ) /x
+    12-sep-98
+    12-09-98
+    *** Failers
+    sep-12-98
+        
+/(?i:saturday|sunday)/
+    saturday
+    sunday
+    Saturday
+    Sunday
+    SATURDAY
+    SUNDAY
+    SunDay
+    
+/(a(?i)bc|BB)x/
+    abcx
+    aBCx
+    bbx
+    BBx
+    *** Failers
+    abcX
+    aBCX
+    bbX
+    BBX               
+
+/^([ab](?i)[cd]|[ef])/
+    ac
+    aC
+    bD
+    elephant
+    Europe 
+    frog
+    France
+    *** Failers
+    Africa     
+
+/^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
+    ab
+    aBd
+    xy
+    xY
+    zebra
+    Zambesi
+    *** Failers
+    aCD  
+    XY  
+
+/(?<=foo\n)^bar/m
+    foo\nbar
+    *** Failers
+    bar
+    baz\nbar   
+
+/(?<=(?<!foo)bar)baz/
+    barbaz
+    barbarbaz 
+    koobarbaz 
+    *** Failers
+    baz
+    foobarbaz 
+
+/The following tests are taken from the Perl 5.005 test suite; some of them/
+/are compatible with 5.004, but I'd rather not have to sort them out./
+
+/abc/
+    abc
+    xabcy
+    ababc
+    *** Failers
+    xbc
+    axc
+    abx
+
+/ab*c/
+    abc
+
+/ab*bc/
+    abc
+    abbc
+    abbbbc
+
+/.{1}/
+    abbbbc
+
+/.{3,4}/
+    abbbbc
+
+/ab{0,}bc/
+    abbbbc
+
+/ab+bc/
+    abbc
+    *** Failers
+    abc
+    abq
+
+/ab{1,}bc/
+
+/ab+bc/
+    abbbbc
+
+/ab{1,}bc/
+    abbbbc
+
+/ab{1,3}bc/
+    abbbbc
+
+/ab{3,4}bc/
+    abbbbc
+
+/ab{4,5}bc/
+    *** Failers
+    abq
+    abbbbc
+
+/ab?bc/
+    abbc
+    abc
+
+/ab{0,1}bc/
+    abc
+
+/ab?bc/
+
+/ab?c/
+    abc
+
+/ab{0,1}c/
+    abc
+
+/^abc$/
+    abc
+    *** Failers
+    abbbbc
+    abcc
+
+/^abc/
+    abcc
+
+/^abc$/
+
+/abc$/
+    aabc
+    *** Failers
+    aabc
+    aabcd
+
+/^/
+    abc
+
+/$/
+    abc
+
+/a.c/
+    abc
+    axc
+
+/a.*c/
+    axyzc
+
+/a[bc]d/
+    abd
+    *** Failers
+    axyzd
+    abc
+
+/a[b-d]e/
+    ace
+
+/a[b-d]/
+    aac
+
+/a[-b]/
+    a-
+
+/a[b-]/
+    a-
+
+/a]/
+    a]
+
+/a[]]b/
+    a]b
+
+/a[^bc]d/
+    aed
+    *** Failers
+    abd
+    abd
+
+/a[^-b]c/
+    adc
+
+/a[^]b]c/
+    adc
+    *** Failers
+    a-c
+    a]c
+
+/\ba\b/
+    a-
+    -a
+    -a-
+
+/\by\b/
+    *** Failers
+    xy
+    yz
+    xyz
+
+/\Ba\B/
+    *** Failers
+    a-
+    -a
+    -a-
+
+/\By\b/
+    xy
+
+/\by\B/
+    yz
+
+/\By\B/
+    xyz
+
+/\w/
+    a
+
+/\W/
+    -
+    *** Failers
+    -
+    a
+
+/a\sb/
+    a b
+
+/a\Sb/
+    a-b
+    *** Failers
+    a-b
+    a b
+
+/\d/
+    1
+
+/\D/
+    -
+    *** Failers
+    -
+    1
+
+/[\w]/
+    a
+
+/[\W]/
+    -
+    *** Failers
+    -
+    a
+
+/a[\s]b/
+    a b
+
+/a[\S]b/
+    a-b
+    *** Failers
+    a-b
+    a b
+
+/[\d]/
+    1
+
+/[\D]/
+    -
+    *** Failers
+    -
+    1
+
+/ab|cd/
+    abc
+    abcd
+
+/()ef/
+    def
+
+/$b/
+
+/a\(b/
+    a(b
+
+/a\(*b/
+    ab
+    a((b
+
+/a\\b/
+    a\b
+
+/((a))/
+    abc
+
+/(a)b(c)/
+    abc
+
+/a+b+c/
+    aabbabc
+
+/a{1,}b{1,}c/
+    aabbabc
+
+/a.+?c/
+    abcabc
+
+/(a+|b)*/
+    ab
+
+/(a+|b){0,}/
+    ab
+
+/(a+|b)+/
+    ab
+
+/(a+|b){1,}/
+    ab
+
+/(a+|b)?/
+    ab
+
+/(a+|b){0,1}/
+    ab
+
+/[^ab]*/
+    cde
+
+/abc/
+    *** Failers
+    b
+    
+
+/a*/
+    
+
+/([abc])*d/
+    abbbcd
+
+/([abc])*bcd/
+    abcd
+
+/a|b|c|d|e/
+    e
+
+/(a|b|c|d|e)f/
+    ef
+
+/abcd*efg/
+    abcdefg
+
+/ab*/
+    xabyabbbz
+    xayabbbz
+
+/(ab|cd)e/
+    abcde
+
+/[abhgefdc]ij/
+    hij
+
+/^(ab|cd)e/
+
+/(abc|)ef/
+    abcdef
+
+/(a|b)c*d/
+    abcd
+
+/(ab|ab*)bc/
+    abc
+
+/a([bc]*)c*/
+    abc
+
+/a([bc]*)(c*d)/
+    abcd
+
+/a([bc]+)(c*d)/
+    abcd
+
+/a([bc]*)(c+d)/
+    abcd
+
+/a[bcd]*dcdcde/
+    adcdcde
+
+/a[bcd]+dcdcde/
+    *** Failers
+    abcde
+    adcdcde
+
+/(ab|a)b*c/
+    abc
+
+/((a)(b)c)(d)/
+    abcd
+
+/[a-zA-Z_][a-zA-Z0-9_]*/
+    alpha
+
+/^a(bc+|b[eh])g|.h$/
+    abh
+
+/(bc+d$|ef*g.|h?i(j|k))/
+    effgz
+    ij
+    reffgz
+    *** Failers
+    effg
+    bcdd
+
+/((((((((((a))))))))))/
+    a
+
+/(((((((((a)))))))))/
+    a
+
+/multiple words of text/
+    *** Failers
+    aa
+    uh-uh
+
+/multiple words/
+    multiple words, yeah
+
+/(.*)c(.*)/
+    abcde
+
+/\((.*), (.*)\)/
+    (a, b)
+
+/[k]/
+
+/abcd/
+    abcd
+
+/a(bc)d/
+    abcd
+
+/a[-]?c/
+    ac
+
+/abc/i
+    ABC
+    XABCY
+    ABABC
+    *** Failers
+    aaxabxbaxbbx
+    XBC
+    AXC
+    ABX
+
+/ab*c/i
+    ABC
+
+/ab*bc/i
+    ABC
+    ABBC
+
+/ab*?bc/i
+    ABBBBC
+
+/ab{0,}?bc/i
+    ABBBBC
+
+/ab+?bc/i
+    ABBC
+
+/ab+bc/i
+    *** Failers
+    ABC
+    ABQ
+
+/ab{1,}bc/i
+
+/ab+bc/i
+    ABBBBC
+
+/ab{1,}?bc/i
+    ABBBBC
+
+/ab{1,3}?bc/i
+    ABBBBC
+
+/ab{3,4}?bc/i
+    ABBBBC
+
+/ab{4,5}?bc/i
+    *** Failers
+    ABQ
+    ABBBBC
+
+/ab??bc/i
+    ABBC
+    ABC
+
+/ab{0,1}?bc/i
+    ABC
+
+/ab??bc/i
+
+/ab??c/i
+    ABC
+
+/ab{0,1}?c/i
+    ABC
+
+/^abc$/i
+    ABC
+    *** Failers
+    ABBBBC
+    ABCC
+
+/^abc/i
+    ABCC
+
+/^abc$/i
+
+/abc$/i
+    AABC
+
+/^/i
+    ABC
+
+/$/i
+    ABC
+
+/a.c/i
+    ABC
+    AXC
+
+/a.*?c/i
+    AXYZC
+
+/a.*c/i
+    *** Failers
+    AABC
+    AXYZD
+
+/a[bc]d/i
+    ABD
+
+/a[b-d]e/i
+    ACE
+    *** Failers
+    ABC
+    ABD
+
+/a[b-d]/i
+    AAC
+
+/a[-b]/i
+    A-
+
+/a[b-]/i
+    A-
+
+/a]/i
+    A]
+
+/a[]]b/i
+    A]B
+
+/a[^bc]d/i
+    AED
+
+/a[^-b]c/i
+    ADC
+    *** Failers
+    ABD
+    A-C
+
+/a[^]b]c/i
+    ADC
+
+/ab|cd/i
+    ABC
+    ABCD
+
+/()ef/i
+    DEF
+
+/$b/i
+    *** Failers
+    A]C
+    B
+
+/a\(b/i
+    A(B
+
+/a\(*b/i
+    AB
+    A((B
+
+/a\\b/i
+    A\B
+
+/((a))/i
+    ABC
+
+/(a)b(c)/i
+    ABC
+
+/a+b+c/i
+    AABBABC
+
+/a{1,}b{1,}c/i
+    AABBABC
+
+/a.+?c/i
+    ABCABC
+
+/a.*?c/i
+    ABCABC
+
+/a.{0,5}?c/i
+    ABCABC
+
+/(a+|b)*/i
+    AB
+
+/(a+|b){0,}/i
+    AB
+
+/(a+|b)+/i
+    AB
+
+/(a+|b){1,}/i
+    AB
+
+/(a+|b)?/i
+    AB
+
+/(a+|b){0,1}/i
+    AB
+
+/(a+|b){0,1}?/i
+    AB
+
+/[^ab]*/i
+    CDE
+
+/abc/i
+
+/a*/i
+    
+
+/([abc])*d/i
+    ABBBCD
+
+/([abc])*bcd/i
+    ABCD
+
+/a|b|c|d|e/i
+    E
+
+/(a|b|c|d|e)f/i
+    EF
+
+/abcd*efg/i
+    ABCDEFG
+
+/ab*/i
+    XABYABBBZ
+    XAYABBBZ
+
+/(ab|cd)e/i
+    ABCDE
+
+/[abhgefdc]ij/i
+    HIJ
+
+/^(ab|cd)e/i
+    ABCDE
+
+/(abc|)ef/i
+    ABCDEF
+
+/(a|b)c*d/i
+    ABCD
+
+/(ab|ab*)bc/i
+    ABC
+
+/a([bc]*)c*/i
+    ABC
+
+/a([bc]*)(c*d)/i
+    ABCD
+
+/a([bc]+)(c*d)/i
+    ABCD
+
+/a([bc]*)(c+d)/i
+    ABCD
+
+/a[bcd]*dcdcde/i
+    ADCDCDE
+
+/a[bcd]+dcdcde/i
+
+/(ab|a)b*c/i
+    ABC
+
+/((a)(b)c)(d)/i
+    ABCD
+
+/[a-zA-Z_][a-zA-Z0-9_]*/i
+    ALPHA
+
+/^a(bc+|b[eh])g|.h$/i
+    ABH
+
+/(bc+d$|ef*g.|h?i(j|k))/i
+    EFFGZ
+    IJ
+    REFFGZ
+    *** Failers
+    ADCDCDE
+    EFFG
+    BCDD
+
+/((((((((((a))))))))))/i
+    A
+
+/(((((((((a)))))))))/i
+    A
+
+/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
+    A
+
+/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
+    C
+
+/multiple words of text/i
+    *** Failers
+    AA
+    UH-UH
+
+/multiple words/i
+    MULTIPLE WORDS, YEAH
+
+/(.*)c(.*)/i
+    ABCDE
+
+/\((.*), (.*)\)/i
+    (A, B)
+
+/[k]/i
+
+/abcd/i
+    ABCD
+
+/a(bc)d/i
+    ABCD
+
+/a[-]?c/i
+    AC
+
+/a(?!b)./
+    abad
+
+/a(?=d)./
+    abad
+
+/a(?=c|d)./
+    abad
+
+/a(?:b|c|d)(.)/
+    ace
+
+/a(?:b|c|d)*(.)/
+    ace
+
+/a(?:b|c|d)+?(.)/
+    ace
+    acdbcdbe
+
+/a(?:b|c|d)+(.)/
+    acdbcdbe
+
+/a(?:b|c|d){2}(.)/
+    acdbcdbe
+
+/a(?:b|c|d){4,5}(.)/
+    acdbcdbe
+
+/a(?:b|c|d){4,5}?(.)/
+    acdbcdbe
+
+/((foo)|(bar))*/
+    foobar
+
+/a(?:b|c|d){6,7}(.)/
+    acdbcdbe
+
+/a(?:b|c|d){6,7}?(.)/
+    acdbcdbe
+
+/a(?:b|c|d){5,6}(.)/
+    acdbcdbe
+
+/a(?:b|c|d){5,6}?(.)/
+    acdbcdbe
+
+/a(?:b|c|d){5,7}(.)/
+    acdbcdbe
+
+/a(?:b|c|d){5,7}?(.)/
+    acdbcdbe
+
+/a(?:b|(c|e){1,2}?|d)+?(.)/
+    ace
+
+/^(.+)?B/
+    AB
+
+/^([^a-z])|(\^)$/
+    .
+
+/^[<>]&/
+    <&OUT
+
+/(?:(f)(o)(o)|(b)(a)(r))*/
+    foobar
+
+/(?<=a)b/
+    ab
+    *** Failers
+    cb
+    b
+
+/(?<!c)b/
+    ab
+    b
+    b
+
+/(?:..)*a/
+    aba
+
+/(?:..)*?a/
+    aba
+
+/^(){3,5}/
+    abc
+
+/^(a+)*ax/
+    aax
+
+/^((a|b)+)*ax/
+    aax
+
+/^((a|bc)+)*ax/
+    aax
+
+/(a|x)*ab/
+    cab
+
+/(a)*ab/
+    cab
+
+/(?:(?i)a)b/
+    ab
+
+/((?i)a)b/
+    ab
+
+/(?:(?i)a)b/
+    Ab
+
+/((?i)a)b/
+    Ab
+
+/(?:(?i)a)b/
+    *** Failers
+    cb
+    aB
+
+/((?i)a)b/
+
+/(?i:a)b/
+    ab
+
+/((?i:a))b/
+    ab
+
+/(?i:a)b/
+    Ab
+
+/((?i:a))b/
+    Ab
+
+/(?i:a)b/
+    *** Failers
+    aB
+    aB
+
+/((?i:a))b/
+
+/(?:(?-i)a)b/i
+    ab
+
+/((?-i)a)b/i
+    ab
+
+/(?:(?-i)a)b/i
+    aB
+
+/((?-i)a)b/i
+    aB
+
+/(?:(?-i)a)b/i
+    *** Failers
+    aB
+    Ab
+
+/((?-i)a)b/i
+
+/(?:(?-i)a)b/i
+    aB
+
+/((?-i)a)b/i
+    aB
+
+/(?:(?-i)a)b/i
+    *** Failers
+    Ab
+    AB
+
+/((?-i)a)b/i
+
+/(?-i:a)b/i
+    ab
+
+/((?-i:a))b/i
+    ab
+
+/(?-i:a)b/i
+    aB
+
+/((?-i:a))b/i
+    aB
+
+/(?-i:a)b/i
+    *** Failers
+    AB
+    Ab
+
+/((?-i:a))b/i
+
+/(?-i:a)b/i
+    aB
+
+/((?-i:a))b/i
+    aB
+
+/(?-i:a)b/i
+    *** Failers
+    Ab
+    AB
+
+/((?-i:a))b/i
+
+/((?-i:a.))b/i
+    *** Failers
+    AB
+    a\nB
+
+/((?s-i:a.))b/i
+    a\nB
+
+/(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
+    cabbbb
+
+/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
+    caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+
+/foo\w*\d{4}baz/
+    foobar1234baz
+
+/x(~~)*(?:(?:F)?)?/
+    x~~
+
+/^a(?#xxx){3}c/
+    aaac
+
+/^a (?#xxx) (?#yyy) {3}c/x
+    aaac
+
+/(?<![cd])b/
+    *** Failers
+    B\nB
+    dbcb
+
+/(?<![cd])[ab]/
+    dbaacb
+
+/(?<!(c|d))b/
+
+/(?<!(c|d))[ab]/
+    dbaacb
+
+/(?<!cd)[ab]/
+    cdaccb
+
+/^(?:a?b?)*$/
+    *** Failers
+    dbcb
+    a--
+
+/((?s)^a(.))((?m)^b$)/
+    a\nb\nc\n
+
+/((?m)^b$)/
+    a\nb\nc\n
+
+/(?m)^b/
+    a\nb\n
+
+/(?m)^(b)/
+    a\nb\n
+
+/((?m)^b)/
+    a\nb\n
+
+/\n((?m)^b)/
+    a\nb\n
+
+/((?s).)c(?!.)/
+    a\nb\nc\n
+    a\nb\nc\n
+
+/((?s)b.)c(?!.)/
+    a\nb\nc\n
+    a\nb\nc\n
+
+/^b/
+
+/()^b/
+    *** Failers
+    a\nb\nc\n
+    a\nb\nc\n
+
+/((?m)^b)/
+    a\nb\nc\n
+
+/(?(?!a)a|b)/
+
+/(?(?!a)b|a)/
+    a
+
+/(?(?=a)b|a)/
+    *** Failers
+    a
+    a
+
+/(?(?=a)a|b)/
+    a
+
+/(\w+:)+/
+    one:
+
+/$(?<=^(a))/
+    a
+
+/([\w:]+::)?(\w+)$/
+    abcd
+    xy:z:::abcd
+
+/^[^bcd]*(c+)/
+    aexycd
+
+/(a*)b+/
+    caab
+
+/([\w:]+::)?(\w+)$/
+    abcd
+    xy:z:::abcd
+    *** Failers
+    abcd:
+    abcd:
+
+/^[^bcd]*(c+)/
+    aexycd
+
+/(>a+)ab/
+
+/(?>a+)b/
+    aaab
+
+/([[:]+)/
+    a:[b]:
+
+/([[=]+)/
+    a=[b]=
+
+/([[.]+)/
+    a.[b].
+
+/((?>a+)b)/
+    aaab
+
+/(?>(a+))b/
+    aaab
+
+/((?>[^()]+)|\([^()]*\))+/
+    ((abc(ade)ufh()()x
+
+/a\Z/
+    *** Failers
+    aaab
+    a\nb\n
+
+/b\Z/
+    a\nb\n
+
+/b\z/
+
+/b\Z/
+    a\nb
+
+/b\z/
+    a\nb
+    *** Failers
+    
+/(?>.*)(?<=(abcd|wxyz))/
+    alphabetabcd
+    endingwxyz
+    *** Failers
+    a rather long string that doesn't end with one of them
+
+/word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
+    word cat dog elephant mussel cow horse canary baboon snake shark otherword
+    word cat dog elephant mussel cow horse canary baboon snake shark
+  
+/word (?>[a-zA-Z0-9]+ ){0,30}otherword/
+    word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
+
+/(?<=\d{3}(?!999))foo/
+    999foo
+    123999foo 
+    *** Failers
+    123abcfoo
+    
+/(?<=(?!...999)\d{3})foo/
+    999foo
+    123999foo 
+    *** Failers
+    123abcfoo
+
+/(?<=\d{3}(?!999)...)foo/
+    123abcfoo
+    123456foo 
+    *** Failers
+    123999foo  
+    
+/(?<=\d{3}...)(?<!999)foo/
+    123abcfoo   
+    123456foo 
+    *** Failers
+    123999foo  
+
+/((Z)+|A)*/
+    ZABCDEFG
+
+/(Z()|A)*/
+    ZABCDEFG
+
+/(Z(())|A)*/
+    ZABCDEFG
+
+/((?>Z)+|A)*/
+    ZABCDEFG
+
+/((?>)+|A)*/
+    ZABCDEFG
+
+/a*/g
+    abbab
+
+/^[a-\d]/
+    abcde
+    -things
+    0digit
+    *** Failers
+    bcdef    
+
+/^[\d-a]/
+    abcde
+    -things
+    0digit
+    *** Failers
+    bcdef    
+    
+/[[:space:]]+/
+    > \x09\x0a\x0c\x0d\x0b<
+     
+/[[:blank:]]+/
+    > \x09\x0a\x0c\x0d\x0b<
+     
+/[\s]+/
+    > \x09\x0a\x0c\x0d\x0b<
+     
+/\s+/
+    > \x09\x0a\x0c\x0d\x0b<
+     
+/a\vb/x
+    ab
+
+/(?!\A)x/m
+  a\nxb\n
+
+/(?!^)x/m
+  a\nxb\n
+
+/abc\Qabc\Eabc/
+    abcabcabc
+    
+/abc\Q(*+|\Eabc/
+    abc(*+|abc 
+
+/   abc\Q abc\Eabc/x
+    abc abcabc
+    *** Failers
+    abcabcabc  
+    
+/abc#comment
+    \Q#not comment
+    literal\E/x
+    abc#not comment\n    literal     
+
+/abc#comment
+    \Q#not comment
+    literal/x
+    abc#not comment\n    literal     
+
+/abc#comment
+    \Q#not comment
+    literal\E #more comment
+    /x
+    abc#not comment\n    literal     
+
+/abc#comment
+    \Q#not comment
+    literal\E #more comment/x
+    abc#not comment\n    literal     
+
+/\Qabc\$xyz\E/
+    abc\\\$xyz
+
+/\Qabc\E\$\Qxyz\E/
+    abc\$xyz
+
+/\Gabc/
+    abc
+    *** Failers
+    xyzabc  
+
+/\Gabc./g
+    abc1abc2xyzabc3
+
+/abc./g
+    abc1abc2xyzabc3 
+
+/a(?x: b c )d/
+    XabcdY
+    *** Failers 
+    Xa b c d Y 
+
+/((?x)x y z | a b c)/
+    XabcY
+    AxyzB 
+
+/(?i)AB(?-i)C/
+    XabCY
+    *** Failers
+    XabcY  
+
+/((?i)AB(?-i)C|D)E/
+    abCE
+    DE
+    *** Failers
+    abcE
+    abCe  
+    dE
+    De    
+
+/[z\Qa-d]\E]/
+    z
+    a
+    -
+    d
+    ] 
+    *** Failers
+    b     
+
+/[\z\C]/
+    z
+    C 
+    
+/\M/
+    M 
+    
+/(a+)*b/
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
+    
+/(?i)reg(?:ul(?:[aä]|ae)r|ex)/
+    REGular
+    regulaer
+    Regex  
+    regulär 
+
+/Åæåä[à-ÿÀ-ß]+/
+    Åæåäà
+    Åæåäÿ
+    ÅæåäÀ
+    Åæåäß
+
+/(?<=Z)X./
+    \x84XAZXB
+
+/^(?(2)a|(1)(2))+$/
+    123a
+
+/(?<=a|bbbb)c/
+    ac
+    bbbbc
+
+/abc/>testsavedregex
+<testsavedregex
+    abc
+    *** Failers
+    bca
+    
+/abc/F>testsavedregex
+<testsavedregex
+    abc
+    *** Failers
+    bca
+
+/(a|b)/S>testsavedregex
+<testsavedregex
+    abc
+    *** Failers
+    def  
+    
+/(a|b)/SF>testsavedregex
+<testsavedregex
+    abc
+    *** Failers
+    def  
+    
+/line\nbreak/
+    this is a line\nbreak
+    line one\nthis is a line\nbreak in the second line 
+
+/line\nbreak/f
+    this is a line\nbreak
+    ** Failers 
+    line one\nthis is a line\nbreak in the second line 
+
+/line\nbreak/mf
+    this is a line\nbreak
+    ** Failers 
+    line one\nthis is a line\nbreak in the second line 
+
+/ End of testinput7 /
diff --git a/ext/pcre/pcrelib/testdata/testinput8 b/ext/pcre/pcrelib/testdata/testinput8
new file mode 100644 (file)
index 0000000..36db243
--- /dev/null
@@ -0,0 +1,540 @@
+/-- Do not use the \x{} construct except with patterns that have the --/
+/-- /8 option set, because PCRE doesn't recognize them as UTF-8 unless --/
+/-- that option is set. However, the latest Perls recognize them always. --/
+
+/\x{100}ab/8
+  \x{100}ab
+  
+/a\x{100}*b/8
+    ab
+    a\x{100}b  
+    a\x{100}\x{100}b  
+    
+/a\x{100}+b/8
+    a\x{100}b  
+    a\x{100}\x{100}b  
+    *** Failers 
+    ab
+     
+/\bX/8
+    Xoanon
+    +Xoanon
+    \x{300}Xoanon 
+    *** Failers 
+    YXoanon  
+    
+/\BX/8
+    YXoanon
+    *** Failers
+    Xoanon
+    +Xoanon    
+    \x{300}Xoanon 
+
+/X\b/8
+    X+oanon
+    ZX\x{300}oanon 
+    FAX 
+    *** Failers 
+    Xoanon  
+    
+/X\B/8
+    Xoanon  
+    *** Failers
+    X+oanon
+    ZX\x{300}oanon 
+    FAX 
+    
+/[^a]/8
+    abcd
+    a\x{100}   
+
+/^[abc\x{123}\x{400}-\x{402}]{2,3}\d/8
+    ab99
+    \x{123}\x{123}45
+    \x{400}\x{401}\x{402}6  
+    *** Failers
+    d99
+    \x{123}\x{122}4   
+    \x{400}\x{403}6  
+    \x{400}\x{401}\x{402}\x{402}6  
+
+/abc/8
+    Ã]
+    Ã
+    ÃÃÃ
+    ÃÃÃ\?
+
+/a.b/8
+    acb
+    a\x7fb
+    a\x{100}b 
+    *** Failers
+    a\nb  
+
+/a(.{3})b/8
+    a\x{4000}xyb 
+    a\x{4000}\x7fyb 
+    a\x{4000}\x{100}yb 
+    *** Failers
+    a\x{4000}b 
+    ac\ncb 
+
+/a(.*?)(.)/
+    a\xc0\x88b
+
+/a(.*?)(.)/8
+    a\x{100}b
+
+/a(.*)(.)/
+    a\xc0\x88b
+
+/a(.*)(.)/8
+    a\x{100}b
+
+/a(.)(.)/
+    a\xc0\x92bcd
+
+/a(.)(.)/8
+    a\x{240}bcd
+
+/a(.?)(.)/
+    a\xc0\x92bcd
+
+/a(.?)(.)/8
+    a\x{240}bcd
+
+/a(.??)(.)/
+    a\xc0\x92bcd
+
+/a(.??)(.)/8
+    a\x{240}bcd
+
+/a(.{3})b/8
+    a\x{1234}xyb 
+    a\x{1234}\x{4321}yb 
+    a\x{1234}\x{4321}\x{3412}b 
+    *** Failers
+    a\x{1234}b 
+    ac\ncb 
+
+/a(.{3,})b/8
+    a\x{1234}xyb 
+    a\x{1234}\x{4321}yb 
+    a\x{1234}\x{4321}\x{3412}b 
+    axxxxbcdefghijb 
+    a\x{1234}\x{4321}\x{3412}\x{3421}b 
+    *** Failers
+    a\x{1234}b 
+
+/a(.{3,}?)b/8
+    a\x{1234}xyb 
+    a\x{1234}\x{4321}yb 
+    a\x{1234}\x{4321}\x{3412}b 
+    axxxxbcdefghijb 
+    a\x{1234}\x{4321}\x{3412}\x{3421}b 
+    *** Failers
+    a\x{1234}b 
+
+/a(.{3,5})b/8
+    a\x{1234}xyb 
+    a\x{1234}\x{4321}yb 
+    a\x{1234}\x{4321}\x{3412}b 
+    axxxxbcdefghijb 
+    a\x{1234}\x{4321}\x{3412}\x{3421}b 
+    axbxxbcdefghijb 
+    axxxxxbcdefghijb 
+    *** Failers
+    a\x{1234}b 
+    axxxxxxbcdefghijb 
+
+/a(.{3,5}?)b/8
+    a\x{1234}xyb 
+    a\x{1234}\x{4321}yb 
+    a\x{1234}\x{4321}\x{3412}b 
+    axxxxbcdefghijb 
+    a\x{1234}\x{4321}\x{3412}\x{3421}b 
+    axbxxbcdefghijb 
+    axxxxxbcdefghijb 
+    *** Failers
+    a\x{1234}b 
+    axxxxxxbcdefghijb 
+
+/^[a\x{c0}]/8
+    *** Failers
+    \x{100}
+
+/(?<=aXb)cd/8
+    aXbcd
+
+/(?<=a\x{100}b)cd/8
+    a\x{100}bcd
+
+/(?<=a\x{100000}b)cd/8
+    a\x{100000}bcd
+    
+/(?:\x{100}){3}b/8
+    \x{100}\x{100}\x{100}b
+    *** Failers 
+    \x{100}\x{100}b
+
+/\x{ab}/8
+    \x{ab} 
+    \xc2\xab
+    *** Failers 
+    \x00{ab}
+
+/(?<=(.))X/8
+    WXYZ
+    \x{256}XYZ 
+    *** Failers
+    XYZ 
+
+/[^a]+/8g
+    bcd
+    \x{100}aY\x{256}Z 
+    
+/^[^a]{2}/8
+    \x{100}bc
+/^[^a]{2,}/8
+    \x{100}bcAa
+
+/^[^a]{2,}?/8
+    \x{100}bca
+
+/[^a]+/8ig
+    bcd
+    \x{100}aY\x{256}Z 
+    
+/^[^a]{2}/8i
+    \x{100}bc
+/^[^a]{2,}/8i
+    \x{100}bcAa
+
+/^[^a]{2,}?/8i
+    \x{100}bca
+
+/\x{100}{0,0}/8
+    abcd
+/\x{100}?/8
+    abcd
+    \x{100}\x{100} 
+
+/\x{100}{0,3}/8 
+    \x{100}\x{100} 
+    \x{100}\x{100}\x{100}\x{100} 
+    
+/\x{100}*/8
+    abce
+    \x{100}\x{100}\x{100}\x{100} 
+
+/\x{100}{1,1}/8
+    abcd\x{100}\x{100}\x{100}\x{100} 
+
+/\x{100}{1,3}/8
+    abcd\x{100}\x{100}\x{100}\x{100} 
+
+/\x{100}+/8
+    abcd\x{100}\x{100}\x{100}\x{100} 
+
+/\x{100}{3}/8
+    abcd\x{100}\x{100}\x{100}XX
+
+/\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
+    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
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+
+/\D*/8
+  \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\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
+    1X2
+    1\x{100}2 
+  
+/>\S/8
+    > >X Y
+    > >\x{100} Y
+  
+/\d/8
+    \x{100}3
+    
+/\s/8
+    \x{100} X
+    
+/\D+/8
+    12abcd34
+    *** Failers
+    1234  
+
+/\D{2,3}/8
+    12abcd34
+    12ab34
+    *** Failers  
+    1234
+    12a34  
+
+/\D{2,3}?/8
+    12abcd34
+    12ab34
+    *** Failers  
+    1234
+    12a34  
+
+/\d+/8
+    12abcd34
+    *** Failers
+
+/\d{2,3}/8
+    12abcd34
+    1234abcd
+    *** Failers  
+    1.4 
+
+/\d{2,3}?/8
+    12abcd34
+    1234abcd
+    *** Failers  
+    1.4 
+
+/\S+/8
+    12abcd34
+    *** Failers
+    \    \ 
+
+/\S{2,3}/8
+    12abcd34
+    1234abcd
+    *** Failers
+    \     \  
+
+/\S{2,3}?/8
+    12abcd34
+    1234abcd
+    *** Failers
+    \     \  
+
+/>\s+</8
+    12>      <34
+    *** Failers
+
+/>\s{2,3}</8
+    ab>  <cd
+    ab>   <ce
+    *** Failers
+    ab>    <cd 
+
+/>\s{2,3}?</8
+    ab>  <cd
+    ab>   <ce
+    *** Failers
+    ab>    <cd 
+
+/\w+/8
+    12      34
+    *** Failers
+    +++=*! 
+
+/\w{2,3}/8
+    ab  cd
+    abcd ce
+    *** Failers
+    a.b.c
+
+/\w{2,3}?/8
+    ab  cd
+    abcd ce
+    *** Failers
+    a.b.c
+
+/\W+/8
+    12====34
+    *** Failers
+    abcd 
+
+/\W{2,3}/8
+    ab====cd
+    ab==cd
+    *** Failers
+    a.b.c
+
+/\W{2,3}?/8
+    ab====cd
+    ab==cd
+    *** Failers
+    a.b.c
+
+/[\x{100}]/8
+    \x{100}
+    Z\x{100}
+    \x{100}Z
+    *** Failers 
+
+/[Z\x{100}]/8
+    Z\x{100}
+    \x{100}
+    \x{100}Z
+    *** Failers 
+
+/[\x{100}\x{200}]/8
+   ab\x{100}cd
+   ab\x{200}cd
+   *** Failers  
+
+/[\x{100}-\x{200}]/8
+   ab\x{100}cd
+   ab\x{200}cd
+   ab\x{111}cd 
+   *** Failers  
+
+/[z-\x{200}]/8
+   ab\x{100}cd
+   ab\x{200}cd
+   ab\x{111}cd 
+   abzcd
+   ab|cd  
+   *** Failers  
+
+/[Q\x{100}\x{200}]/8
+   ab\x{100}cd
+   ab\x{200}cd
+   Q? 
+   *** Failers  
+
+/[Q\x{100}-\x{200}]/8
+   ab\x{100}cd
+   ab\x{200}cd
+   ab\x{111}cd 
+   Q? 
+   *** Failers  
+
+/[Qz-\x{200}]/8
+   ab\x{100}cd
+   ab\x{200}cd
+   ab\x{111}cd 
+   abzcd
+   ab|cd  
+   Q? 
+   *** Failers  
+
+/[\x{100}\x{200}]{1,3}/8
+   ab\x{100}cd
+   ab\x{200}cd
+   ab\x{200}\x{100}\x{200}\x{100}cd
+   *** Failers  
+
+/[\x{100}\x{200}]{1,3}?/8
+   ab\x{100}cd
+   ab\x{200}cd
+   ab\x{200}\x{100}\x{200}\x{100}cd
+   *** Failers  
+
+/[Q\x{100}\x{200}]{1,3}/8
+   ab\x{100}cd
+   ab\x{200}cd
+   ab\x{200}\x{100}\x{200}\x{100}cd
+   *** Failers  
+
+/[Q\x{100}\x{200}]{1,3}?/8
+   ab\x{100}cd
+   ab\x{200}cd
+   ab\x{200}\x{100}\x{200}\x{100}cd
+   *** Failers  
+
+/(?<=[\x{100}\x{200}])X/8
+    abc\x{200}X
+    abc\x{100}X 
+    *** Failers
+    X  
+
+/(?<=[Q\x{100}\x{200}])X/8
+    abc\x{200}X
+    abc\x{100}X 
+    abQX 
+    *** Failers
+    X  
+
+/(?<=[\x{100}\x{200}]{3})X/8
+    abc\x{100}\x{200}\x{100}X
+    *** Failers
+    abc\x{200}X
+    X  
+
+/[^\x{100}\x{200}]X/8
+    AX
+    \x{150}X
+    \x{500}X 
+    *** Failers
+    \x{100}X
+    \x{200}X   
+
+/[^Q\x{100}\x{200}]X/8
+    AX
+    \x{150}X
+    \x{500}X 
+    *** Failers
+    \x{100}X
+    \x{200}X   
+    QX 
+
+/[^\x{100}-\x{200}]X/8
+    AX
+    \x{500}X 
+    *** Failers
+    \x{100}X
+    \x{150}X
+    \x{200}X   
+
+/[z-\x{100}]/8i
+    z
+    Z 
+    \x{100}
+    *** Failers
+    \x{102}
+    y    
+
+/[\xFF]/
+    >\xff<
+
+/[\xff]/8
+    >\x{ff}<
+
+/[^\xFF]/
+    XYZ
+
+/[^\xff]/8
+    XYZ
+    \x{123} 
+
+/^[ac]*b/8
+  xb
+
+/^[ac\x{100}]*b/8
+  xb
+
+/^[^x]*b/8i
+  xb
+
+/^[^x]*b/8
+  xb
+  
+/^\d*b/8
+  xb 
+
+/(|a)/g8
+    catac
+    a\x{256}a 
+
+/^\x{85}$/8i
+    \x{85}
+
+/ End of testinput 8 / 
diff --git a/ext/pcre/pcrelib/testdata/testinput9 b/ext/pcre/pcrelib/testdata/testinput9
new file mode 100644 (file)
index 0000000..f18dd12
--- /dev/null
@@ -0,0 +1,599 @@
+/\pL\P{Nd}/8
+    AB
+    *** Failers
+    A0
+    00   
+
+/\X./8
+    AB
+    A\x{300}BC 
+    A\x{300}\x{301}\x{302}BC 
+    *** Failers
+    \x{300}  
+
+/\X\X/8
+    ABC
+    A\x{300}B\x{300}\x{301}C 
+    A\x{300}\x{301}\x{302}BC 
+    *** Failers
+    \x{300}  
+
+/^\pL+/8
+    abcd
+    a 
+    *** Failers 
+
+/^\PL+/8
+    1234
+    = 
+    *** Failers 
+    abcd 
+
+/^\X+/8
+    abcdA\x{300}\x{301}\x{302}
+    A\x{300}\x{301}\x{302}
+    A\x{300}\x{301}\x{302}A\x{300}\x{301}\x{302}
+    a 
+    *** Failers 
+    \x{300}\x{301}\x{302}
+
+/\X?abc/8
+    abc
+    A\x{300}abc
+    A\x{300}\x{301}\x{302}A\x{300}A\x{300}A\x{300}abcxyz
+    \x{300}abc  
+    *** Failers
+
+/^\X?abc/8
+    abc
+    A\x{300}abc
+    *** Failers
+    A\x{300}\x{301}\x{302}A\x{300}A\x{300}A\x{300}abcxyz
+    \x{300}abc  
+
+/\X*abc/8
+    abc
+    A\x{300}abc
+    A\x{300}\x{301}\x{302}A\x{300}A\x{300}A\x{300}abcxyz
+    \x{300}abc  
+    *** Failers
+
+/^\X*abc/8
+    abc
+    A\x{300}abc
+    A\x{300}\x{301}\x{302}A\x{300}A\x{300}A\x{300}abcxyz
+    *** Failers
+    \x{300}abc  
+
+/^\pL?=./8
+    A=b
+    =c 
+    *** Failers
+    1=2 
+    AAAA=b  
+
+/^\pL*=./8
+    AAAA=b
+    =c 
+    *** Failers
+    1=2  
+
+/^\X{2,3}X/8
+    A\x{300}\x{301}\x{302}A\x{300}\x{301}\x{302}X
+    A\x{300}\x{301}\x{302}A\x{300}\x{301}\x{302}A\x{300}\x{301}\x{302}X 
+    *** Failers
+    X
+    A\x{300}\x{301}\x{302}X
+    A\x{300}\x{301}\x{302}A\x{300}\x{301}\x{302}A\x{300}\x{301}\x{302}A\x{300}\x{301}\x{302}X
+
+/^\pC\pL\pM\pN\pP\pS\pZ</8
+    \x7f\x{c0}\x{30f}\x{660}\x{66c}\x{f01}\x{1680}<
+    \np\x{300}9!\$ < 
+    ** Failers 
+    ap\x{300}9!\$ < 
+  
+/^\PC/8
+    X
+    ** Failers 
+    \x7f
+  
+/^\PL/8
+    9
+    ** Failers 
+    \x{c0}
+  
+/^\PM/8
+    X
+    ** Failers 
+    \x{30f}
+  
+/^\PN/8
+    X
+    ** Failers 
+    \x{660}
+  
+/^\PP/8
+    X
+    ** Failers 
+    \x{66c}
+  
+/^\PS/8
+    X
+    ** Failers 
+    \x{f01}
+  
+/^\PZ/8
+    X
+    ** Failers 
+    \x{1680}
+    
+/^\p{Cc}/8
+    \x{017}
+    \x{09f} 
+    ** Failers
+    \x{0600} 
+  
+/^\p{Cf}/8
+    \x{601}
+    ** Failers
+    \x{09f} 
+  
+/^\p{Cn}/8
+    ** Failers
+    \x{09f} 
+  
+/^\p{Co}/8
+    \x{f8ff}
+    ** Failers
+    \x{09f} 
+  
+/^\p{Cs}/8
+    \x{dfff}
+    ** Failers
+    \x{09f} 
+  
+/^\p{Ll}/8
+    a
+    ** Failers 
+    Z
+    \x{dfff}  
+  
+/^\p{Lm}/8
+    \x{2b0}
+    ** Failers
+    a 
+  
+/^\p{Lo}/8
+    \x{1bb}
+    ** Failers
+    a 
+    \x{2b0}
+  
+/^\p{Lt}/8
+    \x{1c5}
+    ** Failers
+    a 
+    \x{2b0}
+  
+/^\p{Lu}/8
+    A
+    ** Failers
+    \x{2b0}
+  
+/^\p{Mc}/8
+    \x{903}
+    ** Failers
+    X
+    \x{300}
+       
+/^\p{Me}/8
+    \x{488}
+    ** Failers
+    X
+    \x{903}
+    \x{300}
+  
+/^\p{Mn}/8
+    \x{300}
+    ** Failers
+    X
+    \x{903}
+  
+/^\p{Nd}+/8
+    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}
+    ** Failers
+    X
+  
+/^\p{Nl}/8
+    \x{16ee}
+    ** Failers
+    X
+    \x{966}
+  
+/^\p{No}/8
+    \x{b2}
+    \x{b3}
+    ** Failers
+    X
+    \x{16ee}
+  
+/^\p{Pc}/8
+    \x5f
+    \x{203f}
+    ** Failers
+    X
+    -
+    \x{58a}
+  
+/^\p{Pd}/8
+    -
+    \x{58a}
+    ** Failers
+    X
+    \x{203f}
+  
+/^\p{Pe}/8
+    )
+    ]
+    }
+    \x{f3b}
+    ** Failers
+    X
+    \x{203f}
+    (
+    [
+    {
+    \x{f3c}
+  
+/^\p{Pf}/8
+    \x{bb}
+    \x{2019}
+    ** Failers
+    X
+    \x{203f}
+  
+/^\p{Pi}/8
+    \x{ab}
+    \x{2018}
+    ** Failers
+    X
+    \x{203f}
+  
+/^\p{Po}/8
+    !
+    \x{37e}
+    ** Failers
+    X
+    \x{203f}
+  
+/^\p{Ps}/8
+    (
+    [
+    {
+    \x{f3c}
+    ** Failers
+    X
+    )
+    ]
+    }
+    \x{f3b}
+  
+/^\p{Sc}+/8
+    $\x{a2}\x{a3}\x{a4}\x{a5}\x{a6}
+    \x{9f2}
+    ** Failers
+    X
+    \x{2c2}
+  
+/^\p{Sk}/8
+    \x{2c2}
+    ** Failers
+    X
+    \x{9f2}
+  
+/^\p{Sm}+/8
+    +<|~\x{ac}\x{2044}
+    ** Failers
+    X
+    \x{9f2}
+  
+/^\p{So}/8
+    \x{a6}
+    \x{482} 
+    ** Failers
+    X
+    \x{9f2}
+  
+/^\p{Zl}/8
+    \x{2028}
+    ** Failers
+    X
+    \x{2029}
+  
+/^\p{Zp}/8
+    \x{2029}
+    ** Failers
+    X
+    \x{2028}
+  
+/^\p{Zs}/8
+    \ \
+    \x{a0}
+    \x{1680}
+    \x{180e}
+    \x{2000}
+    \x{2001}     
+    ** Failers
+    \x{2028}
+    \x{200d} 
+  
+/\p{Nd}+(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}+?(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}{2,}(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}{2,}?(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}*(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}*?(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}{2}(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}{2,3}(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}{2,3}?(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}?(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}??(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}*+(..)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}*+(...)/8
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}*+(....)/8
+      ** Failers
+      \x{660}\x{661}\x{662}ABC
+  
+/\p{Lu}/8i
+    A
+    a\x{10a0}B 
+    ** Failers 
+    a
+    \x{1d00}  
+
+/\p{^Lu}/8i
+    1234
+    ** Failers
+    ABC 
+
+/\P{Lu}/8i
+    1234
+    ** Failers
+    ABC 
+
+/(?<=A\p{Nd})XYZ/8
+    A2XYZ
+    123A5XYZPQR
+    ABA\x{660}XYZpqr
+    ** Failers
+    AXYZ
+    XYZ     
+    
+/(?<!\pL)XYZ/8
+    1XYZ
+    AB=XYZ.. 
+    XYZ 
+    ** Failers
+    WXYZ 
+
+/[\p{Nd}]/8
+    1234
+
+/[\p{Nd}+-]+/8
+    1234
+    12-34
+    12+\x{661}-34  
+    ** Failers
+    abcd  
+
+/[\P{Nd}]+/8
+    abcd
+    ** Failers
+    1234
+
+/\D+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+     
+/\P{Nd}+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+
+/[\D]+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+
+/[\P{Nd}]+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+
+/[\D\P{Nd}]+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+
+/\pL/8
+    a
+    A 
+
+/\pL/8i
+    a
+    A 
+    
+/\p{Lu}/8 
+    A
+    aZ
+    ** Failers
+    abc   
+
+/\p{Lu}/8i
+    A
+    aZ
+    ** Failers
+    abc   
+
+/\p{Ll}/8 
+    a
+    Az
+    ** Failers
+    ABC   
+
+/\p{Ll}/8i 
+    a
+    Az
+    ** Failers
+    ABC   
+
+/^\x{c0}$/8i
+    \x{c0}
+    \x{e0} 
+
+/^\x{e0}$/8i
+    \x{c0}
+    \x{e0} 
+
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8
+    A\x{391}\x{10427}\x{ff3a}\x{1fb0}
+    ** Failers
+    a\x{391}\x{10427}\x{ff3a}\x{1fb0}   
+    A\x{3b1}\x{10427}\x{ff3a}\x{1fb0}
+    A\x{391}\x{1044F}\x{ff3a}\x{1fb0}
+    A\x{391}\x{10427}\x{ff5a}\x{1fb0}
+    A\x{391}\x{10427}\x{ff3a}\x{1fb8}
+
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8i
+    A\x{391}\x{10427}\x{ff3a}\x{1fb0}
+    a\x{391}\x{10427}\x{ff3a}\x{1fb0}   
+    A\x{3b1}\x{10427}\x{ff3a}\x{1fb0}
+    A\x{391}\x{1044F}\x{ff3a}\x{1fb0}
+    A\x{391}\x{10427}\x{ff5a}\x{1fb0}
+    A\x{391}\x{10427}\x{ff3a}\x{1fb8}
+
+/\x{391}+/8i
+    \x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}
+
+/\x{391}{3,5}(.)/8i
+    \x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}X
+
+/\x{391}{3,5}?(.)/8i
+    \x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}X
+
+/[\x{391}\x{ff3a}]/8i
+    \x{391}
+    \x{ff3a}
+    \x{3b1}
+    \x{ff5a}   
+    
+/[\x{c0}\x{391}]/8i
+    \x{c0}
+    \x{e0} 
+
+/[\x{105}-\x{109}]/8i
+    \x{104}
+    \x{105}
+    \x{109}  
+    ** Failers
+    \x{100}
+    \x{10a} 
+    
+/[z-\x{100}]/8i 
+    Z
+    z
+    \x{39c}
+    \x{178}
+    |
+    \x{80}
+    \x{ff}
+    \x{100}
+    \x{101} 
+    ** Failers
+    \x{102}
+    Y
+    y           
+
+/[z-\x{100}]/8i
+
+/^\X/8
+    A
+    A\x{300}BC 
+    A\x{300}\x{301}\x{302}BC 
+    *** Failers
+    \x{300}  
+
+/^[\X]/8
+    X123
+    *** Failers
+    AXYZ
+
+/^(\X*)C/8
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301} 
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C 
+
+/^(\X*?)C/8
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301} 
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C 
+
+/^(\X*)(.)/8
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301} 
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C 
+
+/^(\X*?)(.)/8
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301} 
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C 
+
+/^\X(.)/8
+    *** Failers
+    A\x{300}\x{301}\x{302}
+
+/^\X{2,3}(.)/8
+    A\x{300}\x{301}B\x{300}X
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}X
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}DA\x{300}X
+    
+/^\X{2,3}?(.)/8
+    A\x{300}\x{301}B\x{300}X
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}X
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}DA\x{300}X
+
+/^\pN{2,3}X/
+    12X
+    123X
+    *** Failers
+    X
+    1X
+    1234X     
+
+/\x{100}/i8
+    \x{100}   
+    \x{101} 
+    
+/ End / 
index 81bf6cef3d5af311e37286dd07b210a227afddcd..1f835b7886bf1a98d145123d506d31173072131e 100644 (file)
@@ -1,4 +1,4 @@
-PCRE version 3.92 11-Sep-2002
+PCRE version 6.2 01-Aug-2005
 
 /the quick brown fox/
     the quick brown fox
@@ -1942,7 +1942,7 @@ No match
 /^[W-c]+$/
     WXY_^abc
  0: WXY_^abc
-    ***Failers
+    *** Failers
 No match
     wxy
 No match
@@ -5792,7 +5792,7 @@ No match
     12-ab.1245 
  0: 12-ab.1245
  1: 
-    ***Failers
+    *** Failers
 No match
     \
 No match
@@ -6218,5 +6218,70 @@ No match
     1:  
 No match
 
-/ End of testinput1 /
+/[z\Qa-d]\E]/
+    z
+ 0: z
+    a
+ 0: a
+    -
+ 0: -
+    d
+ 0: d
+    ] 
+ 0: ]
+    *** Failers
+ 0: a
+    b     
+No match
+
+/[\z\C]/
+    z
+ 0: z
+    C 
+ 0: C
+    
+/\M/
+    M 
+ 0: M
+    
+/(a+)*b/
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
+No match
+    
+/(?i)reg(?:ul(?:[aä]|ae)r|ex)/
+    REGular
+ 0: REGular
+    regulaer
+ 0: regulaer
+    Regex  
+ 0: Regex
+    regulär 
+ 0: regul\xe4r
+
+/Åæåä[à-ÿÀ-ß]+/
+    Åæåäà
+ 0: \xc5\xe6\xe5\xe4\xe0
+    Åæåäÿ
+ 0: \xc5\xe6\xe5\xe4\xff
+    ÅæåäÀ
+ 0: \xc5\xe6\xe5\xe4\xc0
+    Åæåäß
+ 0: \xc5\xe6\xe5\xe4\xdf
+
+/(?<=Z)X./
+  \x84XAZXB
+ 0: XB
+
+/ab cd (?x) de fg/
+    ab cd defg
+ 0: ab cd defg
+
+/ab cd(?x) de fg/
+    ab cddefg
+ 0: ab cddefg
+    ** Failers 
+No match
+    abcddefg
+No match
 
+/ End of testinput1 /
index 2d1db0fb13463cd1724f8ac1ce666d63d14c2ccf..8f078b8464d8f3fb86f98839877ef244c081bd64 100644 (file)
@@ -1,4 +1,4 @@
-PCRE version 3.92 11-Sep-2002
+PCRE version 6.2 01-Aug-2005
 
 /(a)b|/
 Capturing subpattern count = 1
@@ -28,7 +28,7 @@ No match
 Capturing subpattern count = 0
 Options: anchored
 No first char
-Need char = 'c'
+No need char
     abc
  0: abc
     \Aabc
@@ -42,24 +42,28 @@ No match
 
 /a+bc/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'a'
 Need char = 'c'
 
 /a*bc/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 No first char
 Need char = 'c'
 
 /a{3}bc/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'a'
 Need char = 'c'
 
 /(abc|a+z)/
 Capturing subpattern count = 1
+Partial matching not supported
 No options
 First char = 'a'
 No need char
@@ -68,7 +72,7 @@ No need char
 Capturing subpattern count = 0
 Options: anchored
 No first char
-Need char = 'c'
+No need char
     abc
  0: abc
     *** Failers
@@ -91,8 +95,8 @@ Failed: number too big in {} quantifier at offset 7
 /[abcd/
 Failed: missing terminating ] for character class at offset 5
 
-/[\B]/
-Failed: invalid escape sequence in character class at offset 2
+/(?X)[\B]/
+Failed: invalid escape sequence in character class at offset 6
 
 /[z-a]/
 Failed: range out of order in character class at offset 3
@@ -111,12 +115,14 @@ Failed: unrecognized character after (? at offset 2
 
 /.*b/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char at start or follows \n
 Need char = 'b'
 
 /.*?b/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char at start or follows \n
 Need char = 'b'
@@ -136,7 +142,7 @@ Capturing subpattern count = 0
 No options
 No first char
 No need char
-Starting character set: c d e 
+Starting byte set: c d e 
     this sentence eventually mentions a cat
  0: cat
     this sentences rambles on and on for a while and then reaches elephant
@@ -147,7 +153,7 @@ Capturing subpattern count = 0
 Options: caseless
 No first char
 No need char
-Starting character set: C D E c d e 
+Starting byte set: C D E c d e 
     this sentence eventually mentions a CAT cat
  0: CAT
     this sentences rambles on and on for a while to elephant ElePhant
@@ -158,14 +164,14 @@ Capturing subpattern count = 0
 No options
 No first char
 No need char
-Starting character set: a b c d 
+Starting byte set: a b c d 
 
 /(a|[^\dZ])/S
 Capturing subpattern count = 1
 No options
 No first char
 No need char
-Starting character set: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a 
+Starting byte set: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a 
   \x0b \x0c \x0d \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 
   \x1a \x1b \x1c \x1d \x1e \x1f \x20 ! " # $ % & ' ( ) * + , - . / : ; < = > 
   ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y [ \ ] ^ _ ` a b c d 
@@ -185,7 +191,7 @@ Capturing subpattern count = 1
 No options
 No first char
 No need char
-Starting character set: \x09 \x0a \x0c \x0d \x20 a b 
+Starting byte set: \x09 \x0a \x0c \x0d \x20 a b 
 
 /(ab\2)/
 Failed: reference to non-existent subpattern at offset 6
@@ -297,7 +303,7 @@ Need char = 'x'
 Capturing subpattern count = 0
 Options: anchored
 No first char
-Need char = 'x'
+No need char
     the quick brown fox
  0: the quick brown fox
     *** Failers
@@ -320,6 +326,7 @@ No need char
 
 /.*((abc)$|(def))/
 Capturing subpattern count = 3
+Partial matching not supported
 No options
 First char at start or follows \n
 No need char
@@ -396,6 +403,7 @@ Failed: missing terminating ] for character class at offset 4
 
 /[^aeiou ]{3,}/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 No first char
 No need char
@@ -404,6 +412,7 @@ No need char
     
 /<.*>/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = '<'
 Need char = '>'
@@ -412,6 +421,7 @@ Need char = '>'
 
 /<.*?>/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = '<'
 Need char = '>'
@@ -420,6 +430,7 @@ Need char = '>'
 
 /<.*>/U
 Capturing subpattern count = 0
+Partial matching not supported
 Options: ungreedy
 First char = '<'
 Need char = '>'
@@ -428,6 +439,7 @@ Need char = '>'
     
 /(?U)<.*>/
 Capturing subpattern count = 0
+Partial matching not supported
 Options: ungreedy
 First char = '<'
 Need char = '>'
@@ -436,6 +448,7 @@ Need char = '>'
 
 /<.*?>/U
 Capturing subpattern count = 0
+Partial matching not supported
 Options: ungreedy
 First char = '<'
 Need char = '>'
@@ -444,6 +457,7 @@ Need char = '>'
     
 /={3,}/U
 Capturing subpattern count = 0
+Partial matching not supported
 Options: ungreedy
 First char = '='
 Need char = '='
@@ -452,6 +466,7 @@ Need char = '='
     
 /(?U)={3,}?/
 Capturing subpattern count = 0
+Partial matching not supported
 Options: ungreedy
 First char = '='
 Need char = '='
@@ -499,7 +514,7 @@ No need char
 Capturing subpattern count = 0
 Options: anchored caseless
 No first char
-Need char = '4'
+No need char
 
 /(^b|(?i)^d)/
 Capturing subpattern count = 1
@@ -510,6 +525,7 @@ No need char
 
 /(?s).*/
 Capturing subpattern count = 0
+Partial matching not supported
 Options: anchored dotall
 No first char
 No need char
@@ -519,21 +535,21 @@ Capturing subpattern count = 0
 No options
 No first char
 No need char
-Starting character set: a b c d 
+Starting byte set: a b c d 
 
 /(?i)[abcd]/S
 Capturing subpattern count = 0
 Options: caseless
 No first char
 No need char
-Starting character set: A B C D a b c d 
+Starting byte set: A B C D a b c d 
 
 /(?m)[xy]|(b|c)/S
 Capturing subpattern count = 1
 Options: multiline
 No first char
 No need char
-Starting character set: b c x y 
+Starting byte set: b c x y 
 
 /(^a|^b)/m
 Capturing subpattern count = 1
@@ -568,6 +584,7 @@ Failed: unrecognized character after (?< at offset 5
 /((?s)blah)\s+\1/
 Capturing subpattern count = 1
 Max back reference = 1
+Partial matching not supported
 No options
 First char = 'b'
 Need char = 'h'
@@ -575,6 +592,7 @@ Need char = 'h'
 /((?i)blah)\s+\1/
 Capturing subpattern count = 1
 Max back reference = 1
+Partial matching not supported
 No options
 Case state changes
 First char = 'b' (caseless)
@@ -582,14 +600,14 @@ Need char = 'h' (caseless)
 
 /((?i)b)/DS
 ------------------------------------------------------------------
-  0  16 Bra 0
-  3   8 Bra 1
+  0  15 Bra 0
+  3   7 Bra 1
   6  01 Opt
-  8   1 b
- 11   8 Ket
- 14  00 Opt
- 16  16 Ket
- 19     End
+  8  NC b
+ 10   7 Ket
+ 13  00 Opt
+ 15  15 Ket
+ 18     End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 No options
@@ -600,11 +618,12 @@ Study returned NULL
 
 /(a*b|(?i:c*(?-i)d))/S
 Capturing subpattern count = 1
+Partial matching not supported
 No options
 Case state changes
 No first char
 No need char
-Starting character set: C a b c d 
+Starting byte set: C a b c d 
 
 /a$/
 Capturing subpattern count = 0
@@ -642,7 +661,7 @@ No match
 Capturing subpattern count = 0
 Options: anchored multiline
 No first char
-Need char = 'c'
+No need char
 
 /^abc/m 
 Capturing subpattern count = 0
@@ -652,9 +671,10 @@ Need char = 'c'
 
 /^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/
 Capturing subpattern count = 5
+Partial matching not supported
 Options: anchored
 No first char
-Need char = 'a'
+No need char
   aaaaabbbbbcccccdef
  0: aaaaabbbbbcccccdef
  1: aaaaabbbbbcccccdef
@@ -668,27 +688,53 @@ Capturing subpattern count = 0
 No options
 No first char
 No need char
-Starting character set: a b 
+Starting byte set: a b 
 
 /(?<!foo)(alpha|omega)/S
 Capturing subpattern count = 1
 No options
 No first char
 Need char = 'a'
-Starting character set: a o 
+Starting byte set: a o 
 
 /(?!alphabet)[ab]/S
 Capturing subpattern count = 0
 No options
 No first char
 No need char
-Starting character set: a b 
+Starting byte set: a b 
 
 /(?<=foo\n)^bar/m
 Capturing subpattern count = 0
 Options: multiline
+No first char
+Need char = 'r'
+    foo\nbarbar 
+ 0: bar
+    ***Failers
+No match
+    rhubarb 
+No match
+    barbell
+No match
+    abc\nbarton 
+No match
+
+/^(?<=foo\n)bar/m
+Capturing subpattern count = 0
+Options: multiline
 First char at start or follows \n
 Need char = 'r'
+    foo\nbarbar 
+ 0: bar
+    ***Failers
+No match
+    rhubarb 
+No match
+    barbell
+No match
+    abc\nbarton 
+No match
 
 /(?>^abc)/m
 Capturing subpattern count = 0
@@ -744,6 +790,7 @@ No need char
 
 /(?>.*)(?<=(abcd)|(xyz))/
 Capturing subpattern count = 2
+Partial matching not supported
 No options
 First char at start or follows \n
 No need char
@@ -825,7 +872,7 @@ Capturing subpattern count = 1
 Max back reference = 1
 Options: anchored
 No first char
-Need char = 'a'
+No need char
     aaaaaa
  0: aaaaaa
  1: aa
@@ -966,6 +1013,7 @@ copy substring 5 failed -7
      
 /(.{20})/
 Capturing subpattern count = 1
+Partial matching not supported
 No options
 No first char
 No need char
@@ -983,6 +1031,7 @@ copy substring 1 failed -6
      
 /(.{15})/
 Capturing subpattern count = 1
+Partial matching not supported
 No options
 No first char
 No need char
@@ -997,6 +1046,7 @@ No need char
 
 /(.{16})/
 Capturing subpattern count = 1
+Partial matching not supported
 No options
 No first char
 No need char
@@ -1015,7 +1065,7 @@ copy substring 1 failed -6
 Capturing subpattern count = 3
 Options: anchored
 No first char
-Need char = 'f'
+No need char
     adef\G1\G2\G3\G4\L 
  0: adef
  1: a
@@ -1053,7 +1103,7 @@ get substring 4 failed -7
 Capturing subpattern count = 0
 Options: anchored
 No first char
-Need char = 'f'
+No need char
     abc\00def\L\C0 
  0: abc\x00def
  0C abc (7)
@@ -1062,109 +1112,116 @@ Need char = 'f'
 /word ((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ 
 )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ 
 )?)?)?)?)?)?)?)?)?otherword/M
-Memory allocation (code space): 428
+Memory allocation (code space): 432
 Capturing subpattern count = 8
+Partial matching not supported
 No options
 First char = 'w'
 Need char = 'd'
 
 /.*X/D
 ------------------------------------------------------------------
-  0   8 Bra 0
+  0   7 Bra 0
   3     Any*
-  5   1 X
-  8   8 Ket
- 11     End
+  5     X
+  7   7 Ket
+ 10     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char at start or follows \n
 Need char = 'X'
 
 /.*X/Ds
 ------------------------------------------------------------------
-  0   8 Bra 0
+  0   7 Bra 0
   3     Any*
-  5   1 X
-  8   8 Ket
- 11     End
+  5     X
+  7   7 Ket
+ 10     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
+Partial matching not supported
 Options: anchored dotall
 No first char
 Need char = 'X'
 
 /(.*X|^B)/D
 ------------------------------------------------------------------
-  0  21 Bra 0
-  3   8 Bra 1
+  0  19 Bra 0
+  3   7 Bra 1
   6     Any*
-  8   1 X
- 11   7 Alt
- 14     ^
- 15   1 B
- 18  15 Ket
21  21 Ket
- 24     End
+  8     X
+ 10   6 Alt
+ 13     ^
+ 14     B
+ 16  13 Ket
19  19 Ket
+ 22     End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
+Partial matching not supported
 No options
 First char at start or follows \n
 No need char
 
 /(.*X|^B)/Ds
 ------------------------------------------------------------------
-  0  21 Bra 0
-  3   8 Bra 1
+  0  19 Bra 0
+  3   7 Bra 1
   6     Any*
-  8   1 X
- 11   7 Alt
- 14     ^
- 15   1 B
- 18  15 Ket
21  21 Ket
- 24     End
+  8     X
+ 10   6 Alt
+ 13     ^
+ 14     B
+ 16  13 Ket
19  19 Ket
+ 22     End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
+Partial matching not supported
 Options: anchored dotall
 No first char
 No need char
     
 /(?s)(.*X|^B)/D
 ------------------------------------------------------------------
-  0  21 Bra 0
-  3   8 Bra 1
+  0  19 Bra 0
+  3   7 Bra 1
   6     Any*
-  8   1 X
- 11   7 Alt
- 14     ^
- 15   1 B
- 18  15 Ket
21  21 Ket
- 24     End
+  8     X
+ 10   6 Alt
+ 13     ^
+ 14     B
+ 16  13 Ket
19  19 Ket
+ 22     End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
+Partial matching not supported
 Options: anchored dotall
 No first char
 No need char
 
 /(?s:.*X|^B)/D
 ------------------------------------------------------------------
-  0  27 Bra 0
-  3  10 Bra 0
+  0  25 Bra 0
+  3   9 Bra 0
   6  04 Opt
   8     Any*
- 10   1 X
- 13   9 Alt
- 16  04 Opt
- 18     ^
- 19   1 B
- 22  19 Ket
- 25  00 Opt
- 27  27 Ket
30     End
+ 10     X
+ 12   8 Alt
+ 15  04 Opt
+ 17     ^
+ 18     B
+ 20  17 Ket
+ 23  00 Opt
+ 25  25 Ket
28     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char at start or follows \n
 No need char
@@ -1242,13 +1299,14 @@ Need char = 's'
 Capturing subpattern count = 0
 Options: anchored
 No first char
-Need char = 's'
+No need char
     ississippi
  0: iss
  0+ issippi
     
 /.*iss/g+
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char at start or follows \n
 Need char = 's'
@@ -1292,7 +1350,7 @@ Need char = 'i'
 Capturing subpattern count = 0
 Options: anchored
 No first char
-Need char = 's'
+No need char
     Mississippi
  0: Mis
  0+ sissippi
@@ -1301,7 +1359,7 @@ Need char = 's'
 Capturing subpattern count = 0
 Options: anchored
 No first char
-Need char = 10
+No need char
     ab\nab\ncd
  0: ab\x0a
  0+ ab\x0acd
@@ -1349,36 +1407,42 @@ Need char = 'c'
 
 /a*/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 No first char
 No need char
 
 /a+/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'a'
 No need char
 
 /(baa|a+)/
 Capturing subpattern count = 1
+Partial matching not supported
 No options
 No first char
 Need char = 'a'
 
 /a{0,3}/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 No first char
 No need char
 
 /baa{3,}/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'b'
 Need char = 'a'
 
 /"([^\\"]+|\\.)*"/
 Capturing subpattern count = 1
+Partial matching not supported
 No options
 First char = '"'
 Need char = '"'
@@ -1433,60 +1497,70 @@ Need char = 'b'
 
 /abc*/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'a'
 Need char = 'b'
 
 /ab.c*/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'a'
 Need char = 'b'
 
 /a.c*/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'a'
 No need char
 
 /.c*/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 No first char
 No need char
 
 /ac*/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'a'
 No need char
 
 /(a.c*|b.c*)/
 Capturing subpattern count = 1
+Partial matching not supported
 No options
 No first char
 No need char
 
 /a.c*|aba/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'a'
 No need char
 
 /.+a/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 No first char
 Need char = 'a'
 
 /(?=abcda)a.*/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'a'
 Need char = 'a'
 
 /(?=a)a.*/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'a'
 No need char
@@ -1499,12 +1573,14 @@ No need char
 
 /a\d*/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'a'
 No need char
 
 /ab\d*/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'a'
 Need char = 'b'
@@ -1523,6 +1599,7 @@ Need char = 'd'
 
 /ab\d+/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'a'
 Need char = 'b'
@@ -1640,6 +1717,7 @@ Study returned NULL
   \)            # Closing )
   /x
 Capturing subpattern count = 0
+Partial matching not supported
 Options: extended
 First char = '('
 Need char = ')'
@@ -1668,6 +1746,7 @@ No match
 
 /\(  ( (?>[^()]+) | (?R) )* \) /xg
 Capturing subpattern count = 1
+Partial matching not supported
 Options: extended
 First char = '('
 Need char = ')'
@@ -1682,6 +1761,7 @@ Need char = ')'
 
 /\(  (?: (?>[^()]+) | (?R) ) \) /x
 Capturing subpattern count = 0
+Partial matching not supported
 Options: extended
 First char = '('
 Need char = ')'
@@ -1700,6 +1780,7 @@ No match
 
 /\(  (?: (?>[^()]+) | (?R) )? \) /x
 Capturing subpattern count = 0
+Partial matching not supported
 Options: extended
 First char = '('
 Need char = ')'
@@ -1710,6 +1791,7 @@ Need char = ')'
 
 /\(  ( (?>[^()]+) | (?R) )* \) /x
 Capturing subpattern count = 1
+Partial matching not supported
 Options: extended
 First char = '('
 Need char = ')'
@@ -1719,6 +1801,7 @@ Need char = ')'
 
 /\( ( ( (?>[^()]+) | (?R) )* ) \) /x
 Capturing subpattern count = 2
+Partial matching not supported
 Options: extended
 First char = '('
 Need char = ')'
@@ -1729,6 +1812,7 @@ Need char = ')'
 
 /\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /x
 Capturing subpattern count = 3
+Partial matching not supported
 Options: extended
 First char = '('
 Need char = ')'
@@ -1745,6 +1829,7 @@ Need char = ')'
 
 /\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /x
 Capturing subpattern count = 3
+Partial matching not supported
 Options: extended
 First char = '('
 Need char = ')'
@@ -1761,6 +1846,7 @@ Need char = ')'
 
 /\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /x
 Capturing subpattern count = 11
+Partial matching not supported
 Options: extended
 First char = '('
 Need char = ')'
@@ -1780,6 +1866,7 @@ Need char = ')'
 
 /\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /x
 Capturing subpattern count = 3
+Partial matching not supported
 Options: extended
 First char = '('
 Need char = ')'
@@ -1791,6 +1878,7 @@ Need char = ')'
 
 /\( ( ( (?>[^()]+) | ((?R)) )* ) \) /x
 Capturing subpattern count = 3
+Partial matching not supported
 Options: extended
 First char = '('
 Need char = ')'
@@ -1818,6 +1906,19 @@ Options: anchored
 No first char
 No need char
 
+/^[[:^alnum:]]/D
+------------------------------------------------------------------
+  0  37 Bra 0
+  3     ^
+  4     [\x00-/:-@[-`{-\xff]
+ 37  37 Ket
+ 40     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: anchored
+No first char
+No need char
+
 /^[[:alpha:]]/D
 ------------------------------------------------------------------
   0  37 Bra 0
@@ -1830,6 +1931,19 @@ Capturing subpattern count = 0
 Options: anchored
 No first char
 No need char
+
+/^[[:^alpha:]]/D
+------------------------------------------------------------------
+  0  37 Bra 0
+  3     ^
+  4     [\x00-@[-`{-\xff]
+ 37  37 Ket
+ 40     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: anchored
+No first char
+No need char
              
 /^[[:ascii:]]/D
 ------------------------------------------------------------------
@@ -1844,6 +1958,19 @@ Options: anchored
 No first char
 No need char
 
+/^[[:^ascii:]]/D
+------------------------------------------------------------------
+  0  37 Bra 0
+  3     ^
+  4     [\x80-\xff]
+ 37  37 Ket
+ 40     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: anchored
+No first char
+No need char
+
 /^[[:blank:]]/D
 ------------------------------------------------------------------
   0  37 Bra 0
@@ -2004,7 +2131,7 @@ No need char
 ------------------------------------------------------------------
   0  37 Bra 0
   3     ^
-  4     [\x00-/1-2:-\xff]
+  4     [\x00-/12:-\xff]
  37  37 Ket
  40     End
 ------------------------------------------------------------------
@@ -2029,7 +2156,7 @@ No need char
 /[01[:alpha:]%]/D
 ------------------------------------------------------------------
   0  36 Bra 0
-  3     [%0-1A-Za-z]
+  3     [%01A-Za-z]
  36  36 Ket
  39     End
 ------------------------------------------------------------------
@@ -2102,6 +2229,7 @@ Need char = 'd'
 /(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\w+)\s+(\270)/
 Capturing subpattern count = 271
 Max back reference = 270
+Partial matching not supported
 No options
 No first char
 No need char
@@ -2408,7 +2536,7 @@ Need char = 's'
 Capturing subpattern count = 2
 Options: anchored
 No first char
-Need char = 'a'
+No need char
     aba
  0: aba
  1: a
@@ -2418,7 +2546,7 @@ Need char = 'a'
 Capturing subpattern count = 2
 Options: anchored
 No first char
-Need char = 'a'
+No need char
     aabbaa    
  0: aabbaa
  1: aa
@@ -2428,7 +2556,7 @@ Need char = 'a'
 Capturing subpattern count = 2
 Options: anchored
 No first char
-Need char = 'a'
+No need char
     aabbaa 
  0: aabbaa
  1: aa
@@ -2438,7 +2566,7 @@ Need char = 'a'
 Capturing subpattern count = 2
 Options: anchored
 No first char
-Need char = 'a'
+No need char
     aabbaa    
  0: aabbaa
  1: aa
@@ -2448,7 +2576,7 @@ Need char = 'a'
 Capturing subpattern count = 1
 Options: anchored
 No first char
-Need char = 'a'
+No need char
     aabbaa    
  0: aabbaa
  1: bb
@@ -2457,7 +2585,7 @@ Need char = 'a'
 Capturing subpattern count = 3
 Options: anchored
 No first char
-Need char = 'a'
+No need char
     aabbaa    
  0: aabbaa
  1: aa
@@ -2468,7 +2596,7 @@ Need char = 'a'
 Capturing subpattern count = 2
 Options: anchored
 No first char
-Need char = 'a'
+No need char
     aabbaa    
  0: aabbaa
  1: bb
@@ -2478,7 +2606,7 @@ Need char = 'a'
 Capturing subpattern count = 1
 Options: anchored
 No first char
-Need char = 'a'
+No need char
     aabbaa    
  0: aabbaa
  1: bb
@@ -2487,7 +2615,7 @@ Need char = 'a'
 Capturing subpattern count = 1
 Options: anchored
 No first char
-Need char = 'a'
+No need char
     aabbbaa    
  0: aabbbaa
  1: bbb
@@ -2496,7 +2624,7 @@ Need char = 'a'
 Capturing subpattern count = 1
 Options: anchored
 No first char
-Need char = 'a'
+No need char
     aabbbaa    
  0: aabbbaa
  1: bbb
@@ -2505,7 +2633,7 @@ Need char = 'a'
 Capturing subpattern count = 1
 Options: anchored
 No first char
-Need char = 'a'
+No need char
     aabbaa    
  0: aabbaa
  1: b
@@ -2514,7 +2642,7 @@ Need char = 'a'
 Capturing subpattern count = 1
 Options: anchored
 No first char
-Need char = 'a'
+No need char
     aabbbaa    
  0: aabbbaa
  1: bb
@@ -2523,7 +2651,7 @@ Need char = 'a'
 Capturing subpattern count = 3
 Options: anchored
 No first char
-Need char = 'a'
+No need char
     aabbbaa    
  0: aabbbaa
  1: aa
@@ -2534,7 +2662,7 @@ Need char = 'a'
 Capturing subpattern count = 3
 Options: anchored
 No first char
-Need char = 'a'
+No need char
     aabbbbaa    
  0: aabbbbaa
  1: aa
@@ -2560,12 +2688,12 @@ No first char
 No need char
 
 /a#/xMD
-Memory allocation (code space): 13
+Memory allocation (code space): 9
 ------------------------------------------------------------------
-  0   6 Bra 0
-  3   1 a
-  6   6 Ket
-  9     End
+  0   5 Bra 0
+  3     a
+  5   5 Ket
+  8     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: extended
@@ -2575,7 +2703,7 @@ No need char
 /[\s]/D
 ------------------------------------------------------------------
   0  36 Bra 0
-  3     [\x09-\x0a\x0c-\x0d ]
+  3     [\x09\x0a\x0c\x0d ]
  36  36 Ket
  39     End
 ------------------------------------------------------------------
@@ -2598,12 +2726,12 @@ No need char
 
 /a(?i)b/D
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3   1 a
-  6  01 Opt
-  8   1 b
11  11 Ket
- 14     End
+  0   9 Bra 0
+  3     a
+  5  01 Opt
+  7  NC b
 9   9 Ket
+ 12     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
@@ -2621,15 +2749,15 @@ No match
 
 /(a(?i)b)/D
 ------------------------------------------------------------------
-  0  19 Bra 0
-  3  11 Bra 1
-  6   1 a
-  9  01 Opt
- 11   1 b
- 14  11 Ket
- 17  00 Opt
- 19  19 Ket
- 22     End
+  0  17 Bra 0
+  3   9 Bra 1
+  6     a
+  8  01 Opt
+ 10  NC b
+ 12   9 Ket
+ 15  00 Opt
+ 17  17 Ket
+ 20     End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 No options
@@ -2649,10 +2777,10 @@ No match
     
 /   (?i)abc/xD
 ------------------------------------------------------------------
-  0   8 Bra 0
-  3   3 abc
-  8   8 Ket
- 11     End
+  0   9 Bra 0
+  3  NC abc
+  9   9 Ket
+ 12     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: caseless extended
@@ -2662,10 +2790,10 @@ Need char = 'c' (caseless)
 /#this is a comment
   (?i)abc/xD
 ------------------------------------------------------------------
-  0   8 Bra 0
-  3   3 abc
-  8   8 Ket
- 11     End
+  0   9 Bra 0
+  3  NC abc
+  9   9 Ket
+ 12     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: caseless extended
@@ -2674,11 +2802,10 @@ Need char = 'c' (caseless)
 
 /123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/D
 ------------------------------------------------------------------
-  0 307 Bra 0
-  3 250 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
-255  50 12345678901234567890123456789012345678901234567890
-307 307 Ket
-310     End
+  0 603 Bra 0
+  3     123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+603 603 Ket
+606     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
@@ -2687,11 +2814,10 @@ Need char = '0'
 
 /\Q123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/D
 ------------------------------------------------------------------
-  0 307 Bra 0
-  3 250 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
-255  50 12345678901234567890123456789012345678901234567890
-307 307 Ket
-310     End
+  0 603 Bra 0
+  3     123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
+603 603 Ket
+606     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
@@ -2713,10 +2839,10 @@ No need char
 
 /\Q\Ex/D
 ------------------------------------------------------------------
-  0   6 Bra 0
-  3   1 x
-  6   6 Ket
-  9     End
+  0   5 Bra 0
+  3     x
+  5   5 Ket
+  8     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
@@ -2725,10 +2851,10 @@ No need char
 
 / \Q\E/D
 ------------------------------------------------------------------
-  0   6 Bra 0
-  3   1  
-  6   6 Ket
-  9     End
+  0   5 Bra 0
+  3      
+  5   5 Ket
+  8     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
@@ -2737,10 +2863,10 @@ No need char
 
 /a\Q\E/D
 ------------------------------------------------------------------
-  0   6 Bra 0
-  3   1 a
-  6   6 Ket
-  9     End
+  0   5 Bra 0
+  3     a
+  5   5 Ket
+  8     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
@@ -2755,11 +2881,10 @@ No need char
 
 /a\Q\Eb/D
 ------------------------------------------------------------------
-  0   9 Bra 0
-  3   1 a
-  6   1 b
-  9   9 Ket
- 12     End
+  0   7 Bra 0
+  3     ab
+  7   7 Ket
+ 10     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
@@ -2770,10 +2895,10 @@ Need char = 'b'
 
 /\Q\Eabc/D
 ------------------------------------------------------------------
-  0   8 Bra 0
-  3   3 abc
-  8   8 Ket
- 11     End
+  0   9 Bra 0
+  3     abc
+  9   9 Ket
+ 12     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
@@ -2791,10 +2916,11 @@ Need char = 'c'
  15     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 No first char
 No need char
-    ****Failers
+    *** Failers
  0: F
     xxxxx
 No match
@@ -2823,36 +2949,38 @@ No need char
  14     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'x'
 No need char
 
 /x{1,3}+/D 
 ------------------------------------------------------------------
-  0  16 Bra 0
-  3  10 Once
-  6   1 x
-  9     x{,2}
- 13  10 Ket
- 16  16 Ket
- 19     End
+  0  15 Bra 0
+  3   9 Once
+  6     x
+  8     x{,2}
+ 12   9 Ket
+ 15  15 Ket
+ 18     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'x'
 No need char
 
 /(x)*+/D
 ------------------------------------------------------------------
-  0  19 Bra 0
-  3  13 Once
+  0  18 Bra 0
+  3  12 Once
   6     Brazero
-  7   6 Bra 1
- 10   1 x
- 13   6 KetRmax
- 16  13 Ket
- 19  19 Ket
- 22     End
+  7   5 Bra 1
+ 10     x
+ 12   5 KetRmax
+ 15  12 Ket
+ 18  18 Ket
+ 21     End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 No options
@@ -2861,6 +2989,7 @@ No need char
 
 /^(\w++|\s++)*$/
 Capturing subpattern count = 1
+Partial matching not supported
 Options: anchored
 No first char
 No need char
@@ -2874,6 +3003,7 @@ No match
     
 /(\d++)(\w)/
 Capturing subpattern count = 2
+Partial matching not supported
 No options
 No first char
 No need char
@@ -2888,6 +3018,7 @@ No match
 
 /a++b/
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'a'
 Need char = 'b'
@@ -2896,6 +3027,7 @@ Need char = 'b'
 
 /(a++b)/
 Capturing subpattern count = 1
+Partial matching not supported
 No options
 First char = 'a'
 Need char = 'b'
@@ -2905,6 +3037,7 @@ Need char = 'b'
 
 /(a++)b/
 Capturing subpattern count = 1
+Partial matching not supported
 No options
 First char = 'a'
 Need char = 'b'
@@ -2914,6 +3047,7 @@ Need char = 'b'
 
 /([^()]++|\([^()]*\))+/
 Capturing subpattern count = 1
+Partial matching not supported
 No options
 No first char
 No need char
@@ -2923,6 +3057,7 @@ No need char
     
 /\(([^()]++|\([^()]+\))+\)/ 
 Capturing subpattern count = 1
+Partial matching not supported
 No options
 First char = '('
 Need char = ')'
@@ -2939,24 +3074,24 @@ No match
 
 /(abc){1,3}+/D
 ------------------------------------------------------------------
-  0  50 Bra 0
-  3  44 Once
-  6   8 Bra 1
-  9   3 abc
- 14   8 Ket
- 17     Brazero
- 18  26 Bra 0
- 21   8 Bra 1
- 24   3 abc
29   8 Ket
- 32     Brazero
- 33   8 Bra 1
- 36   3 abc
- 41   8 Ket
- 44  26 Ket
47  44 Ket
- 50  50 Ket
- 53     End
+  0  53 Bra 0
+  3  47 Once
+  6   9 Bra 1
+  9     abc
+ 15   9 Ket
+ 18     Brazero
+ 19  28 Bra 0
+ 22   9 Bra 1
+ 25     abc
31   9 Ket
+ 34     Brazero
+ 35   9 Bra 1
+ 38     abc
+ 44   9 Ket
+ 47  28 Ket
50  47 Ket
+ 53  53 Ket
+ 56     End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 No options
@@ -2977,16 +3112,17 @@ Failed: nothing to repeat at offset 7
 
 /x(?U)a++b/D
 ------------------------------------------------------------------
-  0  17 Bra 0
-  3   1 x
-  6   5 Once
-  9     a+
- 11   5 Ket
- 14   1 b
- 17  17 Ket
20     End
+  0  15 Bra 0
+  3     x
+  5   5 Once
+  8     a+
+ 10   5 Ket
+ 13     b
+ 15  15 Ket
18     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'x'
 Need char = 'b'
@@ -2995,16 +3131,17 @@ Need char = 'b'
 
 /(?U)xa++b/D
 ------------------------------------------------------------------
-  0  17 Bra 0
-  3   1 x
-  6   5 Once
-  9     a+
- 11   5 Ket
- 14   1 b
- 17  17 Ket
20     End
+  0  15 Bra 0
+  3     x
+  5   5 Once
+  8     a+
+ 10   5 Ket
+ 13     b
+ 15  15 Ket
18     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
+Partial matching not supported
 Options: ungreedy
 First char = 'x'
 Need char = 'b'
@@ -3020,10 +3157,10 @@ Need char = 'b'
  10     a+
  12   5 Ket
  15  37 Bra 3
- 18     [a-b]+?
+ 18     [ab]+?
  52  37 Ket
  55  37 Bra 4
- 58     [b-c]+
+ 58     [bc]+
  92  37 Ket
  95   5 Bra 5
  98     \w*
@@ -3033,38 +3170,41 @@ Need char = 'b'
 109     End
 ------------------------------------------------------------------
 Capturing subpattern count = 5
+Partial matching not supported
 Options: anchored
 No first char
-Need char = 'a'
+No need char
 
 /^x(?U)a+b/D
 ------------------------------------------------------------------
-  0  12 Bra 0
+  0  10 Bra 0
   3     ^
-  4   1 x
-  7     a+?
-  9   1 b
- 12  12 Ket
- 15     End
+  4     x
+  6     a+?
+  8     b
+ 10  10 Ket
+ 13     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
+Partial matching not supported
 Options: anchored
 No first char
 Need char = 'b'
 
 /^x(?U)(a+)b/D
 ------------------------------------------------------------------
-  0  18 Bra 0
+  0  16 Bra 0
   3     ^
-  4   1 x
-  7   5 Bra 1
10     a+?
- 12   5 Ket
- 15   1 b
- 18  18 Ket
21     End
+  4     x
+  6   5 Bra 1
 9     a+?
+ 11   5 Ket
+ 14     b
+ 16  16 Ket
19     End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
+Partial matching not supported
 Options: anchored
 No first char
 Need char = 'b'
@@ -3079,34 +3219,19 @@ Failed: POSIX collating elements are not supported at offset 0
 Failed: POSIX named classes are supported only within a class at offset 0
 
 /\l/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
+Failed: PCRE does not support \L, \l, \N, \U, or \u at offset 1
 
 /\L/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
+Failed: PCRE does not support \L, \l, \N, \U, or \u at offset 1
 
 /\N{name}/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
-
-/\pP/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
-
-/\PP/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
-
-/\p{prop}/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
-
-/\P{prop}/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
+Failed: PCRE does not support \L, \l, \N, \U, or \u at offset 1
 
 /\u/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
+Failed: PCRE does not support \L, \l, \N, \U, or \u at offset 1
 
 /\U/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
-
-/\X/
-Failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1
+Failed: PCRE does not support \L, \l, \N, \U, or \u at offset 1
 
 /[/
 Failed: missing terminating ] for character class at offset 1
@@ -3121,7 +3246,7 @@ Failed: missing terminating ] for character class at offset 10
 Memory allocation (code space): 40
 ------------------------------------------------------------------
   0  36 Bra 0
-  3     [\x09-\x0a\x0c-\x0d ]
+  3     [\x09\x0a\x0c\x0d ]
  36  36 Ket
  39     End
 ------------------------------------------------------------------
@@ -3158,6 +3283,7 @@ No need char
 
 /< (?: (?(R) \d++  | [^<>]*+) | (?R)) * >/x
 Capturing subpattern count = 0
+Partial matching not supported
 Options: extended
 First char = '<'
 Need char = '>'
@@ -3179,14 +3305,13 @@ No match
 No match
 
 |8J\$WE\<\.rX\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|DM
-Memory allocation (code space): 421
+Memory allocation (code space): 826
 ------------------------------------------------------------------
-  0 417 Bra 0
-  3 250 8J$WE<.rX+ix[d1b!H#?vV0vrK:ZH1=2M>iV;?aPhFB<*vW@QW@sO9}cfZA-i'w%hKd6gt1UJP,15_#QY$M^Mss_U/]&LK9[5vQub^w[KDD<EjmhUZ?.akp2dF>qmj;2}YWFdYx.Ap]hjCPTP(n28k+3;o&WXqs/gOXdr$:r'do0;b4c(f_Gr="\4)[01T7ajQJvL$W~mL_sS/4h:x*[ZN=KLs&L5zX//>it,o:aU(;Z>pW&T7oP'2K^E:
-255 159 x9'c[%z-,64JQ5AeH_G#KijUKghQw^\vea3a?kka_G$8#`*kynsxzBLru']k_[7FrVx}^=$blx>s-N%j;D*aZDnsw:YKZ%Q.Kne9#hP?+b3(SOvL,^;&u5@?5C5Bhb=m-vEh_L15Jl]U)0RP6{q%L^_z5E'Dw6X
-416     \b
-417 417 Ket
-420     End
+  0 822 Bra 0
+  3     8J$WE<.rX+ix[d1b!H#?vV0vrK:ZH1=2M>iV;?aPhFB<*vW@QW@sO9}cfZA-i'w%hKd6gt1UJP,15_#QY$M^Mss_U/]&LK9[5vQub^w[KDD<EjmhUZ?.akp2dF>qmj;2}YWFdYx.Ap]hjCPTP(n28k+3;o&WXqs/gOXdr$:r'do0;b4c(f_Gr="\4)[01T7ajQJvL$W~mL_sS/4h:x*[ZN=KLs&L5zX//>it,o:aU(;Z>pW&T7oP'2K^E:x9'c[%z-,64JQ5AeH_G#KijUKghQw^\vea3a?kka_G$8#`*kynsxzBLru']k_[7FrVx}^=$blx>s-N%j;D*aZDnsw:YKZ%Q.Kne9#hP?+b3(SOvL,^;&u5@?5C5Bhb=m-vEh_L15Jl]U)0RP6{q%L^_z5E'Dw6X
+821     \b
+822 822 Ket
+825     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
@@ -3194,14 +3319,13 @@ First char = '8'
 Need char = 'X'
 
 |\$\<\.X\+ix\[d1b\!H\#\?vV0vrK\:ZH1\=2M\>iV\;\?aPhFB\<\*vW\@QW\@sO9\}cfZA\-i\'w\%hKd6gt1UJP\,15_\#QY\$M\^Mss_U\/\]\&LK9\[5vQub\^w\[KDD\<EjmhUZ\?\.akp2dF\>qmj\;2\}YWFdYx\.Ap\]hjCPTP\(n28k\+3\;o\&WXqs\/gOXdr\$\:r\'do0\;b4c\(f_Gr\=\"\\4\)\[01T7ajQJvL\$W\~mL_sS\/4h\:x\*\[ZN\=KLs\&L5zX\/\/\>it\,o\:aU\(\;Z\>pW\&T7oP\'2K\^E\:x9\'c\[\%z\-\,64JQ5AeH_G\#KijUKghQw\^\\vea3a\?kka_G\$8\#\`\*kynsxzBLru\'\]k_\[7FrVx\}\^\=\$blx\>s\-N\%j\;D\*aZDnsw\:YKZ\%Q\.Kne9\#hP\?\+b3\(SOvL\,\^\;\&u5\@\?5C5Bhb\=m\-vEh_L15Jl\]U\)0RP6\{q\%L\^_z5E\'Dw6X\b|DM
-Memory allocation (code space): 416
+Memory allocation (code space): 816
 ------------------------------------------------------------------
-  0 412 Bra 0
-  3 250 $<.X+ix[d1b!H#?vV0vrK:ZH1=2M>iV;?aPhFB<*vW@QW@sO9}cfZA-i'w%hKd6gt1UJP,15_#QY$M^Mss_U/]&LK9[5vQub^w[KDD<EjmhUZ?.akp2dF>qmj;2}YWFdYx.Ap]hjCPTP(n28k+3;o&WXqs/gOXdr$:r'do0;b4c(f_Gr="\4)[01T7ajQJvL$W~mL_sS/4h:x*[ZN=KLs&L5zX//>it,o:aU(;Z>pW&T7oP'2K^E:x9'c[
-255 154 %z-,64JQ5AeH_G#KijUKghQw^\vea3a?kka_G$8#`*kynsxzBLru']k_[7FrVx}^=$blx>s-N%j;D*aZDnsw:YKZ%Q.Kne9#hP?+b3(SOvL,^;&u5@?5C5Bhb=m-vEh_L15Jl]U)0RP6{q%L^_z5E'Dw6X
-411     \b
-412 412 Ket
-415     End
+  0 812 Bra 0
+  3     $<.X+ix[d1b!H#?vV0vrK:ZH1=2M>iV;?aPhFB<*vW@QW@sO9}cfZA-i'w%hKd6gt1UJP,15_#QY$M^Mss_U/]&LK9[5vQub^w[KDD<EjmhUZ?.akp2dF>qmj;2}YWFdYx.Ap]hjCPTP(n28k+3;o&WXqs/gOXdr$:r'do0;b4c(f_Gr="\4)[01T7ajQJvL$W~mL_sS/4h:x*[ZN=KLs&L5zX//>it,o:aU(;Z>pW&T7oP'2K^E:x9'c[%z-,64JQ5AeH_G#KijUKghQw^\vea3a?kka_G$8#`*kynsxzBLru']k_[7FrVx}^=$blx>s-N%j;D*aZDnsw:YKZ%Q.Kne9#hP?+b3(SOvL,^;&u5@?5C5Bhb=m-vEh_L15Jl]U)0RP6{q%L^_z5E'Dw6X
+811     \b
+812 812 Ket
+815     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 No options
@@ -3211,12 +3335,14 @@ Need char = 'X'
 /(.*)\d+\1/I
 Capturing subpattern count = 1
 Max back reference = 1
+Partial matching not supported
 No options
 No first char
 No need char
 
 /(.*)\d+/I
 Capturing subpattern count = 1
+Partial matching not supported
 No options
 First char at start or follows \n
 No need char
@@ -3224,12 +3350,14 @@ No need char
 /(.*)\d+\1/Is
 Capturing subpattern count = 1
 Max back reference = 1
+Partial matching not supported
 Options: dotall
 No first char
 No need char
 
 /(.*)\d+/Is
 Capturing subpattern count = 1
+Partial matching not supported
 Options: anchored dotall
 No first char
 No need char
@@ -3237,13 +3365,15 @@ No need char
 /(.*(xyz))\d+\2/I
 Capturing subpattern count = 2
 Max back reference = 2
+Partial matching not supported
 No options
-No first char
+First char at start or follows \n
 Need char = 'z'
 
 /((.*))\d+\1/I
 Capturing subpattern count = 2
 Max back reference = 1
+Partial matching not supported
 No options
 No first char
 No need char
@@ -3260,6 +3390,7 @@ Need char = 'b'
 
 /(?=a).*/I
 Capturing subpattern count = 0
+Partial matching not supported
 No options
 First char = 'a'
 No need char
@@ -3366,7 +3497,7 @@ Capturing subpattern count = 0
 No options
 No first char
 No need char
-Starting character set: a b 
+Starting byte set: a b 
 
 /[^a]/I
 Capturing subpattern count = 0
@@ -3385,7 +3516,7 @@ Capturing subpattern count = 0
 No options
 No first char
 Need char = '6'
-Starting character set: 0 1 2 3 4 5 6 7 8 9 
+Starting byte set: 0 1 2 3 4 5 6 7 8 9 
 
 /a^b/I
 Capturing subpattern count = 0
@@ -3418,7 +3549,7 @@ Capturing subpattern count = 0
 Options: caseless
 No first char
 No need char
-Starting character set: A B a b 
+Starting byte set: A B a b 
 
 /[ab](?i)cd/IS
 Capturing subpattern count = 0
@@ -3426,7 +3557,7 @@ No options
 Case state changes
 No first char
 Need char = 'd' (caseless)
-Starting character set: a b 
+Starting byte set: a b 
 
 /abc(?C)def/
 Capturing subpattern count = 0
@@ -3435,11 +3566,11 @@ First char = 'a'
 Need char = 'f'
     abcdef
 --->abcdef
-  0 ^  ^
+  0 ^  ^       d
  0: abcdef
     1234abcdef 
 --->1234abcdef
-  0     ^  ^
+  0     ^  ^       d
  0: abcdef
     *** Failers
 No match
@@ -3447,7 +3578,7 @@ No match
 No match
     abcxyzf   
 --->abcxyzf
-  0 ^  ^
+  0 ^  ^        d
 No match
 
 /abc(?C)de(?C1)f/
@@ -3457,8 +3588,8 @@ First char = 'a'
 Need char = 'f'
     123abcdef
 --->123abcdef
-  0    ^  ^
-  1    ^    ^
+  0    ^  ^       d
+  1    ^    ^     f
  0: abcdef
     
 /(?C1)\dabc(?C2)def/ 
@@ -3468,22 +3599,22 @@ No first char
 Need char = 'f'
     1234abcdef
 --->1234abcdef
-  1 ^
-  1  ^
-  1   ^
-  1    ^
-  2    ^   ^
+  1 ^              \d
+  1  ^             \d
+  1   ^            \d
+  1    ^           \d
+  2    ^   ^       d
  0: 4abcdef
     *** Failers
 No match
     abcdef 
 --->abcdef
-  1 ^
-  1  ^
-  1   ^
-  1    ^
-  1     ^
-  1      ^
+  1 ^          \d
+  1  ^         \d
+  1   ^        \d
+  1    ^       \d
+  1     ^      \d
+  1      ^     \d
 No match
     
 /(?C255)ab/
@@ -3510,7 +3641,7 @@ Need char = 'f'
 No match
     \x83\x0\x61bcdef
 --->\x83\x00abcdef
-  0         ^  ^
+  0         ^  ^       d
  0: abcdef
 
 /(abc)(?C)de(?C1)f/
@@ -3520,8 +3651,8 @@ First char = 'a'
 Need char = 'f'
     123abcdef
 --->123abcdef
-  0    ^  ^
-  1    ^    ^
+  0    ^  ^       d
+  1    ^    ^     f
  0: abcdef
  1: abc
     123abcdef\C+ 
@@ -3529,12 +3660,12 @@ Callout 0: last capture = 1
  0: <unset>
  1: abc
 --->123abcdef
-       ^  ^
+       ^  ^       d
 Callout 1: last capture = 1
  0: <unset>
  1: abc
 --->123abcdef
-       ^    ^
+       ^    ^     f
  0: abcdef
  1: abc
     123abcdef\C- 
@@ -3544,8 +3675,8 @@ Callout 1: last capture = 1
 No match
     123abcdef\C!1 
 --->123abcdef
-  0    ^  ^
-  1    ^    ^
+  0    ^  ^       d
+  1    ^    ^     f
 No match
     
 /(?C0)(abc(?C1))*/
@@ -3555,34 +3686,35 @@ No first char
 No need char
     abcabcabc
 --->abcabcabc
-  0 ^
-  1 ^  ^
-  1 ^     ^
-  1 ^        ^
+  0 ^             (abc(?C1))*
+  1 ^  ^          )
+  1 ^     ^       )
+  1 ^        ^    )
  0: abcabcabc
  1: abc
     abcabc\C!1!3   
 --->abcabc
-  0 ^
-  1 ^  ^
-  1 ^     ^
+  0 ^          (abc(?C1))*
+  1 ^  ^       )
+  1 ^     ^    )
  0: abcabc
  1: abc
     *** Failers
 --->*** Failers
-  0 ^
+  0 ^               (abc(?C1))*
  0: 
     abcabcabc\C!1!3   
 --->abcabcabc
-  0 ^
-  1 ^  ^
-  1 ^     ^
-  1 ^        ^
+  0 ^             (abc(?C1))*
+  1 ^  ^          )
+  1 ^     ^       )
+  1 ^        ^    )
  0: abcabc
  1: abc
 
 /(\d{3}(?C))*/
 Capturing subpattern count = 1
+Partial matching not supported
 No options
 No first char
 No need char
@@ -3590,36 +3722,36 @@ No need char
 Callout 0: last capture = -1
  0: <unset>
 --->123
-    ^  ^
+    ^  ^    )
  0: 123
  1: 123
     123456\C+
 Callout 0: last capture = -1
  0: <unset>
 --->123456
-    ^  ^
+    ^  ^       )
 Callout 0: last capture = 1
  0: <unset>
  1: 123
 --->123456
-    ^     ^
+    ^     ^    )
  0: 123456
  1: 456
     123456789\C+  
 Callout 0: last capture = -1
  0: <unset>
 --->123456789
-    ^  ^
+    ^  ^          )
 Callout 0: last capture = 1
  0: <unset>
  1: 123
 --->123456789
-    ^     ^
+    ^     ^       )
 Callout 0: last capture = 1
  0: <unset>
  1: 456
 --->123456789
-    ^        ^
+    ^        ^    )
  0: 123456789
  1: 789
 
@@ -3634,11 +3766,11 @@ Callout 0: last capture = 2
  1: <unset>
  2: xyz
 --->xyzabc
-    ^  ^
+    ^  ^       p
 Callout 1: last capture = -1
  0: <unset>
 --->xyzabc
-    ^
+    ^          x
  0: xyzabc
  1: xyzabc
 
@@ -3654,12 +3786,12 @@ Callout 0: last capture = 3
  2: <unset>
  3: xyz
 --->Xxyzabc
-    ^   ^
+    ^   ^       p
 Callout 1: last capture = 1
  0: <unset>
  1: X
 --->Xxyzabc
-    ^^
+    ^^          x
  0: Xxyzabc
  1: X
  2: xyzabc
@@ -3674,7 +3806,7 @@ Callout 0: last capture = 1
  0: <unset>
  1: abc
 --->abcdef
-    ^
+    ^          a
  0: abcdef
  1: abc
     
@@ -3688,11 +3820,11 @@ Callout 1: last capture = 1
  0: <unset>
  1: abc
 --->abcxyz
-    ^  ^
+    ^  ^       d
 Callout 2: last capture = -1
  0: <unset>
 --->abcxyz
-    ^
+    ^          a
  0: abcxyz
 
 /(?<=(abc)(?C))xyz/
@@ -3705,10 +3837,62 @@ Callout 0: last capture = 1
  0: <unset>
  1: abc
 --->abcxyz
-       ^
+       ^       )
  0: xyz
  1: abc
    
+/a(b+)(c*)(?C1)/
+Capturing subpattern count = 2
+Partial matching not supported
+No options
+First char = 'a'
+Need char = 'b'
+    abbbbbccc\C*1
+--->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)/
+Capturing subpattern count = 2
+Partial matching not supported
+No options
+First char = 'a'
+Need char = 'b'
+    abbbbbccc\C*1
+--->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
+   
 /(?C)abc/ 
 Capturing subpattern count = 0
 No options
@@ -3719,14 +3903,14 @@ Need char = 'c'
 Capturing subpattern count = 0
 Options: anchored
 No first char
-Need char = 'c'
+No need char
 
 /(?C)a|b/S
 Capturing subpattern count = 0
 No options
 No first char
 No need char
-Starting character set: a b 
+Starting byte set: a b 
 
 /(?R)/
 Failed: recursive call could loop indefinitely at offset 3
@@ -3811,14 +3995,14 @@ Need char = '<'
 
 /(a(?1)b)/D
 ------------------------------------------------------------------
-  0  18 Bra 0
-  3  12 Bra 1
-  6   1 a
-  9   3 Recurse
- 12   1 b
- 15  12 Ket
- 18  18 Ket
21     End
+  0  16 Bra 0
+  3  10 Bra 1
+  6     a
+  8   3 Recurse
+ 11     b
+ 13  10 Ket
+ 16  16 Ket
19     End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 No options
@@ -3827,16 +4011,16 @@ Need char = 'b'
 
 /(a(?1)+b)/D
 ------------------------------------------------------------------
-  0  24 Bra 0
-  3  18 Bra 1
-  6   1 a
-  9   6 Bra 0
- 12   3 Recurse
- 15   6 KetRmax
- 18   1 b
21  18 Ket
- 24  24 Ket
- 27     End
+  0  22 Bra 0
+  3  16 Bra 1
+  6     a
+  8   6 Bra 0
+ 11   3 Recurse
+ 14   6 KetRmax
+ 17     b
19  16 Ket
+ 22  22 Ket
+ 25     End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
 No options
@@ -3846,6 +4030,7 @@ Need char = 'b'
 /^\W*(?:((.)\W*(?1)\W*\2|)|((.)\W*(?3)\W*\4|\W*.\W*))\W*$/i
 Capturing subpattern count = 4
 Max back reference = 4
+Partial matching not supported
 Options: anchored caseless
 No first char
 No need char
@@ -3878,6 +4063,7 @@ No match
     
 /^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/
 Capturing subpattern count = 2
+Partial matching not supported
 Options: anchored
 No first char
 No need char
@@ -3900,7 +4086,7 @@ No match
 Capturing subpattern count = 2
 Options: anchored
 No first char
-Need char = 'z'
+No need char
     xyz
  0: xyz
  1: xyz
@@ -3918,6 +4104,7 @@ No match
 
 /((< (?: (?(R) \d++  | [^<>]*+) | (?2)) * >))/x
 Capturing subpattern count = 2
+Partial matching not supported
 Options: extended
 First char = '<'
 Need char = '>'
@@ -3960,7 +4147,7 @@ Failed: reference to non-existent subpattern at offset 4
 Capturing subpattern count = 1
 Options: anchored
 No first char
-Need char = 'f'
+No need char
     abcdefabc
  0: abcdefabc
  1: abc
@@ -3969,7 +4156,7 @@ Need char = 'f'
 Capturing subpattern count = 1
 Options: anchored
 No first char
-Need char = '='
+No need char
     a=a
  0: a=a
  1: a
@@ -3984,7 +4171,7 @@ Need char = '='
 Capturing subpattern count = 2
 Options: anchored
 No first char
-Need char = '='
+No need char
     a=a
  0: a=a
  1: a
@@ -4000,19 +4187,19 @@ Need char = '='
 
 /a(?P<name1>b|c)d(?P<longername2>e)/D
 ------------------------------------------------------------------
-  0  33 Bra 0
-  3   1 a
-  6   6 Bra 1
-  9   1 b
- 12   6 Alt
- 15   1 c
- 18  12 Ket
21   1 d
- 24   6 Bra 2
- 27   1 e
30   6 Ket
33  33 Ket
- 36     End
+  0  28 Bra 0
+  3     a
+  5   5 Bra 1
+  8     b
+ 10   5 Alt
+ 13     c
+ 15  10 Ket
18     d
+ 20   5 Bra 2
+ 23     e
25   5 Ket
28  28 Ket
+ 31     End
 ------------------------------------------------------------------
 Capturing subpattern count = 2
 Named capturing subpatterns:
@@ -4032,21 +4219,21 @@ Need char = 'e'
 
 /(?:a(?P<c>c(?P<d>d)))(?P<a>a)/D
 ------------------------------------------------------------------
-  0  39 Bra 0
-  3  24 Bra 0
-  6   1 a
-  9  15 Bra 1
- 12   1 c
- 15   6 Bra 2
- 18   1 d
21   6 Ket
- 24  15 Ket
- 27  24 Ket
30   6 Bra 3
- 33   1 a
- 36   6 Ket
- 39  39 Ket
42     End
+  0  35 Bra 0
+  3  21 Bra 0
+  6     a
+  8  13 Bra 1
+ 11     c
+ 13   5 Bra 2
+ 16     d
18   5 Ket
+ 21  13 Ket
+ 24  21 Ket
27   5 Bra 3
+ 30     a
+ 32   5 Ket
+ 35  35 Ket
38     End
 ------------------------------------------------------------------
 Capturing subpattern count = 3
 Named capturing subpatterns:
@@ -4059,30 +4246,1701 @@ Need char = 'a'
 
 /(?P<a>a)...(?P=a)bbb(?P>a)d/D
 ------------------------------------------------------------------
-  0  29 Bra 0
-  3   6 Bra 1
-  6   1 a
-  9   6 Ket
+  0  28 Bra 0
+  3   5 Bra 1
+  6     a
+  8   5 Ket
+ 11     Any
  12     Any
  13     Any
- 14     Any
- 15     \1
- 18   3 bbb
+ 14     \1
+ 17     bbb
  23   3 Recurse
- 26   1 d
- 29  29 Ket
- 32     End
+ 26     d
+ 28  28 Ket
+ 31     End
 ------------------------------------------------------------------
 Capturing subpattern count = 1
+Max back reference = 1
 Named capturing subpatterns:
   a   1
 No options
 First char = 'a'
 Need char = 'd'
 
-/ End of testinput2 /
-Capturing subpattern count = 0
-No options
-First char = ' '
-Need char = ' '
-
+/^\W*(?:(?P<one>(?P<two>.)\W*(?P>one)\W*(?P=two)|)|(?P<three>(?P<four>.)\W*(?P>three)\W*(?P=four)|\W*.\W*))\W*$/i
+Capturing subpattern count = 4
+Max back reference = 4
+Named capturing subpatterns:
+  four    4
+  one     1
+  three   3
+  two     2
+Partial matching not supported
+Options: anchored caseless
+No first char
+No need char
+    1221
+ 0: 1221
+ 1: 1221
+ 2: 1
+    Satan, oscillate my metallic sonatas!
+ 0: Satan, oscillate my metallic sonatas!
+ 1: <unset>
+ 2: <unset>
+ 3: Satan, oscillate my metallic sonatas
+ 4: S
+    A man, a plan, a canal: Panama!
+ 0: A man, a plan, a canal: Panama!
+ 1: <unset>
+ 2: <unset>
+ 3: A man, a plan, a canal: Panama
+ 4: A
+    Able was I ere I saw Elba. 
+ 0: Able was I ere I saw Elba.
+ 1: <unset>
+ 2: <unset>
+ 3: Able was I ere I saw Elba
+ 4: A
+    *** Failers
+No match
+    The quick brown fox  
+No match
+    
+/((?(R)a|b))\1(?1)?/
+Capturing subpattern count = 1
+Max back reference = 1
+No options
+No first char
+No need char
+  bb
+ 0: bb
+ 1: b
+  bbaa 
+ 0: bba
+ 1: b
+
+/(.*)a/sI
+Capturing subpattern count = 1
+Partial matching not supported
+Options: anchored dotall
+No first char
+Need char = 'a'
+
+/(.*)a\1/sI
+Capturing subpattern count = 1
+Max back reference = 1
+Partial matching not supported
+Options: dotall
+No first char
+Need char = 'a'
+
+/(.*)a(b)\2/sI
+Capturing subpattern count = 2
+Max back reference = 2
+Partial matching not supported
+Options: anchored dotall
+No first char
+Need char = 'b'
+
+/((.*)a|(.*)b)z/sI
+Capturing subpattern count = 3
+Partial matching not supported
+Options: anchored dotall
+No first char
+Need char = 'z'
+
+/((.*)a|(.*)b)z\1/sI
+Capturing subpattern count = 3
+Max back reference = 1
+Partial matching not supported
+Options: dotall
+No first char
+Need char = 'z'
+
+/((.*)a|(.*)b)z\2/sI
+Capturing subpattern count = 3
+Max back reference = 2
+Partial matching not supported
+Options: dotall
+No first char
+Need char = 'z'
+
+/((.*)a|(.*)b)z\3/sI
+Capturing subpattern count = 3
+Max back reference = 3
+Partial matching not supported
+Options: dotall
+No first char
+Need char = 'z'
+
+/((.*)a|^(.*)b)z\3/sI
+Capturing subpattern count = 3
+Max back reference = 3
+Partial matching not supported
+Options: anchored dotall
+No first char
+Need char = 'z'
+
+/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/sI
+Capturing subpattern count = 31
+Partial matching not supported
+Options: anchored dotall
+No first char
+No need char
+
+/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/sI
+Capturing subpattern count = 31
+Max back reference = 31
+Partial matching not supported
+Options: dotall
+No first char
+No need char
+
+/(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/sI
+Capturing subpattern count = 32
+Max back reference = 32
+Partial matching not supported
+Options: dotall
+No first char
+No need char
+
+/(a)(bc)/ND
+------------------------------------------------------------------
+  0  21 Bra 0
+  3   5 Bra 0
+  6     a
+  8   5 Ket
+ 11   7 Bra 0
+ 14     bc
+ 18   7 Ket
+ 21  21 Ket
+ 24     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options:
+First char = 'a'
+Need char = 'c'
+  abc
+ 0: abc
+
+/(?P<one>a)(bc)/ND
+------------------------------------------------------------------
+  0  21 Bra 0
+  3   5 Bra 1
+  6     a
+  8   5 Ket
+ 11   7 Bra 0
+ 14     bc
+ 18   7 Ket
+ 21  21 Ket
+ 24     End
+------------------------------------------------------------------
+Capturing subpattern count = 1
+Named capturing subpatterns:
+  one   1
+Options:
+First char = 'a'
+Need char = 'c'
+  abc
+ 0: abc
+ 1: a
+
+/(a)(?P<named>bc)/ND
+------------------------------------------------------------------
+  0  21 Bra 0
+  3   5 Bra 0
+  6     a
+  8   5 Ket
+ 11   7 Bra 1
+ 14     bc
+ 18   7 Ket
+ 21  21 Ket
+ 24     End
+------------------------------------------------------------------
+Capturing subpattern count = 1
+Named capturing subpatterns:
+  named   1
+Options:
+First char = 'a'
+Need char = 'c'
+
+/(a+)*zz/
+Capturing subpattern count = 1
+Partial matching not supported
+No options
+No first char
+Need char = 'z'
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazzbbbbbb\M
+Minimum match limit = 8
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazz
+ 1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+  aaaaaaaaaaaaaz\M
+Minimum match limit = 32768
+No match
+
+/(aaa(?C1)bbb|ab)/
+Capturing subpattern count = 1
+No options
+First char = 'a'
+Need char = 'b'
+   aaabbb
+--->aaabbb
+  1 ^  ^       b
+ 0: aaabbb
+ 1: aaabbb
+   aaabbb\C*0
+--->aaabbb
+  1 ^  ^       b
+ 0: aaabbb
+ 1: aaabbb
+   aaabbb\C*1
+--->aaabbb
+  1 ^  ^       b
+Callout data = 1
+ 0: ab
+ 1: ab
+   aaabbb\C*-1
+--->aaabbb
+  1 ^  ^       b
+Callout data = -1
+No match
+
+/ab(?P<one>cd)ef(?P<two>gh)/
+Capturing subpattern count = 2
+Named capturing subpatterns:
+  one   1
+  two   2
+No options
+First char = 'a'
+Need char = 'h'
+    abcdefgh
+ 0: abcdefgh
+ 1: cd
+ 2: gh
+    abcdefgh\C1\Gtwo
+ 0: abcdefgh
+ 1: cd
+ 2: gh
+ 1C cd (2)
+ 2G gh (2)
+    abcdefgh\Cone\Ctwo
+ 0: abcdefgh
+ 1: cd
+ 2: gh
+ 1C cd (2)
+ 2C gh (2)
+    abcdefgh\Cthree  
+no parentheses with name "three"
+ 0: abcdefgh
+ 1: cd
+ 2: gh
+
+/(?P<Tes>)(?P<Test>)/D
+------------------------------------------------------------------
+  0  15 Bra 0
+  3   3 Bra 1
+  6   3 Ket
+  9   3 Bra 2
+ 12   3 Ket
+ 15  15 Ket
+ 18     End
+------------------------------------------------------------------
+Capturing subpattern count = 2
+Named capturing subpatterns:
+  Tes    1
+  Test   2
+No options
+No first char
+No need char
+
+/(?P<Test>)(?P<Tes>)/D
+------------------------------------------------------------------
+  0  15 Bra 0
+  3   3 Bra 1
+  6   3 Ket
+  9   3 Bra 2
+ 12   3 Ket
+ 15  15 Ket
+ 18     End
+------------------------------------------------------------------
+Capturing subpattern count = 2
+Named capturing subpatterns:
+  Tes    2
+  Test   1
+No options
+No first char
+No need char
+
+/(?P<Z>zz)(?P<A>aa)/
+Capturing subpattern count = 2
+Named capturing subpatterns:
+  A   2
+  Z   1
+No options
+First char = 'z'
+Need char = 'a'
+    zzaa\CZ
+ 0: zzaa
+ 1: zz
+ 2: aa
+ 1C zz (2)
+    zzaa\CA
+ 0: zzaa
+ 1: zz
+ 2: aa
+ 2C aa (2)
+
+/(?P<x>eks)(?P<x>eccs)/
+Failed: two named groups have the same name at offset 16
+
+/(?P<abc>abc(?P<def>def)(?P<abc>xyz))/
+Failed: two named groups have the same name at offset 31
+
+"\[((?P<elem>\d+)(,(?P>elem))*)\]"
+Capturing subpattern count = 3
+Named capturing subpatterns:
+  elem   2
+Partial matching not supported
+No options
+First char = '['
+Need char = ']'
+    [10,20,30,5,5,4,4,2,43,23,4234]
+ 0: [10,20,30,5,5,4,4,2,43,23,4234]
+ 1: 10,20,30,5,5,4,4,2,43,23,4234
+ 2: 10
+ 3: ,4234
+    *** Failers
+No match
+    []  
+No match
+
+"\[((?P<elem>\d+)(,(?P>elem))*)?\]"
+Capturing subpattern count = 3
+Named capturing subpatterns:
+  elem   2
+Partial matching not supported
+No options
+First char = '['
+Need char = ']'
+    [10,20,30,5,5,4,4,2,43,23,4234]
+ 0: [10,20,30,5,5,4,4,2,43,23,4234]
+ 1: 10,20,30,5,5,4,4,2,43,23,4234
+ 2: 10
+ 3: ,4234
+    [] 
+ 0: []
+
+/(a(b(?2)c))?/D
+------------------------------------------------------------------
+  0  25 Bra 0
+  3     Brazero
+  4  18 Bra 1
+  7     a
+  9  10 Bra 2
+ 12     b
+ 14   9 Recurse
+ 17     c
+ 19  10 Ket
+ 22  18 Ket
+ 25  25 Ket
+ 28     End
+------------------------------------------------------------------
+Capturing subpattern count = 2
+No options
+No first char
+No need char
+
+/(a(b(?2)c))*/D
+------------------------------------------------------------------
+  0  25 Bra 0
+  3     Brazero
+  4  18 Bra 1
+  7     a
+  9  10 Bra 2
+ 12     b
+ 14   9 Recurse
+ 17     c
+ 19  10 Ket
+ 22  18 KetRmax
+ 25  25 Ket
+ 28     End
+------------------------------------------------------------------
+Capturing subpattern count = 2
+No options
+No first char
+No need char
+
+/(a(b(?2)c)){0,2}/D
+------------------------------------------------------------------
+  0  53 Bra 0
+  3     Brazero
+  4  46 Bra 0
+  7  18 Bra 1
+ 10     a
+ 12  10 Bra 2
+ 15     b
+ 17  12 Recurse
+ 20     c
+ 22  10 Ket
+ 25  18 Ket
+ 28     Brazero
+ 29  18 Bra 1
+ 32     a
+ 34  10 Bra 2
+ 37     b
+ 39  12 Recurse
+ 42     c
+ 44  10 Ket
+ 47  18 Ket
+ 50  46 Ket
+ 53  53 Ket
+ 56     End
+------------------------------------------------------------------
+Capturing subpattern count = 2
+No options
+No first char
+No need char
+
+/[ab]{1}+/D
+------------------------------------------------------------------
+  0  47 Bra 0
+  3  41 Once
+  6     [ab]{1,1}
+ 44  41 Ket
+ 47  47 Ket
+ 50     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+No options
+No first char
+No need char
+
+/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/i
+Capturing subpattern count = 3
+Partial matching not supported
+Options: caseless
+No first char
+Need char = 'g' (caseless)
+     Baby Bjorn Active Carrier - With free SHIPPING!!
+ 0: Baby Bjorn Active Carrier - With free SHIPPING!!
+ 1: Baby Bjorn Active Carrier - With free SHIPPING!!
+
+/((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/iS
+Capturing subpattern count = 3
+Partial matching not supported
+Options: caseless
+No first char
+Need char = 'g' (caseless)
+Study returned NULL
+     Baby Bjorn Active Carrier - With free SHIPPING!!
+ 0: Baby Bjorn Active Carrier - With free SHIPPING!!
+ 1: Baby Bjorn Active Carrier - With free SHIPPING!!
+     
+/a*.*b/SD
+------------------------------------------------------------------
+  0   9 Bra 0
+  3     a*
+  5     Any*
+  7     b
+  9   9 Ket
+ 12     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+No options
+No first char
+Need char = 'b'
+Study returned NULL
+
+/(a|b)*.?c/SD 
+------------------------------------------------------------------
+  0  21 Bra 0
+  3     Brazero
+  4   5 Bra 1
+  7     a
+  9   5 Alt
+ 12     b
+ 14  10 KetRmax
+ 17     Any?
+ 19     c
+ 21  21 Ket
+ 24     End
+------------------------------------------------------------------
+Capturing subpattern count = 1
+No options
+No first char
+Need char = 'c'
+Study returned NULL
+
+/abc(?C255)de(?C)f/D
+------------------------------------------------------------------
+  0  27 Bra 0
+  3     abc
+  9     Callout 255 10 1
+ 15     de
+ 19     Callout 0 16 1
+ 25     f
+ 27  27 Ket
+ 30     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+No options
+First char = 'a'
+Need char = 'f'
+
+/abcde/CD
+------------------------------------------------------------------
+  0  49 Bra 0
+  3     Callout 255 0 1
+  9     a
+ 11     Callout 255 1 1
+ 17     b
+ 19     Callout 255 2 1
+ 25     c
+ 27     Callout 255 3 1
+ 33     d
+ 35     Callout 255 4 1
+ 41     e
+ 43     Callout 255 5 0
+ 49  49 Ket
+ 52     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options:
+First char = 'a'
+Need char = 'e'
+  abcde
+--->abcde
+ +0 ^         a
+ +1 ^^        b
+ +2 ^ ^       c
+ +3 ^  ^      d
+ +4 ^   ^     e
+ +5 ^    ^    
+ 0: abcde
+  abcdfe 
+--->abcdfe
+ +0 ^          a
+ +1 ^^         b
+ +2 ^ ^        c
+ +3 ^  ^       d
+ +4 ^   ^      e
+No match
+  
+/a*b/CD
+------------------------------------------------------------------
+  0  25 Bra 0
+  3     Callout 255 0 2
+  9     a*
+ 11     Callout 255 2 1
+ 17     b
+ 19     Callout 255 3 0
+ 25  25 Ket
+ 28     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options:
+No first char
+Need char = 'b'
+  ab
+--->ab
+ +0 ^      a*
+ +2 ^^     b
+ +3 ^ ^    
+ 0: ab
+  aaaab
+--->aaaab
+ +0 ^         a*
+ +2 ^   ^     b
+ +3 ^    ^    
+ 0: aaaab
+  aaaacb   
+--->aaaacb
+ +0 ^          a*
+ +2 ^   ^      b
+ +2 ^  ^       b
+ +2 ^ ^        b
+ +2 ^^         b
+ +2 ^          b
+ +0  ^         a*
+ +2  ^  ^      b
+ +2  ^ ^       b
+ +2  ^^        b
+ +2  ^         b
+ +0   ^        a*
+ +2   ^ ^      b
+ +2   ^^       b
+ +2   ^        b
+ +0    ^       a*
+ +2    ^^      b
+ +2    ^       b
+ +0     ^      a*
+ +2     ^      b
+ +0      ^     a*
+ +2      ^     b
+ +3      ^^    
+ 0: b
+
+/a+b/CD
+------------------------------------------------------------------
+  0  25 Bra 0
+  3     Callout 255 0 2
+  9     a+
+ 11     Callout 255 2 1
+ 17     b
+ 19     Callout 255 3 0
+ 25  25 Ket
+ 28     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options:
+First char = 'a'
+Need char = 'b'
+  ab
+--->ab
+ +0 ^      a+
+ +2 ^^     b
+ +3 ^ ^    
+ 0: ab
+  aaaab
+--->aaaab
+ +0 ^         a+
+ +2 ^   ^     b
+ +3 ^    ^    
+ 0: aaaab
+  aaaacb   
+--->aaaacb
+ +0 ^          a+
+ +2 ^   ^      b
+ +2 ^  ^       b
+ +2 ^ ^        b
+ +2 ^^         b
+ +0  ^         a+
+ +2  ^  ^      b
+ +2  ^ ^       b
+ +2  ^^        b
+ +0   ^        a+
+ +2   ^ ^      b
+ +2   ^^       b
+ +0    ^       a+
+ +2    ^^      b
+No match
+
+/(abc|def)x/CD
+------------------------------------------------------------------
+  0  92 Bra 0
+  3     Callout 255 0 9
+  9  33 Bra 1
+ 12     Callout 255 1 1
+ 18     a
+ 20     Callout 255 2 1
+ 26     b
+ 28     Callout 255 3 1
+ 34     c
+ 36     Callout 255 4 0
+ 42  33 Alt
+ 45     Callout 255 5 1
+ 51     d
+ 53     Callout 255 6 1
+ 59     e
+ 61     Callout 255 7 1
+ 67     f
+ 69     Callout 255 8 0
+ 75  66 Ket
+ 78     Callout 255 9 1
+ 84     x
+ 86     Callout 255 10 0
+ 92  92 Ket
+ 95     End
+------------------------------------------------------------------
+Capturing subpattern count = 1
+Options:
+No first char
+Need char = 'x'
+  abcx
+--->abcx
+ +0 ^        (abc|def)
+ +1 ^        a
+ +2 ^^       b
+ +3 ^ ^      c
+ +4 ^  ^     |
+ +9 ^  ^     x
++10 ^   ^    
+ 0: abcx
+ 1: abc
+  defx
+--->defx
+ +0 ^        (abc|def)
+ +1 ^        a
+ +5 ^        d
+ +6 ^^       e
+ +7 ^ ^      f
+ +8 ^  ^     )
+ +9 ^  ^     x
++10 ^   ^    
+ 0: defx
+ 1: def
+  abcdefzx
+--->abcdefzx
+ +0 ^            (abc|def)
+ +1 ^            a
+ +2 ^^           b
+ +3 ^ ^          c
+ +4 ^  ^         |
+ +9 ^  ^         x
+ +5 ^            d
+ +0  ^           (abc|def)
+ +1  ^           a
+ +5  ^           d
+ +0   ^          (abc|def)
+ +1   ^          a
+ +5   ^          d
+ +0    ^         (abc|def)
+ +1    ^         a
+ +5    ^         d
+ +6    ^^        e
+ +7    ^ ^       f
+ +8    ^  ^      )
+ +9    ^  ^      x
+ +0     ^        (abc|def)
+ +1     ^        a
+ +5     ^        d
+ +0      ^       (abc|def)
+ +1      ^       a
+ +5      ^       d
+ +0       ^      (abc|def)
+ +1       ^      a
+ +5       ^      d
+ +0        ^     (abc|def)
+ +1        ^     a
+ +5        ^     d
+No match
+
+/(ab|cd){3,4}/C
+Capturing subpattern count = 1
+Options:
+No first char
+No need char
+  ababab
+--->ababab
+ +0 ^          (ab|cd){3,4}
+ +1 ^          a
+ +2 ^^         b
+ +3 ^ ^        |
+ +1 ^ ^        a
+ +2 ^  ^       b
+ +3 ^   ^      |
+ +1 ^   ^      a
+ +2 ^    ^     b
+ +3 ^     ^    |
+ +1 ^     ^    a
+ +4 ^     ^    c
++12 ^     ^    
+ 0: ababab
+ 1: ab
+  abcdabcd
+--->abcdabcd
+ +0 ^            (ab|cd){3,4}
+ +1 ^            a
+ +2 ^^           b
+ +3 ^ ^          |
+ +1 ^ ^          a
+ +4 ^ ^          c
+ +5 ^  ^         d
+ +6 ^   ^        )
+ +1 ^   ^        a
+ +2 ^    ^       b
+ +3 ^     ^      |
+ +1 ^     ^      a
+ +4 ^     ^      c
+ +5 ^      ^     d
+ +6 ^       ^    )
++12 ^       ^    
+ 0: abcdabcd
+ 1: cd
+  abcdcdcdcdcd  
+--->abcdcdcdcdcd
+ +0 ^                (ab|cd){3,4}
+ +1 ^                a
+ +2 ^^               b
+ +3 ^ ^              |
+ +1 ^ ^              a
+ +4 ^ ^              c
+ +5 ^  ^             d
+ +6 ^   ^            )
+ +1 ^   ^            a
+ +4 ^   ^            c
+ +5 ^    ^           d
+ +6 ^     ^          )
+ +1 ^     ^          a
+ +4 ^     ^          c
+ +5 ^      ^         d
+ +6 ^       ^        )
++12 ^       ^        
+ 0: abcdcdcd
+ 1: cd
+
+/([ab]{,4}c|xy)/CD
+------------------------------------------------------------------
+  0 131 Bra 0
+  3     Callout 255 0 14
+  9  88 Bra 1
+ 12     Callout 255 1 4
+ 18     [ab]
+ 51     Callout 255 5 1
+ 57     {
+ 59     Callout 255 6 1
+ 65     ,
+ 67     Callout 255 7 1
+ 73     4
+ 75     Callout 255 8 1
+ 81     }
+ 83     Callout 255 9 1
+ 89     c
+ 91     Callout 255 10 0
+ 97  25 Alt
+100     Callout 255 11 1
+106     x
+108     Callout 255 12 1
+114     y
+116     Callout 255 13 0
+122 113 Ket
+125     Callout 255 14 0
+131 131 Ket
+134     End
+------------------------------------------------------------------
+Capturing subpattern count = 1
+Options:
+No first char
+No need char
+    Note: that { does NOT introduce a quantifier
+--->Note: that { does NOT introduce a quantifier
+ +0 ^                                                ([ab]{,4}c|xy)
+ +1 ^                                                [ab]
++11 ^                                                x
+ +0  ^                                               ([ab]{,4}c|xy)
+ +1  ^                                               [ab]
++11  ^                                               x
+ +0   ^                                              ([ab]{,4}c|xy)
+ +1   ^                                              [ab]
++11   ^                                              x
+ +0    ^                                             ([ab]{,4}c|xy)
+ +1    ^                                             [ab]
++11    ^                                             x
+ +0     ^                                            ([ab]{,4}c|xy)
+ +1     ^                                            [ab]
++11     ^                                            x
+ +0      ^                                           ([ab]{,4}c|xy)
+ +1      ^                                           [ab]
++11      ^                                           x
+ +0       ^                                          ([ab]{,4}c|xy)
+ +1       ^                                          [ab]
++11       ^                                          x
+ +0        ^                                         ([ab]{,4}c|xy)
+ +1        ^                                         [ab]
++11        ^                                         x
+ +0         ^                                        ([ab]{,4}c|xy)
+ +1         ^                                        [ab]
+ +5         ^^                                       {
++11         ^                                        x
+ +0          ^                                       ([ab]{,4}c|xy)
+ +1          ^                                       [ab]
++11          ^                                       x
+ +0           ^                                      ([ab]{,4}c|xy)
+ +1           ^                                      [ab]
++11           ^                                      x
+ +0            ^                                     ([ab]{,4}c|xy)
+ +1            ^                                     [ab]
++11            ^                                     x
+ +0             ^                                    ([ab]{,4}c|xy)
+ +1             ^                                    [ab]
++11             ^                                    x
+ +0              ^                                   ([ab]{,4}c|xy)
+ +1              ^                                   [ab]
++11              ^                                   x
+ +0               ^                                  ([ab]{,4}c|xy)
+ +1               ^                                  [ab]
++11               ^                                  x
+ +0                ^                                 ([ab]{,4}c|xy)
+ +1                ^                                 [ab]
++11                ^                                 x
+ +0                 ^                                ([ab]{,4}c|xy)
+ +1                 ^                                [ab]
++11                 ^                                x
+ +0                  ^                               ([ab]{,4}c|xy)
+ +1                  ^                               [ab]
++11                  ^                               x
+ +0                   ^                              ([ab]{,4}c|xy)
+ +1                   ^                              [ab]
++11                   ^                              x
+ +0                    ^                             ([ab]{,4}c|xy)
+ +1                    ^                             [ab]
++11                    ^                             x
+ +0                     ^                            ([ab]{,4}c|xy)
+ +1                     ^                            [ab]
++11                     ^                            x
+ +0                      ^                           ([ab]{,4}c|xy)
+ +1                      ^                           [ab]
++11                      ^                           x
+ +0                       ^                          ([ab]{,4}c|xy)
+ +1                       ^                          [ab]
++11                       ^                          x
+ +0                        ^                         ([ab]{,4}c|xy)
+ +1                        ^                         [ab]
++11                        ^                         x
+ +0                         ^                        ([ab]{,4}c|xy)
+ +1                         ^                        [ab]
++11                         ^                        x
+ +0                          ^                       ([ab]{,4}c|xy)
+ +1                          ^                       [ab]
++11                          ^                       x
+ +0                           ^                      ([ab]{,4}c|xy)
+ +1                           ^                      [ab]
++11                           ^                      x
+ +0                            ^                     ([ab]{,4}c|xy)
+ +1                            ^                     [ab]
++11                            ^                     x
+ +0                             ^                    ([ab]{,4}c|xy)
+ +1                             ^                    [ab]
++11                             ^                    x
+ +0                              ^                   ([ab]{,4}c|xy)
+ +1                              ^                   [ab]
++11                              ^                   x
+ +0                               ^                  ([ab]{,4}c|xy)
+ +1                               ^                  [ab]
++11                               ^                  x
+ +0                                ^                 ([ab]{,4}c|xy)
+ +1                                ^                 [ab]
++11                                ^                 x
+ +0                                 ^                ([ab]{,4}c|xy)
+ +1                                 ^                [ab]
+ +5                                 ^^               {
++11                                 ^                x
+ +0                                  ^               ([ab]{,4}c|xy)
+ +1                                  ^               [ab]
++11                                  ^               x
+ +0                                   ^              ([ab]{,4}c|xy)
+ +1                                   ^              [ab]
++11                                   ^              x
+ +0                                    ^             ([ab]{,4}c|xy)
+ +1                                    ^             [ab]
++11                                    ^             x
+ +0                                     ^            ([ab]{,4}c|xy)
+ +1                                     ^            [ab]
+ +5                                     ^^           {
++11                                     ^            x
+ +0                                      ^           ([ab]{,4}c|xy)
+ +1                                      ^           [ab]
++11                                      ^           x
+ +0                                       ^          ([ab]{,4}c|xy)
+ +1                                       ^          [ab]
++11                                       ^          x
+ +0                                        ^         ([ab]{,4}c|xy)
+ +1                                        ^         [ab]
++11                                        ^         x
+ +0                                         ^        ([ab]{,4}c|xy)
+ +1                                         ^        [ab]
++11                                         ^        x
+ +0                                          ^       ([ab]{,4}c|xy)
+ +1                                          ^       [ab]
++11                                          ^       x
+ +0                                           ^      ([ab]{,4}c|xy)
+ +1                                           ^      [ab]
++11                                           ^      x
+ +0                                            ^     ([ab]{,4}c|xy)
+ +1                                            ^     [ab]
++11                                            ^     x
+ +0                                             ^    ([ab]{,4}c|xy)
+ +1                                             ^    [ab]
++11                                             ^    x
+No match
+
+/([ab]{1,4}c|xy){4,5}?123/CD
+------------------------------------------------------------------
+  0 485 Bra 0
+  3     Callout 255 0 21
+  9  61 Bra 1
+ 12     Callout 255 1 9
+ 18     [ab]{1,4}
+ 56     Callout 255 10 1
+ 62     c
+ 64     Callout 255 11 0
+ 70  25 Alt
+ 73     Callout 255 12 1
+ 79     x
+ 81     Callout 255 13 1
+ 87     y
+ 89     Callout 255 14 0
+ 95  86 Ket
+ 98  61 Bra 1
+101     Callout 255 1 9
+107     [ab]{1,4}
+145     Callout 255 10 1
+151     c
+153     Callout 255 11 0
+159  25 Alt
+162     Callout 255 12 1
+168     x
+170     Callout 255 13 1
+176     y
+178     Callout 255 14 0
+184  86 Ket
+187  61 Bra 1
+190     Callout 255 1 9
+196     [ab]{1,4}
+234     Callout 255 10 1
+240     c
+242     Callout 255 11 0
+248  25 Alt
+251     Callout 255 12 1
+257     x
+259     Callout 255 13 1
+265     y
+267     Callout 255 14 0
+273  86 Ket
+276  61 Bra 1
+279     Callout 255 1 9
+285     [ab]{1,4}
+323     Callout 255 10 1
+329     c
+331     Callout 255 11 0
+337  25 Alt
+340     Callout 255 12 1
+346     x
+348     Callout 255 13 1
+354     y
+356     Callout 255 14 0
+362  86 Ket
+365     Braminzero
+366  61 Bra 1
+369     Callout 255 1 9
+375     [ab]{1,4}
+413     Callout 255 10 1
+419     c
+421     Callout 255 11 0
+427  25 Alt
+430     Callout 255 12 1
+436     x
+438     Callout 255 13 1
+444     y
+446     Callout 255 14 0
+452  86 Ket
+455     Callout 255 21 1
+461     1
+463     Callout 255 22 1
+469     2
+471     Callout 255 23 1
+477     3
+479     Callout 255 24 0
+485 485 Ket
+488     End
+------------------------------------------------------------------
+Capturing subpattern count = 1
+Partial matching not supported
+Options:
+No first char
+Need char = '3'
+    aacaacaacaacaac123
+--->aacaacaacaacaac123
+ +0 ^                      ([ab]{1,4}c|xy){4,5}?
+ +1 ^                      [ab]{1,4}
++10 ^ ^                    c
++11 ^  ^                   |
+ +1 ^  ^                   [ab]{1,4}
++10 ^    ^                 c
++11 ^     ^                |
+ +1 ^     ^                [ab]{1,4}
++10 ^       ^              c
++11 ^        ^             |
+ +1 ^        ^             [ab]{1,4}
++10 ^          ^           c
++11 ^           ^          |
++21 ^           ^          1
+ +1 ^           ^          [ab]{1,4}
++10 ^             ^        c
++11 ^              ^       |
++21 ^              ^       1
++22 ^               ^      2
++23 ^                ^     3
++24 ^                 ^    
+ 0: aacaacaacaacaac123
+ 1: aac
+
+/\b.*/I
+Capturing subpattern count = 0
+Partial matching not supported
+No options
+No first char
+No need char
+  ab cd\>1
+ 0:  cd
+  
+/\b.*/Is 
+Capturing subpattern count = 0
+Partial matching not supported
+Options: dotall
+No first char
+No need char
+  ab cd\>1
+ 0:  cd
+  
+/(?!.bcd).*/I
+Capturing subpattern count = 0
+Partial matching not supported
+No options
+No first char
+No need char
+  Xbcd12345 
+ 0: bcd12345
+
+/abcde/
+Capturing subpattern count = 0
+No options
+First char = 'a'
+Need char = 'e'
+    ab\P
+Partial match
+    abc\P
+Partial match
+    abcd\P
+Partial match
+    abcde\P   
+ 0: abcde
+    the quick brown abc\P
+Partial match
+    ** Failers\P
+No match
+    the quick brown abxyz fox\P
+No match
+    
+"^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/(20)?\d\d$"
+Capturing subpattern count = 3
+Options: anchored
+No first char
+Need char = '/'
+    13/05/04\P
+ 0: 13/05/04
+ 1: 13
+ 2: 05
+    13/5/2004\P
+ 0: 13/5/2004
+ 1: 13
+ 2: 5
+ 3: 20
+    02/05/09\P 
+ 0: 02/05/09
+ 1: 02
+ 2: 05
+    1\P
+Partial match
+    1/2\P
+Partial match
+    1/2/0\P
+Partial match
+    1/2/04\P    
+ 0: 1/2/04
+ 1: 1
+ 2: 2
+    0\P
+Partial match
+    02/\P
+Partial match
+    02/0\P   
+Partial match
+    02/1\P
+Partial match
+    ** Failers\P
+No match
+    \P
+No match
+    123\P
+No match
+    33/4/04\P
+No match
+    3/13/04\P
+No match
+    0/1/2003\P
+No match
+    0/\P 
+No match
+    02/0/\P 
+No match
+    02/13\P  
+No match
+
+/0{0,2}ABC/I
+Capturing subpattern count = 0
+Partial matching not supported
+No options
+No first char
+Need char = 'C'
+    
+/\d{3,}ABC/I
+Capturing subpattern count = 0
+Partial matching not supported
+No options
+No first char
+Need char = 'C'
+    
+/\d*ABC/I
+Capturing subpattern count = 0
+Partial matching not supported
+No options
+No first char
+Need char = 'C'
+
+/[abc]+DE/I
+Capturing subpattern count = 0
+Partial matching not supported
+No options
+No first char
+Need char = 'E'
+
+/[abc]?123/
+Capturing subpattern count = 0
+No options
+No first char
+Need char = '3'
+    123\P
+ 0: 123
+    a\P
+Partial match
+    b\P
+Partial match
+    c\P
+Partial match
+    c12\P
+Partial match
+    c123\P      
+ 0: c123
+
+/^(?:\d){3,5}X/
+Capturing subpattern count = 0
+Options: anchored
+No first char
+Need char = 'X'
+    1\P
+Partial match
+    123\P
+Partial match
+    123X
+ 0: 123X
+    1234\P
+Partial match
+    1234X
+ 0: 1234X
+    12345\P
+Partial match
+    12345X      
+ 0: 12345X
+    *** Failers 
+No match
+    1X 
+No match
+    123456\P 
+No match
+
+/abc/>testsavedregex
+Capturing subpattern count = 0
+No options
+First char = 'a'
+Need char = 'c'
+Compiled regex written to testsavedregex
+<testsavedregex
+Compiled regex loaded from testsavedregex
+No study data
+Capturing subpattern count = 0
+No options
+First char = 'a'
+Need char = 'c'
+    abc
+ 0: abc
+    ** Failers
+No match
+    bca
+No match
+    
+/abc/F>testsavedregex
+Capturing subpattern count = 0
+No options
+First char = 'a'
+Need char = 'c'
+Compiled regex written to testsavedregex
+<testsavedregex
+Compiled regex (byte-inverted) loaded from testsavedregex
+No study data
+Capturing subpattern count = 0
+No options
+First char = 'a'
+Need char = 'c'
+    abc
+ 0: abc
+    ** Failers
+No match
+    bca
+No match
+
+/(a|b)/S>testsavedregex
+Capturing subpattern count = 1
+No options
+No first char
+No need char
+Starting byte set: a b 
+Compiled regex written to testsavedregex
+Study data written to testsavedregex
+<testsavedregex
+Compiled regex loaded from testsavedregex
+Study data loaded from testsavedregex
+Capturing subpattern count = 1
+No options
+No first char
+No need char
+Starting byte set: a b 
+    abc
+ 0: a
+ 1: a
+    ** Failers
+ 0: a
+ 1: a
+    def  
+No match
+    
+/(a|b)/SF>testsavedregex
+Capturing subpattern count = 1
+No options
+No first char
+No need char
+Starting byte set: a b 
+Compiled regex written to testsavedregex
+Study data written to testsavedregex
+<testsavedregex
+Compiled regex (byte-inverted) loaded from testsavedregex
+Study data loaded from testsavedregex
+Capturing subpattern count = 1
+No options
+No first char
+No need char
+Starting byte set: a b 
+    abc
+ 0: a
+ 1: a
+    ** Failers
+ 0: a
+ 1: a
+    def  
+No match
+    
+~<(\w+)/?>(.)*</(\1)>~smg
+Capturing subpattern count = 3
+Max back reference = 1
+Partial matching not supported
+Options: multiline dotall
+First char = '<'
+Need char = '>'
+    <!DOCTYPE seite SYSTEM "http://www.lco.lineas.de/xmlCms.dtd">\n<seite>\n<dokumenteninformation>\n<seitentitel>Partner der LCO</seitentitel>\n<sprache>de</sprache>\n<seitenbeschreibung>Partner der LINEAS Consulting\nGmbH</seitenbeschreibung>\n<schluesselworte>LINEAS Consulting GmbH Hamburg\nPartnerfirmen</schluesselworte>\n<revisit>30 days</revisit>\n<robots>index,follow</robots>\n<menueinformation>\n<aktiv>ja</aktiv>\n<menueposition>3</menueposition>\n<menuetext>Partner</menuetext>\n</menueinformation>\n<lastedited>\n<autor>LCO</autor>\n<firma>LINEAS Consulting</firma>\n<datum>15.10.2003</datum>\n</lastedited>\n</dokumenteninformation>\n<inhalt>\n\n<absatzueberschrift>Die Partnerfirmen der LINEAS Consulting\nGmbH</absatzueberschrift>\n\n<absatz><link ziel="http://www.ca.com/" zielfenster="_blank">\n<bild name="logo_ca.gif" rahmen="no"/></link> <link\nziel="http://www.ey.com/" zielfenster="_blank"><bild\nname="logo_euy.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><link ziel="http://www.cisco.de/" zielfenster="_blank">\n<bild name="logo_cisco.gif" rahmen="ja"/></link></absatz>\n\n<absatz><link ziel="http://www.atelion.de/"\nzielfenster="_blank"><bild\nname="logo_atelion.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><link ziel="http://www.line-information.de/"\nzielfenster="_blank">\n<bild name="logo_line_information.gif" rahmen="no"/></link>\n</absatz>\n\n<absatz><bild name="logo_aw.gif" rahmen="no"/></absatz>\n\n<absatz><link ziel="http://www.incognis.de/"\nzielfenster="_blank"><bild\nname="logo_incognis.gif" rahmen="no"/></link></absatz>\n\n<absatz><link ziel="http://www.addcraft.com/"\nzielfenster="_blank"><bild\nname="logo_addcraft.gif" rahmen="no"/></link></absatz>\n\n<absatz><link ziel="http://www.comendo.com/"\nzielfenster="_blank"><bild\nname="logo_comendo.gif" rahmen="no"/></link></absatz>\n\n</inhalt>\n</seite>
+ 0: <seite>\x0a<dokumenteninformation>\x0a<seitentitel>Partner der LCO</seitentitel>\x0a<sprache>de</sprache>\x0a<seitenbeschreibung>Partner der LINEAS Consulting\x0aGmbH</seitenbeschreibung>\x0a<schluesselworte>LINEAS Consulting GmbH Hamburg\x0aPartnerfirmen</schluesselworte>\x0a<revisit>30 days</revisit>\x0a<robots>index,follow</robots>\x0a<menueinformation>\x0a<aktiv>ja</aktiv>\x0a<menueposition>3</menueposition>\x0a<menuetext>Partner</menuetext>\x0a</menueinformation>\x0a<lastedited>\x0a<autor>LCO</autor>\x0a<firma>LINEAS Consulting</firma>\x0a<datum>15.10.2003</datum>\x0a</lastedited>\x0a</dokumenteninformation>\x0a<inhalt>\x0a\x0a<absatzueberschrift>Die Partnerfirmen der LINEAS Consulting\x0aGmbH</absatzueberschrift>\x0a\x0a<absatz><link ziel="http://www.ca.com/" zielfenster="_blank">\x0a<bild name="logo_ca.gif" rahmen="no"/></link> <link\x0aziel="http://www.ey.com/" zielfenster="_blank"><bild\x0aname="logo_euy.gif" rahmen="no"/></link>\x0a</absatz>\x0a\x0a<absatz><link ziel="http://www.cisco.de/" zielfenster="_blank">\x0a<bild name="logo_cisco.gif" rahmen="ja"/></link></absatz>\x0a\x0a<absatz><link ziel="http://www.atelion.de/"\x0azielfenster="_blank"><bild\x0aname="logo_atelion.gif" rahmen="no"/></link>\x0a</absatz>\x0a\x0a<absatz><link ziel="http://www.line-information.de/"\x0azielfenster="_blank">\x0a<bild name="logo_line_information.gif" rahmen="no"/></link>\x0a</absatz>\x0a\x0a<absatz><bild name="logo_aw.gif" rahmen="no"/></absatz>\x0a\x0a<absatz><link ziel="http://www.incognis.de/"\x0azielfenster="_blank"><bild\x0aname="logo_incognis.gif" rahmen="no"/></link></absatz>\x0a\x0a<absatz><link ziel="http://www.addcraft.com/"\x0azielfenster="_blank"><bild\x0aname="logo_addcraft.gif" rahmen="no"/></link></absatz>\x0a\x0a<absatz><link ziel="http://www.comendo.com/"\x0azielfenster="_blank"><bild\x0aname="logo_comendo.gif" rahmen="no"/></link></absatz>\x0a\x0a</inhalt>\x0a</seite>
+ 1: seite
+ 2: \x0a
+ 3: seite
+
+/^a/IF
+Capturing subpattern count = 0
+Options: anchored
+No first char
+No need char
+
+/line\nbreak/
+Capturing subpattern count = 0
+No options
+First char = 'l'
+Need char = 'k'
+    this is a line\nbreak
+ 0: line\x0abreak
+    line one\nthis is a line\nbreak in the second line 
+ 0: line\x0abreak
+
+/line\nbreak/f
+Capturing subpattern count = 0
+Options: firstline
+First char = 'l'
+Need char = 'k'
+    this is a line\nbreak
+ 0: line\x0abreak
+    ** Failers 
+No match
+    line one\nthis is a line\nbreak in the second line 
+No match
+
+/line\nbreak/mf
+Capturing subpattern count = 0
+Options: multiline firstline
+First char = 'l'
+Need char = 'k'
+    this is a line\nbreak
+ 0: line\x0abreak
+    ** Failers 
+No match
+    line one\nthis is a line\nbreak in the second line 
+No match
+
+/ab.cd/P
+    ab-cd
+ 0: ab-cd
+    ab=cd 
+ 0: ab=cd
+    ** Failers
+No match: POSIX code 17: match failed
+    ab\ncd
+No match: POSIX code 17: match failed
+
+/ab.cd/Ps
+    ab-cd
+ 0: ab-cd
+    ab=cd 
+ 0: ab=cd
+    ab\ncd
+ 0: ab\x0acd
+
+/(?i)(?-i)AbCd/
+Capturing subpattern count = 0
+No options
+First char = 'A'
+Need char = 'd'
+    AbCd
+ 0: AbCd
+    ** Failers
+No match
+    abcd  
+No match
+    
+/a{11111111111111111111}/
+Failed: number too big in {} quantifier at offset 22
+
+/(){64294967295}/
+Failed: number too big in {} quantifier at offset 14
+
+/(){2,4294967295}/
+Failed: number too big in {} quantifier at offset 15
+
+"(?i:a)(?i:b)(?i:c)(?i:d)(?i:e)(?i:f)(?i:g)(?i:h)(?i:i)(?i:j)(k)(?i:l)A\1B"
+Capturing subpattern count = 1
+Max back reference = 1
+No options
+Case state changes
+First char = 'a' (caseless)
+Need char = 'B'
+    abcdefghijklAkB
+ 0: abcdefghijklAkB
+ 1: k
+
+"(?P<n0>a)(?P<n1>b)(?P<n2>c)(?P<n3>d)(?P<n4>e)(?P<n5>f)(?P<n6>g)(?P<n7>h)(?P<n8>i)(?P<n9>j)(?P<n10>k)(?P<n11>l)A\11B"
+Capturing subpattern count = 12
+Max back reference = 11
+Named capturing subpatterns:
+  n0    1
+  n1    2
+  n10  11
+  n11  12
+  n2    3
+  n3    4
+  n4    5
+  n5    6
+  n6    7
+  n7    8
+  n8    9
+  n9   10
+No options
+First char = 'a'
+Need char = 'B'
+    abcdefghijklAkB
+ 0: abcdefghijklAkB
+ 1: a
+ 2: b
+ 3: c
+ 4: d
+ 5: e
+ 6: f
+ 7: g
+ 8: h
+ 9: i
+10: j
+11: k
+12: l
+
+"(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)A\11B"
+Capturing subpattern count = 12
+Max back reference = 11
+No options
+First char = 'a'
+Need char = 'B'
+    abcdefghijklAkB
+ 0: abcdefghijklAkB
+ 1: a
+ 2: b
+ 3: c
+ 4: d
+ 5: e
+ 6: f
+ 7: g
+ 8: h
+ 9: i
+10: j
+11: k
+12: l
+
+"(?P<name0>a)(?P<name1>a)(?P<name2>a)(?P<name3>a)(?P<name4>a)(?P<name5>a)(?P<name6>a)(?P<name7>a)(?P<name8>a)(?P<name9>a)(?P<name10>a)(?P<name11>a)(?P<name12>a)(?P<name13>a)(?P<name14>a)(?P<name15>a)(?P<name16>a)(?P<name17>a)(?P<name18>a)(?P<name19>a)(?P<name20>a)(?P<name21>a)(?P<name22>a)(?P<name23>a)(?P<name24>a)(?P<name25>a)(?P<name26>a)(?P<name27>a)(?P<name28>a)(?P<name29>a)(?P<name30>a)(?P<name31>a)(?P<name32>a)(?P<name33>a)(?P<name34>a)(?P<name35>a)(?P<name36>a)(?P<name37>a)(?P<name38>a)(?P<name39>a)(?P<name40>a)(?P<name41>a)(?P<name42>a)(?P<name43>a)(?P<name44>a)(?P<name45>a)(?P<name46>a)(?P<name47>a)(?P<name48>a)(?P<name49>a)(?P<name50>a)(?P<name51>a)(?P<name52>a)(?P<name53>a)(?P<name54>a)(?P<name55>a)(?P<name56>a)(?P<name57>a)(?P<name58>a)(?P<name59>a)(?P<name60>a)(?P<name61>a)(?P<name62>a)(?P<name63>a)(?P<name64>a)(?P<name65>a)(?P<name66>a)(?P<name67>a)(?P<name68>a)(?P<name69>a)(?P<name70>a)(?P<name71>a)(?P<name72>a)(?P<name73>a)(?P<name74>a)(?P<name75>a)(?P<name76>a)(?P<name77>a)(?P<name78>a)(?P<name79>a)(?P<name80>a)(?P<name81>a)(?P<name82>a)(?P<name83>a)(?P<name84>a)(?P<name85>a)(?P<name86>a)(?P<name87>a)(?P<name88>a)(?P<name89>a)(?P<name90>a)(?P<name91>a)(?P<name92>a)(?P<name93>a)(?P<name94>a)(?P<name95>a)(?P<name96>a)(?P<name97>a)(?P<name98>a)(?P<name99>a)(?P<name100>a)"
+Capturing subpattern count = 101
+Named capturing subpatterns:
+  name0     1
+  name1     2
+  name10   11
+  name100 101
+  name11   12
+  name12   13
+  name13   14
+  name14   15
+  name15   16
+  name16   17
+  name17   18
+  name18   19
+  name19   20
+  name2     3
+  name20   21
+  name21   22
+  name22   23
+  name23   24
+  name24   25
+  name25   26
+  name26   27
+  name27   28
+  name28   29
+  name29   30
+  name3     4
+  name30   31
+  name31   32
+  name32   33
+  name33   34
+  name34   35
+  name35   36
+  name36   37
+  name37   38
+  name38   39
+  name39   40
+  name4     5
+  name40   41
+  name41   42
+  name42   43
+  name43   44
+  name44   45
+  name45   46
+  name46   47
+  name47   48
+  name48   49
+  name49   50
+  name5     6
+  name50   51
+  name51   52
+  name52   53
+  name53   54
+  name54   55
+  name55   56
+  name56   57
+  name57   58
+  name58   59
+  name59   60
+  name6     7
+  name60   61
+  name61   62
+  name62   63
+  name63   64
+  name64   65
+  name65   66
+  name66   67
+  name67   68
+  name68   69
+  name69   70
+  name7     8
+  name70   71
+  name71   72
+  name72   73
+  name73   74
+  name74   75
+  name75   76
+  name76   77
+  name77   78
+  name78   79
+  name79   80
+  name8     9
+  name80   81
+  name81   82
+  name82   83
+  name83   84
+  name84   85
+  name85   86
+  name86   87
+  name87   88
+  name88   89
+  name89   90
+  name9    10
+  name90   91
+  name91   92
+  name92   93
+  name93   94
+  name94   95
+  name95   96
+  name96   97
+  name97   98
+  name98   99
+  name99  100
+No options
+First char = 'a'
+Need char = 'a'
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+Matched, but too many substrings
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 1: a
+ 2: a
+ 3: a
+ 4: a
+ 5: a
+ 6: a
+ 7: a
+ 8: a
+ 9: a
+10: a
+11: a
+12: a
+13: a
+14: a
+
+"(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)(a)"
+Capturing subpattern count = 101
+No options
+First char = 'a'
+Need char = 'a'
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+Matched, but too many substrings
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 1: a
+ 2: a
+ 3: a
+ 4: a
+ 5: a
+ 6: a
+ 7: a
+ 8: a
+ 9: a
+10: a
+11: a
+12: a
+13: a
+14: a
+
+/ End of testinput2 /
+Capturing subpattern count = 0
+No options
+First char = ' '
+Need char = ' '
index 8cc3e8dc64613bc28366399bef1c13251a149b34..16ebc7125a374cd22939245610288b2205051a46 100644 (file)
@@ -1,4 +1,4 @@
-PCRE version 3.92 11-Sep-2002
+PCRE version 6.2 01-Aug-2005
 
 /^[\w]+/
     *** Failers
@@ -6,7 +6,7 @@ No match
     École
 No match
 
-/^[\w]+/Lfr
+/^[\w]+/Lfr_FR
     École
  0: École
 
@@ -20,7 +20,7 @@ No match
     École
  0: \xc9
 
-/^[\W]+/Lfr
+/^[\W]+/Lfr_FR
     *** Failers
  0: *** 
     École
@@ -34,7 +34,7 @@ No match
     a
 No match
 
-/[\b]/Lfr
+/[\b]/Lfr_FR
     \b
  0: \x08
     *** Failers
@@ -48,7 +48,7 @@ No match
     École
 No match
 
-/^\w+/Lfr
+/^\w+/Lfr_FR
     École
  0: École
 
@@ -58,7 +58,7 @@ No match
  1: \xc9
  2: cole
 
-/(.+)\b(.+)/Lfr
+/(.+)\b(.+)/Lfr_FR
     *** Failers
  0: *** Failers
  1: *** 
@@ -74,7 +74,7 @@ No match
     école
 No match
 
-/École/iLfr
+/École/iLfr_FR
     École
  0: École
     école
@@ -85,26 +85,26 @@ Capturing subpattern count = 0
 No options
 No first char
 No need char
-Starting character set: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P 
+Starting byte set: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P 
   Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z 
 
-/\w/ISLfr
+/\w/ISLfr_FR
 Capturing subpattern count = 0
 No options
 No first char
 No need char
-Starting character set: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P 
+Starting byte set: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P 
   Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z 
-  À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å 
-  æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ø ù ú û ü ý þ ÿ 
+  µ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ ß à á â ã ä 
+  å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ø ù ú û ü ý þ ÿ 
 
-/^[\xc8-\xc9]/iLfr
+/^[\xc8-\xc9]/iLfr_FR
     École
  0: É
     école
  0: é
 
-/^[\xc8-\xc9]/Lfr
+/^[\xc8-\xc9]/Lfr_FR
     École
  0: É
     *** Failers 
@@ -113,4 +113,3 @@ No match
 No match
 
 / End of testinput3 /
-
index 3018c9baa7f1870c90d0e6e50a82ae9b049fcb0b..234fd1ae145e0c4dbb763e7b706a60d2b33c73bd 100644 (file)
@@ -1,4 +1,4 @@
-PCRE version 3.92 11-Sep-2002
+PCRE version 6.2 01-Aug-2005
 
 /-- Do not use the \x{} construct except with patterns that have the --/
 /-- /8 option set, because PCRE doesn't recognize them as UTF-8 unless --/
@@ -300,5 +300,604 @@ No match
     X\x{1234}\x{512}  
  0: X\x{1234}
 
-/ End of testinput4 /
+/[^a]+/8g
+    bcd
+ 0: bcd
+    \x{100}aY\x{256}Z 
+ 0: \x{100}
+ 0: Y\x{256}Z
+    
+/^[^a]{2}/8
+    \x{100}bc
+ 0: \x{100}b
+/^[^a]{2,}/8
+    \x{100}bcAa
+ 0: \x{100}bcA
+
+/^[^a]{2,}?/8
+    \x{100}bca
+ 0: \x{100}b
+
+/[^a]+/8ig
+    bcd
+ 0: bcd
+    \x{100}aY\x{256}Z 
+ 0: \x{100}
+ 0: Y\x{256}Z
+    
+/^[^a]{2}/8i
+    \x{100}bc
+ 0: \x{100}b
+/^[^a]{2,}/8i
+    \x{100}bcAa
+ 0: \x{100}bc
+
+/^[^a]{2,}?/8i
+    \x{100}bca
+ 0: \x{100}b
+
+/\x{100}{0,0}/8
+    abcd
+ 0: 
+/\x{100}?/8
+    abcd
+ 0: 
+    \x{100}\x{100} 
+ 0: \x{100}
+
+/\x{100}{0,3}/8 
+    \x{100}\x{100} 
+ 0: \x{100}\x{100}
+    \x{100}\x{100}\x{100}\x{100} 
+ 0: \x{100}\x{100}\x{100}
+    
+/\x{100}*/8
+    abce
+ 0: 
+    \x{100}\x{100}\x{100}\x{100} 
+ 0: \x{100}\x{100}\x{100}\x{100}
+
+/\x{100}{1,1}/8
+    abcd\x{100}\x{100}\x{100}\x{100} 
+ 0: \x{100}
+
+/\x{100}{1,3}/8
+    abcd\x{100}\x{100}\x{100}\x{100} 
+ 0: \x{100}\x{100}\x{100}
+
+/\x{100}+/8
+    abcd\x{100}\x{100}\x{100}\x{100} 
+ 0: \x{100}\x{100}\x{100}\x{100}
+
+/\x{100}{3}/8
+    abcd\x{100}\x{100}\x{100}XX
+ 0: \x{100}\x{100}\x{100}
+
+/\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}
+
+/\x{100}{3,}/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}\x{100}\x{100}
+
+/(?<=a\x{100}{2}b)X/8+
+    Xyyya\x{100}\x{100}bXzzz
+ 0: X
+ 0+ zzz
+
+/\D*/8
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+
+/\D*/8
+  \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+ 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}
+
+/\D/8
+    1X2
+ 0: X
+    1\x{100}2 
+ 0: \x{100}
+  
+/>\S/8
+    > >X Y
+ 0: >X
+    > >\x{100} Y
+ 0: >\x{100}
+  
+/\d/8
+    \x{100}3
+ 0: 3
+    
+/\s/8
+    \x{100} X
+ 0:  
+    
+/\D+/8
+    12abcd34
+ 0: abcd
+    *** Failers
+ 0: *** Failers
+    1234  
+No match
+
+/\D{2,3}/8
+    12abcd34
+ 0: abc
+    12ab34
+ 0: ab
+    *** Failers  
+ 0: ***
+    1234
+No match
+    12a34  
+No match
+
+/\D{2,3}?/8
+    12abcd34
+ 0: ab
+    12ab34
+ 0: ab
+    *** Failers  
+ 0: **
+    1234
+No match
+    12a34  
+No match
+
+/\d+/8
+    12abcd34
+ 0: 12
+    *** Failers
+No match
+
+/\d{2,3}/8
+    12abcd34
+ 0: 12
+    1234abcd
+ 0: 123
+    *** Failers  
+No match
+    1.4 
+No match
+
+/\d{2,3}?/8
+    12abcd34
+ 0: 12
+    1234abcd
+ 0: 12
+    *** Failers  
+No match
+    1.4 
+No match
+
+/\S+/8
+    12abcd34
+ 0: 12abcd34
+    *** Failers
+ 0: ***
+    \    \ 
+No match
+
+/\S{2,3}/8
+    12abcd34
+ 0: 12a
+    1234abcd
+ 0: 123
+    *** Failers
+ 0: ***
+    \     \  
+No match
 
+/\S{2,3}?/8
+    12abcd34
+ 0: 12
+    1234abcd
+ 0: 12
+    *** Failers
+ 0: **
+    \     \  
+No match
+
+/>\s+</8+
+    12>      <34
+ 0: >      <
+ 0+ 34
+    *** Failers
+No match
+
+/>\s{2,3}</8+
+    ab>  <cd
+ 0: >  <
+ 0+ cd
+    ab>   <ce
+ 0: >   <
+ 0+ ce
+    *** Failers
+No match
+    ab>    <cd 
+No match
+
+/>\s{2,3}?</8+
+    ab>  <cd
+ 0: >  <
+ 0+ cd
+    ab>   <ce
+ 0: >   <
+ 0+ ce
+    *** Failers
+No match
+    ab>    <cd 
+No match
+
+/\w+/8
+    12      34
+ 0: 12
+    *** Failers
+ 0: Failers
+    +++=*! 
+No match
+
+/\w{2,3}/8
+    ab  cd
+ 0: ab
+    abcd ce
+ 0: abc
+    *** Failers
+ 0: Fai
+    a.b.c
+No match
+
+/\w{2,3}?/8
+    ab  cd
+ 0: ab
+    abcd ce
+ 0: ab
+    *** Failers
+ 0: Fa
+    a.b.c
+No match
+
+/\W+/8
+    12====34
+ 0: ====
+    *** Failers
+ 0: *** 
+    abcd 
+No match
+
+/\W{2,3}/8
+    ab====cd
+ 0: ===
+    ab==cd
+ 0: ==
+    *** Failers
+ 0: ***
+    a.b.c
+No match
+
+/\W{2,3}?/8
+    ab====cd
+ 0: ==
+    ab==cd
+ 0: ==
+    *** Failers
+ 0: **
+    a.b.c
+No match
+
+/[\x{100}]/8
+    \x{100}
+ 0: \x{100}
+    Z\x{100}
+ 0: \x{100}
+    \x{100}Z
+ 0: \x{100}
+    *** Failers 
+No match
+
+/[Z\x{100}]/8
+    Z\x{100}
+ 0: Z
+    \x{100}
+ 0: \x{100}
+    \x{100}Z
+ 0: \x{100}
+    *** Failers 
+No match
+
+/[\x{100}\x{200}]/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 0: \x{200}
+   *** Failers  
+No match
+
+/[\x{100}-\x{200}]/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 0: \x{200}
+   ab\x{111}cd 
+ 0: \x{111}
+   *** Failers  
+No match
+
+/[z-\x{200}]/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 0: \x{200}
+   ab\x{111}cd 
+ 0: \x{111}
+   abzcd
+ 0: z
+   ab|cd  
+ 0: |
+   *** Failers  
+No match
+
+/[Q\x{100}\x{200}]/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 0: \x{200}
+   Q? 
+ 0: Q
+   *** Failers  
+No match
+
+/[Q\x{100}-\x{200}]/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 0: \x{200}
+   ab\x{111}cd 
+ 0: \x{111}
+   Q? 
+ 0: Q
+   *** Failers  
+No match
+
+/[Qz-\x{200}]/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 0: \x{200}
+   ab\x{111}cd 
+ 0: \x{111}
+   abzcd
+ 0: z
+   ab|cd  
+ 0: |
+   Q? 
+ 0: Q
+   *** Failers  
+No match
+
+/[\x{100}\x{200}]{1,3}/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 0: \x{200}
+   ab\x{200}\x{100}\x{200}\x{100}cd
+ 0: \x{200}\x{100}\x{200}
+   *** Failers  
+No match
+
+/[\x{100}\x{200}]{1,3}?/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 0: \x{200}
+   ab\x{200}\x{100}\x{200}\x{100}cd
+ 0: \x{200}
+   *** Failers  
+No match
+
+/[Q\x{100}\x{200}]{1,3}/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 0: \x{200}
+   ab\x{200}\x{100}\x{200}\x{100}cd
+ 0: \x{200}\x{100}\x{200}
+   *** Failers  
+No match
+
+/[Q\x{100}\x{200}]{1,3}?/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 0: \x{200}
+   ab\x{200}\x{100}\x{200}\x{100}cd
+ 0: \x{200}
+   *** Failers  
+No match
+
+/(?<=[\x{100}\x{200}])X/8
+    abc\x{200}X
+ 0: X
+    abc\x{100}X 
+ 0: X
+    *** Failers
+No match
+    X  
+No match
+
+/(?<=[Q\x{100}\x{200}])X/8
+    abc\x{200}X
+ 0: X
+    abc\x{100}X 
+ 0: X
+    abQX 
+ 0: X
+    *** Failers
+No match
+    X  
+No match
+
+/(?<=[\x{100}\x{200}]{3})X/8
+    abc\x{100}\x{200}\x{100}X
+ 0: X
+    *** Failers
+No match
+    abc\x{200}X
+No match
+    X  
+No match
+
+/[^\x{100}\x{200}]X/8
+    AX
+ 0: AX
+    \x{150}X
+ 0: \x{150}X
+    \x{500}X 
+ 0: \x{500}X
+    *** Failers
+No match
+    \x{100}X
+No match
+    \x{200}X   
+No match
+
+/[^Q\x{100}\x{200}]X/8
+    AX
+ 0: AX
+    \x{150}X
+ 0: \x{150}X
+    \x{500}X 
+ 0: \x{500}X
+    *** Failers
+No match
+    \x{100}X
+No match
+    \x{200}X   
+No match
+    QX 
+No match
+
+/[^\x{100}-\x{200}]X/8
+    AX
+ 0: AX
+    \x{500}X 
+ 0: \x{500}X
+    *** Failers
+No match
+    \x{100}X
+No match
+    \x{150}X
+No match
+    \x{200}X   
+No match
+
+/a\Cb/
+    aXb
+ 0: aXb
+    a\nb
+ 0: a\x0ab
+  
+/a\Cb/8
+    aXb
+ 0: aXb
+    a\nb
+ 0: a\x{0a}b
+    *** Failers 
+No match
+    a\x{100}b 
+No match
+
+/[z-\x{100}]/8i
+    z
+ 0: z
+    Z 
+ 0: Z
+    \x{100}
+ 0: \x{100}
+    *** Failers
+No match
+    \x{102}
+No match
+    y    
+No match
+
+/[\xFF]/
+    >\xff<
+ 0: \xff
+
+/[\xff]/8
+    >\x{ff}<
+ 0: \x{ff}
+
+/[^\xFF]/
+    XYZ
+ 0: X
+
+/[^\xff]/8
+    XYZ
+ 0: X
+    \x{123} 
+ 0: \x{123}
+
+/^[ac]*b/8
+  xb
+No match
+
+/^[ac\x{100}]*b/8
+  xb
+No match
+
+/^[^x]*b/8i
+  xb
+No match
+
+/^[^x]*b/8
+  xb
+No match
+  
+/^\d*b/8
+  xb 
+No match
+
+/(|a)/g8
+    catac
+ 0: 
+ 1: 
+ 0: 
+ 1: 
+ 0: a
+ 1: a
+ 0: 
+ 1: 
+ 0: 
+ 1: 
+ 0: a
+ 1: a
+ 0: 
+ 1: 
+ 0: 
+ 1: 
+    a\x{256}a 
+ 0: 
+ 1: 
+ 0: a
+ 1: a
+ 0: 
+ 1: 
+ 0: 
+ 1: 
+ 0: a
+ 1: a
+ 0: 
+ 1: 
+
+/^\x{85}$/8i
+    \x{85}
+ 0: \x{85}
+
+/ End of testinput4 /
index 01daca505ee1498265d57522b2bbfc93a35eeb38..6e0d41802050841f363621288b882eb4b98aea1b 100644 (file)
@@ -1,12 +1,12 @@
-PCRE version 3.92 11-Sep-2002
+PCRE version 6.2 01-Aug-2005
 
 /\x{100}/8DM
-Memory allocation (code space): 11
+Memory allocation (code space): 10
 ------------------------------------------------------------------
-  0   7 Bra 0
-  3   2 \xc4\x80
-  7   7 Ket
10     End
+  0   6 Bra 0
+  3     \x{100}
+  6   6 Ket
 9     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -14,12 +14,12 @@ First char = 196
 Need char = 128
 
 /\x{1000}/8DM
-Memory allocation (code space): 12
+Memory allocation (code space): 11
 ------------------------------------------------------------------
-  0   8 Bra 0
-  3   3 \xe1\x80\x80
-  8   8 Ket
- 11     End
+  0   7 Bra 0
+  3     \x{1000}
+  7   7 Ket
+ 10     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -27,12 +27,12 @@ First char = 225
 Need char = 128
 
 /\x{10000}/8DM
-Memory allocation (code space): 13
+Memory allocation (code space): 12
 ------------------------------------------------------------------
-  0   9 Bra 0
-  3   4 \xf0\x90\x80\x80
-  9   9 Ket
- 12     End
+  0   8 Bra 0
+  3     \x{10000}
+  8   8 Ket
+ 11     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -40,12 +40,12 @@ First char = 240
 Need char = 128
 
 /\x{100000}/8DM
-Memory allocation (code space): 13
+Memory allocation (code space): 12
 ------------------------------------------------------------------
-  0   9 Bra 0
-  3   4 \xf4\x80\x80\x80
-  9   9 Ket
- 12     End
+  0   8 Bra 0
+  3     \x{100000}
+  8   8 Ket
+ 11     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -53,12 +53,12 @@ First char = 244
 Need char = 128
 
 /\x{1000000}/8DM
-Memory allocation (code space): 14
+Memory allocation (code space): 13
 ------------------------------------------------------------------
-  0  10 Bra 0
-  3   5 \xf9\x80\x80\x80\x80
10  10 Ket
- 13     End
+  0   9 Bra 0
+  3     \x{1000000}
 9   9 Ket
+ 12     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -66,12 +66,12 @@ First char = 249
 Need char = 128
 
 /\x{4000000}/8DM
-Memory allocation (code space): 15
+Memory allocation (code space): 14
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3   6 \xfc\x84\x80\x80\x80\x80
- 11  11 Ket
- 14     End
+  0  10 Bra 0
+  3     \x{4000000}
+ 10  10 Ket
+ 13     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -79,12 +79,12 @@ First char = 252
 Need char = 128
 
 /\x{7fffFFFF}/8DM
-Memory allocation (code space): 15
+Memory allocation (code space): 14
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3   6 \xfd\xbf\xbf\xbf\xbf\xbf
- 11  11 Ket
- 14     End
+  0  10 Bra 0
+  3     \x{7fffffff}
+ 10  10 Ket
+ 13     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -92,20 +92,30 @@ First char = 253
 Need char = 191
 
 /[\x{ff}]/8DM
-Memory allocation (code space): 40
+Memory allocation (code space): 10
 ------------------------------------------------------------------
   0   6 Bra 0
-  3   1 \xff
+  3     \x{ff}
   6   6 Ket
   9     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
-First char = 255
-No need char
+First char = 195
+Need char = 191
 
 /[\x{100}]/8DM
-Failed: characters with values > 255 are not yet supported in classes at offset 7
+Memory allocation (code space): 47
+------------------------------------------------------------------
+  0  11 Bra 0
+  3     [\x{100}]
+ 11  11 Ket
+ 14     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: utf8
+No first char
+No need char
 
 /\x{ffffffff}/8
 Failed: character value in \x{...} sequence is too large at offset 11
@@ -119,10 +129,10 @@ Failed: character value in \x{...} sequence is too large at offset 12
 
 /\x80/8D
 ------------------------------------------------------------------
-  0   7 Bra 0
-  3   2 \xc2\x80
-  7   7 Ket
10     End
+  0   6 Bra 0
+  3     \x{80}
+  6   6 Ket
 9     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -131,10 +141,10 @@ Need char = 128
 
 /\xff/8D
 ------------------------------------------------------------------
-  0   7 Bra 0
-  3   2 \xc3\xbf
-  7   7 Ket
10     End
+  0   6 Bra 0
+  3     \x{ff}
+  6   6 Ket
 9     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -143,10 +153,10 @@ Need char = 191
 
 /\x{0041}\x{2262}\x{0391}\x{002e}/D8
 ------------------------------------------------------------------
-  0  12 Bra 0
-  3   7 A\xe2\x89\xa2\xce\x91.
- 12  12 Ket
- 15     End
+  0  14 Bra 0
+  3     A\x{2262}\x{391}.
+ 14  14 Ket
+ 17     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -157,10 +167,10 @@ Need char = '.'
     
 /\x{D55c}\x{ad6d}\x{C5B4}/D8 
 ------------------------------------------------------------------
-  0  14 Bra 0
-  3   9 \xed\x95\x9c\xea\xb5\xad\xec\x96\xb4
- 14  14 Ket
- 17     End
+  0  15 Bra 0
+  3     \x{d55c}\x{ad6d}\x{c5b4}
+ 15  15 Ket
+ 18     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -171,10 +181,10 @@ Need char = 180
 
 /\x{65e5}\x{672c}\x{8a9e}/D8
 ------------------------------------------------------------------
-  0  14 Bra 0
-  3   9 \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e
- 14  14 Ket
- 17     End
+  0  15 Bra 0
+  3     \x{65e5}\x{672c}\x{8a9e}
+ 15  15 Ket
+ 18     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -185,10 +195,10 @@ Need char = 158
 
 /\x{80}/D8
 ------------------------------------------------------------------
-  0   7 Bra 0
-  3   2 \xc2\x80
-  7   7 Ket
10     End
+  0   6 Bra 0
+  3     \x{80}
+  6   6 Ket
 9     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -197,10 +207,10 @@ Need char = 128
 
 /\x{084}/D8
 ------------------------------------------------------------------
-  0   7 Bra 0
-  3   2 \xc2\x84
-  7   7 Ket
10     End
+  0   6 Bra 0
+  3     \x{84}
+  6   6 Ket
 9     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -209,10 +219,10 @@ Need char = 132
 
 /\x{104}/D8
 ------------------------------------------------------------------
-  0   7 Bra 0
-  3   2 \xc4\x84
-  7   7 Ket
10     End
+  0   6 Bra 0
+  3     \x{104}
+  6   6 Ket
 9     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -221,10 +231,10 @@ Need char = 132
 
 /\x{861}/D8
 ------------------------------------------------------------------
-  0   8 Bra 0
-  3   3 \xe0\xa1\xa1
-  8   8 Ket
- 11     End
+  0   7 Bra 0
+  3     \x{861}
+  7   7 Ket
+ 10     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -233,10 +243,10 @@ Need char = 161
 
 /\x{212ab}/D8
 ------------------------------------------------------------------
-  0   9 Bra 0
-  3   4 \xf0\xa1\x8a\xab
-  9   9 Ket
- 12     End
+  0   8 Bra 0
+  3     \x{212ab}
+  8   8 Ket
+ 11     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
@@ -245,14 +255,15 @@ Need char = 171
 
 /.{3,5}X/D8
 ------------------------------------------------------------------
-  0  14 Bra 0
+  0  13 Bra 0
   3     Any{3}
   7     Any{0,2}
- 11   1 X
- 14  14 Ket
- 17     End
+ 11     X
+ 13  13 Ket
+ 16     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
+Partial matching not supported
 Options: utf8
 No first char
 Need char = 'X'
@@ -269,6 +280,7 @@ Need char = 'X'
  14     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
+Partial matching not supported
 Options: utf8
 No first char
 No need char
@@ -334,6 +346,730 @@ No match
  0: X\x{0a}abc
  1: \x{0a}
  2: abc
+    
+/^[ab]/8D
+------------------------------------------------------------------
+  0  37 Bra 0
+  3     ^
+  4     [ab]
+ 37  37 Ket
+ 40     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: anchored utf8
+No first char
+No need char
+    bar
+ 0: b
+    *** Failers
+No match
+    c
+No match
+    \x{ff}
+No match
+    \x{100}  
+No match
 
-/ End of testinput5 /
+/^[^ab]/8D
+------------------------------------------------------------------
+  0  37 Bra 0
+  3     ^
+  4     [\x00-`c-\xff] (neg)
+ 37  37 Ket
+ 40     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: anchored utf8
+No first char
+No need char
+    c
+ 0: c
+    \x{ff}
+ 0: \x{ff}
+    \x{100}  
+ 0: \x{100}
+    *** Failers 
+ 0: *
+    aaa
+No match
+  
+/[^ab\xC0-\xF0]/8SD
+------------------------------------------------------------------
+  0  36 Bra 0
+  3     [\x00-`c-\xbf\xf1-\xff] (neg)
+ 36  36 Ket
+ 39     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: utf8
+No first char
+No need char
+Starting byte set: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a 
+  \x0b \x0c \x0d \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 
+  \x1a \x1b \x1c \x1d \x1e \x1f \x20 ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 
+  5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y 
+  Z [ \ ] ^ _ ` c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ \x7f 
+  \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf \xd0 
+  \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb \xdc \xdd \xde \xdf 
+  \xe0 \xe1 \xe2 \xe3 \xe4 \xe5 \xe6 \xe7 \xe8 \xe9 \xea \xeb \xec \xed \xee 
+  \xef \xf0 \xf1 \xf2 \xf3 \xf4 \xf5 \xf6 \xf7 \xf8 \xf9 \xfa \xfb \xfc \xfd 
+  \xfe \xff 
+    \x{f1}
+ 0: \x{f1}
+    \x{bf}
+ 0: \x{bf}
+    \x{100}
+ 0: \x{100}
+    \x{1000}   
+ 0: \x{1000}
+    *** Failers
+ 0: *
+    \x{c0} 
+No match
+    \x{f0} 
+No match
+
+/Ā{3,4}/8SD
+------------------------------------------------------------------
+  0  13 Bra 0
+  3     \x{100}{3}
+  8     \x{100}{,1}
+ 13  13 Ket
+ 16     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+First char = 196
+Need char = 128
+Study returned NULL
+  \x{100}\x{100}\x{100}\x{100\x{100}
+ 0: \x{100}\x{100}\x{100}
+
+/(\x{100}+|x)/8SD
+------------------------------------------------------------------
+  0  17 Bra 0
+  3   6 Bra 1
+  6     \x{100}+
+  9   5 Alt
+ 12     x
+ 14  11 Ket
+ 17  17 Ket
+ 20     End
+------------------------------------------------------------------
+Capturing subpattern count = 1
+Partial matching not supported
+Options: utf8
+No first char
+No need char
+Starting byte set: x \xc4 
+
+/(\x{100}*a|x)/8SD
+------------------------------------------------------------------
+  0  19 Bra 0
+  3   8 Bra 1
+  6     \x{100}*
+  9     a
+ 11   5 Alt
+ 14     x
+ 16  13 Ket
+ 19  19 Ket
+ 22     End
+------------------------------------------------------------------
+Capturing subpattern count = 1
+Partial matching not supported
+Options: utf8
+No first char
+No need char
+Starting byte set: a x \xc4 
+
+/(\x{100}{0,2}a|x)/8SD
+------------------------------------------------------------------
+  0  21 Bra 0
+  3  10 Bra 1
+  6     \x{100}{,2}
+ 11     a
+ 13   5 Alt
+ 16     x
+ 18  15 Ket
+ 21  21 Ket
+ 24     End
+------------------------------------------------------------------
+Capturing subpattern count = 1
+Partial matching not supported
+Options: utf8
+No first char
+No need char
+Starting byte set: a x \xc4 
+
+/(\x{100}{1,2}a|x)/8SD
+------------------------------------------------------------------
+  0  24 Bra 0
+  3  13 Bra 1
+  6     \x{100}
+  9     \x{100}{,1}
+ 14     a
+ 16   5 Alt
+ 19     x
+ 21  18 Ket
+ 24  24 Ket
+ 27     End
+------------------------------------------------------------------
+Capturing subpattern count = 1
+Partial matching not supported
+Options: utf8
+No first char
+No need char
+Starting byte set: x \xc4 
+
+/\x{100}*(\d+|"(?1)")/8
+    1234
+ 0: 1234
+ 1: 1234
+    "1234" 
+ 0: "1234"
+ 1: "1234"
+    \x{100}1234
+ 0: \x{100}1234
+ 1: 1234
+    "\x{100}1234"  
+ 0: \x{100}1234
+ 1: 1234
+    \x{100}\x{100}12ab 
+ 0: \x{100}\x{100}12
+ 1: 12
+    \x{100}\x{100}"12" 
+ 0: \x{100}\x{100}"12"
+ 1: "12"
+    *** Failers 
+No match
+    \x{100}\x{100}abcd
+No match
+
+/\x{100}/8D
+------------------------------------------------------------------
+  0   6 Bra 0
+  3     \x{100}
+  6   6 Ket
+  9     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: utf8
+First char = 196
+Need char = 128
+
+/\x{100}*/8D
+------------------------------------------------------------------
+  0   6 Bra 0
+  3     \x{100}*
+  6   6 Ket
+  9     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+No first char
+No need char
 
+/a\x{100}*/8D
+------------------------------------------------------------------
+  0   8 Bra 0
+  3     a
+  5     \x{100}*
+  8   8 Ket
+ 11     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+First char = 'a'
+No need char
+
+/ab\x{100}*/8D
+------------------------------------------------------------------
+  0  10 Bra 0
+  3     ab
+  7     \x{100}*
+ 10  10 Ket
+ 13     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+First char = 'a'
+Need char = 'b'
+
+/a\x{100}\x{101}*/8D
+------------------------------------------------------------------
+  0  11 Bra 0
+  3     a\x{100}
+  8     \x{101}*
+ 11  11 Ket
+ 14     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+First char = 'a'
+Need char = 128
+
+/a\x{100}\x{101}+/8D
+------------------------------------------------------------------
+  0  11 Bra 0
+  3     a\x{100}
+  8     \x{101}+
+ 11  11 Ket
+ 14     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+First char = 'a'
+Need char = 129
+
+/\x{100}*A/8D
+------------------------------------------------------------------
+  0   8 Bra 0
+  3     \x{100}*
+  6     A
+  8   8 Ket
+ 11     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+No first char
+Need char = 'A'
+    A
+ 0: A
+
+/\x{100}*\d(?R)/8D
+------------------------------------------------------------------
+  0  10 Bra 0
+  3     \x{100}*
+  6     \d
+  7   0 Recurse
+ 10  10 Ket
+ 13     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Partial matching not supported
+Options: utf8
+No first char
+No need char
+
+/[^\x{c4}]/D
+------------------------------------------------------------------
+  0  36 Bra 0
+  3     [\x01-35-bd-z|~-\xff] (neg)
+ 36  36 Ket
+ 39     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+No options
+No first char
+No need char
+
+/[^\x{c4}]/8D
+------------------------------------------------------------------
+  0  36 Bra 0
+  3     [\x00-\xc3\xc5-\xff] (neg)
+ 36  36 Ket
+ 39     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: utf8
+No first char
+No need char
+
+/[\x{100}]/8DM
+Memory allocation (code space): 47
+------------------------------------------------------------------
+  0  11 Bra 0
+  3     [\x{100}]
+ 11  11 Ket
+ 14     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: utf8
+No first char
+No need char
+    \x{100}
+ 0: \x{100}
+    Z\x{100}
+ 0: \x{100}
+    \x{100}Z
+ 0: \x{100}
+    *** Failers 
+No match
+
+/[Z\x{100}]/8DM
+Memory allocation (code space): 47
+------------------------------------------------------------------
+  0  43 Bra 0
+  3     [Z\x{100}]
+ 43  43 Ket
+ 46     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: utf8
+No first char
+No need char
+    Z\x{100}
+ 0: Z
+    \x{100}
+ 0: \x{100}
+    \x{100}Z
+ 0: \x{100}
+    *** Failers 
+No match
+
+/[\x{200}-\x{100}]/8
+Failed: range out of order in character class at offset 15
+
+/[Ā-Ą]/8
+    \x{100}
+ 0: \x{100}
+    \x{104}
+ 0: \x{104}
+    *** Failers
+No match
+    \x{105}
+No match
+    \x{ff}    
+No match
+
+/[z-\x{100}]/8D
+------------------------------------------------------------------
+  0  12 Bra 0
+  3     [z-\x{100}]
+ 12  12 Ket
+ 15     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: utf8
+No first char
+No need char
+
+/[z\Qa-d]Ā\E]/8D
+------------------------------------------------------------------
+  0  43 Bra 0
+  3     [\-\]adz\x{100}]
+ 43  43 Ket
+ 46     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: utf8
+No first char
+No need char
+    \x{100}
+ 0: \x{100}
+    Ā 
+ 0: \x{100}
+
+/[\xFF]/D
+------------------------------------------------------------------
+  0   5 Bra 0
+  3     \xff
+  5   5 Ket
+  8     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+No options
+First char = 255
+No need char
+    >\xff<
+ 0: \xff
+
+/[\xff]/D8
+------------------------------------------------------------------
+  0   6 Bra 0
+  3     \x{ff}
+  6   6 Ket
+  9     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: utf8
+First char = 195
+Need char = 191
+    >\x{ff}<
+ 0: \x{ff}
+
+/[^\xFF]/D
+------------------------------------------------------------------
+  0   5 Bra 0
+  3     [^\xff]
+  5   5 Ket
+  8     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+No options
+No first char
+No need char
+
+/[^\xff]/8D
+------------------------------------------------------------------
+  0  36 Bra 0
+  3     [\x00-\xfe] (neg)
+ 36  36 Ket
+ 39     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: utf8
+No first char
+No need char
+
+/[Ä-Ü]/8
+    Ö # Matches without Study
+ 0: \x{d6}
+    \x{d6}
+ 0: \x{d6}
+    
+/[Ä-Ü]/8S
+    Ö <-- Same with Study
+ 0: \x{d6}
+    \x{d6}
+ 0: \x{d6}
+    
+/[\x{c4}-\x{dc}]/8 
+    Ö # Matches without Study
+ 0: \x{d6}
+    \x{d6} 
+ 0: \x{d6}
+
+/[\x{c4}-\x{dc}]/8S
+    Ö <-- Same with Study
+ 0: \x{d6}
+    \x{d6} 
+ 0: \x{d6}
+
+/[Ã]/8
+Failed: invalid UTF-8 string at offset 2
+
+/Ã/8
+Failed: invalid UTF-8 string at offset 0
+
+/ÃÃÃxxx/8
+Failed: invalid UTF-8 string at offset 1
+
+/ÃÃÃxxx/8?D
+------------------------------------------------------------------
+  0  15 Bra 0
+  3     \X{c0}\X{c0}\X{c0}xxx
+ 15  15 Ket
+ 18     End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: utf8 no_utf8_check
+First char = 195
+Need char = 'x'
+
+/abc/8
+    Ã]
+Error -10
+    Ã
+Error -10
+    ÃÃÃ
+Error -10
+    ÃÃÃ\?
+No match
+
+/anything/8
+    \xc0\x80
+Error -10
+    \xc1\x8f 
+Error -10
+    \xe0\x9f\x80
+Error -10
+    \xf0\x8f\x80\x80 
+Error -10
+    \xf8\x87\x80\x80\x80  
+Error -10
+    \xfc\x83\x80\x80\x80\x80
+Error -10
+    \xfe\x80\x80\x80\x80\x80  
+Error -10
+    \xff\x80\x80\x80\x80\x80  
+Error -10
+    \xc3\x8f
+No match
+    \xe0\xaf\x80
+No match
+    \xe1\x80\x80
+No match
+    \xf0\x9f\x80\x80 
+No match
+    \xf1\x8f\x80\x80 
+No match
+    \xf8\x88\x80\x80\x80  
+No match
+    \xf9\x87\x80\x80\x80  
+No match
+    \xfc\x84\x80\x80\x80\x80
+No match
+    \xfd\x83\x80\x80\x80\x80
+No match
+
+/\x{100}abc(xyz(?1))/8D
+------------------------------------------------------------------
+  0  27 Bra 0
+  3     \x{100}abc
+ 12  12 Bra 1
+ 15     xyz
+ 21  12 Recurse
+ 24  12 Ket
+ 27  27 Ket
+ 30     End
+------------------------------------------------------------------
+Capturing subpattern count = 1
+Options: utf8
+First char = 196
+Need char = 'z'
+
+/[^\x{100}]abc(xyz(?1))/8D
+------------------------------------------------------------------
+  0  32 Bra 0
+  3     [^\x{100}]
+ 11     abc
+ 17  12 Bra 1
+ 20     xyz
+ 26  17 Recurse
+ 29  12 Ket
+ 32  32 Ket
+ 35     End
+------------------------------------------------------------------
+Capturing subpattern count = 1
+Options: utf8
+No first char
+Need char = 'z'
+
+/[ab\x{100}]abc(xyz(?1))/8D
+------------------------------------------------------------------
+  0  64 Bra 0
+  3     [ab\x{100}]
+ 43     abc
+ 49  12 Bra 1
+ 52     xyz
+ 58  49 Recurse
+ 61  12 Ket
+ 64  64 Ket
+ 67     End
+------------------------------------------------------------------
+Capturing subpattern count = 1
+Options: utf8
+No first char
+Need char = 'z'
+
+/(\x{100}(b(?2)c))?/D8
+------------------------------------------------------------------
+  0  26 Bra 0
+  3     Brazero
+  4  19 Bra 1
+  7     \x{100}
+ 10  10 Bra 2
+ 13     b
+ 15  10 Recurse
+ 18     c
+ 20  10 Ket
+ 23  19 Ket
+ 26  26 Ket
+ 29     End
+------------------------------------------------------------------
+Capturing subpattern count = 2
+Options: utf8
+No first char
+No need char
+
+/(\x{100}(b(?2)c)){0,2}/D8
+------------------------------------------------------------------
+  0  55 Bra 0
+  3     Brazero
+  4  48 Bra 0
+  7  19 Bra 1
+ 10     \x{100}
+ 13  10 Bra 2
+ 16     b
+ 18  13 Recurse
+ 21     c
+ 23  10 Ket
+ 26  19 Ket
+ 29     Brazero
+ 30  19 Bra 1
+ 33     \x{100}
+ 36  10 Bra 2
+ 39     b
+ 41  13 Recurse
+ 44     c
+ 46  10 Ket
+ 49  19 Ket
+ 52  48 Ket
+ 55  55 Ket
+ 58     End
+------------------------------------------------------------------
+Capturing subpattern count = 2
+Options: utf8
+No first char
+No need char
+
+/(\x{100}(b(?1)c))?/D8
+------------------------------------------------------------------
+  0  26 Bra 0
+  3     Brazero
+  4  19 Bra 1
+  7     \x{100}
+ 10  10 Bra 2
+ 13     b
+ 15   4 Recurse
+ 18     c
+ 20  10 Ket
+ 23  19 Ket
+ 26  26 Ket
+ 29     End
+------------------------------------------------------------------
+Capturing subpattern count = 2
+Options: utf8
+No first char
+No need char
+
+/(\x{100}(b(?1)c)){0,2}/D8
+------------------------------------------------------------------
+  0  55 Bra 0
+  3     Brazero
+  4  48 Bra 0
+  7  19 Bra 1
+ 10     \x{100}
+ 13  10 Bra 2
+ 16     b
+ 18   7 Recurse
+ 21     c
+ 23  10 Ket
+ 26  19 Ket
+ 29     Brazero
+ 30  19 Bra 1
+ 33     \x{100}
+ 36  10 Bra 2
+ 39     b
+ 41   7 Recurse
+ 44     c
+ 46  10 Ket
+ 49  19 Ket
+ 52  48 Ket
+ 55  55 Ket
+ 58     End
+------------------------------------------------------------------
+Capturing subpattern count = 2
+Options: utf8
+No first char
+No need char
+
+/\W/8
+    A.B
+ 0: .
+    A\x{100}B 
+ 0: \x{100}
+  
+/\w/8
+    \x{100}X   
+ 0: X
+
+/ End of testinput5 /
index fcf084670fa37a4259c5172deff30f705133a0c6..9f9421e51937b0a44f3cbbcc001451da51122592 100644 (file)
-PCRE version 3.9 02-Jan-2002
+PCRE version 6.2 01-Aug-2005
 
-/\x{100}/8DM
-Memory allocation (code space): 11
-------------------------------------------------------------------
-  0   7 Bra 0
-  3   2 \xc4\x80
-  7   7 Ket
- 10     End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 196
-Need char = 128
+/^\pC\pL\pM\pN\pP\pS\pZ</8
+    \x7f\x{c0}\x{30f}\x{660}\x{66c}\x{f01}\x{1680}<
+ 0: \x{7f}\x{c0}\x{30f}\x{660}\x{66c}\x{f01}\x{1680}<
+    \np\x{300}9!\$ < 
+ 0: \x{0a}p\x{300}9!$ <
+    ** Failers 
+No match
+    ap\x{300}9!\$ < 
+No match
+  
+/^\PC/8
+    X
+ 0: X
+    ** Failers 
+ 0: *
+    \x7f
+No match
+  
+/^\PL/8
+    9
+ 0: 9
+    ** Failers 
+ 0: *
+    \x{c0}
+No match
+  
+/^\PM/8
+    X
+ 0: X
+    ** Failers 
+ 0: *
+    \x{30f}
+No match
+  
+/^\PN/8
+    X
+ 0: X
+    ** Failers 
+ 0: *
+    \x{660}
+No match
+  
+/^\PP/8
+    X
+ 0: X
+    ** Failers 
+No match
+    \x{66c}
+No match
+  
+/^\PS/8
+    X
+ 0: X
+    ** Failers 
+ 0: *
+    \x{f01}
+No match
+  
+/^\PZ/8
+    X
+ 0: X
+    ** Failers 
+ 0: *
+    \x{1680}
+No match
+    
+/^\p{Cc}/8
+    \x{017}
+ 0: \x{17}
+    \x{09f} 
+ 0: \x{9f}
+    ** Failers
+No match
+    \x{0600} 
+No match
+  
+/^\p{Cf}/8
+    \x{601}
+ 0: \x{601}
+    ** Failers
+No match
+    \x{09f} 
+No match
+  
+/^\p{Cn}/8
+    ** Failers
+No match
+    \x{09f} 
+No match
+  
+/^\p{Co}/8
+    \x{f8ff}
+ 0: \x{f8ff}
+    ** Failers
+No match
+    \x{09f} 
+No match
+  
+/^\p{Cs}/8
+    \x{dfff}
+ 0: \x{dfff}
+    ** Failers
+No match
+    \x{09f} 
+No match
+  
+/^\p{Ll}/8
+    a
+ 0: a
+    ** Failers 
+No match
+    Z
+No match
+    \x{dfff}  
+No match
+  
+/^\p{Lm}/8
+    \x{2b0}
+ 0: \x{2b0}
+    ** Failers
+No match
+    a 
+No match
+  
+/^\p{Lo}/8
+    \x{1bb}
+ 0: \x{1bb}
+    ** Failers
+No match
+    a 
+No match
+    \x{2b0}
+No match
+  
+/^\p{Lt}/8
+    \x{1c5}
+ 0: \x{1c5}
+    ** Failers
+No match
+    a 
+No match
+    \x{2b0}
+No match
+  
+/^\p{Lu}/8
+    A
+ 0: A
+    ** Failers
+No match
+    \x{2b0}
+No match
+  
+/^\p{Mc}/8
+    \x{903}
+ 0: \x{903}
+    ** Failers
+No match
+    X
+No match
+    \x{300}
+No match
+       
+/^\p{Me}/8
+    \x{488}
+ 0: \x{488}
+    ** Failers
+No match
+    X
+No match
+    \x{903}
+No match
+    \x{300}
+No match
+  
+/^\p{Mn}/8
+    \x{300}
+ 0: \x{300}
+    ** Failers
+No match
+    X
+No match
+    \x{903}
+No match
+  
+/^\p{Nd}+/8
+    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}
+    \x{6f0}\x{6f1}\x{6f2}\x{6f3}\x{6f4}\x{6f5}\x{6f6}\x{6f7}\x{6f8}\x{6f9}\x{6fa}
+ 0: \x{6f0}\x{6f1}\x{6f2}\x{6f3}\x{6f4}\x{6f5}\x{6f6}\x{6f7}\x{6f8}\x{6f9}
+    \x{966}\x{967}\x{968}\x{969}\x{96a}\x{96b}\x{96c}\x{96d}\x{96e}\x{96f}\x{970}
+ 0: \x{966}\x{967}\x{968}\x{969}\x{96a}\x{96b}\x{96c}\x{96d}\x{96e}\x{96f}
+    ** Failers
+No match
+    X
+No match
+  
+/^\p{Nl}/8
+    \x{16ee}
+ 0: \x{16ee}
+    ** Failers
+No match
+    X
+No match
+    \x{966}
+No match
+  
+/^\p{No}/8
+    \x{b2}
+ 0: \x{b2}
+    \x{b3}
+ 0: \x{b3}
+    ** Failers
+No match
+    X
+No match
+    \x{16ee}
+No match
+  
+/^\p{Pc}/8
+    \x5f
+ 0: _
+    \x{203f}
+ 0: \x{203f}
+    ** Failers
+No match
+    X
+No match
+    -
+No match
+    \x{58a}
+No match
+  
+/^\p{Pd}/8
+    -
+ 0: -
+    \x{58a}
+ 0: \x{58a}
+    ** Failers
+No match
+    X
+No match
+    \x{203f}
+No match
+  
+/^\p{Pe}/8
+    )
+ 0: )
+    ]
+ 0: ]
+    }
+ 0: }
+    \x{f3b}
+ 0: \x{f3b}
+    ** Failers
+No match
+    X
+No match
+    \x{203f}
+No match
+    (
+No match
+    [
+No match
+    {
+No match
+    \x{f3c}
+No match
+  
+/^\p{Pf}/8
+    \x{bb}
+ 0: \x{bb}
+    \x{2019}
+ 0: \x{2019}
+    ** Failers
+No match
+    X
+No match
+    \x{203f}
+No match
+  
+/^\p{Pi}/8
+    \x{ab}
+ 0: \x{ab}
+    \x{2018}
+ 0: \x{2018}
+    ** Failers
+No match
+    X
+No match
+    \x{203f}
+No match
+  
+/^\p{Po}/8
+    !
+ 0: !
+    \x{37e}
+ 0: \x{37e}
+    ** Failers
+ 0: *
+    X
+No match
+    \x{203f}
+No match
+  
+/^\p{Ps}/8
+    (
+ 0: (
+    [
+ 0: [
+    {
+ 0: {
+    \x{f3c}
+ 0: \x{f3c}
+    ** Failers
+No match
+    X
+No match
+    )
+No match
+    ]
+No match
+    }
+No match
+    \x{f3b}
+No match
+  
+/^\p{Sc}+/8
+    $\x{a2}\x{a3}\x{a4}\x{a5}\x{a6}
+ 0: $\x{a2}\x{a3}\x{a4}\x{a5}
+    \x{9f2}
+ 0: \x{9f2}
+    ** Failers
+No match
+    X
+No match
+    \x{2c2}
+No match
+  
+/^\p{Sk}/8
+    \x{2c2}
+ 0: \x{2c2}
+    ** Failers
+No match
+    X
+No match
+    \x{9f2}
+No match
+  
+/^\p{Sm}+/8
+    +<|~\x{ac}\x{2044}
+ 0: +<|~\x{ac}\x{2044}
+    ** Failers
+No match
+    X
+No match
+    \x{9f2}
+No match
+  
+/^\p{So}/8
+    \x{a6}
+ 0: \x{a6}
+    \x{482} 
+ 0: \x{482}
+    ** Failers
+No match
+    X
+No match
+    \x{9f2}
+No match
+  
+/^\p{Zl}/8
+    \x{2028}
+ 0: \x{2028}
+    ** Failers
+No match
+    X
+No match
+    \x{2029}
+No match
+  
+/^\p{Zp}/8
+    \x{2029}
+ 0: \x{2029}
+    ** Failers
+No match
+    X
+No match
+    \x{2028}
+No match
+  
+/^\p{Zs}/8
+    \ \
+ 0:  
+    \x{a0}
+ 0: \x{a0}
+    \x{1680}
+ 0: \x{1680}
+    \x{180e}
+ 0: \x{180e}
+    \x{2000}
+ 0: \x{2000}
+    \x{2001}     
+ 0: \x{2001}
+    ** Failers
+No match
+    \x{2028}
+No match
+    \x{200d} 
+No match
+  
+/\p{Nd}+(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}AB
+ 1: AB
+  
+/\p{Nd}+?(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}
+ 1: \x{661}\x{662}
+  
+/\p{Nd}{2,}(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}AB
+ 1: AB
+  
+/\p{Nd}{2,}?(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}A
+ 1: \x{662}A
+  
+/\p{Nd}*(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}AB
+ 1: AB
+  
+/\p{Nd}*?(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}
+ 1: \x{660}\x{661}
+  
+/\p{Nd}{2}(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}A
+ 1: \x{662}A
+  
+/\p{Nd}{2,3}(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}AB
+ 1: AB
+  
+/\p{Nd}{2,3}?(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}A
+ 1: \x{662}A
+  
+/\p{Nd}?(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}
+ 1: \x{661}\x{662}
+  
+/\p{Nd}??(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}
+ 1: \x{660}\x{661}
+  
+/\p{Nd}*+(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}AB
+ 1: AB
+  
+/\p{Nd}*+(...)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}ABC
+ 1: ABC
+  
+/\p{Nd}*+(....)/8
+      ** Failers
+ 0: ** F
+ 1: ** F
+      \x{660}\x{661}\x{662}ABC
+No match
+  
+/\p{Lu}/8i
+    A
+ 0: A
+    a\x{10a0}B 
+ 0: \x{10a0}
+    ** Failers 
+ 0: F
+    a
+No match
+    \x{1d00}  
+No match
 
-/\x{1000}/8DM
-Memory allocation (code space): 12
+/\p{^Lu}/8i
+    1234
+ 0: 1
+    ** Failers
+ 0: *
+    ABC 
+No match
+
+/\P{Lu}/8i
+    1234
+ 0: 1
+    ** Failers
+ 0: *
+    ABC 
+No match
+
+/(?<=A\p{Nd})XYZ/8
+    A2XYZ
+ 0: XYZ
+    123A5XYZPQR
+ 0: XYZ
+    ABA\x{660}XYZpqr
+ 0: XYZ
+    ** Failers
+No match
+    AXYZ
+No match
+    XYZ     
+No match
+    
+/(?<!\pL)XYZ/8
+    1XYZ
+ 0: XYZ
+    AB=XYZ.. 
+ 0: XYZ
+    XYZ 
+ 0: XYZ
+    ** Failers
+No match
+    WXYZ 
+No match
+
+/[\p{L}]/D
 ------------------------------------------------------------------
-  0   8 Bra 0
-  3   3 \xe1\x80\x80
 8   8 Ket
- 11     End
+  0  10 Bra 0
+  3     [\p{L}]
10  10 Ket
+ 13     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
-Options: utf8
-First char = 225
-Need char = 128
+No options
+No first char
+No need char
 
-/\x{10000}/8DM
-Memory allocation (code space): 13
+/[\p{^L}]/D
 ------------------------------------------------------------------
-  0   9 Bra 0
-  3   4 \xf0\x90\x80\x80
 9   9 Ket
- 12     End
+  0  10 Bra 0
+  3     [\P{L}]
10  10 Ket
+ 13     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
-Options: utf8
-First char = 240
-Need char = 128
+No options
+No first char
+No need char
 
-/\x{100000}/8DM
-Memory allocation (code space): 13
+/[\P{L}]/D
 ------------------------------------------------------------------
-  0   9 Bra 0
-  3   4 \xf4\x80\x80\x80
 9   9 Ket
- 12     End
+  0  10 Bra 0
+  3     [\P{L}]
10  10 Ket
+ 13     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
-Options: utf8
-First char = 244
-Need char = 128
+No options
+No first char
+No need char
 
-/\x{1000000}/8DM
-Memory allocation (code space): 14
+/[\P{^L}]/D
 ------------------------------------------------------------------
   0  10 Bra 0
-  3   5 \xf9\x80\x80\x80\x80
+  3     [\p{L}]
  10  10 Ket
  13     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
-Options: utf8
-First char = 249
-Need char = 128
+No options
+No first char
+No need char
 
-/\x{4000000}/8DM
-Memory allocation (code space): 15
+/[abc\p{L}\x{0660}]/8D
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3   6 \xfc\x84\x80\x80\x80\x80
11  11 Ket
14     End
+  0  45 Bra 0
+  3     [a-c\p{L}\x{660}]
45  45 Ket
48     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
-First char = 252
-Need char = 128
+No first char
+No need char
 
-/\x{7fffFFFF}/8DM
-Memory allocation (code space): 15
+/[\p{Nd}]/8DM
+Memory allocation (code space): 46
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3   6 \xfd\xbf\xbf\xbf\xbf\xbf
- 11  11 Ket
- 14     End
+  0  10 Bra 0
+  3     [\p{Nd}]
+ 10  10 Ket
+ 13     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
-First char = 253
-Need char = 191
+No first char
+No need char
+    1234
+ 0: 1
 
-/[\x{ff}]/8DM
-Memory allocation (code space): 40
+/[\p{Nd}+-]+/8DM
+Memory allocation (code space): 47
 ------------------------------------------------------------------
-  0   6 Bra 0
-  3   1 \xff
 6   6 Ket
 9     End
+  0  43 Bra 0
+  3     [+\-\p{Nd}]+
43  43 Ket
46     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
+Partial matching not supported
 Options: utf8
-First char = 255
+No first char
 No need char
+    1234
+ 0: 1234
+    12-34
+ 0: 12-34
+    12+\x{661}-34  
+ 0: 12+\x{661}-34
+    ** Failers
+No match
+    abcd  
+No match
 
-/[\x{100}]/8DM
-Memory allocation (code space): 40
-Failed: characters with values > 255 are not yet supported in classes at offset 7
+/[\P{Nd}]+/8
+    abcd
+ 0: abcd
+    ** Failers
+ 0: ** Failers
+    1234
+No match
 
-/\x{ffffffff}/8
-Failed: character value in \x{...} sequence is too large at offset 11
+/\D+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+No match
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+     
+/\P{Nd}+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+No match
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
-/\x{100000000}/8
-Failed: character value in \x{...} sequence is too large at offset 12
+/[\D]+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+No match
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
-/^\x{100}a\x{1234}/8
-    \x{100}a\x{1234}bcd
- 0: \x{100}a\x{1234}
+/[\P{Nd}]+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+No match
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
-/\x80/8D
-------------------------------------------------------------------
-  0   7 Bra 0
-  3   2 \xc2\x80
-  7   7 Ket
- 10     End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 194
-Need char = 128
+/[\D\P{Nd}]+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+No match
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
-/\xff/8D
-------------------------------------------------------------------
-  0   7 Bra 0
-  3   2 \xc3\xbf
-  7   7 Ket
- 10     End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 195
-Need char = 191
+/\pL/8
+    a
+ 0: a
+    A 
+ 0: A
 
-/\x{0041}\x{2262}\x{0391}\x{002e}/D8
-------------------------------------------------------------------
-  0  12 Bra 0
-  3   7 A\xe2\x89\xa2\xce\x91.
- 12  12 Ket
- 15     End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 'A'
-Need char = '.'
-    \x{0041}\x{2262}\x{0391}\x{002e}
- 0: A\x{2262}\x{391}.
+/\pL/8i
+    a
+ 0: a
+    A 
+ 0: A
     
-/\x{D55c}\x{ad6d}\x{C5B4}/D8 
-------------------------------------------------------------------
-  0  14 Bra 0
-  3   9 \xed\x95\x9c\xea\xb5\xad\xec\x96\xb4
- 14  14 Ket
- 17     End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 237
-Need char = 180
-    \x{D55c}\x{ad6d}\x{C5B4} 
- 0: \x{d55c}\x{ad6d}\x{c5b4}
+/\p{Lu}/8 
+    A
+ 0: A
+    aZ
+ 0: Z
+    ** Failers
+ 0: F
+    abc   
+No match
 
-/\x{65e5}\x{672c}\x{8a9e}/D8
-------------------------------------------------------------------
-  0  14 Bra 0
-  3   9 \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e
- 14  14 Ket
- 17     End
-------------------------------------------------------------------
-Capturing subpattern count = 0
-Options: utf8
-First char = 230
-Need char = 158
-    \x{65e5}\x{672c}\x{8a9e}
- 0: \x{65e5}\x{672c}\x{8a9e}
+/\p{Lu}/8i
+    A
+ 0: A
+    aZ
+ 0: Z
+    ** Failers
+ 0: F
+    abc   
+No match
 
-/\x{80}/D8
+/\p{Ll}/8 
+    a
+ 0: a
+    Az
+ 0: z
+    ** Failers
+ 0: a
+    ABC   
+No match
+
+/\p{Ll}/8i 
+    a
+ 0: a
+    Az
+ 0: z
+    ** Failers
+ 0: a
+    ABC   
+No match
+
+/^\x{c0}$/8i
+    \x{c0}
+ 0: \x{c0}
+    \x{e0} 
+ 0: \x{e0}
+
+/^\x{e0}$/8i
+    \x{c0}
+ 0: \x{c0}
+    \x{e0} 
+ 0: \x{e0}
+
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8
+    A\x{391}\x{10427}\x{ff3a}\x{1fb0}
+ 0: A\x{391}\x{10427}\x{ff3a}\x{1fb0}
+    ** Failers
+No match
+    a\x{391}\x{10427}\x{ff3a}\x{1fb0}   
+No match
+    A\x{3b1}\x{10427}\x{ff3a}\x{1fb0}
+No match
+    A\x{391}\x{1044F}\x{ff3a}\x{1fb0}
+No match
+    A\x{391}\x{10427}\x{ff5a}\x{1fb0}
+No match
+    A\x{391}\x{10427}\x{ff3a}\x{1fb8}
+No match
+
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8i
+    A\x{391}\x{10427}\x{ff3a}\x{1fb0}
+ 0: A\x{391}\x{10427}\x{ff3a}\x{1fb0}
+    a\x{391}\x{10427}\x{ff3a}\x{1fb0}   
+ 0: a\x{391}\x{10427}\x{ff3a}\x{1fb0}
+    A\x{3b1}\x{10427}\x{ff3a}\x{1fb0}
+ 0: A\x{3b1}\x{10427}\x{ff3a}\x{1fb0}
+    A\x{391}\x{1044F}\x{ff3a}\x{1fb0}
+ 0: A\x{391}\x{1044f}\x{ff3a}\x{1fb0}
+    A\x{391}\x{10427}\x{ff5a}\x{1fb0}
+ 0: A\x{391}\x{10427}\x{ff5a}\x{1fb0}
+    A\x{391}\x{10427}\x{ff3a}\x{1fb8}
+ 0: A\x{391}\x{10427}\x{ff3a}\x{1fb8}
+
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8iD
 ------------------------------------------------------------------
-  0   7 Bra 0
-  3   2 \xc2\x80
 7   7 Ket
10     End
+  0  21 Bra 0
+  3  NC A\x{391}\x{10427}\x{ff3a}\x{1fb0}
21  21 Ket
24     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
-Options: utf8
-First char = 194
-Need char = 128
+Options: caseless utf8
+First char = 'A' (caseless)
+No need char
 
-/\x{084}/D8
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8D
 ------------------------------------------------------------------
-  0   7 Bra 0
-  3   2 \xc2\x84
 7   7 Ket
10     End
+  0  21 Bra 0
+  3     A\x{391}\x{10427}\x{ff3a}\x{1fb0}
21  21 Ket
24     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
-First char = 194
-Need char = 132
+First char = 'A'
+Need char = 176
 
-/\x{104}/D8
+/AB\x{1fb0}/8D
 ------------------------------------------------------------------
-  0   7 Bra 0
-  3   2 \xc4\x84
 7   7 Ket
- 10     End
+  0  11 Bra 0
+  3     AB\x{1fb0}
11  11 Ket
+ 14     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
 Options: utf8
-First char = 196
-Need char = 132
+First char = 'A'
+Need char = 176
 
-/\x{861}/D8
+/AB\x{1fb0}/8Di
 ------------------------------------------------------------------
-  0   8 Bra 0
-  3   3 \xe0\xa1\xa1
 8   8 Ket
- 11     End
+  0  11 Bra 0
+  3  NC AB\x{1fb0}
11  11 Ket
+ 14     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
-Options: utf8
-First char = 224
-Need char = 161
+Options: caseless utf8
+First char = 'A' (caseless)
+Need char = 'B' (caseless)
+
+/\x{391}+/8i
+    \x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}
+ 0: \x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}
+
+/\x{391}{3,5}(.)/8i
+    \x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}X
+ 0: \x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}X
+ 1: X
+
+/\x{391}{3,5}?(.)/8i
+    \x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}X
+ 0: \x{391}\x{3b1}\x{3b1}\x{3b1}
+ 1: \x{3b1}
 
-/\x{212ab}/D8
+/[\x{391}\x{ff3a}]/8i
+    \x{391}
+ 0: \x{391}
+    \x{ff3a}
+ 0: \x{ff3a}
+    \x{3b1}
+ 0: \x{3b1}
+    \x{ff5a}   
+ 0: \x{ff5a}
+    
+/[\x{c0}\x{391}]/8i
+    \x{c0}
+ 0: \x{c0}
+    \x{e0} 
+ 0: \x{e0}
+
+/[\x{105}-\x{109}]/8iD
 ------------------------------------------------------------------
-  0   9 Bra 0
-  3   4 \xf0\xa1\x8a\xab
 9   9 Ket
- 12     End
+  0  13 Bra 0
+  3     [\x{104}-\x{109}]
13  13 Ket
+ 16     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
-Options: utf8
-First char = 240
-Need char = 171
-
-/.{3,5}X/D8
+Options: caseless utf8
+No first char
+No need char
+    \x{104}
+ 0: \x{104}
+    \x{105}
+ 0: \x{105}
+    \x{109}  
+ 0: \x{109}
+    ** Failers
+No match
+    \x{100}
+No match
+    \x{10a} 
+No match
+    
+/[z-\x{100}]/8iD 
 ------------------------------------------------------------------
-  0  14 Bra 0
-  3     Any{3}
-  7     Any{0,2}
- 11   1 X
- 14  14 Ket
- 17     End
+  0  20 Bra 0
+  3     [Z\x{39c}\x{178}z-\x{101}]
+ 20  20 Ket
+ 23     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
-Options: utf8
+Options: caseless utf8
 No first char
-Need char = 'X'
-    \x{212ab}\x{212ab}\x{212ab}\x{861}X
- 0: \x{212ab}\x{212ab}\x{212ab}\x{861}X
-
+No need char
+    Z
+ 0: Z
+    z
+ 0: z
+    \x{39c}
+ 0: \x{39c}
+    \x{178}
+ 0: \x{178}
+    |
+ 0: |
+    \x{80}
+ 0: \x{80}
+    \x{ff}
+ 0: \x{ff}
+    \x{100}
+ 0: \x{100}
+    \x{101} 
+ 0: \x{101}
+    ** Failers
+No match
+    \x{102}
+No match
+    Y
+No match
+    y           
+No match
 
-/.{3,5}?/D8
+/[z-\x{100}]/8Di
 ------------------------------------------------------------------
-  0  11 Bra 0
-  3     Any{3}
-  7     Any{0,2}?
- 11  11 Ket
- 14     End
+  0  20 Bra 0
+  3     [Z\x{39c}\x{178}z-\x{101}]
+ 20  20 Ket
+ 23     End
 ------------------------------------------------------------------
 Capturing subpattern count = 0
-Options: utf8
+Options: caseless utf8
 No first char
 No need char
-    \x{212ab}\x{212ab}\x{212ab}\x{861}
- 0: \x{212ab}\x{212ab}\x{212ab}
 
-/-- These tests are here rather than in testinput5 because Perl 5.6 has --/
-/-- some problems with UTF-8 support, in the area of \x{..} where the   --/
+/^\X/8
+    A
+ 0: A
+    A\x{300}BC 
+ 0: A\x{300}
+    A\x{300}\x{301}\x{302}BC 
+ 0: A\x{300}\x{301}\x{302}
+    *** Failers
+ 0: *
+    \x{300}  
+No match
+
+/^[\X]/8
+    X123
+ 0: X
+    *** Failers
 No match
-/-- value is < 255. It grumbles about invalid UTF-8 strings.            --/
+    AXYZ
 No match
 
-/^[a\x{c0}]b/8
-    \x{c0}b
- 0: \x{c0}b
-    
-/^([a\x{c0}]*?)aa/8
-    a\x{c0}aaaa/ 
- 0: a\x{c0}aa
- 1: a\x{c0}
-
-/^([a\x{c0}]*?)aa/8
-    a\x{c0}aaaa/ 
- 0: a\x{c0}aa
- 1: a\x{c0}
-    a\x{c0}a\x{c0}aaa/ 
- 0: a\x{c0}a\x{c0}aa
- 1: a\x{c0}a\x{c0}
-
-/^([a\x{c0}]*)aa/8
-    a\x{c0}aaaa/ 
- 0: a\x{c0}aaaa
- 1: a\x{c0}aa
-    a\x{c0}a\x{c0}aaa/ 
- 0: a\x{c0}a\x{c0}aaa
- 1: a\x{c0}a\x{c0}a
-
-/^([a\x{c0}]*)a\x{c0}/8
-    a\x{c0}aaaa/ 
- 0: a\x{c0}
+/^(\X*)C/8
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301} 
+ 0: A\x{300}\x{301}\x{302}BC
+ 1: A\x{300}\x{301}\x{302}B
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C 
+ 0: A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C
+ 1: A\x{300}\x{301}\x{302}BCA\x{300}\x{301}
+
+/^(\X*?)C/8
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301} 
+ 0: A\x{300}\x{301}\x{302}BC
+ 1: A\x{300}\x{301}\x{302}B
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C 
+ 0: A\x{300}\x{301}\x{302}BC
+ 1: A\x{300}\x{301}\x{302}B
+
+/^(\X*)(.)/8
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301} 
+ 0: A\x{300}\x{301}\x{302}BCA
+ 1: A\x{300}\x{301}\x{302}BC
+ 2: A
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C 
+ 0: A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C
+ 1: A\x{300}\x{301}\x{302}BCA\x{300}\x{301}
+ 2: C
+
+/^(\X*?)(.)/8
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301} 
+ 0: A
+ 1: 
+ 2: A
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C 
+ 0: A
  1: 
-    a\x{c0}a\x{c0}aaa/ 
- 0: a\x{c0}a\x{c0}
- 1: a\x{c0}
+ 2: A
 
-/ End of testinput6 /
+/^\X(.)/8
+    *** Failers
+ 0: **
+ 1: *
+    A\x{300}\x{301}\x{302}
+No match
 
+/^\X{2,3}(.)/8
+    A\x{300}\x{301}B\x{300}X
+ 0: A\x{300}\x{301}B\x{300}X
+ 1: X
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}
+ 0: A\x{300}\x{301}B\x{300}C
+ 1: C
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}X
+ 0: A\x{300}\x{301}B\x{300}C\x{300}\x{301}X
+ 1: X
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}DA\x{300}X
+ 0: A\x{300}\x{301}B\x{300}C\x{300}\x{301}D
+ 1: D
+    
+/^\X{2,3}?(.)/8
+    A\x{300}\x{301}B\x{300}X
+ 0: A\x{300}\x{301}B\x{300}X
+ 1: X
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}
+ 0: A\x{300}\x{301}B\x{300}C
+ 1: C
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}X
+ 0: A\x{300}\x{301}B\x{300}C
+ 1: C
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}DA\x{300}X
+ 0: A\x{300}\x{301}B\x{300}C
+ 1: C
+    
+/ End of testinput6 /
diff --git a/ext/pcre/pcrelib/testdata/testoutput7 b/ext/pcre/pcrelib/testdata/testoutput7
new file mode 100644 (file)
index 0000000..85dd0a6
--- /dev/null
@@ -0,0 +1,6517 @@
+PCRE version 6.2 01-Aug-2005
+
+/abc/
+    abc
+ 0: abc
+    
+/ab*c/
+    abc
+ 0: abc
+    abbbbc
+ 0: abbbbc
+    ac
+ 0: ac
+    
+/ab+c/
+    abc
+ 0: abc
+    abbbbbbc
+ 0: abbbbbbc
+    *** Failers 
+No match
+    ac
+No match
+    ab
+No match
+    
+/a*/
+    a
+ 0: a
+ 1: 
+    aaaaaaaaaaaaaaaaa
+ 0: aaaaaaaaaaaaaaaaa
+ 1: aaaaaaaaaaaaaaaa
+ 2: aaaaaaaaaaaaaaa
+ 3: aaaaaaaaaaaaaa
+ 4: aaaaaaaaaaaaa
+ 5: aaaaaaaaaaaa
+ 6: aaaaaaaaaaa
+ 7: aaaaaaaaaa
+ 8: aaaaaaaaa
+ 9: aaaaaaaa
+10: aaaaaaa
+11: aaaaaa
+12: aaaaa
+13: aaaa
+14: aaa
+15: aa
+16: a
+17: 
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
+Matched, but too many subsidiary matches
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 2: aaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 3: aaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 4: aaaaaaaaaaaaaaaaaaaaaaaaaa
+ 5: aaaaaaaaaaaaaaaaaaaaaaaaa
+ 6: aaaaaaaaaaaaaaaaaaaaaaaa
+ 7: aaaaaaaaaaaaaaaaaaaaaaa
+ 8: aaaaaaaaaaaaaaaaaaaaaa
+ 9: aaaaaaaaaaaaaaaaaaaaa
+10: aaaaaaaaaaaaaaaaaaaa
+11: aaaaaaaaaaaaaaaaaaa
+12: aaaaaaaaaaaaaaaaaa
+13: aaaaaaaaaaaaaaaaa
+14: aaaaaaaaaaaaaaaa
+15: aaaaaaaaaaaaaaa
+16: aaaaaaaaaaaaaa
+17: aaaaaaaaaaaaa
+18: aaaaaaaaaaaa
+19: aaaaaaaaaaa
+20: aaaaaaaaaa
+21: aaaaaaaaa
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\F 
+ 0: 
+    
+/(a|abcd|african)/
+    a
+ 0: a
+    abcd
+ 0: abcd
+ 1: a
+    african
+ 0: african
+ 1: a
+    
+/^abc/
+    abcdef
+ 0: abc
+    *** Failers
+No match
+    xyzabc
+No match
+    xyz\nabc    
+No match
+    
+/^abc/m
+    abcdef
+ 0: abc
+    xyz\nabc    
+ 0: abc
+    *** Failers
+No match
+    xyzabc
+No match
+    
+/\Aabc/
+    abcdef
+ 0: abc
+    *** Failers
+No match
+    xyzabc
+No match
+    xyz\nabc    
+No match
+    
+/\Aabc/m
+    abcdef
+ 0: abc
+    *** Failers
+No match
+    xyzabc
+No match
+    xyz\nabc    
+No match
+    
+/\Gabc/
+    abcdef
+ 0: abc
+    xyzabc\>3
+ 0: abc
+    *** Failers
+No match
+    xyzabc    
+No match
+    xyzabc\>2 
+No match
+    
+/x\dy\Dz/
+    x9yzz
+ 0: x9yzz
+    x0y+z
+ 0: x0y+z
+    *** Failers
+No match
+    xyz
+No match
+    xxy0z     
+No match
+    
+/x\sy\Sz/
+    x yzz
+ 0: x yzz
+    x y+z
+ 0: x y+z
+    *** Failers
+No match
+    xyz
+No match
+    xxyyz
+No match
+    
+/x\wy\Wz/
+    xxy+z
+ 0: xxy+z
+    *** Failers
+No match
+    xxy0z
+No match
+    x+y+z         
+No match
+    
+/x.y/
+    x+y
+ 0: x+y
+    x-y
+ 0: x-y
+    *** Failers
+No match
+    x\ny
+No match
+    
+/x.y/s
+    x+y
+ 0: x+y
+    x-y
+ 0: x-y
+    x\ny
+ 0: x\x0ay
+
+/(a.b(?s)c.d|x.y)p.q/
+    a+bc+dp+q
+ 0: a+bc+dp+q
+    a+bc\ndp+q
+ 0: a+bc\x0adp+q
+    x\nyp+q 
+ 0: x\x0ayp+q
+    *** Failers 
+No match
+    a\nbc\ndp+q
+No match
+    a+bc\ndp\nq
+No match
+    x\nyp\nq 
+No match
+
+/a\d\z/
+    ba0
+ 0: a0
+    *** Failers
+No match
+    ba0\n
+No match
+    ba0\ncd   
+No match
+
+/a\d\z/m
+    ba0
+ 0: a0
+    *** Failers
+No match
+    ba0\n
+No match
+    ba0\ncd   
+No match
+
+/a\d\Z/
+    ba0
+ 0: a0
+    ba0\n
+ 0: a0
+    *** Failers
+No match
+    ba0\ncd   
+No match
+
+/a\d\Z/m
+    ba0
+ 0: a0
+    ba0\n
+ 0: a0
+    *** Failers
+No match
+    ba0\ncd   
+No match
+
+/a\d$/
+    ba0
+ 0: a0
+    ba0\n
+ 0: a0
+    *** Failers
+No match
+    ba0\ncd   
+No match
+
+/a\d$/m
+    ba0
+ 0: a0
+    ba0\n
+ 0: a0
+    ba0\ncd   
+ 0: a0
+    *** Failers
+No match
+
+/abc/i
+    abc
+ 0: abc
+    aBc
+ 0: aBc
+    ABC
+ 0: ABC
+    
+/[^a]/
+    abcd
+ 0: b
+    
+/ab?\w/
+    abz
+ 0: abz
+ 1: ab
+    abbz
+ 0: abb
+ 1: ab
+    azz  
+ 0: az
+
+/x{0,3}yz/
+    ayzq
+ 0: yz
+    axyzq
+ 0: xyz
+    axxyz
+ 0: xxyz
+    axxxyzq
+ 0: xxxyz
+    axxxxyzq
+ 0: xxxyz
+    *** Failers
+No match
+    ax
+No match
+    axx     
+No match
+      
+/x{3}yz/
+    axxxyzq
+ 0: xxxyz
+    axxxxyzq
+ 0: xxxyz
+    *** Failers
+No match
+    ax
+No match
+    axx     
+No match
+    ayzq
+No match
+    axyzq
+No match
+    axxyz
+No match
+      
+/x{2,3}yz/
+    axxyz
+ 0: xxyz
+    axxxyzq
+ 0: xxxyz
+    axxxxyzq
+ 0: xxxyz
+    *** Failers
+No match
+    ax
+No match
+    axx     
+No match
+    ayzq
+No match
+    axyzq
+No match
+      
+/[^a]+/
+    bac
+ 0: b
+    bcdefax
+ 0: bcdef
+ 1: bcde
+ 2: bcd
+ 3: bc
+ 4: b
+    *** Failers
+ 0: *** F
+ 1: *** 
+ 2: ***
+ 3: **
+ 4: *
+    aaaaa   
+No match
+
+/[^a]*/
+    bac
+ 0: b
+ 1: 
+    bcdefax
+ 0: bcdef
+ 1: bcde
+ 2: bcd
+ 3: bc
+ 4: b
+ 5: 
+    *** Failers
+ 0: *** F
+ 1: *** 
+ 2: ***
+ 3: **
+ 4: *
+ 5: 
+    aaaaa   
+ 0: 
+    
+/[^a]{3,5}/
+    xyz
+ 0: xyz
+    awxyza
+ 0: wxyz
+ 1: wxy
+    abcdefa
+ 0: bcdef
+ 1: bcde
+ 2: bcd
+    abcdefghijk
+ 0: bcdef
+ 1: bcde
+ 2: bcd
+    *** Failers
+ 0: *** F
+ 1: *** 
+ 2: ***
+    axya
+No match
+    axa
+No match
+    aaaaa         
+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
+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
+    
+/\d?A/
+    045ABC
+ 0: 5A
+    ABC
+ 0: A
+    *** Failers
+No match
+    XYZ
+No match
+    
+/\D?A/
+    ABC
+ 0: A
+    BAC
+ 0: BA
+    9ABC             
+ 0: A
+    *** Failers
+No match
+
+/a+/
+    aaaa
+ 0: aaaa
+ 1: aaa
+ 2: aa
+ 3: a
+
+/^.*xyz/
+    xyz
+ 0: xyz
+    ggggggggxyz
+ 0: ggggggggxyz
+    
+/^.+xyz/
+    abcdxyz
+ 0: abcdxyz
+    axyz
+ 0: axyz
+    *** Failers
+No match
+    xyz
+No match
+    
+/^.?xyz/
+    xyz
+ 0: xyz
+    cxyz       
+ 0: cxyz
+
+/^\d{2,3}X/
+    12X
+ 0: 12X
+    123X
+ 0: 123X
+    *** Failers
+No match
+    X
+No match
+    1X
+No match
+    1234X     
+No match
+
+/^[abcd]\d/
+    a45
+ 0: a4
+    b93
+ 0: b9
+    c99z
+ 0: c9
+    d04
+ 0: d0
+    *** Failers
+No match
+    e45
+No match
+    abcd      
+No match
+    abcd1234
+No match
+    1234  
+No match
+
+/^[abcd]*\d/
+    a45
+ 0: a4
+    b93
+ 0: b9
+    c99z
+ 0: c9
+    d04
+ 0: d0
+    abcd1234
+ 0: abcd1
+    1234  
+ 0: 1
+    *** Failers
+No match
+    e45
+No match
+    abcd      
+No match
+
+/^[abcd]+\d/
+    a45
+ 0: a4
+    b93
+ 0: b9
+    c99z
+ 0: c9
+    d04
+ 0: d0
+    abcd1234
+ 0: abcd1
+    *** Failers
+No match
+    1234  
+No match
+    e45
+No match
+    abcd      
+No match
+
+/^a+X/
+    aX
+ 0: aX
+    aaX 
+ 0: aaX
+
+/^[abcd]?\d/
+    a45
+ 0: a4
+    b93
+ 0: b9
+    c99z
+ 0: c9
+    d04
+ 0: d0
+    1234  
+ 0: 1
+    *** Failers
+No match
+    abcd1234
+No match
+    e45
+No match
+
+/^[abcd]{2,3}\d/
+    ab45
+ 0: ab4
+    bcd93
+ 0: bcd9
+    *** Failers
+No match
+    1234 
+No match
+    a36 
+No match
+    abcd1234
+No match
+    ee45
+No match
+
+/^(abc)*\d/
+    abc45
+ 0: abc4
+    abcabcabc45
+ 0: abcabcabc4
+    42xyz 
+ 0: 4
+    *** Failers
+No match
+
+/^(abc)+\d/
+    abc45
+ 0: abc4
+    abcabcabc45
+ 0: abcabcabc4
+    *** Failers
+No match
+    42xyz 
+No match
+
+/^(abc)?\d/
+    abc45
+ 0: abc4
+    42xyz 
+ 0: 4
+    *** Failers
+No match
+    abcabcabc45
+No match
+
+/^(abc){2,3}\d/
+    abcabc45
+ 0: abcabc4
+    abcabcabc45
+ 0: abcabcabc4
+    *** Failers
+No match
+    abcabcabcabc45
+No match
+    abc45
+No match
+    42xyz 
+No match
+
+/1(abc|xyz)2(?1)3/
+    1abc2abc3456
+ 0: 1abc2abc3
+    1abc2xyz3456 
+ 0: 1abc2xyz3
+
+/^(a*\w|ab)=(a*\w|ab)/
+    ab=ab
+ 0: ab=ab
+ 1: ab=a
+
+/^(a*\w|ab)=(?1)/
+    ab=ab
+ 0: ab=ab
+ 1: ab=a
+
+/^([^()]|\((?1)*\))*$/
+    abc
+ 0: abc
+    a(b)c
+ 0: a(b)c
+    a(b(c))d  
+ 0: a(b(c))d
+    *** Failers)
+No match
+    a(b(c)d  
+No match
+
+/^>abc>([^()]|\((?1)*\))*<xyz<$/
+    >abc>123<xyz<
+ 0: >abc>123<xyz<
+    >abc>1(2)3<xyz<
+ 0: >abc>1(2)3<xyz<
+    >abc>(1(2)3)<xyz<
+ 0: >abc>(1(2)3)<xyz<
+
+/^(?>a*)\d/
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa9876
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa9
+    *** Failers 
+No match
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+No match
+
+/< (?: (?(R) \d++  | [^<>]*+) | (?R)) * >/x
+    <>
+ 0: <>
+    <abcd>
+ 0: <abcd>
+    <abc <123> hij>
+ 0: <abc <123> hij>
+    <abc <def> hij>
+ 0: <def>
+    <abc<>def> 
+ 0: <abc<>def>
+    <abc<>      
+ 0: <>
+    *** Failers
+No match
+    <abc
+No match
+
+/^(?(?=abc)\w{3}:|\d\d)$/        
+    abc:                          
+ 0: abc:
+    12                             
+ 0: 12
+    *** Failers                     
+No match
+    123                       
+No match
+    xyz                        
+No match
+                                
+/^(?(?!abc)\d\d|\w{3}:)$/      
+    abc:                        
+ 0: abc:
+    12         
+ 0: 12
+    *** Failers
+No match
+    123
+No match
+    xyz    
+No match
+
+/^(?=abc)\w{5}:$/        
+    abcde:                          
+ 0: abcde:
+    *** Failers                     
+No match
+    abc.. 
+No match
+    123                       
+No match
+    vwxyz                        
+No match
+                                
+/^(?!abc)\d\d$/      
+    12         
+ 0: 12
+    *** Failers
+No match
+    abcde:
+No match
+    abc..  
+No match
+    123
+No match
+    vwxyz    
+No match
+
+/(?<=abc|xy)123/
+    abc12345
+ 0: 123
+    wxy123z
+ 0: 123
+    *** Failers
+No match
+    123abc
+No match
+
+/(?<!abc|xy)123/
+    123abc
+ 0: 123
+    mno123456 
+ 0: 123
+    *** Failers
+No match
+    abc12345
+No match
+    wxy123z
+No match
+
+/abc(?C1)xyz/
+    abcxyz
+--->abcxyz
+  1 ^  ^       x
+ 0: abcxyz
+    123abcxyz999 
+--->123abcxyz999
+  1    ^  ^          x
+ 0: abcxyz
+
+/(ab|cd){3,4}/C
+  ababab
+--->ababab
+ +0 ^          (ab|cd){3,4}
+ +1 ^          a
+ +4 ^          c
+ +2 ^^         b
+ +3 ^ ^        |
+ +1 ^ ^        a
+ +4 ^ ^        c
+ +2 ^  ^       b
+ +3 ^   ^      |
+ +1 ^   ^      a
+ +4 ^   ^      c
+ +2 ^    ^     b
+ +3 ^     ^    |
++12 ^     ^    
+ +1 ^     ^    a
+ +4 ^     ^    c
+ 0: ababab
+  abcdabcd
+--->abcdabcd
+ +0 ^            (ab|cd){3,4}
+ +1 ^            a
+ +4 ^            c
+ +2 ^^           b
+ +3 ^ ^          |
+ +1 ^ ^          a
+ +4 ^ ^          c
+ +5 ^  ^         d
+ +6 ^   ^        )
+ +1 ^   ^        a
+ +4 ^   ^        c
+ +2 ^    ^       b
+ +3 ^     ^      |
++12 ^     ^      
+ +1 ^     ^      a
+ +4 ^     ^      c
+ +5 ^      ^     d
+ +6 ^       ^    )
++12 ^       ^    
+ 0: abcdabcd
+ 1: abcdab
+  abcdcdcdcdcd  
+--->abcdcdcdcdcd
+ +0 ^                (ab|cd){3,4}
+ +1 ^                a
+ +4 ^                c
+ +2 ^^               b
+ +3 ^ ^              |
+ +1 ^ ^              a
+ +4 ^ ^              c
+ +5 ^  ^             d
+ +6 ^   ^            )
+ +1 ^   ^            a
+ +4 ^   ^            c
+ +5 ^    ^           d
+ +6 ^     ^          )
++12 ^     ^          
+ +1 ^     ^          a
+ +4 ^     ^          c
+ +5 ^      ^         d
+ +6 ^       ^        )
++12 ^       ^        
+ 0: abcdcdcd
+ 1: abcdcd
+
+/^abc/
+    abcdef
+ 0: abc
+    *** Failers
+No match
+    abcdef\B  
+No match
+
+/^(a*|xyz)/
+    bcd
+ 0: 
+    aaabcd
+ 0: aaa
+ 1: aa
+ 2: a
+ 3: 
+    xyz
+ 0: xyz
+ 1: 
+    xyz\N  
+ 0: xyz
+    *** Failers
+ 0: 
+    bcd\N   
+No match
+    
+/xyz$/
+    xyz
+ 0: xyz
+    xyz\n
+ 0: xyz
+    *** Failers
+No match
+    xyz\Z
+No match
+    xyz\n\Z    
+No match
+    
+/xyz$/m
+    xyz
+ 0: xyz
+    xyz\n 
+ 0: xyz
+    abcxyz\npqr 
+ 0: xyz
+    abcxyz\npqr\Z 
+ 0: xyz
+    xyz\n\Z    
+ 0: xyz
+    *** Failers
+No match
+    xyz\Z
+No match
+
+/\Gabc/
+    abcdef
+ 0: abc
+    defabcxyz\>3 
+ 0: abc
+    *** Failers 
+No match
+    defabcxyz
+No match
+
+/^abcdef/
+    ab\P
+Partial match: ab
+    abcde\P
+Partial match: abcde
+    abcdef\P
+ 0: abcdef
+    *** Failers
+No match
+    abx\P    
+No match
+
+/^a{2,4}\d+z/
+    a\P
+Partial match: a
+    aa\P
+Partial match: aa
+    aa2\P 
+Partial match: aa2
+    aaa\P
+Partial match: aaa
+    aaa23\P 
+Partial match: aaa23
+    aaaa12345\P
+Partial match: aaaa12345
+    aa0z\P
+ 0: aa0z
+    aaaa4444444444444z\P 
+ 0: aaaa4444444444444z
+    *** Failers
+No match
+    az\P 
+No match
+    aaaaa\P 
+No match
+    a56\P 
+No match
+
+/^abcdef/
+   abc\P
+Partial match: abc
+   def\R 
+ 0: def
+   
+/(?<=foo)bar/
+   xyzfo\P 
+No match
+   foob\R\P\>2 
+Partial match: b
+   foobar...\R\P\>4 
+ 0: ar
+   xyzfo\P
+No match
+   foobar\R\>2  
+ 0: bar
+   *** Failers
+No match
+   xyzfo\P
+No match
+   obar\R   
+No match
+
+/(ab*(cd|ef))+X/
+    adfadadaklhlkalkajhlkjahdfasdfasdfladsfjkj\P\Z
+No match
+    lkjhlkjhlkjhlkjhabbbbbbcdaefabbbbbbbefa\P\B\Z
+Partial match: abbbbbbcdaefabbbbbbbefa
+    cdabbbbbbbb\P\R\B\Z
+Partial match: cdabbbbbbbb
+    efabbbbbbbbbbbbbbbb\P\R\B\Z
+Partial match: efabbbbbbbbbbbbbbbb
+    bbbbbbbbbbbbcdXyasdfadf\P\R\B\Z    
+ 0: bbbbbbbbbbbbcdX
+
+/(a|b)/SF>testsavedregex
+Compiled regex written to testsavedregex
+Study data written to testsavedregex
+<testsavedregex
+Compiled regex (byte-inverted) loaded from testsavedregex
+Study data loaded from testsavedregex
+    abc
+ 0: a
+    ** Failers
+ 0: a
+    def  
+No match
+    
+/the quick brown fox/
+    the quick brown fox
+ 0: the quick brown fox
+    The quick brown FOX
+No match
+    What do you know about the quick brown fox?
+ 0: the quick brown fox
+    What do you know about THE QUICK BROWN FOX?
+No match
+
+/The quick brown fox/i
+    the quick brown fox
+ 0: the quick brown fox
+    The quick brown FOX
+ 0: The quick brown FOX
+    What do you know about the quick brown fox?
+ 0: the quick brown fox
+    What do you know about THE QUICK BROWN FOX?
+ 0: THE QUICK BROWN FOX
+
+/abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
+    abcd\t\n\r\f\a\e9;\$\\?caxyz
+ 0: abcd\x09\x0a\x0d\x0c\x07\x1b9;$\?caxyz
+
+/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
+    abxyzpqrrrabbxyyyypqAzz
+ 0: abxyzpqrrrabbxyyyypqAzz
+    abxyzpqrrrabbxyyyypqAzz
+ 0: abxyzpqrrrabbxyyyypqAzz
+    aabxyzpqrrrabbxyyyypqAzz
+ 0: aabxyzpqrrrabbxyyyypqAzz
+    aaabxyzpqrrrabbxyyyypqAzz
+ 0: aaabxyzpqrrrabbxyyyypqAzz
+    aaaabxyzpqrrrabbxyyyypqAzz
+ 0: aaaabxyzpqrrrabbxyyyypqAzz
+    abcxyzpqrrrabbxyyyypqAzz
+ 0: abcxyzpqrrrabbxyyyypqAzz
+    aabcxyzpqrrrabbxyyyypqAzz
+ 0: aabcxyzpqrrrabbxyyyypqAzz
+    aaabcxyzpqrrrabbxyyyypAzz
+ 0: aaabcxyzpqrrrabbxyyyypAzz
+    aaabcxyzpqrrrabbxyyyypqAzz
+ 0: aaabcxyzpqrrrabbxyyyypqAzz
+    aaabcxyzpqrrrabbxyyyypqqAzz
+ 0: aaabcxyzpqrrrabbxyyyypqqAzz
+    aaabcxyzpqrrrabbxyyyypqqqAzz
+ 0: aaabcxyzpqrrrabbxyyyypqqqAzz
+    aaabcxyzpqrrrabbxyyyypqqqqAzz
+ 0: aaabcxyzpqrrrabbxyyyypqqqqAzz
+    aaabcxyzpqrrrabbxyyyypqqqqqAzz
+ 0: aaabcxyzpqrrrabbxyyyypqqqqqAzz
+    aaabcxyzpqrrrabbxyyyypqqqqqqAzz
+ 0: aaabcxyzpqrrrabbxyyyypqqqqqqAzz
+    aaaabcxyzpqrrrabbxyyyypqAzz
+ 0: aaaabcxyzpqrrrabbxyyyypqAzz
+    abxyzzpqrrrabbxyyyypqAzz
+ 0: abxyzzpqrrrabbxyyyypqAzz
+    aabxyzzzpqrrrabbxyyyypqAzz
+ 0: aabxyzzzpqrrrabbxyyyypqAzz
+    aaabxyzzzzpqrrrabbxyyyypqAzz
+ 0: aaabxyzzzzpqrrrabbxyyyypqAzz
+    aaaabxyzzzzpqrrrabbxyyyypqAzz
+ 0: aaaabxyzzzzpqrrrabbxyyyypqAzz
+    abcxyzzpqrrrabbxyyyypqAzz
+ 0: abcxyzzpqrrrabbxyyyypqAzz
+    aabcxyzzzpqrrrabbxyyyypqAzz
+ 0: aabcxyzzzpqrrrabbxyyyypqAzz
+    aaabcxyzzzzpqrrrabbxyyyypqAzz
+ 0: aaabcxyzzzzpqrrrabbxyyyypqAzz
+    aaaabcxyzzzzpqrrrabbxyyyypqAzz
+ 0: aaaabcxyzzzzpqrrrabbxyyyypqAzz
+    aaaabcxyzzzzpqrrrabbbxyyyypqAzz
+ 0: aaaabcxyzzzzpqrrrabbbxyyyypqAzz
+    aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
+ 0: aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
+    aaabcxyzpqrrrabbxyyyypABzz
+ 0: aaabcxyzpqrrrabbxyyyypABzz
+    aaabcxyzpqrrrabbxyyyypABBzz
+ 0: aaabcxyzpqrrrabbxyyyypABBzz
+    >>>aaabxyzpqrrrabbxyyyypqAzz
+ 0: aaabxyzpqrrrabbxyyyypqAzz
+    >aaaabxyzpqrrrabbxyyyypqAzz
+ 0: aaaabxyzpqrrrabbxyyyypqAzz
+    >>>>abcxyzpqrrrabbxyyyypqAzz
+ 0: abcxyzpqrrrabbxyyyypqAzz
+    *** Failers
+No match
+    abxyzpqrrabbxyyyypqAzz
+No match
+    abxyzpqrrrrabbxyyyypqAzz
+No match
+    abxyzpqrrrabxyyyypqAzz
+No match
+    aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
+No match
+    aaaabcxyzzzzpqrrrabbbxyyypqAzz
+No match
+    aaabcxyzpqrrrabbxyyyypqqqqqqqAzz
+No match
+
+/^(abc){1,2}zz/
+    abczz
+ 0: abczz
+    abcabczz
+ 0: abcabczz
+    *** Failers
+No match
+    zz
+No match
+    abcabcabczz
+No match
+    >>abczz
+No match
+
+/^(b+?|a){1,2}?c/
+    bc
+ 0: bc
+    bbc
+ 0: bbc
+    bbbc
+ 0: bbbc
+    bac
+ 0: bac
+    bbac
+ 0: bbac
+    aac
+ 0: aac
+    abbbbbbbbbbbc
+ 0: abbbbbbbbbbbc
+    bbbbbbbbbbbac
+ 0: bbbbbbbbbbbac
+    *** Failers
+No match
+    aaac
+No match
+    abbbbbbbbbbbac
+No match
+
+/^(b+|a){1,2}c/
+    bc
+ 0: bc
+    bbc
+ 0: bbc
+    bbbc
+ 0: bbbc
+    bac
+ 0: bac
+    bbac
+ 0: bbac
+    aac
+ 0: aac
+    abbbbbbbbbbbc
+ 0: abbbbbbbbbbbc
+    bbbbbbbbbbbac
+ 0: bbbbbbbbbbbac
+    *** Failers
+No match
+    aaac
+No match
+    abbbbbbbbbbbac
+No match
+
+/^(b+|a){1,2}?bc/
+    bbc
+ 0: bbc
+
+/^(b*|ba){1,2}?bc/
+    babc
+ 0: babc
+    bbabc
+ 0: bbabc
+    bababc
+ 0: bababc
+    *** Failers
+No match
+    bababbc
+No match
+    babababc
+No match
+
+/^(ba|b*){1,2}?bc/
+    babc
+ 0: babc
+    bbabc
+ 0: bbabc
+    bababc
+ 0: bababc
+    *** Failers
+No match
+    bababbc
+No match
+    babababc
+No match
+
+/^\ca\cA\c[\c{\c:/
+    \x01\x01\e;z
+ 0: \x01\x01\x1b;z
+
+/^[ab\]cde]/
+    athing
+ 0: a
+    bthing
+ 0: b
+    ]thing
+ 0: ]
+    cthing
+ 0: c
+    dthing
+ 0: d
+    ething
+ 0: e
+    *** Failers
+No match
+    fthing
+No match
+    [thing
+No match
+    \\thing
+No match
+
+/^[]cde]/
+    ]thing
+ 0: ]
+    cthing
+ 0: c
+    dthing
+ 0: d
+    ething
+ 0: e
+    *** Failers
+No match
+    athing
+No match
+    fthing
+No match
+
+/^[^ab\]cde]/
+    fthing
+ 0: f
+    [thing
+ 0: [
+    \\thing
+ 0: \
+    *** Failers
+ 0: *
+    athing
+No match
+    bthing
+No match
+    ]thing
+No match
+    cthing
+No match
+    dthing
+No match
+    ething
+No match
+
+/^[^]cde]/
+    athing
+ 0: a
+    fthing
+ 0: f
+    *** Failers
+ 0: *
+    ]thing
+No match
+    cthing
+No match
+    dthing
+No match
+    ething
+No match
+
+/^\\81/
+    \81
+ 0: \x81
+
+/^ÿ/
+    ÿ
+ 0: \xff
+
+/^[0-9]+$/
+    0
+ 0: 0
+    1
+ 0: 1
+    2
+ 0: 2
+    3
+ 0: 3
+    4
+ 0: 4
+    5
+ 0: 5
+    6
+ 0: 6
+    7
+ 0: 7
+    8
+ 0: 8
+    9
+ 0: 9
+    10
+ 0: 10
+    100
+ 0: 100
+    *** Failers
+No match
+    abc
+No match
+
+/^.*nter/
+    enter
+ 0: enter
+    inter
+ 0: inter
+    uponter
+ 0: uponter
+
+/^xxx[0-9]+$/
+    xxx0
+ 0: xxx0
+    xxx1234
+ 0: xxx1234
+    *** Failers
+No match
+    xxx
+No match
+
+/^.+[0-9][0-9][0-9]$/
+    x123
+ 0: x123
+    xx123
+ 0: xx123
+    123456
+ 0: 123456
+    *** Failers
+No match
+    123
+No match
+    x1234
+ 0: x1234
+
+/^.+?[0-9][0-9][0-9]$/
+    x123
+ 0: x123
+    xx123
+ 0: xx123
+    123456
+ 0: 123456
+    *** Failers
+No match
+    123
+No match
+    x1234
+ 0: x1234
+
+/^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
+    abc!pqr=apquxz.ixr.zzz.ac.uk
+ 0: abc!pqr=apquxz.ixr.zzz.ac.uk
+    *** Failers
+No match
+    !pqr=apquxz.ixr.zzz.ac.uk
+No match
+    abc!=apquxz.ixr.zzz.ac.uk
+No match
+    abc!pqr=apquxz:ixr.zzz.ac.uk
+No match
+    abc!pqr=apquxz.ixr.zzz.ac.ukk
+No match
+
+/:/
+    Well, we need a colon: somewhere
+ 0: :
+    *** Fail if we don't
+No match
+
+/([\da-f:]+)$/i
+    0abc
+ 0: 0abc
+    abc
+ 0: abc
+    fed
+ 0: fed
+    E
+ 0: E
+    ::
+ 0: ::
+    5f03:12C0::932e
+ 0: 5f03:12C0::932e
+    fed def
+ 0: def
+    Any old stuff
+ 0: ff
+    *** Failers
+No match
+    0zzz
+No match
+    gzzz
+No match
+    fed\x20
+No match
+    Any old rubbish
+No match
+
+/^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
+    .1.2.3
+ 0: .1.2.3
+    A.12.123.0
+ 0: A.12.123.0
+    *** Failers
+No match
+    .1.2.3333
+No match
+    1.2.3
+No match
+    1234.2.3
+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    IN    SOA    non-sp1    non-sp2   (
+ 0: 1    IN    SOA    non-sp1    non-sp2   (
+    *** Failers
+No match
+    1IN SOA non-sp1 non-sp2(
+No match
+
+/^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/
+    a.
+ 0: a.
+    Z.
+ 0: Z.
+    2.
+ 0: 2.
+    ab-c.pq-r.
+ 0: ab-c.pq-r.
+    sxk.zzz.ac.uk.
+ 0: sxk.zzz.ac.uk.
+    x-.y-.
+ 0: x-.y-.
+    *** Failers
+No match
+    -abc.peq.
+No match
+
+/^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/
+    *.a
+ 0: *.a
+    *.b0-a
+ 0: *.b0-a
+    *.c3-b.c
+ 0: *.c3-b.c
+    *.c-a.b-c
+ 0: *.c-a.b-c
+    *** Failers
+No match
+    *.0
+No match
+    *.a-
+No match
+    *.a-b.c-
+No match
+    *.c-a.0-c
+No match
+
+/^(?=ab(de))(abd)(e)/
+    abde
+ 0: abde
+
+/^(?!(ab)de|x)(abd)(f)/
+    abdf
+ 0: abdf
+
+/^(?=(ab(cd)))(ab)/
+    abcd
+ 0: ab
+
+/^[\da-f](\.[\da-f])*$/i
+    a.b.c.d
+ 0: a.b.c.d
+    A.B.C.D
+ 0: A.B.C.D
+    a.b.c.1.2.3.C
+ 0: a.b.c.1.2.3.C
+
+/^\".*\"\s*(;.*)?$/
+    \"1234\"
+ 0: "1234"
+    \"abcd\" ;
+ 0: "abcd" ;
+    \"\" ; rhubarb
+ 0: "" ; rhubarb
+    *** Failers
+No match
+    \"1234\" : things
+No match
+
+/^$/
+    \
+ 0: 
+    *** Failers
+No match
+
+/   ^    a   (?# begins with a)  b\sc (?# then b c) $ (?# then end)/x
+    ab c
+ 0: ab c
+    *** Failers
+No match
+    abc
+No match
+    ab cde
+No match
+
+/(?x)   ^    a   (?# begins with a)  b\sc (?# then b c) $ (?# then end)/
+    ab c
+ 0: ab c
+    *** Failers
+No match
+    abc
+No match
+    ab cde
+No match
+
+/^   a\ b[c ]d       $/x
+    a bcd
+ 0: a bcd
+    a b d
+ 0: a b d
+    *** Failers
+No match
+    abcd
+No match
+    ab d
+No match
+
+/^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
+    abcdefhijklm
+ 0: abcdefhijklm
+
+/^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/
+    abcdefhijklm
+ 0: abcdefhijklm
+
+/^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/
+    a+ Z0+\x08\n\x1d\x12
+ 0: a+ Z0+\x08\x0a\x1d\x12
+
+/^[.^$|()*+?{,}]+/
+    .^\$(*+)|{?,?}
+ 0: .^$(*+)|{?,?}
+ 1: .^$(*+)|{?,?
+ 2: .^$(*+)|{?,
+ 3: .^$(*+)|{?
+ 4: .^$(*+)|{
+ 5: .^$(*+)|
+ 6: .^$(*+)
+ 7: .^$(*+
+ 8: .^$(*
+ 9: .^$(
+10: .^$
+11: .^
+12: .
+
+/^a*\w/
+    z
+ 0: z
+    az
+ 0: az
+ 1: a
+    aaaz
+ 0: aaaz
+ 1: aaa
+ 2: aa
+ 3: a
+    a
+ 0: a
+    aa
+ 0: aa
+ 1: a
+    aaaa
+ 0: aaaa
+ 1: aaa
+ 2: aa
+ 3: a
+    a+
+ 0: a
+    aa+
+ 0: aa
+ 1: a
+
+/^a*?\w/
+    z
+ 0: z
+    az
+ 0: az
+ 1: a
+    aaaz
+ 0: aaaz
+ 1: aaa
+ 2: aa
+ 3: a
+    a
+ 0: a
+    aa
+ 0: aa
+ 1: a
+    aaaa
+ 0: aaaa
+ 1: aaa
+ 2: aa
+ 3: a
+    a+
+ 0: a
+    aa+
+ 0: aa
+ 1: a
+
+/^a+\w/
+    az
+ 0: az
+    aaaz
+ 0: aaaz
+ 1: aaa
+ 2: aa
+    aa
+ 0: aa
+    aaaa
+ 0: aaaa
+ 1: aaa
+ 2: aa
+    aa+
+ 0: aa
+
+/^a+?\w/
+    az
+ 0: az
+    aaaz
+ 0: aaaz
+ 1: aaa
+ 2: aa
+    aa
+ 0: aa
+    aaaa
+ 0: aaaa
+ 1: aaa
+ 2: aa
+    aa+
+ 0: aa
+
+/^\d{8}\w{2,}/
+    1234567890
+ 0: 1234567890
+    12345678ab
+ 0: 12345678ab
+    12345678__
+ 0: 12345678__
+    *** Failers
+No match
+    1234567
+No match
+
+/^[aeiou\d]{4,5}$/
+    uoie
+ 0: uoie
+    1234
+ 0: 1234
+    12345
+ 0: 12345
+    aaaaa
+ 0: aaaaa
+    *** Failers
+No match
+    123456
+No match
+
+/^[aeiou\d]{4,5}?/
+    uoie
+ 0: uoie
+    1234
+ 0: 1234
+    12345
+ 0: 12345
+ 1: 1234
+    aaaaa
+ 0: aaaaa
+ 1: aaaa
+    123456
+ 0: 12345
+ 1: 1234
+
+/^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/
+    From abcd  Mon Sep 01 12:33:02 1997
+ 0: From abcd  Mon Sep 01 12:33
+
+/^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/
+    From abcd  Mon Sep 01 12:33:02 1997
+ 0: From abcd  Mon Sep 01 12:33
+    From abcd  Mon Sep  1 12:33:02 1997
+ 0: From abcd  Mon Sep  1 12:33
+    *** Failers
+No match
+    From abcd  Sep 01 12:33:02 1997
+No match
+
+/^12.34/s
+    12\n34
+ 0: 12\x0a34
+    12\r34
+ 0: 12\x0d34
+
+/\w+(?=\t)/
+    the quick brown\t fox
+ 0: brown
+
+/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
+ 0: abc
+    *** Failers
+No match
+    abc123
+No match
+
+/^1234(?# test newlines
+  inside)/
+    1234
+ 0: 1234
+
+/^1234 #comment in extended re
+  /x
+    1234
+ 0: 1234
+
+/#rhubarb
+  abcd/x
+    abcd
+ 0: abcd
+
+/^abcd#rhubarb/x
+    abcd
+ 0: abcd
+
+/(?!^)abc/
+    the abc
+ 0: abc
+    *** Failers
+No match
+    abc
+No match
+
+/(?=^)abc/
+    abc
+ 0: abc
+    *** Failers
+No match
+    the abc
+No match
+
+/^[ab]{1,3}(ab*|b)/
+    aabbbbb
+ 0: aabbbbb
+ 1: aabbbb
+ 2: aabbb
+ 3: aabb
+ 4: aab
+ 5: aa
+
+/^[ab]{1,3}?(ab*|b)/
+    aabbbbb
+ 0: aabbbbb
+ 1: aabbbb
+ 2: aabbb
+ 3: aabb
+ 4: aab
+ 5: aa
+
+/^[ab]{1,3}?(ab*?|b)/
+    aabbbbb
+ 0: aabbbbb
+ 1: aabbbb
+ 2: aabbb
+ 3: aabb
+ 4: aab
+ 5: aa
+
+/^[ab]{1,3}(ab*?|b)/
+    aabbbbb
+ 0: aabbbbb
+ 1: aabbbb
+ 2: aabbb
+ 3: aabb
+ 4: aab
+ 5: aa
+
+/  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*                          # optional leading comment
+(?:    (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+" (?:                      # opening quote...
+[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
+|                     #    or
+\\ [^\x80-\xff]           #   Escaped something (something != CR)
+)* "  # closing quote
+)                    # initial word
+(?:  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  \.  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*   (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+" (?:                      # opening quote...
+[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
+|                     #    or
+\\ [^\x80-\xff]           #   Escaped something (something != CR)
+)* "  # closing quote
+)  )* # further okay, if led by a period
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  @  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*    (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|   \[                         # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
+\]                        #           ]
+)                           # initial subdomain
+(?:                                  #
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  \.                        # if led by a period...
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*   (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|   \[                         # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
+\]                        #           ]
+)                     #   ...further okay
+)*
+# address
+|                     #  or
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+" (?:                      # opening quote...
+[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
+|                     #    or
+\\ [^\x80-\xff]           #   Escaped something (something != CR)
+)* "  # closing quote
+)             # one word, optionally followed by....
+(?:
+[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037]  |  # atom and space parts, or...
+\(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)       |  # comments, or...
+
+" (?:                      # opening quote...
+[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
+|                     #    or
+\\ [^\x80-\xff]           #   Escaped something (something != CR)
+)* "  # closing quote
+# quoted strings
+)*
+<  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*                     # leading <
+(?:  @  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*    (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|   \[                         # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
+\]                        #           ]
+)                           # initial subdomain
+(?:                                  #
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  \.                        # if led by a period...
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*   (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|   \[                         # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
+\]                        #           ]
+)                     #   ...further okay
+)*
+
+(?:  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  ,  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  @  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*    (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|   \[                         # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
+\]                        #           ]
+)                           # initial subdomain
+(?:                                  #
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  \.                        # if led by a period...
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*   (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|   \[                         # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
+\]                        #           ]
+)                     #   ...further okay
+)*
+)* # further okay, if led by comma
+:                                # closing colon
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  )? #       optional route
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+" (?:                      # opening quote...
+[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
+|                     #    or
+\\ [^\x80-\xff]           #   Escaped something (something != CR)
+)* "  # closing quote
+)                    # initial word
+(?:  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  \.  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*   (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+" (?:                      # opening quote...
+[^\\\x80-\xff\n\015"]                #   Anything except backslash and quote
+|                     #    or
+\\ [^\x80-\xff]           #   Escaped something (something != CR)
+)* "  # closing quote
+)  )* # further okay, if led by a period
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  @  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*    (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|   \[                         # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
+\]                        #           ]
+)                           # initial subdomain
+(?:                                  #
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  \.                        # if led by a period...
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*   (?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|   \[                         # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*    #    stuff
+\]                        #           ]
+)                     #   ...further okay
+)*
+#       address spec
+(?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*  > #                  trailing >
+# name and address
+)  (?: [\040\t] |  \(
+(?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  |  \( (?:  [^\\\x80-\xff\n\015()]  |  \\ [^\x80-\xff]  )* \)  )*
+\)  )*                       # optional trailing comment
+/x
+    Alan Other <user\@dom.ain>
+ 0: Alan Other <user@dom.ain>
+    <user\@dom.ain>
+ 0: user@dom.ain
+ 1: user@dom
+    user\@dom.ain
+ 0: user@dom.ain
+ 1: user@dom
+    \"A. Other\" <user.1234\@dom.ain> (a comment)
+ 0: "A. Other" <user.1234@dom.ain> (a comment)
+ 1: "A. Other" <user.1234@dom.ain> 
+ 2: "A. Other" <user.1234@dom.ain>
+    A. Other <user.1234\@dom.ain> (a comment)
+ 0:  Other <user.1234@dom.ain> (a comment)
+ 1:  Other <user.1234@dom.ain> 
+ 2:  Other <user.1234@dom.ain>
+    \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
+ 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay
+ 1: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re
+    A missing angle <user\@some.where
+ 0: user@some.where
+ 1: user@some
+    *** Failers
+No match
+    The quick brown fox
+No match
+
+/[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional leading comment
+(?:
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+# Atom
+|                       #  or
+"                                     # "
+[^\\\x80-\xff\n\015"] *                            #   normal
+(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
+"                                     #        "
+# Quoted string
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+\.
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+# Atom
+|                       #  or
+"                                     # "
+[^\\\x80-\xff\n\015"] *                            #   normal
+(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
+"                                     #        "
+# Quoted string
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# additional words
+)*
+@
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+\[                            # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
+\]                           #           ]
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional trailing comments
+(?:
+\.
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+\[                            # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
+\]                           #           ]
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional trailing comments
+)*
+# address
+|                             #  or
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+# Atom
+|                       #  or
+"                                     # "
+[^\\\x80-\xff\n\015"] *                            #   normal
+(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
+"                                     #        "
+# Quoted string
+)
+# leading word
+[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] *               # "normal" atoms and or spaces
+(?:
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+|
+"                                     # "
+[^\\\x80-\xff\n\015"] *                            #   normal
+(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
+"                                     #        "
+) # "special" comment or quoted string
+[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] *            #  more "normal"
+)*
+<
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# <
+(?:
+@
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+\[                            # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
+\]                           #           ]
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional trailing comments
+(?:
+\.
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+\[                            # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
+\]                           #           ]
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional trailing comments
+)*
+(?: ,
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+@
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+\[                            # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
+\]                           #           ]
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional trailing comments
+(?:
+\.
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+\[                            # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
+\]                           #           ]
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional trailing comments
+)*
+)*  # additional domains
+:
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional trailing comments
+)?     #       optional route
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+# Atom
+|                       #  or
+"                                     # "
+[^\\\x80-\xff\n\015"] *                            #   normal
+(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
+"                                     #        "
+# Quoted string
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+\.
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+# Atom
+|                       #  or
+"                                     # "
+[^\\\x80-\xff\n\015"] *                            #   normal
+(?:  \\ [^\x80-\xff]  [^\\\x80-\xff\n\015"] * )*        #   ( special normal* )*
+"                                     #        "
+# Quoted string
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# additional words
+)*
+@
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+\[                            # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
+\]                           #           ]
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional trailing comments
+(?:
+\.
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+(?:
+[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+    # some number of atom characters...
+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
+|
+\[                            # [
+(?: [^\\\x80-\xff\n\015\[\]] |  \\ [^\x80-\xff]  )*     #    stuff
+\]                           #           ]
+)
+[\040\t]*                    # Nab whitespace.
+(?:
+\(                              #  (
+[^\\\x80-\xff\n\015()] *                             #     normal*
+(?:                                 #       (
+(?:  \\ [^\x80-\xff]  |
+\(                            #  (
+[^\\\x80-\xff\n\015()] *                            #     normal*
+(?:  \\ [^\x80-\xff]   [^\\\x80-\xff\n\015()] * )*        #     (special normal*)*
+\)                           #                       )
+)    #         special
+[^\\\x80-\xff\n\015()] *                         #         normal*
+)*                                  #            )*
+\)                             #                )
+[\040\t]* )*    # If comment found, allow more spaces.
+# optional trailing comments
+)*
+#       address spec
+>                    #                 >
+# name and address
+)
+/x
+    Alan Other <user\@dom.ain>
+ 0: Alan Other <user@dom.ain>
+    <user\@dom.ain>
+ 0: user@dom.ain
+ 1: user@dom
+    user\@dom.ain
+ 0: user@dom.ain
+ 1: user@dom
+    \"A. Other\" <user.1234\@dom.ain> (a comment)
+ 0: "A. Other" <user.1234@dom.ain>
+    A. Other <user.1234\@dom.ain> (a comment)
+ 0:  Other <user.1234@dom.ain>
+    \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
+ 0: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re.lay
+ 1: "/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/"@x400-re
+    A missing angle <user\@some.where
+ 0: user@some.where
+ 1: user@some
+    *** Failers
+No match
+    The quick brown fox
+No match
+
+/abc\0def\00pqr\000xyz\0000AB/
+    abc\0def\00pqr\000xyz\0000AB
+ 0: abc\x00def\x00pqr\x00xyz\x000AB
+    abc456 abc\0def\00pqr\000xyz\0000ABCDE
+ 0: abc\x00def\x00pqr\x00xyz\x000AB
+
+/abc\x0def\x00pqr\x000xyz\x0000AB/
+    abc\x0def\x00pqr\x000xyz\x0000AB
+ 0: abc\x0def\x00pqr\x000xyz\x0000AB
+    abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE
+ 0: abc\x0def\x00pqr\x000xyz\x0000AB
+
+/^[\000-\037]/
+    \0A
+ 0: \x00
+    \01B
+ 0: \x01
+    \037C
+ 0: \x1f
+
+/\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
+ 0: A\x00\x00Z
+    An A\0\x0\0Z
+ 0: A\x00\x00\x00Z
+    *** Failers
+No match
+    A\0Z
+No match
+    A\0\x0\0\x0Z
+No match
+
+/^\s/
+    \040abc
+ 0:  
+    \x0cabc
+ 0: \x0c
+    \nabc
+ 0: \x0a
+    \rabc
+ 0: \x0d
+    \tabc
+ 0: \x09
+    *** Failers
+No match
+    abc
+No match
+
+/^a    b
+  
+  \f  c/x
+    abc
+ 0: abc
+
+/ab{1,3}bc/
+    abbbbc
+ 0: abbbbc
+    abbbc
+ 0: abbbc
+    abbc
+ 0: abbc
+    *** Failers
+No match
+    abc
+No match
+    abbbbbc
+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
+ 0: WXY_^abc
+    *** Failers
+No match
+    wxy
+No match
+
+/^[W-c]+$/i
+    WXY_^abc
+ 0: WXY_^abc
+    wxy_^ABC
+ 0: wxy_^ABC
+
+/^[\x3f-\x5F]+$/i
+    WXY_^abc
+ 0: WXY_^abc
+    wxy_^ABC
+ 0: wxy_^ABC
+
+/^abc$/m
+    abc
+ 0: abc
+    qqq\nabc
+ 0: abc
+    abc\nzzz
+ 0: abc
+    qqq\nabc\nzzz
+ 0: abc
+
+/^abc$/
+    abc
+ 0: abc
+    *** Failers
+No match
+    qqq\nabc
+No match
+    abc\nzzz
+No match
+    qqq\nabc\nzzz
+No match
+
+/\Aabc\Z/m
+    abc
+ 0: abc
+    abc\n 
+ 0: abc
+    *** Failers
+No match
+    qqq\nabc
+No match
+    abc\nzzz
+No match
+    qqq\nabc\nzzz
+No match
+    
+/\A(.)*\Z/s
+    abc\ndef
+ 0: abc\x0adef
+
+/\A(.)*\Z/m
+    *** Failers
+ 0: *** Failers
+    abc\ndef
+No match
+
+/(?:b)|(?::+)/
+    b::c
+ 0: b
+    c::b
+ 0: ::
+ 1: :
+
+/[-az]+/
+    az-
+ 0: az-
+ 1: az
+ 2: a
+    *** Failers
+ 0: a
+    b
+No match
+
+/[az-]+/
+    za-
+ 0: za-
+ 1: za
+ 2: z
+    *** Failers
+ 0: a
+    b
+No match
+
+/[a\-z]+/
+    a-z
+ 0: a-z
+ 1: a-
+ 2: a
+    *** Failers
+ 0: a
+    b
+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
+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
+No match
+
+/\x5c/
+    \\
+ 0: \
+
+/\x20Z/
+    the Zoo
+ 0:  Z
+    *** Failers
+No match
+    Zulu
+No match
+
+/ab{3cd/
+    ab{3cd
+ 0: ab{3cd
+
+/ab{3,cd/
+    ab{3,cd
+ 0: ab{3,cd
+
+/ab{3,4a}cd/
+    ab{3,4a}cd
+ 0: ab{3,4a}cd
+
+/{4,5a}bc/
+    {4,5a}bc
+ 0: {4,5a}bc
+
+/^a.b/
+    a\rb
+ 0: a\x0db
+    *** Failers
+No match
+    a\nb
+No match
+
+/abc$/
+    abc
+ 0: abc
+    abc\n
+ 0: abc
+    *** Failers
+No match
+    abc\ndef
+No match
+
+/(abc)\123/
+    abc\x53
+ 0: abcS
+
+/(abc)\223/
+    abc\x93
+ 0: abc\x93
+
+/(abc)\323/
+    abc\xd3
+ 0: abc\xd3
+
+/(abc)\500/
+    abc\x40
+ 0: abc@
+    abc\100
+ 0: abc@
+
+/(abc)\5000/
+    abc\x400
+ 0: abc@0
+    abc\x40\x30
+ 0: abc@0
+    abc\1000
+ 0: abc@0
+    abc\100\x30
+ 0: abc@0
+    abc\100\060
+ 0: abc@0
+    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)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
+    abcdefghijk\12S
+ 0: abcdefghijk\x0aS
+
+/ab\gdef/
+    abgdef
+ 0: abgdef
+
+/a{0}bc/
+    bc
+ 0: bc
+
+/(a|(bc)){0,0}?xyz/
+    xyz
+ 0: xyz
+
+/abc[\10]de/
+    abc\010de
+ 0: abc\x08de
+
+/abc[\1]de/
+    abc\1de
+ 0: abc\x01de
+
+/(abc)[\1]de/
+    abc\1de
+ 0: abc\x01de
+
+/(?s)a.b/
+    a\nb
+ 0: a\x0ab
+
+/^([^a])([^\b])([^c]*)([^d]{3,4})/
+    baNOTccccd
+ 0: baNOTcccc
+ 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
+ 0: *** Failers
+ 1: *** Failer
+ 2: *** Faile
+ 3: *** Fail
+ 4: *** Fai
+ 5: *** Fa
+ 6: *** F
+    anything
+No match
+    b\bc   
+No match
+    baccd
+No match
+
+/[^a]/
+    Abc
+ 0: A
+  
+/[^a]/i
+    Abc 
+ 0: b
+
+/[^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
+ 0: c
+    *** Failers
+ 0: s
+    abk   
+No match
+   
+/[^k]{2,3}$/
+    abc
+ 0: abc
+    kbc
+ 0: bc
+    kabc 
+ 0: abc
+    *** Failers
+ 0: ers
+    abk
+No match
+    akb
+No match
+    akk 
+No match
+
+/^\d{8,}\@.+[^k]$/
+    12345678\@a.b.c.d
+ 0: 12345678@a.b.c.d
+    123456789\@x.y.z
+ 0: 123456789@x.y.z
+    *** Failers
+No match
+    12345678\@x.y.uk
+No match
+    1234567\@a.b.c.d       
+No match
+
+/[^a]/
+    aaaabcd
+ 0: b
+    aaAabcd 
+ 0: A
+
+/[^a]/i
+    aaaabcd
+ 0: b
+    aaAabcd 
+ 0: b
+
+/[^az]/
+    aaaabcd
+ 0: b
+    aaAabcd 
+ 0: A
+
+/[^az]/i
+    aaaabcd
+ 0: b
+    aaAabcd 
+ 0: b
+
+/\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377/
+ \000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377
+ 0: \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff
+
+/P[^*]TAIRE[^*]{1,6}?LL/
+    xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
+ 0: PSTAIREISLL
+
+/P[^*]TAIRE[^*]{1,}?LL/
+    xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
+ 0: PSTAIREISLL
+
+/(\.\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
+                  
+/(\.\d\d((?=0)|\d(?=\d)))/
+    1.230003938      
+ 0: .230
+ 1: .23
+    1.875000282
+ 0: .875
+    *** Failers 
+No match
+    1.235 
+No match
+    
+/a(?)b/
+    ab 
+ 0: ab
+/\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.
+ 0: food is under the bar in the bar
+ 1: food is under the bar
+    
+/foo(.*?)bar/  
+    The food is under the bar in the barn.
+ 0: food is under the bar in the bar
+ 1: food is under the bar
+
+/(.*)(\d*)/
+    I have 2 numbers: 53147
+Matched, but too many subsidiary matches
+ 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 numbers: 
+ 6: I have 2 numbers:
+ 7: I have 2 numbers
+ 8: I have 2 number
+ 9: I have 2 numbe
+10: I have 2 numb
+11: I have 2 num
+12: I have 2 nu
+13: I have 2 n
+14: I have 2 
+15: I have 2
+16: I have 
+17: I have
+18: I hav
+19: I ha
+20: I h
+21: I 
+    
+/(.*)(\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
+/(.*?)(\d*)/
+    I have 2 numbers: 53147
+Matched, but too many subsidiary matches
+ 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 numbers: 
+ 6: I have 2 numbers:
+ 7: I have 2 numbers
+ 8: I have 2 number
+ 9: I have 2 numbe
+10: I have 2 numb
+11: I have 2 num
+12: I have 2 nu
+13: I have 2 n
+14: I have 2 
+15: I have 2
+16: I have 
+17: I have
+18: I hav
+19: I ha
+20: I h
+21: I 
+
+/(.*?)(\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
+
+/(.*)(\d+)$/
+    I have 2 numbers: 53147
+ 0: I have 2 numbers: 53147
+
+/(.*?)(\d+)$/
+    I have 2 numbers: 53147
+ 0: I have 2 numbers: 53147
+
+/(.*)\b(\d+)$/
+    I have 2 numbers: 53147
+ 0: I have 2 numbers: 53147
+
+/(.*\D)(\d+)$/
+    I have 2 numbers: 53147
+ 0: I have 2 numbers: 53147
+
+/^\D*(?!123)/
+    ABC123
+ 0: AB
+ 1: A
+ 2: 
+     
+/^(\D*)(?=\d)(?!123)/
+    ABC445
+ 0: ABC
+    *** Failers
+No match
+    ABC123
+No match
+    
+/^[W-]46]/
+    W46]789 
+ 0: W46]
+    -46]789
+ 0: -46]
+    *** Failers
+No match
+    Wall
+No match
+    Zebra
+No match
+    42
+No match
+    [abcd] 
+No match
+    ]abcd[
+No match
+       
+/^[W-\]46]/
+    W46]789 
+ 0: W
+    Wall
+ 0: W
+    Zebra
+ 0: Z
+    Xylophone  
+ 0: X
+    42
+ 0: 4
+    [abcd] 
+ 0: [
+    ]abcd[
+ 0: ]
+    \\backslash 
+ 0: \
+    *** Failers
+No match
+    -46]789
+No match
+    well
+No match
+    
+/\d\d\/\d\d\/\d\d\d\d/
+    01/01/2000
+ 0: 01/01/2000
+
+/word (?:[a-zA-Z0-9]+ ){0,10}otherword/
+  word cat dog elephant mussel cow horse canary baboon snake shark otherword
+ 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword
+  word cat dog elephant mussel cow horse canary baboon snake shark
+No match
+
+/word (?:[a-zA-Z0-9]+ ){0,300}otherword/
+  word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
+No match
+
+/^(a){0,0}/
+    bcd
+ 0: 
+    abc
+ 0: 
+    aab     
+ 0: 
+
+/^(a){0,1}/
+    bcd
+ 0: 
+    abc
+ 0: a
+ 1: 
+    aab  
+ 0: a
+ 1: 
+
+/^(a){0,2}/
+    bcd
+ 0: 
+    abc
+ 0: a
+ 1: 
+    aab  
+ 0: aa
+ 1: a
+ 2: 
+
+/^(a){0,3}/
+    bcd
+ 0: 
+    abc
+ 0: a
+ 1: 
+    aab
+ 0: aa
+ 1: a
+ 2: 
+    aaa   
+ 0: aaa
+ 1: aa
+ 2: a
+ 3: 
+
+/^(a){0,}/
+    bcd
+ 0: 
+    abc
+ 0: a
+ 1: 
+    aab
+ 0: aa
+ 1: a
+ 2: 
+    aaa
+ 0: aaa
+ 1: aa
+ 2: a
+ 3: 
+    aaaaaaaa    
+ 0: aaaaaaaa
+ 1: aaaaaaa
+ 2: aaaaaa
+ 3: aaaaa
+ 4: aaaa
+ 5: aaa
+ 6: aa
+ 7: a
+ 8: 
+
+/^(a){1,1}/
+    bcd
+No match
+    abc
+ 0: a
+    aab  
+ 0: a
+
+/^(a){1,2}/
+    bcd
+No match
+    abc
+ 0: a
+    aab  
+ 0: aa
+ 1: a
+
+/^(a){1,3}/
+    bcd
+No match
+    abc
+ 0: a
+    aab
+ 0: aa
+ 1: a
+    aaa   
+ 0: aaa
+ 1: aa
+ 2: a
+
+/^(a){1,}/
+    bcd
+No match
+    abc
+ 0: a
+    aab
+ 0: aa
+ 1: a
+    aaa
+ 0: aaa
+ 1: aa
+ 2: a
+    aaaaaaaa    
+ 0: aaaaaaaa
+ 1: aaaaaaa
+ 2: aaaaaa
+ 3: aaaaa
+ 4: aaaa
+ 5: aaa
+ 6: aa
+ 7: a
+
+/.*\.gif/
+    borfle\nbib.gif\nno
+ 0: bib.gif
+
+/.{0,}\.gif/
+    borfle\nbib.gif\nno
+ 0: bib.gif
+
+/.*\.gif/m
+    borfle\nbib.gif\nno
+ 0: bib.gif
+
+/.*\.gif/s
+    borfle\nbib.gif\nno
+ 0: borfle\x0abib.gif
+
+/.*\.gif/ms
+    borfle\nbib.gif\nno
+ 0: borfle\x0abib.gif
+    
+/.*$/
+    borfle\nbib.gif\nno
+ 0: no
+
+/.*$/m
+    borfle\nbib.gif\nno
+ 0: borfle
+
+/.*$/s
+    borfle\nbib.gif\nno
+ 0: borfle\x0abib.gif\x0ano
+
+/.*$/ms
+    borfle\nbib.gif\nno
+ 0: borfle\x0abib.gif\x0ano
+ 1: borfle\x0abib.gif
+ 2: borfle
+    
+/.*$/
+    borfle\nbib.gif\nno\n
+ 0: no
+
+/.*$/m
+    borfle\nbib.gif\nno\n
+ 0: borfle
+
+/.*$/s
+    borfle\nbib.gif\nno\n
+ 0: borfle\x0abib.gif\x0ano\x0a
+ 1: borfle\x0abib.gif\x0ano
+
+/.*$/ms
+    borfle\nbib.gif\nno\n
+ 0: borfle\x0abib.gif\x0ano\x0a
+ 1: borfle\x0abib.gif\x0ano
+ 2: borfle\x0abib.gif
+ 3: borfle
+    
+/(.*X|^B)/
+    abcde\n1234Xyz
+ 0: 1234X
+    BarFoo 
+ 0: B
+    *** Failers
+No match
+    abcde\nBar  
+No match
+
+/(.*X|^B)/m
+    abcde\n1234Xyz
+ 0: 1234X
+    BarFoo 
+ 0: B
+    abcde\nBar  
+ 0: B
+
+/(.*X|^B)/s
+    abcde\n1234Xyz
+ 0: abcde\x0a1234X
+    BarFoo 
+ 0: B
+    *** Failers
+No match
+    abcde\nBar  
+No match
+
+/(.*X|^B)/ms
+    abcde\n1234Xyz
+ 0: abcde\x0a1234X
+    BarFoo 
+ 0: B
+    abcde\nBar  
+ 0: B
+
+/(?s)(.*X|^B)/
+    abcde\n1234Xyz
+ 0: abcde\x0a1234X
+    BarFoo 
+ 0: B
+    *** Failers 
+No match
+    abcde\nBar  
+No match
+
+/(?s:.*X|^B)/
+    abcde\n1234Xyz
+ 0: abcde\x0a1234X
+    BarFoo 
+ 0: B
+    *** Failers 
+No match
+    abcde\nBar  
+No match
+
+/^.*B/
+    **** Failers
+No match
+    abc\nB
+No match
+     
+/(?s)^.*B/
+    abc\nB
+ 0: abc\x0aB
+
+/(?m)^.*B/
+    abc\nB
+ 0: B
+     
+/(?ms)^.*B/
+    abc\nB
+ 0: abc\x0aB
+
+/(?ms)^B/
+    abc\nB
+ 0: B
+
+/(?s)B$/
+    B\n
+ 0: B
+
+/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
+    123456654321
+ 0: 123456654321
+  
+/^\d\d\d\d\d\d\d\d\d\d\d\d/
+    123456654321 
+ 0: 123456654321
+
+/^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
+    123456654321
+ 0: 123456654321
+  
+/^[abc]{12}/
+    abcabcabcabc
+ 0: abcabcabcabc
+    
+/^[a-c]{12}/
+    abcabcabcabc
+ 0: abcabcabcabc
+    
+/^(a|b|c){12}/
+    abcabcabcabc 
+ 0: abcabcabcabc
+
+/^[abcdefghijklmnopqrstuvwxy0123456789]/
+    n
+ 0: n
+    *** Failers 
+No match
+    z 
+No match
+
+/abcde{0,0}/
+    abcd
+ 0: abcd
+    *** Failers
+No match
+    abce  
+No match
+
+/ab[cd]{0,0}e/
+    abe
+ 0: abe
+    *** Failers
+No match
+    abcde 
+No match
+    
+/ab(c){0,0}d/
+    abd
+ 0: abd
+    *** Failers
+No match
+    abcd   
+No match
+
+/a(b*)/
+    a
+ 0: a
+    ab
+ 0: ab
+ 1: a
+    abbbb
+ 0: abbbb
+ 1: abbb
+ 2: abb
+ 3: ab
+ 4: a
+    *** Failers
+ 0: a
+    bbbbb    
+No match
+    
+/ab\d{0}e/
+    abe
+ 0: abe
+    *** Failers
+No match
+    ab1e   
+No match
+    
+/"([^\\"]+|\\.)*"/
+    the \"quick\" brown fox
+ 0: "quick"
+    \"the \\\"quick\\\" brown fox\" 
+ 0: "the \"quick\" brown fox"
+
+/.*?/g+
+    abc
+ 0: abc
+ 0+ 
+ 1: ab
+ 2: a
+ 3: 
+ 0: 
+ 0+ 
+  
+/\b/g+
+    abc 
+ 0: 
+ 0+ abc
+ 0: 
+ 0+ 
+
+/\b/+g
+    abc 
+ 0: 
+ 0+ abc
+ 0: 
+ 0+ 
+
+//g
+    abc
+ 0: 
+ 0: 
+ 0: 
+ 0: 
+
+/<tr([\w\W\s\d][^<>]{0,})><TD([\w\W\s\d][^<>]{0,})>([\d]{0,}\.)(.*)((<BR>([\w\W\s\d][^<>]{0,})|[\s]{0,}))<\/a><\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><\/TR>/is
+  <TR BGCOLOR='#DBE9E9'><TD align=left valign=top>43.<a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)</a></TD><TD align=left valign=top>Lega lstaff.com</TD><TD align=left valign=top>CA - Statewide</TD></TR>
+ 0: <TR BGCOLOR='#DBE9E9'><TD align=left valign=top>43.<a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)</a></TD><TD align=left valign=top>Lega lstaff.com</TD><TD align=left valign=top>CA - Statewide</TD></TR>
+
+/a[^a]b/
+    acb
+ 0: acb
+    a\nb
+ 0: a\x0ab
+    
+/a.b/
+    acb
+ 0: acb
+    *** Failers 
+No match
+    a\nb   
+No match
+    
+/a[^a]b/s
+    acb
+ 0: acb
+    a\nb  
+ 0: a\x0ab
+    
+/a.b/s
+    acb
+ 0: acb
+    a\nb  
+ 0: a\x0ab
+
+/^(b+?|a){1,2}?c/
+    bac
+ 0: bac
+    bbac
+ 0: bbac
+    bbbac
+ 0: bbbac
+    bbbbac
+ 0: bbbbac
+    bbbbbac 
+ 0: bbbbbac
+
+/^(b+|a){1,2}?c/
+    bac
+ 0: bac
+    bbac
+ 0: bbac
+    bbbac
+ 0: bbbac
+    bbbbac
+ 0: bbbbac
+    bbbbbac 
+ 0: bbbbbac
+    
+/(?!\A)x/m
+    x\nb\n
+No match
+    a\bx\n  
+ 0: x
+    
+/\x0{ab}/
+    \0{ab} 
+ 0: \x00{ab}
+
+/(A|B)*?CD/
+    CD 
+ 0: CD
+    
+/(A|B)*CD/
+    CD 
+ 0: CD
+
+/(?<!bar)foo/
+    foo
+ 0: foo
+    catfood
+ 0: foo
+    arfootle
+ 0: foo
+    rfoosh
+ 0: foo
+    *** Failers
+No match
+    barfoo
+No match
+    towbarfoo
+No match
+
+/\w{3}(?<!bar)foo/
+    catfood
+ 0: catfoo
+    *** Failers
+No match
+    foo
+No match
+    barfoo
+No match
+    towbarfoo
+No match
+
+/(?<=(foo)a)bar/
+    fooabar
+ 0: bar
+    *** Failers
+No match
+    bar
+No match
+    foobbar
+No match
+      
+/\Aabc\z/m
+    abc
+ 0: abc
+    *** Failers
+No match
+    abc\n   
+No match
+    qqq\nabc
+No match
+    abc\nzzz
+No match
+    qqq\nabc\nzzz
+No match
+
+"(?>.*/)foo"
+    /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
+No match
+
+"(?>.*/)foo"
+    /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
+ 0: /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
+
+/(?>(\.\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 
+No match
+
+/^((?>\w+)|(?>\s+))*$/
+    now is the time for all good men to come to the aid of the party
+ 0: now is the time for all good men to come to the aid of the party
+    *** Failers
+No match
+    this is not a line with only words and spaces!
+No match
+    
+/(\d+)(\w)/
+    12345a
+ 0: 12345a
+ 1: 12345
+ 2: 1234
+ 3: 123
+ 4: 12
+    12345+ 
+ 0: 12345
+ 1: 1234
+ 2: 123
+ 3: 12
+
+/((?>\d+))(\w)/
+    12345a
+ 0: 12345a
+    *** Failers
+No match
+    12345+ 
+No match
+
+/(?>a+)b/
+    aaab
+ 0: aaab
+
+/((?>a+)b)/
+    aaab
+ 0: aaab
+
+/(?>(a+))b/
+    aaab
+ 0: aaab
+
+/(?>b)+/
+    aaabbbccc
+ 0: bbb
+ 1: bb
+ 2: b
+
+/(?>a+|b+|c+)*c/
+    aaabbbbccccd
+ 0: aaabbbbcccc
+ 1: aaabbbbc
+    
+/(a+|b+|c+)*c/
+    aaabbbbccccd
+ 0: aaabbbbcccc
+ 1: aaabbbbccc
+ 2: aaabbbbcc
+ 3: aaabbbbc
+
+/((?>[^()]+)|\([^()]*\))+/
+    ((abc(ade)ufh()()x
+ 0: abc(ade)ufh()()x
+ 1: abc(ade)ufh()()
+ 2: abc(ade)ufh()
+ 3: abc(ade)ufh
+ 4: abc(ade)
+ 5: abc
+    
+/\(((?>[^()]+)|\([^()]+\))+\)/ 
+    (abc)
+ 0: (abc)
+    (abc(def)xyz)
+ 0: (abc(def)xyz)
+    *** Failers
+No match
+    ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa   
+No match
+
+/a(?-i)b/i
+    ab
+ 0: ab
+    Ab
+ 0: Ab
+    *** Failers 
+No match
+    aB
+No match
+    AB
+No match
+        
+/(a (?x)b c)d e/
+    a bcd e
+ 0: a bcd e
+    *** Failers
+No match
+    a b cd e
+No match
+    abcd e   
+No match
+    a bcde 
+No match
+/(a b(?x)c d (?-x)e f)/
+    a bcde f
+ 0: a bcde f
+    *** Failers
+No match
+    abcdef  
+No match
+
+/(a(?i)b)c/
+    abc
+ 0: abc
+    aBc
+ 0: aBc
+    *** Failers
+No match
+    abC
+No match
+    aBC  
+No match
+    Abc
+No match
+    ABc
+No match
+    ABC
+No match
+    AbC
+No match
+    
+/a(?i:b)c/
+    abc
+ 0: abc
+    aBc
+ 0: aBc
+    *** Failers 
+No match
+    ABC
+No match
+    abC
+No match
+    aBC
+No match
+    
+/a(?i:b)*c/
+    aBc
+ 0: aBc
+    aBBc
+ 0: aBBc
+    *** Failers 
+No match
+    aBC
+No match
+    aBBC
+No match
+    
+/a(?=b(?i)c)\w\wd/
+    abcd
+ 0: abcd
+    abCd
+ 0: abCd
+    *** Failers
+No match
+    aBCd
+No match
+    abcD     
+No match
+    
+/(?s-i:more.*than).*million/i
+    more than million
+ 0: more than million
+    more than MILLION
+ 0: more than MILLION
+    more \n than Million 
+ 0: more \x0a than Million
+    *** Failers
+No match
+    MORE THAN MILLION    
+No match
+    more \n than \n million 
+No match
+
+/(?:(?s-i)more.*than).*million/i
+    more than million
+ 0: more than million
+    more than MILLION
+ 0: more than MILLION
+    more \n than Million 
+ 0: more \x0a than Million
+    *** Failers
+No match
+    MORE THAN MILLION    
+No match
+    more \n than \n million 
+No match
+    
+/(?>a(?i)b+)+c/ 
+    abc
+ 0: abc
+    aBbc
+ 0: aBbc
+    aBBc 
+ 0: aBBc
+    *** Failers
+No match
+    Abc
+No match
+    abAb    
+No match
+    abbC 
+No match
+    
+/(?=a(?i)b)\w\wc/
+    abc
+ 0: abc
+    aBc
+ 0: aBc
+    *** Failers
+No match
+    Ab 
+No match
+    abC
+No match
+    aBC     
+No match
+    
+/(?<=a(?i)b)(\w\w)c/
+    abxxc
+ 0: xxc
+    aBxxc
+ 0: xxc
+    *** Failers
+No match
+    Abxxc
+No match
+    ABxxc
+No match
+    abxxC      
+No match
+
+/^(?(?=abc)\w{3}:|\d\d)$/
+    abc:
+ 0: abc:
+    12
+ 0: 12
+    *** Failers
+No match
+    123
+No match
+    xyz    
+No match
+
+/^(?(?!abc)\d\d|\w{3}:)$/
+    abc:
+ 0: abc:
+    12
+ 0: 12
+    *** Failers
+No match
+    123
+No match
+    xyz    
+No match
+    
+/(?(?<=foo)bar|cat)/
+    foobar
+ 0: bar
+    cat
+ 0: cat
+    fcat
+ 0: cat
+    focat   
+ 0: cat
+    *** Failers
+No match
+    foocat  
+No match
+
+/(?(?<!foo)cat|bar)/
+    foobar
+ 0: bar
+    cat
+ 0: cat
+    fcat
+ 0: cat
+    focat   
+ 0: cat
+    *** Failers
+No match
+    foocat  
+No match
+
+/(?>a*)*/
+    a
+ 0: a
+ 1: 
+    aa
+ 0: aa
+ 1: 
+    aaaa
+ 0: aaaa
+ 1: 
+    
+/(abc|)+/
+    abc
+ 0: abc
+ 1: 
+    abcabc
+ 0: abcabc
+ 1: abc
+ 2: 
+    abcabcabc
+ 0: abcabcabc
+ 1: abcabc
+ 2: abc
+ 3: 
+    xyz      
+ 0: 
+
+/([a]*)*/
+    a
+ 0: a
+ 1: 
+    aaaaa 
+ 0: aaaaa
+ 1: aaaa
+ 2: aaa
+ 3: aa
+ 4: a
+ 5: 
+/([ab]*)*/
+    a
+ 0: a
+ 1: 
+    b
+ 0: b
+ 1: 
+    ababab
+ 0: ababab
+ 1: ababa
+ 2: abab
+ 3: aba
+ 4: ab
+ 5: a
+ 6: 
+    aaaabcde
+ 0: aaaab
+ 1: aaaa
+ 2: aaa
+ 3: aa
+ 4: a
+ 5: 
+    bbbb    
+ 0: bbbb
+ 1: bbb
+ 2: bb
+ 3: b
+ 4: 
+/([^a]*)*/
+    b
+ 0: b
+ 1: 
+    bbbb
+ 0: bbbb
+ 1: bbb
+ 2: bb
+ 3: b
+ 4: 
+    aaa   
+ 0: 
+/([^ab]*)*/
+    cccc
+ 0: cccc
+ 1: ccc
+ 2: cc
+ 3: c
+ 4: 
+    abab  
+ 0: 
+/([a]*?)*/
+    a
+ 0: a
+ 1: 
+    aaaa 
+ 0: aaaa
+ 1: aaa
+ 2: aa
+ 3: a
+ 4: 
+/([ab]*?)*/
+    a
+ 0: a
+ 1: 
+    b
+ 0: b
+ 1: 
+    abab
+ 0: abab
+ 1: aba
+ 2: ab
+ 3: a
+ 4: 
+    baba   
+ 0: baba
+ 1: bab
+ 2: ba
+ 3: b
+ 4: 
+/([^a]*?)*/
+    b
+ 0: b
+ 1: 
+    bbbb
+ 0: bbbb
+ 1: bbb
+ 2: bb
+ 3: b
+ 4: 
+    aaa   
+ 0: 
+/([^ab]*?)*/
+    c
+ 0: c
+ 1: 
+    cccc
+ 0: cccc
+ 1: ccc
+ 2: cc
+ 3: c
+ 4: 
+    baba   
+ 0: 
+/(?>a*)*/
+    a
+ 0: a
+ 1: 
+    aaabcde 
+ 0: aaa
+ 1: 
+/((?>a*))*/
+    aaaaa
+ 0: aaaaa
+ 1: 
+    aabbaa 
+ 0: aa
+ 1: 
+/((?>a*?))*/
+    aaaaa
+ 0: aaaaa
+ 1: 
+    aabbaa 
+ 0: aa
+ 1: 
+
+/(?(?=[^a-z]+[a-z])  \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} ) /x
+    12-sep-98
+ 0: 12-sep-98
+    12-09-98
+ 0: 12-09-98
+    *** Failers
+No match
+    sep-12-98
+No match
+        
+/(?i:saturday|sunday)/
+    saturday
+ 0: saturday
+    sunday
+ 0: sunday
+    Saturday
+ 0: Saturday
+    Sunday
+ 0: Sunday
+    SATURDAY
+ 0: SATURDAY
+    SUNDAY
+ 0: SUNDAY
+    SunDay
+ 0: SunDay
+    
+/(a(?i)bc|BB)x/
+    abcx
+ 0: abcx
+    aBCx
+ 0: aBCx
+    bbx
+ 0: bbx
+    BBx
+ 0: BBx
+    *** Failers
+No match
+    abcX
+No match
+    aBCX
+No match
+    bbX
+No match
+    BBX               
+No match
+
+/^([ab](?i)[cd]|[ef])/
+    ac
+ 0: ac
+    aC
+ 0: aC
+    bD
+ 0: bD
+    elephant
+ 0: e
+    Europe 
+ 0: E
+    frog
+ 0: f
+    France
+ 0: F
+    *** Failers
+No match
+    Africa     
+No match
+
+/^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
+    ab
+ 0: ab
+    aBd
+ 0: aBd
+    xy
+ 0: xy
+    xY
+ 0: xY
+    zebra
+ 0: z
+    Zambesi
+ 0: Z
+    *** Failers
+No match
+    aCD  
+No match
+    XY  
+No match
+
+/(?<=foo\n)^bar/m
+    foo\nbar
+ 0: bar
+    *** Failers
+No match
+    bar
+No match
+    baz\nbar   
+No match
+
+/(?<=(?<!foo)bar)baz/
+    barbaz
+ 0: baz
+    barbarbaz 
+ 0: baz
+    koobarbaz 
+ 0: baz
+    *** Failers
+No match
+    baz
+No match
+    foobarbaz 
+No match
+
+/The following tests are taken from the Perl 5.005 test suite; some of them/
+/are compatible with 5.004, but I'd rather not have to sort them out./
+No match
+
+/abc/
+    abc
+ 0: abc
+    xabcy
+ 0: abc
+    ababc
+ 0: abc
+    *** Failers
+No match
+    xbc
+No match
+    axc
+No match
+    abx
+No match
+
+/ab*c/
+    abc
+ 0: abc
+
+/ab*bc/
+    abc
+ 0: abc
+    abbc
+ 0: abbc
+    abbbbc
+ 0: abbbbc
+
+/.{1}/
+    abbbbc
+ 0: a
+
+/.{3,4}/
+    abbbbc
+ 0: abbb
+ 1: abb
+
+/ab{0,}bc/
+    abbbbc
+ 0: abbbbc
+
+/ab+bc/
+    abbc
+ 0: abbc
+    *** Failers
+No match
+    abc
+No match
+    abq
+No match
+
+/ab{1,}bc/
+
+/ab+bc/
+    abbbbc
+ 0: abbbbc
+
+/ab{1,}bc/
+    abbbbc
+ 0: abbbbc
+
+/ab{1,3}bc/
+    abbbbc
+ 0: abbbbc
+
+/ab{3,4}bc/
+    abbbbc
+ 0: abbbbc
+
+/ab{4,5}bc/
+    *** Failers
+No match
+    abq
+No match
+    abbbbc
+No match
+
+/ab?bc/
+    abbc
+ 0: abbc
+    abc
+ 0: abc
+
+/ab{0,1}bc/
+    abc
+ 0: abc
+
+/ab?bc/
+
+/ab?c/
+    abc
+ 0: abc
+
+/ab{0,1}c/
+    abc
+ 0: abc
+
+/^abc$/
+    abc
+ 0: abc
+    *** Failers
+No match
+    abbbbc
+No match
+    abcc
+No match
+
+/^abc/
+    abcc
+ 0: abc
+
+/^abc$/
+
+/abc$/
+    aabc
+ 0: abc
+    *** Failers
+No match
+    aabc
+ 0: abc
+    aabcd
+No match
+
+/^/
+    abc
+ 0: 
+
+/$/
+    abc
+ 0: 
+
+/a.c/
+    abc
+ 0: abc
+    axc
+ 0: axc
+
+/a.*c/
+    axyzc
+ 0: axyzc
+
+/a[bc]d/
+    abd
+ 0: abd
+    *** Failers
+No match
+    axyzd
+No match
+    abc
+No match
+
+/a[b-d]e/
+    ace
+ 0: ace
+
+/a[b-d]/
+    aac
+ 0: ac
+
+/a[-b]/
+    a-
+ 0: a-
+
+/a[b-]/
+    a-
+ 0: a-
+
+/a]/
+    a]
+ 0: a]
+
+/a[]]b/
+    a]b
+ 0: a]b
+
+/a[^bc]d/
+    aed
+ 0: aed
+    *** Failers
+No match
+    abd
+No match
+    abd
+No match
+
+/a[^-b]c/
+    adc
+ 0: adc
+
+/a[^]b]c/
+    adc
+ 0: adc
+    *** Failers
+No match
+    a-c
+ 0: a-c
+    a]c
+No match
+
+/\ba\b/
+    a-
+ 0: a
+    -a
+ 0: a
+    -a-
+ 0: a
+
+/\by\b/
+    *** Failers
+No match
+    xy
+No match
+    yz
+No match
+    xyz
+No match
+
+/\Ba\B/
+    *** Failers
+ 0: a
+    a-
+No match
+    -a
+No match
+    -a-
+No match
+
+/\By\b/
+    xy
+ 0: y
+
+/\by\B/
+    yz
+ 0: y
+
+/\By\B/
+    xyz
+ 0: y
+
+/\w/
+    a
+ 0: a
+
+/\W/
+    -
+ 0: -
+    *** Failers
+ 0: *
+    -
+ 0: -
+    a
+No match
+
+/a\sb/
+    a b
+ 0: a b
+
+/a\Sb/
+    a-b
+ 0: a-b
+    *** Failers
+No match
+    a-b
+ 0: a-b
+    a b
+No match
+
+/\d/
+    1
+ 0: 1
+
+/\D/
+    -
+ 0: -
+    *** Failers
+ 0: *
+    -
+ 0: -
+    1
+No match
+
+/[\w]/
+    a
+ 0: a
+
+/[\W]/
+    -
+ 0: -
+    *** Failers
+ 0: *
+    -
+ 0: -
+    a
+No match
+
+/a[\s]b/
+    a b
+ 0: a b
+
+/a[\S]b/
+    a-b
+ 0: a-b
+    *** Failers
+No match
+    a-b
+ 0: a-b
+    a b
+No match
+
+/[\d]/
+    1
+ 0: 1
+
+/[\D]/
+    -
+ 0: -
+    *** Failers
+ 0: *
+    -
+ 0: -
+    1
+No match
+
+/ab|cd/
+    abc
+ 0: ab
+    abcd
+ 0: ab
+
+/()ef/
+    def
+ 0: ef
+
+/$b/
+
+/a\(b/
+    a(b
+ 0: a(b
+
+/a\(*b/
+    ab
+ 0: ab
+    a((b
+ 0: a((b
+
+/a\\b/
+    a\b
+No match
+
+/((a))/
+    abc
+ 0: a
+
+/(a)b(c)/
+    abc
+ 0: abc
+
+/a+b+c/
+    aabbabc
+ 0: abc
+
+/a{1,}b{1,}c/
+    aabbabc
+ 0: abc
+
+/a.+?c/
+    abcabc
+ 0: abcabc
+ 1: abc
+
+/(a+|b)*/
+    ab
+ 0: ab
+ 1: a
+ 2: 
+
+/(a+|b){0,}/
+    ab
+ 0: ab
+ 1: a
+ 2: 
+
+/(a+|b)+/
+    ab
+ 0: ab
+ 1: a
+
+/(a+|b){1,}/
+    ab
+ 0: ab
+ 1: a
+
+/(a+|b)?/
+    ab
+ 0: a
+ 1: 
+
+/(a+|b){0,1}/
+    ab
+ 0: a
+ 1: 
+
+/[^ab]*/
+    cde
+ 0: cde
+ 1: cd
+ 2: c
+ 3: 
+
+/abc/
+    *** Failers
+No match
+    b
+No match
+    
+
+/a*/
+    
+
+/([abc])*d/
+    abbbcd
+ 0: abbbcd
+
+/([abc])*bcd/
+    abcd
+ 0: abcd
+
+/a|b|c|d|e/
+    e
+ 0: e
+
+/(a|b|c|d|e)f/
+    ef
+ 0: ef
+
+/abcd*efg/
+    abcdefg
+ 0: abcdefg
+
+/ab*/
+    xabyabbbz
+ 0: ab
+ 1: a
+    xayabbbz
+ 0: a
+
+/(ab|cd)e/
+    abcde
+ 0: cde
+
+/[abhgefdc]ij/
+    hij
+ 0: hij
+
+/^(ab|cd)e/
+
+/(abc|)ef/
+    abcdef
+ 0: ef
+
+/(a|b)c*d/
+    abcd
+ 0: bcd
+
+/(ab|ab*)bc/
+    abc
+ 0: abc
+
+/a([bc]*)c*/
+    abc
+ 0: abc
+ 1: ab
+ 2: a
+
+/a([bc]*)(c*d)/
+    abcd
+ 0: abcd
+
+/a([bc]+)(c*d)/
+    abcd
+ 0: abcd
+
+/a([bc]*)(c+d)/
+    abcd
+ 0: abcd
+
+/a[bcd]*dcdcde/
+    adcdcde
+ 0: adcdcde
+
+/a[bcd]+dcdcde/
+    *** Failers
+No match
+    abcde
+No match
+    adcdcde
+No match
+
+/(ab|a)b*c/
+    abc
+ 0: abc
+
+/((a)(b)c)(d)/
+    abcd
+ 0: abcd
+
+/[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
+ 0: bh
+
+/(bc+d$|ef*g.|h?i(j|k))/
+    effgz
+ 0: effgz
+    ij
+ 0: ij
+    reffgz
+ 0: effgz
+    *** Failers
+No match
+    effg
+No match
+    bcdd
+No match
+
+/((((((((((a))))))))))/
+    a
+ 0: a
+
+/(((((((((a)))))))))/
+    a
+ 0: a
+
+/multiple words of text/
+    *** Failers
+No match
+    aa
+No match
+    uh-uh
+No match
+
+/multiple words/
+    multiple words, yeah
+ 0: multiple words
+
+/(.*)c(.*)/
+    abcde
+ 0: abcde
+ 1: abcd
+ 2: abc
+
+/\((.*), (.*)\)/
+    (a, b)
+ 0: (a, b)
+
+/[k]/
+
+/abcd/
+    abcd
+ 0: abcd
+
+/a(bc)d/
+    abcd
+ 0: abcd
+
+/a[-]?c/
+    ac
+ 0: ac
+
+/abc/i
+    ABC
+ 0: ABC
+    XABCY
+ 0: ABC
+    ABABC
+ 0: ABC
+    *** Failers
+No match
+    aaxabxbaxbbx
+No match
+    XBC
+No match
+    AXC
+No match
+    ABX
+No match
+
+/ab*c/i
+    ABC
+ 0: ABC
+
+/ab*bc/i
+    ABC
+ 0: ABC
+    ABBC
+ 0: ABBC
+
+/ab*?bc/i
+    ABBBBC
+ 0: ABBBBC
+
+/ab{0,}?bc/i
+    ABBBBC
+ 0: ABBBBC
+
+/ab+?bc/i
+    ABBC
+ 0: ABBC
+
+/ab+bc/i
+    *** Failers
+No match
+    ABC
+No match
+    ABQ
+No match
+
+/ab{1,}bc/i
+
+/ab+bc/i
+    ABBBBC
+ 0: ABBBBC
+
+/ab{1,}?bc/i
+    ABBBBC
+ 0: ABBBBC
+
+/ab{1,3}?bc/i
+    ABBBBC
+ 0: ABBBBC
+
+/ab{3,4}?bc/i
+    ABBBBC
+ 0: ABBBBC
+
+/ab{4,5}?bc/i
+    *** Failers
+No match
+    ABQ
+No match
+    ABBBBC
+No match
+
+/ab??bc/i
+    ABBC
+ 0: ABBC
+    ABC
+ 0: ABC
+
+/ab{0,1}?bc/i
+    ABC
+ 0: ABC
+
+/ab??bc/i
+
+/ab??c/i
+    ABC
+ 0: ABC
+
+/ab{0,1}?c/i
+    ABC
+ 0: ABC
+
+/^abc$/i
+    ABC
+ 0: ABC
+    *** Failers
+No match
+    ABBBBC
+No match
+    ABCC
+No match
+
+/^abc/i
+    ABCC
+ 0: ABC
+
+/^abc$/i
+
+/abc$/i
+    AABC
+ 0: ABC
+
+/^/i
+    ABC
+ 0: 
+
+/$/i
+    ABC
+ 0: 
+
+/a.c/i
+    ABC
+ 0: ABC
+    AXC
+ 0: AXC
+
+/a.*?c/i
+    AXYZC
+ 0: AXYZC
+
+/a.*c/i
+    *** Failers
+No match
+    AABC
+ 0: AABC
+    AXYZD
+No match
+
+/a[bc]d/i
+    ABD
+ 0: ABD
+
+/a[b-d]e/i
+    ACE
+ 0: ACE
+    *** Failers
+No match
+    ABC
+No match
+    ABD
+No match
+
+/a[b-d]/i
+    AAC
+ 0: AC
+
+/a[-b]/i
+    A-
+ 0: A-
+
+/a[b-]/i
+    A-
+ 0: A-
+
+/a]/i
+    A]
+ 0: A]
+
+/a[]]b/i
+    A]B
+ 0: A]B
+
+/a[^bc]d/i
+    AED
+ 0: AED
+
+/a[^-b]c/i
+    ADC
+ 0: ADC
+    *** Failers
+No match
+    ABD
+No match
+    A-C
+No match
+
+/a[^]b]c/i
+    ADC
+ 0: ADC
+
+/ab|cd/i
+    ABC
+ 0: AB
+    ABCD
+ 0: AB
+
+/()ef/i
+    DEF
+ 0: EF
+
+/$b/i
+    *** Failers
+No match
+    A]C
+No match
+    B
+No match
+
+/a\(b/i
+    A(B
+ 0: A(B
+
+/a\(*b/i
+    AB
+ 0: AB
+    A((B
+ 0: A((B
+
+/a\\b/i
+    A\B
+No match
+
+/((a))/i
+    ABC
+ 0: A
+
+/(a)b(c)/i
+    ABC
+ 0: ABC
+
+/a+b+c/i
+    AABBABC
+ 0: ABC
+
+/a{1,}b{1,}c/i
+    AABBABC
+ 0: ABC
+
+/a.+?c/i
+    ABCABC
+ 0: ABCABC
+ 1: ABC
+
+/a.*?c/i
+    ABCABC
+ 0: ABCABC
+ 1: ABC
+
+/a.{0,5}?c/i
+    ABCABC
+ 0: ABCABC
+ 1: ABC
+
+/(a+|b)*/i
+    AB
+ 0: AB
+ 1: A
+ 2: 
+
+/(a+|b){0,}/i
+    AB
+ 0: AB
+ 1: A
+ 2: 
+
+/(a+|b)+/i
+    AB
+ 0: AB
+ 1: A
+
+/(a+|b){1,}/i
+    AB
+ 0: AB
+ 1: A
+
+/(a+|b)?/i
+    AB
+ 0: A
+ 1: 
+
+/(a+|b){0,1}/i
+    AB
+ 0: A
+ 1: 
+
+/(a+|b){0,1}?/i
+    AB
+ 0: A
+ 1: 
+
+/[^ab]*/i
+    CDE
+ 0: CDE
+ 1: CD
+ 2: C
+ 3: 
+
+/abc/i
+
+/a*/i
+    
+
+/([abc])*d/i
+    ABBBCD
+ 0: ABBBCD
+
+/([abc])*bcd/i
+    ABCD
+ 0: ABCD
+
+/a|b|c|d|e/i
+    E
+ 0: E
+
+/(a|b|c|d|e)f/i
+    EF
+ 0: EF
+
+/abcd*efg/i
+    ABCDEFG
+ 0: ABCDEFG
+
+/ab*/i
+    XABYABBBZ
+ 0: AB
+ 1: A
+    XAYABBBZ
+ 0: A
+
+/(ab|cd)e/i
+    ABCDE
+ 0: CDE
+
+/[abhgefdc]ij/i
+    HIJ
+ 0: HIJ
+
+/^(ab|cd)e/i
+    ABCDE
+No match
+
+/(abc|)ef/i
+    ABCDEF
+ 0: EF
+
+/(a|b)c*d/i
+    ABCD
+ 0: BCD
+
+/(ab|ab*)bc/i
+    ABC
+ 0: ABC
+
+/a([bc]*)c*/i
+    ABC
+ 0: ABC
+ 1: AB
+ 2: A
+
+/a([bc]*)(c*d)/i
+    ABCD
+ 0: ABCD
+
+/a([bc]+)(c*d)/i
+    ABCD
+ 0: ABCD
+
+/a([bc]*)(c+d)/i
+    ABCD
+ 0: ABCD
+
+/a[bcd]*dcdcde/i
+    ADCDCDE
+ 0: ADCDCDE
+
+/a[bcd]+dcdcde/i
+
+/(ab|a)b*c/i
+    ABC
+ 0: ABC
+
+/((a)(b)c)(d)/i
+    ABCD
+ 0: ABCD
+
+/[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
+ 0: BH
+
+/(bc+d$|ef*g.|h?i(j|k))/i
+    EFFGZ
+ 0: EFFGZ
+    IJ
+ 0: IJ
+    REFFGZ
+ 0: EFFGZ
+    *** Failers
+No match
+    ADCDCDE
+No match
+    EFFG
+No match
+    BCDD
+No match
+
+/((((((((((a))))))))))/i
+    A
+ 0: A
+
+/(((((((((a)))))))))/i
+    A
+ 0: A
+
+/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
+    A
+ 0: A
+
+/(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
+    C
+ 0: C
+
+/multiple words of text/i
+    *** Failers
+No match
+    AA
+No match
+    UH-UH
+No match
+
+/multiple words/i
+    MULTIPLE WORDS, YEAH
+ 0: MULTIPLE WORDS
+
+/(.*)c(.*)/i
+    ABCDE
+ 0: ABCDE
+ 1: ABCD
+ 2: ABC
+
+/\((.*), (.*)\)/i
+    (A, B)
+ 0: (A, B)
+
+/[k]/i
+
+/abcd/i
+    ABCD
+ 0: ABCD
+
+/a(bc)d/i
+    ABCD
+ 0: ABCD
+
+/a[-]?c/i
+    AC
+ 0: AC
+
+/a(?!b)./
+    abad
+ 0: ad
+
+/a(?=d)./
+    abad
+ 0: ad
+
+/a(?=c|d)./
+    abad
+ 0: ad
+
+/a(?:b|c|d)(.)/
+    ace
+ 0: ace
+
+/a(?:b|c|d)*(.)/
+    ace
+ 0: ace
+ 1: ac
+
+/a(?:b|c|d)+?(.)/
+    ace
+ 0: ace
+    acdbcdbe
+ 0: acdbcdbe
+ 1: acdbcdb
+ 2: acdbcd
+ 3: acdbc
+ 4: acdb
+ 5: acd
+
+/a(?:b|c|d)+(.)/
+    acdbcdbe
+ 0: acdbcdbe
+ 1: acdbcdb
+ 2: acdbcd
+ 3: acdbc
+ 4: acdb
+ 5: acd
+
+/a(?:b|c|d){2}(.)/
+    acdbcdbe
+ 0: acdb
+
+/a(?:b|c|d){4,5}(.)/
+    acdbcdbe
+ 0: acdbcdb
+ 1: acdbcd
+
+/a(?:b|c|d){4,5}?(.)/
+    acdbcdbe
+ 0: acdbcdb
+ 1: acdbcd
+
+/((foo)|(bar))*/
+    foobar
+ 0: foobar
+ 1: foo
+ 2: 
+
+/a(?:b|c|d){6,7}(.)/
+    acdbcdbe
+ 0: acdbcdbe
+
+/a(?:b|c|d){6,7}?(.)/
+    acdbcdbe
+ 0: acdbcdbe
+
+/a(?:b|c|d){5,6}(.)/
+    acdbcdbe
+ 0: acdbcdbe
+ 1: acdbcdb
+
+/a(?:b|c|d){5,6}?(.)/
+    acdbcdbe
+ 0: acdbcdbe
+ 1: acdbcdb
+
+/a(?:b|c|d){5,7}(.)/
+    acdbcdbe
+ 0: acdbcdbe
+ 1: acdbcdb
+
+/a(?:b|c|d){5,7}?(.)/
+    acdbcdbe
+ 0: acdbcdbe
+ 1: acdbcdb
+
+/a(?:b|(c|e){1,2}?|d)+?(.)/
+    ace
+ 0: ace
+
+/^(.+)?B/
+    AB
+ 0: AB
+
+/^([^a-z])|(\^)$/
+    .
+ 0: .
+
+/^[<>]&/
+    <&OUT
+ 0: <&
+
+/(?:(f)(o)(o)|(b)(a)(r))*/
+    foobar
+ 0: foobar
+ 1: foo
+ 2: 
+
+/(?<=a)b/
+    ab
+ 0: b
+    *** Failers
+No match
+    cb
+No match
+    b
+No match
+
+/(?<!c)b/
+    ab
+ 0: b
+    b
+ 0: b
+    b
+ 0: b
+
+/(?:..)*a/
+    aba
+ 0: aba
+ 1: a
+
+/(?:..)*?a/
+    aba
+ 0: aba
+ 1: a
+
+/^(){3,5}/
+    abc
+ 0: 
+
+/^(a+)*ax/
+    aax
+ 0: aax
+
+/^((a|b)+)*ax/
+    aax
+ 0: aax
+
+/^((a|bc)+)*ax/
+    aax
+ 0: aax
+
+/(a|x)*ab/
+    cab
+ 0: ab
+
+/(a)*ab/
+    cab
+ 0: ab
+
+/(?:(?i)a)b/
+    ab
+ 0: ab
+
+/((?i)a)b/
+    ab
+ 0: ab
+
+/(?:(?i)a)b/
+    Ab
+ 0: Ab
+
+/((?i)a)b/
+    Ab
+ 0: Ab
+
+/(?:(?i)a)b/
+    *** Failers
+No match
+    cb
+No match
+    aB
+No match
+
+/((?i)a)b/
+
+/(?i:a)b/
+    ab
+ 0: ab
+
+/((?i:a))b/
+    ab
+ 0: ab
+
+/(?i:a)b/
+    Ab
+ 0: Ab
+
+/((?i:a))b/
+    Ab
+ 0: Ab
+
+/(?i:a)b/
+    *** Failers
+No match
+    aB
+No match
+    aB
+No match
+
+/((?i:a))b/
+
+/(?:(?-i)a)b/i
+    ab
+ 0: ab
+
+/((?-i)a)b/i
+    ab
+ 0: ab
+
+/(?:(?-i)a)b/i
+    aB
+ 0: aB
+
+/((?-i)a)b/i
+    aB
+ 0: aB
+
+/(?:(?-i)a)b/i
+    *** Failers
+No match
+    aB
+ 0: aB
+    Ab
+No match
+
+/((?-i)a)b/i
+
+/(?:(?-i)a)b/i
+    aB
+ 0: aB
+
+/((?-i)a)b/i
+    aB
+ 0: aB
+
+/(?:(?-i)a)b/i
+    *** Failers
+No match
+    Ab
+No match
+    AB
+No match
+
+/((?-i)a)b/i
+
+/(?-i:a)b/i
+    ab
+ 0: ab
+
+/((?-i:a))b/i
+    ab
+ 0: ab
+
+/(?-i:a)b/i
+    aB
+ 0: aB
+
+/((?-i:a))b/i
+    aB
+ 0: aB
+
+/(?-i:a)b/i
+    *** Failers
+No match
+    AB
+No match
+    Ab
+No match
+
+/((?-i:a))b/i
+
+/(?-i:a)b/i
+    aB
+ 0: aB
+
+/((?-i:a))b/i
+    aB
+ 0: aB
+
+/(?-i:a)b/i
+    *** Failers
+No match
+    Ab
+No match
+    AB
+No match
+
+/((?-i:a))b/i
+
+/((?-i:a.))b/i
+    *** Failers
+No match
+    AB
+No match
+    a\nB
+No match
+
+/((?s-i:a.))b/i
+    a\nB
+ 0: a\x0aB
+
+/(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
+    cabbbb
+ 0: cabbbb
+
+/(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
+    caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+ 0: caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+
+/foo\w*\d{4}baz/
+    foobar1234baz
+ 0: foobar1234baz
+
+/x(~~)*(?:(?:F)?)?/
+    x~~
+ 0: x~~
+ 1: x
+
+/^a(?#xxx){3}c/
+    aaac
+ 0: aaac
+
+/^a (?#xxx) (?#yyy) {3}c/x
+    aaac
+ 0: aaac
+
+/(?<![cd])b/
+    *** Failers
+No match
+    B\nB
+No match
+    dbcb
+No match
+
+/(?<![cd])[ab]/
+    dbaacb
+ 0: a
+
+/(?<!(c|d))b/
+
+/(?<!(c|d))[ab]/
+    dbaacb
+ 0: a
+
+/(?<!cd)[ab]/
+    cdaccb
+ 0: b
+
+/^(?:a?b?)*$/
+    *** Failers
+No match
+    dbcb
+No match
+    a--
+No match
+
+/((?s)^a(.))((?m)^b$)/
+    a\nb\nc\n
+ 0: a\x0ab
+
+/((?m)^b$)/
+    a\nb\nc\n
+ 0: b
+
+/(?m)^b/
+    a\nb\n
+ 0: b
+
+/(?m)^(b)/
+    a\nb\n
+ 0: b
+
+/((?m)^b)/
+    a\nb\n
+ 0: b
+
+/\n((?m)^b)/
+    a\nb\n
+ 0: \x0ab
+
+/((?s).)c(?!.)/
+    a\nb\nc\n
+ 0: \x0ac
+    a\nb\nc\n
+ 0: \x0ac
+
+/((?s)b.)c(?!.)/
+    a\nb\nc\n
+ 0: b\x0ac
+    a\nb\nc\n
+ 0: b\x0ac
+
+/^b/
+
+/()^b/
+    *** Failers
+No match
+    a\nb\nc\n
+No match
+    a\nb\nc\n
+No match
+
+/((?m)^b)/
+    a\nb\nc\n
+ 0: b
+
+/(?(?!a)a|b)/
+
+/(?(?!a)b|a)/
+    a
+ 0: a
+
+/(?(?=a)b|a)/
+    *** Failers
+No match
+    a
+No match
+    a
+No match
+
+/(?(?=a)a|b)/
+    a
+ 0: a
+
+/(\w+:)+/
+    one:
+ 0: one:
+
+/$(?<=^(a))/
+    a
+ 0: 
+
+/([\w:]+::)?(\w+)$/
+    abcd
+ 0: abcd
+    xy:z:::abcd
+ 0: xy:z:::abcd
+
+/^[^bcd]*(c+)/
+    aexycd
+ 0: aexyc
+
+/(a*)b+/
+    caab
+ 0: aab
+
+/([\w:]+::)?(\w+)$/
+    abcd
+ 0: abcd
+    xy:z:::abcd
+ 0: xy:z:::abcd
+    *** Failers
+ 0: Failers
+    abcd:
+No match
+    abcd:
+No match
+
+/^[^bcd]*(c+)/
+    aexycd
+ 0: aexyc
+
+/(>a+)ab/
+
+/(?>a+)b/
+    aaab
+ 0: aaab
+
+/([[:]+)/
+    a:[b]:
+ 0: :[
+ 1: :
+
+/([[=]+)/
+    a=[b]=
+ 0: =[
+ 1: =
+
+/([[.]+)/
+    a.[b].
+ 0: .[
+ 1: .
+
+/((?>a+)b)/
+    aaab
+ 0: aaab
+
+/(?>(a+))b/
+    aaab
+ 0: aaab
+
+/((?>[^()]+)|\([^()]*\))+/
+    ((abc(ade)ufh()()x
+ 0: abc(ade)ufh()()x
+ 1: abc(ade)ufh()()
+ 2: abc(ade)ufh()
+ 3: abc(ade)ufh
+ 4: abc(ade)
+ 5: abc
+
+/a\Z/
+    *** Failers
+No match
+    aaab
+No match
+    a\nb\n
+No match
+
+/b\Z/
+    a\nb\n
+ 0: b
+
+/b\z/
+
+/b\Z/
+    a\nb
+ 0: b
+
+/b\z/
+    a\nb
+ 0: b
+    *** Failers
+No match
+    
+/(?>.*)(?<=(abcd|wxyz))/
+    alphabetabcd
+ 0: alphabetabcd
+    endingwxyz
+ 0: endingwxyz
+    *** Failers
+No match
+    a rather long string that doesn't end with one of them
+No match
+
+/word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
+    word cat dog elephant mussel cow horse canary baboon snake shark otherword
+ 0: word cat dog elephant mussel cow horse canary baboon snake shark otherword
+    word cat dog elephant mussel cow horse canary baboon snake shark
+No match
+  
+/word (?>[a-zA-Z0-9]+ ){0,30}otherword/
+    word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
+No match
+
+/(?<=\d{3}(?!999))foo/
+    999foo
+ 0: foo
+    123999foo 
+ 0: foo
+    *** Failers
+No match
+    123abcfoo
+No match
+    
+/(?<=(?!...999)\d{3})foo/
+    999foo
+ 0: foo
+    123999foo 
+ 0: foo
+    *** Failers
+No match
+    123abcfoo
+No match
+
+/(?<=\d{3}(?!999)...)foo/
+    123abcfoo
+ 0: foo
+    123456foo 
+ 0: foo
+    *** Failers
+No match
+    123999foo  
+No match
+    
+/(?<=\d{3}...)(?<!999)foo/
+    123abcfoo   
+ 0: foo
+    123456foo 
+ 0: foo
+    *** Failers
+No match
+    123999foo  
+No match
+
+/((Z)+|A)*/
+    ZABCDEFG
+ 0: ZA
+ 1: Z
+ 2: 
+
+/(Z()|A)*/
+    ZABCDEFG
+ 0: ZA
+ 1: Z
+ 2: 
+
+/(Z(())|A)*/
+    ZABCDEFG
+ 0: ZA
+ 1: Z
+ 2: 
+
+/((?>Z)+|A)*/
+    ZABCDEFG
+ 0: ZA
+ 1: Z
+ 2: 
+
+/((?>)+|A)*/
+    ZABCDEFG
+ 0: 
+
+/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
+    -things
+ 0: -
+    0digit
+ 0: 0
+    *** Failers
+No match
+    bcdef    
+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:  
+     
+/\s+/
+    > \x09\x0a\x0c\x0d\x0b<
+ 0:  \x09\x0a\x0c\x0d
+ 1:  \x09\x0a\x0c
+ 2:  \x09\x0a
+ 3:  \x09
+ 4:  
+     
+/a\vb/x
+    ab
+No match
+
+/(?!\A)x/m
+  a\nxb\n
+ 0: x
+
+/(?!^)x/m
+  a\nxb\n
+No match
+
+/abc\Qabc\Eabc/
+    abcabcabc
+ 0: abcabcabc
+    
+/abc\Q(*+|\Eabc/
+    abc(*+|abc 
+ 0: abc(*+|abc
+
+/   abc\Q abc\Eabc/x
+    abc abcabc
+ 0: abc abcabc
+    *** Failers
+No match
+    abcabcabc  
+No match
+    
+/abc#comment
+    \Q#not comment
+    literal\E/x
+    abc#not comment\n    literal     
+ 0: abc#not comment\x0a    literal
+
+/abc#comment
+    \Q#not comment
+    literal/x
+    abc#not comment\n    literal     
+ 0: abc#not comment\x0a    literal
+
+/abc#comment
+    \Q#not comment
+    literal\E #more comment
+    /x
+    abc#not comment\n    literal     
+ 0: abc#not comment\x0a    literal
+
+/abc#comment
+    \Q#not comment
+    literal\E #more comment/x
+    abc#not comment\n    literal     
+ 0: abc#not comment\x0a    literal
+
+/\Qabc\$xyz\E/
+    abc\\\$xyz
+ 0: abc\$xyz
+
+/\Qabc\E\$\Qxyz\E/
+    abc\$xyz
+ 0: abc$xyz
+
+/\Gabc/
+    abc
+ 0: abc
+    *** Failers
+No match
+    xyzabc  
+No match
+
+/\Gabc./g
+    abc1abc2xyzabc3
+ 0: abc1
+ 0: abc2
+
+/abc./g
+    abc1abc2xyzabc3 
+ 0: abc1
+ 0: abc2
+ 0: abc3
+
+/a(?x: b c )d/
+    XabcdY
+ 0: abcd
+    *** Failers 
+No match
+    Xa b c d Y 
+No match
+
+/((?x)x y z | a b c)/
+    XabcY
+ 0: abc
+    AxyzB 
+ 0: xyz
+
+/(?i)AB(?-i)C/
+    XabCY
+ 0: abC
+    *** Failers
+No match
+    XabcY  
+No match
+
+/((?i)AB(?-i)C|D)E/
+    abCE
+ 0: abCE
+    DE
+ 0: DE
+    *** Failers
+No match
+    abcE
+No match
+    abCe  
+No match
+    dE
+No match
+    De    
+No match
+
+/[z\Qa-d]\E]/
+    z
+ 0: z
+    a
+ 0: a
+    -
+ 0: -
+    d
+ 0: d
+    ] 
+ 0: ]
+    *** Failers
+ 0: a
+    b     
+No match
+
+/[\z\C]/
+    z
+ 0: z
+    C 
+ 0: C
+    
+/\M/
+    M 
+ 0: M
+    
+/(a+)*b/
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
+No match
+    
+/(?i)reg(?:ul(?:[aä]|ae)r|ex)/
+    REGular
+ 0: REGular
+    regulaer
+ 0: regulaer
+    Regex  
+ 0: Regex
+    regulär 
+ 0: regul\xe4r
+
+/Åæåä[à-ÿÀ-ß]+/
+    Åæåäà
+ 0: \xc5\xe6\xe5\xe4\xe0
+    Åæåäÿ
+ 0: \xc5\xe6\xe5\xe4\xff
+    ÅæåäÀ
+ 0: \xc5\xe6\xe5\xe4\xc0
+    Åæåäß
+ 0: \xc5\xe6\xe5\xe4\xdf
+
+/(?<=Z)X./
+    \x84XAZXB
+ 0: XB
+
+/^(?(2)a|(1)(2))+$/
+    123a
+Error -17
+
+/(?<=a|bbbb)c/
+    ac
+ 0: c
+    bbbbc
+ 0: c
+
+/abc/>testsavedregex
+Compiled regex written to testsavedregex
+<testsavedregex
+Compiled regex loaded from testsavedregex
+No study data
+    abc
+ 0: abc
+    *** Failers
+No match
+    bca
+No match
+    
+/abc/F>testsavedregex
+Compiled regex written to testsavedregex
+<testsavedregex
+Compiled regex (byte-inverted) loaded from testsavedregex
+No study data
+    abc
+ 0: abc
+    *** Failers
+No match
+    bca
+No match
+
+/(a|b)/S>testsavedregex
+Compiled regex written to testsavedregex
+Study data written to testsavedregex
+<testsavedregex
+Compiled regex loaded from testsavedregex
+Study data loaded from testsavedregex
+    abc
+ 0: a
+    *** Failers
+ 0: a
+    def  
+No match
+    
+/(a|b)/SF>testsavedregex
+Compiled regex written to testsavedregex
+Study data written to testsavedregex
+<testsavedregex
+Compiled regex (byte-inverted) loaded from testsavedregex
+Study data loaded from testsavedregex
+    abc
+ 0: a
+    *** Failers
+ 0: a
+    def  
+No match
+    
+/line\nbreak/
+    this is a line\nbreak
+ 0: line\x0abreak
+    line one\nthis is a line\nbreak in the second line 
+ 0: line\x0abreak
+
+/line\nbreak/f
+    this is a line\nbreak
+ 0: line\x0abreak
+    ** Failers 
+No match
+    line one\nthis is a line\nbreak in the second line 
+No match
+
+/line\nbreak/mf
+    this is a line\nbreak
+ 0: line\x0abreak
+    ** Failers 
+No match
+    line one\nthis is a line\nbreak in the second line 
+No match
+
+/ End of testinput7 /
diff --git a/ext/pcre/pcrelib/testdata/testoutput8 b/ext/pcre/pcrelib/testdata/testoutput8
new file mode 100644 (file)
index 0000000..eb585ad
--- /dev/null
@@ -0,0 +1,1033 @@
+PCRE version 6.2 01-Aug-2005
+
+/-- Do not use the \x{} construct except with patterns that have the --/
+/-- /8 option set, because PCRE doesn't recognize them as UTF-8 unless --/
+No match
+/-- that option is set. However, the latest Perls recognize them always. --/
+No match
+
+/\x{100}ab/8
+  \x{100}ab
+ 0: \x{100}ab
+  
+/a\x{100}*b/8
+    ab
+ 0: ab
+    a\x{100}b  
+ 0: a\x{100}b
+    a\x{100}\x{100}b  
+ 0: a\x{100}\x{100}b
+    
+/a\x{100}+b/8
+    a\x{100}b  
+ 0: a\x{100}b
+    a\x{100}\x{100}b  
+ 0: a\x{100}\x{100}b
+    *** Failers 
+No match
+    ab
+No match
+     
+/\bX/8
+    Xoanon
+ 0: X
+    +Xoanon
+ 0: X
+    \x{300}Xoanon 
+ 0: X
+    *** Failers 
+No match
+    YXoanon  
+No match
+    
+/\BX/8
+    YXoanon
+ 0: X
+    *** Failers
+No match
+    Xoanon
+No match
+    +Xoanon    
+No match
+    \x{300}Xoanon 
+No match
+
+/X\b/8
+    X+oanon
+ 0: X
+    ZX\x{300}oanon 
+ 0: X
+    FAX 
+ 0: X
+    *** Failers 
+No match
+    Xoanon  
+No match
+    
+/X\B/8
+    Xoanon  
+ 0: X
+    *** Failers
+No match
+    X+oanon
+No match
+    ZX\x{300}oanon 
+No match
+    FAX 
+No match
+    
+/[^a]/8
+    abcd
+ 0: b
+    a\x{100}   
+ 0: \x{100}
+
+/^[abc\x{123}\x{400}-\x{402}]{2,3}\d/8
+    ab99
+ 0: ab9
+    \x{123}\x{123}45
+ 0: \x{123}\x{123}4
+    \x{400}\x{401}\x{402}6  
+ 0: \x{400}\x{401}\x{402}6
+    *** Failers
+No match
+    d99
+No match
+    \x{123}\x{122}4   
+No match
+    \x{400}\x{403}6  
+No match
+    \x{400}\x{401}\x{402}\x{402}6  
+No match
+
+/abc/8
+    Ã]
+Error -10
+    Ã
+Error -10
+    ÃÃÃ
+Error -10
+    ÃÃÃ\?
+No match
+
+/a.b/8
+    acb
+ 0: acb
+    a\x7fb
+ 0: a\x{7f}b
+    a\x{100}b 
+ 0: a\x{100}b
+    *** Failers
+No match
+    a\nb  
+No match
+
+/a(.{3})b/8
+    a\x{4000}xyb 
+ 0: a\x{4000}xyb
+    a\x{4000}\x7fyb 
+ 0: a\x{4000}\x{7f}yb
+    a\x{4000}\x{100}yb 
+ 0: a\x{4000}\x{100}yb
+    *** Failers
+No match
+    a\x{4000}b 
+No match
+    ac\ncb 
+No match
+
+/a(.*?)(.)/
+    a\xc0\x88b
+ 0: a\xc0\x88b
+ 1: a\xc0\x88
+ 2: a\xc0
+
+/a(.*?)(.)/8
+    a\x{100}b
+ 0: a\x{100}b
+ 1: a\x{100}
+
+/a(.*)(.)/
+    a\xc0\x88b
+ 0: a\xc0\x88b
+ 1: a\xc0\x88
+ 2: a\xc0
+
+/a(.*)(.)/8
+    a\x{100}b
+ 0: a\x{100}b
+ 1: a\x{100}
+
+/a(.)(.)/
+    a\xc0\x92bcd
+ 0: a\xc0\x92
+
+/a(.)(.)/8
+    a\x{240}bcd
+ 0: a\x{240}b
+
+/a(.?)(.)/
+    a\xc0\x92bcd
+ 0: a\xc0\x92
+ 1: a\xc0
+
+/a(.?)(.)/8
+    a\x{240}bcd
+ 0: a\x{240}b
+ 1: a\x{240}
+
+/a(.??)(.)/
+    a\xc0\x92bcd
+ 0: a\xc0\x92
+ 1: a\xc0
+
+/a(.??)(.)/8
+    a\x{240}bcd
+ 0: a\x{240}b
+ 1: a\x{240}
+
+/a(.{3})b/8
+    a\x{1234}xyb 
+ 0: a\x{1234}xyb
+    a\x{1234}\x{4321}yb 
+ 0: a\x{1234}\x{4321}yb
+    a\x{1234}\x{4321}\x{3412}b 
+ 0: a\x{1234}\x{4321}\x{3412}b
+    *** Failers
+No match
+    a\x{1234}b 
+No match
+    ac\ncb 
+No match
+
+/a(.{3,})b/8
+    a\x{1234}xyb 
+ 0: a\x{1234}xyb
+    a\x{1234}\x{4321}yb 
+ 0: a\x{1234}\x{4321}yb
+    a\x{1234}\x{4321}\x{3412}b 
+ 0: a\x{1234}\x{4321}\x{3412}b
+    axxxxbcdefghijb 
+ 0: axxxxbcdefghijb
+ 1: axxxxb
+    a\x{1234}\x{4321}\x{3412}\x{3421}b 
+ 0: a\x{1234}\x{4321}\x{3412}\x{3421}b
+    *** Failers
+No match
+    a\x{1234}b 
+No match
+
+/a(.{3,}?)b/8
+    a\x{1234}xyb 
+ 0: a\x{1234}xyb
+    a\x{1234}\x{4321}yb 
+ 0: a\x{1234}\x{4321}yb
+    a\x{1234}\x{4321}\x{3412}b 
+ 0: a\x{1234}\x{4321}\x{3412}b
+    axxxxbcdefghijb 
+ 0: axxxxbcdefghijb
+ 1: axxxxb
+    a\x{1234}\x{4321}\x{3412}\x{3421}b 
+ 0: a\x{1234}\x{4321}\x{3412}\x{3421}b
+    *** Failers
+No match
+    a\x{1234}b 
+No match
+
+/a(.{3,5})b/8
+    a\x{1234}xyb 
+ 0: a\x{1234}xyb
+    a\x{1234}\x{4321}yb 
+ 0: a\x{1234}\x{4321}yb
+    a\x{1234}\x{4321}\x{3412}b 
+ 0: a\x{1234}\x{4321}\x{3412}b
+    axxxxbcdefghijb 
+ 0: axxxxb
+    a\x{1234}\x{4321}\x{3412}\x{3421}b 
+ 0: a\x{1234}\x{4321}\x{3412}\x{3421}b
+    axbxxbcdefghijb 
+ 0: axbxxb
+    axxxxxbcdefghijb 
+ 0: axxxxxb
+    *** Failers
+No match
+    a\x{1234}b 
+No match
+    axxxxxxbcdefghijb 
+No match
+
+/a(.{3,5}?)b/8
+    a\x{1234}xyb 
+ 0: a\x{1234}xyb
+    a\x{1234}\x{4321}yb 
+ 0: a\x{1234}\x{4321}yb
+    a\x{1234}\x{4321}\x{3412}b 
+ 0: a\x{1234}\x{4321}\x{3412}b
+    axxxxbcdefghijb 
+ 0: axxxxb
+    a\x{1234}\x{4321}\x{3412}\x{3421}b 
+ 0: a\x{1234}\x{4321}\x{3412}\x{3421}b
+    axbxxbcdefghijb 
+ 0: axbxxb
+    axxxxxbcdefghijb 
+ 0: axxxxxb
+    *** Failers
+No match
+    a\x{1234}b 
+No match
+    axxxxxxbcdefghijb 
+No match
+
+/^[a\x{c0}]/8
+    *** Failers
+No match
+    \x{100}
+No match
+
+/(?<=aXb)cd/8
+    aXbcd
+ 0: cd
+
+/(?<=a\x{100}b)cd/8
+    a\x{100}bcd
+ 0: cd
+
+/(?<=a\x{100000}b)cd/8
+    a\x{100000}bcd
+ 0: cd
+    
+/(?:\x{100}){3}b/8
+    \x{100}\x{100}\x{100}b
+ 0: \x{100}\x{100}\x{100}b
+    *** Failers 
+No match
+    \x{100}\x{100}b
+No match
+
+/\x{ab}/8
+    \x{ab} 
+ 0: \x{ab}
+    \xc2\xab
+ 0: \x{ab}
+    *** Failers 
+No match
+    \x00{ab}
+No match
+
+/(?<=(.))X/8
+    WXYZ
+ 0: X
+    \x{256}XYZ 
+ 0: X
+    *** Failers
+No match
+    XYZ 
+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
+ 0: \x{100}b
+/^[^a]{2,}/8
+    \x{100}bcAa
+ 0: \x{100}bcA
+ 1: \x{100}bc
+ 2: \x{100}b
+
+/^[^a]{2,}?/8
+    \x{100}bca
+ 0: \x{100}bc
+ 1: \x{100}b
+
+/[^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
+ 0: \x{100}b
+/^[^a]{2,}/8i
+    \x{100}bcAa
+ 0: \x{100}bc
+ 1: \x{100}b
+
+/^[^a]{2,}?/8i
+    \x{100}bca
+ 0: \x{100}bc
+ 1: \x{100}b
+
+/\x{100}{0,0}/8
+    abcd
+ 0: 
+/\x{100}?/8
+    abcd
+ 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} 
+ 0: \x{100}
+
+/\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
+ 0: \x{100}\x{100}\x{100}
+
+/\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
+    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}
+ 2: \x{100}\x{100}\x{100}\x{100}\x{100}
+ 3: \x{100}\x{100}\x{100}\x{100}
+ 4: \x{100}\x{100}\x{100}
+
+/(?<=a\x{100}{2}b)X/8
+    Xyyya\x{100}\x{100}bXzzz
+ 0: X
+
+/\D*/8
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+Matched, but too many subsidiary matches
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 2: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 3: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 4: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 6: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 7: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 8: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 9: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+10: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+11: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+12: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+13: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+14: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+15: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+16: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+17: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+18: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+19: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+20: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+21: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+
+/\D*/8
+  \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\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 too many subsidiary 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}
+ 1: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+ 2: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+ 3: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+ 4: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+ 5: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+ 6: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+ 7: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+ 8: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+ 9: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+10: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+11: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+12: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+13: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+14: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+15: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+16: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+17: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+18: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+19: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+20: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}
+21: \x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\x{100}\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
+    1X2
+ 0: X
+    1\x{100}2 
+ 0: \x{100}
+  
+/>\S/8
+    > >X Y
+ 0: >X
+    > >\x{100} Y
+ 0: >\x{100}
+  
+/\d/8
+    \x{100}3
+ 0: 3
+    
+/\s/8
+    \x{100} X
+ 0:  
+    
+/\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  
+No match
+
+/\D{2,3}?/8
+    12abcd34
+ 0: abc
+ 1: ab
+    12ab34
+ 0: ab
+    *** Failers  
+ 0: ***
+ 1: **
+    1234
+No match
+    12a34  
+No match
+
+/\d+/8
+    12abcd34
+ 0: 12
+ 1: 1
+    *** Failers
+No match
+
+/\d{2,3}/8
+    12abcd34
+ 0: 12
+    1234abcd
+ 0: 123
+ 1: 12
+    *** Failers  
+No match
+    1.4 
+No match
+
+/\d{2,3}?/8
+    12abcd34
+ 0: 12
+    1234abcd
+ 0: 123
+ 1: 12
+    *** Failers  
+No match
+    1.4 
+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
+
+/\S{2,3}?/8
+    12abcd34
+ 0: 12a
+ 1: 12
+    1234abcd
+ 0: 123
+ 1: 12
+    *** Failers
+ 0: ***
+ 1: **
+    \     \  
+No match
+
+/>\s+</8
+    12>      <34
+ 0: >      <
+    *** Failers
+No match
+
+/>\s{2,3}</8
+    ab>  <cd
+ 0: >  <
+    ab>   <ce
+ 0: >   <
+    *** Failers
+No match
+    ab>    <cd 
+No match
+
+/>\s{2,3}?</8
+    ab>  <cd
+ 0: >  <
+    ab>   <ce
+ 0: >   <
+    *** Failers
+No match
+    ab>    <cd 
+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
+
+/\w{2,3}/8
+    ab  cd
+ 0: ab
+    abcd ce
+ 0: abc
+ 1: ab
+    *** Failers
+ 0: Fai
+ 1: Fa
+    a.b.c
+No match
+
+/\w{2,3}?/8
+    ab  cd
+ 0: ab
+    abcd ce
+ 0: abc
+ 1: ab
+    *** Failers
+ 0: Fai
+ 1: Fa
+    a.b.c
+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
+
+/\W{2,3}?/8
+    ab====cd
+ 0: ===
+ 1: ==
+    ab==cd
+ 0: ==
+    *** Failers
+ 0: ***
+ 1: **
+    a.b.c
+No match
+
+/[\x{100}]/8
+    \x{100}
+ 0: \x{100}
+    Z\x{100}
+ 0: \x{100}
+    \x{100}Z
+ 0: \x{100}
+    *** Failers 
+No match
+
+/[Z\x{100}]/8
+    Z\x{100}
+ 0: Z
+    \x{100}
+ 0: \x{100}
+    \x{100}Z
+ 0: \x{100}
+    *** Failers 
+No match
+
+/[\x{100}\x{200}]/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 0: \x{200}
+   *** Failers  
+No match
+
+/[\x{100}-\x{200}]/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 0: \x{200}
+   ab\x{111}cd 
+ 0: \x{111}
+   *** Failers  
+No match
+
+/[z-\x{200}]/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 0: \x{200}
+   ab\x{111}cd 
+ 0: \x{111}
+   abzcd
+ 0: z
+   ab|cd  
+ 0: |
+   *** Failers  
+No match
+
+/[Q\x{100}\x{200}]/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 0: \x{200}
+   Q? 
+ 0: Q
+   *** Failers  
+No match
+
+/[Q\x{100}-\x{200}]/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 0: \x{200}
+   ab\x{111}cd 
+ 0: \x{111}
+   Q? 
+ 0: Q
+   *** Failers  
+No match
+
+/[Qz-\x{200}]/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 0: \x{200}
+   ab\x{111}cd 
+ 0: \x{111}
+   abzcd
+ 0: z
+   ab|cd  
+ 0: |
+   Q? 
+ 0: Q
+   *** Failers  
+No match
+
+/[\x{100}\x{200}]{1,3}/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 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
+
+/[\x{100}\x{200}]{1,3}?/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 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
+
+/[Q\x{100}\x{200}]{1,3}/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 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
+
+/[Q\x{100}\x{200}]{1,3}?/8
+   ab\x{100}cd
+ 0: \x{100}
+   ab\x{200}cd
+ 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
+
+/(?<=[\x{100}\x{200}])X/8
+    abc\x{200}X
+ 0: X
+    abc\x{100}X 
+ 0: X
+    *** Failers
+No match
+    X  
+No match
+
+/(?<=[Q\x{100}\x{200}])X/8
+    abc\x{200}X
+ 0: X
+    abc\x{100}X 
+ 0: X
+    abQX 
+ 0: X
+    *** Failers
+No match
+    X  
+No match
+
+/(?<=[\x{100}\x{200}]{3})X/8
+    abc\x{100}\x{200}\x{100}X
+ 0: X
+    *** Failers
+No match
+    abc\x{200}X
+No match
+    X  
+No match
+
+/[^\x{100}\x{200}]X/8
+    AX
+ 0: AX
+    \x{150}X
+ 0: \x{150}X
+    \x{500}X 
+ 0: \x{500}X
+    *** Failers
+No match
+    \x{100}X
+No match
+    \x{200}X   
+No match
+
+/[^Q\x{100}\x{200}]X/8
+    AX
+ 0: AX
+    \x{150}X
+ 0: \x{150}X
+    \x{500}X 
+ 0: \x{500}X
+    *** Failers
+No match
+    \x{100}X
+No match
+    \x{200}X   
+No match
+    QX 
+No match
+
+/[^\x{100}-\x{200}]X/8
+    AX
+ 0: AX
+    \x{500}X 
+ 0: \x{500}X
+    *** Failers
+No match
+    \x{100}X
+No match
+    \x{150}X
+No match
+    \x{200}X   
+No match
+
+/[z-\x{100}]/8i
+    z
+ 0: z
+    Z 
+ 0: Z
+    \x{100}
+ 0: \x{100}
+    *** Failers
+No match
+    \x{102}
+No match
+    y    
+No match
+
+/[\xFF]/
+    >\xff<
+ 0: \xff
+
+/[\xff]/8
+    >\x{ff}<
+ 0: \x{ff}
+
+/[^\xFF]/
+    XYZ
+ 0: X
+
+/[^\xff]/8
+    XYZ
+ 0: X
+    \x{123} 
+ 0: \x{123}
+
+/^[ac]*b/8
+  xb
+No match
+
+/^[ac\x{100}]*b/8
+  xb
+No match
+
+/^[^x]*b/8i
+  xb
+No match
+
+/^[^x]*b/8
+  xb
+No match
+  
+/^\d*b/8
+  xb 
+No match
+
+/(|a)/g8
+    catac
+ 0: 
+ 0: a
+ 1: 
+ 0: 
+ 0: a
+ 1: 
+ 0: 
+ 0: 
+    a\x{256}a 
+ 0: a
+ 1: 
+ 0: 
+ 0: a
+ 1: 
+ 0: 
+
+/^\x{85}$/8i
+    \x{85}
+ 0: \x{85}
+
+/ End of testinput 8 / 
diff --git a/ext/pcre/pcrelib/testdata/testoutput9 b/ext/pcre/pcrelib/testdata/testoutput9
new file mode 100644 (file)
index 0000000..f7b4661
--- /dev/null
@@ -0,0 +1,1234 @@
+PCRE version 6.2 01-Aug-2005
+
+/\pL\P{Nd}/8
+    AB
+ 0: AB
+    *** Failers
+ 0: Fa
+    A0
+No match
+    00   
+No match
+
+/\X./8
+    AB
+ 0: AB
+    A\x{300}BC 
+ 0: A\x{300}B
+    A\x{300}\x{301}\x{302}BC 
+ 0: A\x{300}\x{301}\x{302}B
+    *** Failers
+ 0: **
+    \x{300}  
+No match
+
+/\X\X/8
+    ABC
+ 0: AB
+    A\x{300}B\x{300}\x{301}C 
+ 0: A\x{300}B\x{300}\x{301}
+    A\x{300}\x{301}\x{302}BC 
+ 0: A\x{300}\x{301}\x{302}B
+    *** Failers
+ 0: **
+    \x{300}  
+No match
+
+/^\pL+/8
+    abcd
+ 0: abcd
+ 1: abc
+ 2: ab
+ 3: a
+    a 
+ 0: a
+    *** Failers 
+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}
+No match
+
+/\X?abc/8
+    abc
+ 0: abc
+    A\x{300}abc
+ 0: A\x{300}abc
+    A\x{300}\x{301}\x{302}A\x{300}A\x{300}A\x{300}abcxyz
+ 0: A\x{300}abc
+    \x{300}abc  
+ 0: abc
+    *** Failers
+No match
+
+/^\X?abc/8
+    abc
+ 0: abc
+    A\x{300}abc
+ 0: A\x{300}abc
+    *** Failers
+No match
+    A\x{300}\x{301}\x{302}A\x{300}A\x{300}A\x{300}abcxyz
+No match
+    \x{300}abc  
+No match
+
+/\X*abc/8
+    abc
+ 0: abc
+    A\x{300}abc
+ 0: A\x{300}abc
+    A\x{300}\x{301}\x{302}A\x{300}A\x{300}A\x{300}abcxyz
+ 0: A\x{300}\x{301}\x{302}A\x{300}A\x{300}A\x{300}abc
+    \x{300}abc  
+ 0: abc
+    *** Failers
+No match
+
+/^\X*abc/8
+    abc
+ 0: abc
+    A\x{300}abc
+ 0: A\x{300}abc
+    A\x{300}\x{301}\x{302}A\x{300}A\x{300}A\x{300}abcxyz
+ 0: A\x{300}\x{301}\x{302}A\x{300}A\x{300}A\x{300}abc
+    *** Failers
+No match
+    \x{300}abc  
+No match
+
+/^\pL?=./8
+    A=b
+ 0: A=b
+    =c 
+ 0: =c
+    *** Failers
+No match
+    1=2 
+No match
+    AAAA=b  
+No match
+
+/^\pL*=./8
+    AAAA=b
+ 0: AAAA=b
+    =c 
+ 0: =c
+    *** Failers
+No match
+    1=2  
+No match
+
+/^\X{2,3}X/8
+    A\x{300}\x{301}\x{302}A\x{300}\x{301}\x{302}X
+ 0: A\x{300}\x{301}\x{302}A\x{300}\x{301}\x{302}X
+    A\x{300}\x{301}\x{302}A\x{300}\x{301}\x{302}A\x{300}\x{301}\x{302}X 
+ 0: A\x{300}\x{301}\x{302}A\x{300}\x{301}\x{302}A\x{300}\x{301}\x{302}X
+    *** Failers
+No match
+    X
+No match
+    A\x{300}\x{301}\x{302}X
+No match
+    A\x{300}\x{301}\x{302}A\x{300}\x{301}\x{302}A\x{300}\x{301}\x{302}A\x{300}\x{301}\x{302}X
+No match
+
+/^\pC\pL\pM\pN\pP\pS\pZ</8
+    \x7f\x{c0}\x{30f}\x{660}\x{66c}\x{f01}\x{1680}<
+ 0: \x{7f}\x{c0}\x{30f}\x{660}\x{66c}\x{f01}\x{1680}<
+    \np\x{300}9!\$ < 
+ 0: \x{0a}p\x{300}9!$ <
+    ** Failers 
+No match
+    ap\x{300}9!\$ < 
+No match
+  
+/^\PC/8
+    X
+ 0: X
+    ** Failers 
+ 0: *
+    \x7f
+No match
+  
+/^\PL/8
+    9
+ 0: 9
+    ** Failers 
+ 0: *
+    \x{c0}
+No match
+  
+/^\PM/8
+    X
+ 0: X
+    ** Failers 
+ 0: *
+    \x{30f}
+No match
+  
+/^\PN/8
+    X
+ 0: X
+    ** Failers 
+ 0: *
+    \x{660}
+No match
+  
+/^\PP/8
+    X
+ 0: X
+    ** Failers 
+No match
+    \x{66c}
+No match
+  
+/^\PS/8
+    X
+ 0: X
+    ** Failers 
+ 0: *
+    \x{f01}
+No match
+  
+/^\PZ/8
+    X
+ 0: X
+    ** Failers 
+ 0: *
+    \x{1680}
+No match
+    
+/^\p{Cc}/8
+    \x{017}
+ 0: \x{17}
+    \x{09f} 
+ 0: \x{9f}
+    ** Failers
+No match
+    \x{0600} 
+No match
+  
+/^\p{Cf}/8
+    \x{601}
+ 0: \x{601}
+    ** Failers
+No match
+    \x{09f} 
+No match
+  
+/^\p{Cn}/8
+    ** Failers
+No match
+    \x{09f} 
+No match
+  
+/^\p{Co}/8
+    \x{f8ff}
+ 0: \x{f8ff}
+    ** Failers
+No match
+    \x{09f} 
+No match
+  
+/^\p{Cs}/8
+    \x{dfff}
+ 0: \x{dfff}
+    ** Failers
+No match
+    \x{09f} 
+No match
+  
+/^\p{Ll}/8
+    a
+ 0: a
+    ** Failers 
+No match
+    Z
+No match
+    \x{dfff}  
+No match
+  
+/^\p{Lm}/8
+    \x{2b0}
+ 0: \x{2b0}
+    ** Failers
+No match
+    a 
+No match
+  
+/^\p{Lo}/8
+    \x{1bb}
+ 0: \x{1bb}
+    ** Failers
+No match
+    a 
+No match
+    \x{2b0}
+No match
+  
+/^\p{Lt}/8
+    \x{1c5}
+ 0: \x{1c5}
+    ** Failers
+No match
+    a 
+No match
+    \x{2b0}
+No match
+  
+/^\p{Lu}/8
+    A
+ 0: A
+    ** Failers
+No match
+    \x{2b0}
+No match
+  
+/^\p{Mc}/8
+    \x{903}
+ 0: \x{903}
+    ** Failers
+No match
+    X
+No match
+    \x{300}
+No match
+       
+/^\p{Me}/8
+    \x{488}
+ 0: \x{488}
+    ** Failers
+No match
+    X
+No match
+    \x{903}
+No match
+    \x{300}
+No match
+  
+/^\p{Mn}/8
+    \x{300}
+ 0: \x{300}
+    ** Failers
+No match
+    X
+No match
+    \x{903}
+No match
+  
+/^\p{Nd}+/8
+    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}
+ 2: 0123456789\x{660}\x{661}\x{662}\x{663}\x{664}\x{665}\x{666}\x{667}
+ 3: 0123456789\x{660}\x{661}\x{662}\x{663}\x{664}\x{665}\x{666}
+ 4: 0123456789\x{660}\x{661}\x{662}\x{663}\x{664}\x{665}
+ 5: 0123456789\x{660}\x{661}\x{662}\x{663}\x{664}
+ 6: 0123456789\x{660}\x{661}\x{662}\x{663}
+ 7: 0123456789\x{660}\x{661}\x{662}
+ 8: 0123456789\x{660}\x{661}
+ 9: 0123456789\x{660}
+10: 0123456789
+11: 012345678
+12: 01234567
+13: 0123456
+14: 012345
+15: 01234
+16: 0123
+17: 012
+18: 01
+19: 0
+    \x{6f0}\x{6f1}\x{6f2}\x{6f3}\x{6f4}\x{6f5}\x{6f6}\x{6f7}\x{6f8}\x{6f9}\x{6fa}
+ 0: \x{6f0}\x{6f1}\x{6f2}\x{6f3}\x{6f4}\x{6f5}\x{6f6}\x{6f7}\x{6f8}\x{6f9}
+ 1: \x{6f0}\x{6f1}\x{6f2}\x{6f3}\x{6f4}\x{6f5}\x{6f6}\x{6f7}\x{6f8}
+ 2: \x{6f0}\x{6f1}\x{6f2}\x{6f3}\x{6f4}\x{6f5}\x{6f6}\x{6f7}
+ 3: \x{6f0}\x{6f1}\x{6f2}\x{6f3}\x{6f4}\x{6f5}\x{6f6}
+ 4: \x{6f0}\x{6f1}\x{6f2}\x{6f3}\x{6f4}\x{6f5}
+ 5: \x{6f0}\x{6f1}\x{6f2}\x{6f3}\x{6f4}
+ 6: \x{6f0}\x{6f1}\x{6f2}\x{6f3}
+ 7: \x{6f0}\x{6f1}\x{6f2}
+ 8: \x{6f0}\x{6f1}
+ 9: \x{6f0}
+    \x{966}\x{967}\x{968}\x{969}\x{96a}\x{96b}\x{96c}\x{96d}\x{96e}\x{96f}\x{970}
+ 0: \x{966}\x{967}\x{968}\x{969}\x{96a}\x{96b}\x{96c}\x{96d}\x{96e}\x{96f}
+ 1: \x{966}\x{967}\x{968}\x{969}\x{96a}\x{96b}\x{96c}\x{96d}\x{96e}
+ 2: \x{966}\x{967}\x{968}\x{969}\x{96a}\x{96b}\x{96c}\x{96d}
+ 3: \x{966}\x{967}\x{968}\x{969}\x{96a}\x{96b}\x{96c}
+ 4: \x{966}\x{967}\x{968}\x{969}\x{96a}\x{96b}
+ 5: \x{966}\x{967}\x{968}\x{969}\x{96a}
+ 6: \x{966}\x{967}\x{968}\x{969}
+ 7: \x{966}\x{967}\x{968}
+ 8: \x{966}\x{967}
+ 9: \x{966}
+    ** Failers
+No match
+    X
+No match
+  
+/^\p{Nl}/8
+    \x{16ee}
+ 0: \x{16ee}
+    ** Failers
+No match
+    X
+No match
+    \x{966}
+No match
+  
+/^\p{No}/8
+    \x{b2}
+ 0: \x{b2}
+    \x{b3}
+ 0: \x{b3}
+    ** Failers
+No match
+    X
+No match
+    \x{16ee}
+No match
+  
+/^\p{Pc}/8
+    \x5f
+ 0: _
+    \x{203f}
+ 0: \x{203f}
+    ** Failers
+No match
+    X
+No match
+    -
+No match
+    \x{58a}
+No match
+  
+/^\p{Pd}/8
+    -
+ 0: -
+    \x{58a}
+ 0: \x{58a}
+    ** Failers
+No match
+    X
+No match
+    \x{203f}
+No match
+  
+/^\p{Pe}/8
+    )
+ 0: )
+    ]
+ 0: ]
+    }
+ 0: }
+    \x{f3b}
+ 0: \x{f3b}
+    ** Failers
+No match
+    X
+No match
+    \x{203f}
+No match
+    (
+No match
+    [
+No match
+    {
+No match
+    \x{f3c}
+No match
+  
+/^\p{Pf}/8
+    \x{bb}
+ 0: \x{bb}
+    \x{2019}
+ 0: \x{2019}
+    ** Failers
+No match
+    X
+No match
+    \x{203f}
+No match
+  
+/^\p{Pi}/8
+    \x{ab}
+ 0: \x{ab}
+    \x{2018}
+ 0: \x{2018}
+    ** Failers
+No match
+    X
+No match
+    \x{203f}
+No match
+  
+/^\p{Po}/8
+    !
+ 0: !
+    \x{37e}
+ 0: \x{37e}
+    ** Failers
+ 0: *
+    X
+No match
+    \x{203f}
+No match
+  
+/^\p{Ps}/8
+    (
+ 0: (
+    [
+ 0: [
+    {
+ 0: {
+    \x{f3c}
+ 0: \x{f3c}
+    ** Failers
+No match
+    X
+No match
+    )
+No match
+    ]
+No match
+    }
+No match
+    \x{f3b}
+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
+No match
+    X
+No match
+    \x{2c2}
+No match
+  
+/^\p{Sk}/8
+    \x{2c2}
+ 0: \x{2c2}
+    ** Failers
+No match
+    X
+No match
+    \x{9f2}
+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
+No match
+    \x{9f2}
+No match
+  
+/^\p{So}/8
+    \x{a6}
+ 0: \x{a6}
+    \x{482} 
+ 0: \x{482}
+    ** Failers
+No match
+    X
+No match
+    \x{9f2}
+No match
+  
+/^\p{Zl}/8
+    \x{2028}
+ 0: \x{2028}
+    ** Failers
+No match
+    X
+No match
+    \x{2029}
+No match
+  
+/^\p{Zp}/8
+    \x{2029}
+ 0: \x{2029}
+    ** Failers
+No match
+    X
+No match
+    \x{2028}
+No match
+  
+/^\p{Zs}/8
+    \ \
+ 0:  
+    \x{a0}
+ 0: \x{a0}
+    \x{1680}
+ 0: \x{1680}
+    \x{180e}
+ 0: \x{180e}
+    \x{2000}
+ 0: \x{2000}
+    \x{2001}     
+ 0: \x{2001}
+    ** Failers
+No match
+    \x{2028}
+No match
+    \x{200d} 
+No match
+  
+/\p{Nd}+(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}AB
+ 1: \x{660}\x{661}\x{662}A
+ 2: \x{660}\x{661}\x{662}
+  
+/\p{Nd}+?(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}AB
+ 1: \x{660}\x{661}\x{662}A
+ 2: \x{660}\x{661}\x{662}
+  
+/\p{Nd}{2,}(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}AB
+ 1: \x{660}\x{661}\x{662}A
+  
+/\p{Nd}{2,}?(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}AB
+ 1: \x{660}\x{661}\x{662}A
+  
+/\p{Nd}*(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}AB
+ 1: \x{660}\x{661}\x{662}A
+ 2: \x{660}\x{661}\x{662}
+ 3: \x{660}\x{661}
+  
+/\p{Nd}*?(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}AB
+ 1: \x{660}\x{661}\x{662}A
+ 2: \x{660}\x{661}\x{662}
+ 3: \x{660}\x{661}
+  
+/\p{Nd}{2}(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}A
+  
+/\p{Nd}{2,3}(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}AB
+ 1: \x{660}\x{661}\x{662}A
+  
+/\p{Nd}{2,3}?(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}AB
+ 1: \x{660}\x{661}\x{662}A
+  
+/\p{Nd}?(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}
+ 1: \x{660}\x{661}
+  
+/\p{Nd}??(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}
+ 1: \x{660}\x{661}
+  
+/\p{Nd}*+(..)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}AB
+  
+/\p{Nd}*+(...)/8
+      \x{660}\x{661}\x{662}ABC
+ 0: \x{660}\x{661}\x{662}ABC
+  
+/\p{Nd}*+(....)/8
+      ** Failers
+ 0: ** F
+      \x{660}\x{661}\x{662}ABC
+No match
+  
+/\p{Lu}/8i
+    A
+ 0: A
+    a\x{10a0}B 
+ 0: \x{10a0}
+    ** Failers 
+ 0: F
+    a
+No match
+    \x{1d00}  
+No match
+
+/\p{^Lu}/8i
+    1234
+ 0: 1
+    ** Failers
+ 0: *
+    ABC 
+No match
+
+/\P{Lu}/8i
+    1234
+ 0: 1
+    ** Failers
+ 0: *
+    ABC 
+No match
+
+/(?<=A\p{Nd})XYZ/8
+    A2XYZ
+ 0: XYZ
+    123A5XYZPQR
+ 0: XYZ
+    ABA\x{660}XYZpqr
+ 0: XYZ
+    ** Failers
+No match
+    AXYZ
+No match
+    XYZ     
+No match
+    
+/(?<!\pL)XYZ/8
+    1XYZ
+ 0: XYZ
+    AB=XYZ.. 
+ 0: XYZ
+    XYZ 
+ 0: XYZ
+    ** Failers
+No match
+    WXYZ 
+No match
+
+/[\p{Nd}]/8
+    1234
+ 0: 1
+
+/[\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  
+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
+    11111111111111111111111111111111111111111111111111111111111111111111111
+No match
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+Matched, but too many subsidiary matches
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 2: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 3: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 4: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 6: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 7: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 8: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 9: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+10: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+11: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+12: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+13: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+14: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+15: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+16: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+17: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+18: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+19: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+20: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+21: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+     
+/\P{Nd}+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+No match
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+Matched, but too many subsidiary matches
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 2: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 3: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 4: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 6: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 7: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 8: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 9: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+10: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+11: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+12: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+13: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+14: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+15: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+16: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+17: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+18: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+19: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+20: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+21: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+
+/[\D]+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+No match
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+Matched, but too many subsidiary matches
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 2: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 3: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 4: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 6: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 7: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 8: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 9: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+10: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+11: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+12: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+13: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+14: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+15: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+16: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+17: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+18: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+19: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+20: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+21: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+
+/[\P{Nd}]+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+No match
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+Matched, but too many subsidiary matches
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 2: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 3: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 4: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 6: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 7: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 8: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 9: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+10: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+11: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+12: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+13: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+14: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+15: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+16: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+17: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+18: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+19: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+20: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+21: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+
+/[\D\P{Nd}]+/8
+    11111111111111111111111111111111111111111111111111111111111111111111111
+No match
+    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+Matched, but too many subsidiary matches
+ 0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 2: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 3: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 4: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 6: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 7: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 8: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ 9: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+10: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+11: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+12: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+13: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+14: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+15: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+16: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+17: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+18: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+19: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+20: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+21: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+
+/\pL/8
+    a
+ 0: a
+    A 
+ 0: A
+
+/\pL/8i
+    a
+ 0: a
+    A 
+ 0: A
+    
+/\p{Lu}/8 
+    A
+ 0: A
+    aZ
+ 0: Z
+    ** Failers
+ 0: F
+    abc   
+No match
+
+/\p{Lu}/8i
+    A
+ 0: A
+    aZ
+ 0: Z
+    ** Failers
+ 0: F
+    abc   
+No match
+
+/\p{Ll}/8 
+    a
+ 0: a
+    Az
+ 0: z
+    ** Failers
+ 0: a
+    ABC   
+No match
+
+/\p{Ll}/8i 
+    a
+ 0: a
+    Az
+ 0: z
+    ** Failers
+ 0: a
+    ABC   
+No match
+
+/^\x{c0}$/8i
+    \x{c0}
+ 0: \x{c0}
+    \x{e0} 
+ 0: \x{e0}
+
+/^\x{e0}$/8i
+    \x{c0}
+ 0: \x{c0}
+    \x{e0} 
+ 0: \x{e0}
+
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8
+    A\x{391}\x{10427}\x{ff3a}\x{1fb0}
+ 0: A\x{391}\x{10427}\x{ff3a}\x{1fb0}
+    ** Failers
+No match
+    a\x{391}\x{10427}\x{ff3a}\x{1fb0}   
+No match
+    A\x{3b1}\x{10427}\x{ff3a}\x{1fb0}
+No match
+    A\x{391}\x{1044F}\x{ff3a}\x{1fb0}
+No match
+    A\x{391}\x{10427}\x{ff5a}\x{1fb0}
+No match
+    A\x{391}\x{10427}\x{ff3a}\x{1fb8}
+No match
+
+/A\x{391}\x{10427}\x{ff3a}\x{1fb0}/8i
+    A\x{391}\x{10427}\x{ff3a}\x{1fb0}
+ 0: A\x{391}\x{10427}\x{ff3a}\x{1fb0}
+    a\x{391}\x{10427}\x{ff3a}\x{1fb0}   
+ 0: a\x{391}\x{10427}\x{ff3a}\x{1fb0}
+    A\x{3b1}\x{10427}\x{ff3a}\x{1fb0}
+ 0: A\x{3b1}\x{10427}\x{ff3a}\x{1fb0}
+    A\x{391}\x{1044F}\x{ff3a}\x{1fb0}
+ 0: A\x{391}\x{1044f}\x{ff3a}\x{1fb0}
+    A\x{391}\x{10427}\x{ff5a}\x{1fb0}
+ 0: A\x{391}\x{10427}\x{ff5a}\x{1fb0}
+    A\x{391}\x{10427}\x{ff3a}\x{1fb8}
+ 0: A\x{391}\x{10427}\x{ff3a}\x{1fb8}
+
+/\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
+ 0: \x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}X
+ 1: \x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}
+ 2: \x{391}\x{3b1}\x{3b1}\x{3b1}
+
+/\x{391}{3,5}?(.)/8i
+    \x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}X
+ 0: \x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}X
+ 1: \x{391}\x{3b1}\x{3b1}\x{3b1}\x{391}
+ 2: \x{391}\x{3b1}\x{3b1}\x{3b1}
+
+/[\x{391}\x{ff3a}]/8i
+    \x{391}
+ 0: \x{391}
+    \x{ff3a}
+ 0: \x{ff3a}
+    \x{3b1}
+ 0: \x{3b1}
+    \x{ff5a}   
+ 0: \x{ff5a}
+    
+/[\x{c0}\x{391}]/8i
+    \x{c0}
+ 0: \x{c0}
+    \x{e0} 
+ 0: \x{e0}
+
+/[\x{105}-\x{109}]/8i
+    \x{104}
+ 0: \x{104}
+    \x{105}
+ 0: \x{105}
+    \x{109}  
+ 0: \x{109}
+    ** Failers
+No match
+    \x{100}
+No match
+    \x{10a} 
+No match
+    
+/[z-\x{100}]/8i 
+    Z
+ 0: Z
+    z
+ 0: z
+    \x{39c}
+ 0: \x{39c}
+    \x{178}
+ 0: \x{178}
+    |
+ 0: |
+    \x{80}
+ 0: \x{80}
+    \x{ff}
+ 0: \x{ff}
+    \x{100}
+ 0: \x{100}
+    \x{101} 
+ 0: \x{101}
+    ** Failers
+No match
+    \x{102}
+No match
+    Y
+No match
+    y           
+No match
+
+/[z-\x{100}]/8i
+
+/^\X/8
+    A
+ 0: A
+    A\x{300}BC 
+ 0: A\x{300}
+    A\x{300}\x{301}\x{302}BC 
+ 0: A\x{300}\x{301}\x{302}
+    *** Failers
+ 0: *
+    \x{300}  
+No match
+
+/^[\X]/8
+    X123
+ 0: X
+    *** Failers
+No match
+    AXYZ
+No match
+
+/^(\X*)C/8
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301} 
+ 0: A\x{300}\x{301}\x{302}BC
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C 
+ 0: A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C
+ 1: A\x{300}\x{301}\x{302}BC
+
+/^(\X*?)C/8
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301} 
+ 0: A\x{300}\x{301}\x{302}BC
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C 
+ 0: A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C
+ 1: A\x{300}\x{301}\x{302}BC
+
+/^(\X*)(.)/8
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301} 
+ 0: A\x{300}\x{301}\x{302}BCA
+ 1: A\x{300}\x{301}\x{302}BC
+ 2: A\x{300}\x{301}\x{302}B
+ 3: A
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C 
+ 0: A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C
+ 1: A\x{300}\x{301}\x{302}BCA
+ 2: A\x{300}\x{301}\x{302}BC
+ 3: A\x{300}\x{301}\x{302}B
+ 4: A
+
+/^(\X*?)(.)/8
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301} 
+ 0: A\x{300}\x{301}\x{302}BCA
+ 1: A\x{300}\x{301}\x{302}BC
+ 2: A\x{300}\x{301}\x{302}B
+ 3: A
+    A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C 
+ 0: A\x{300}\x{301}\x{302}BCA\x{300}\x{301}C
+ 1: A\x{300}\x{301}\x{302}BCA
+ 2: A\x{300}\x{301}\x{302}BC
+ 3: A\x{300}\x{301}\x{302}B
+ 4: A
+
+/^\X(.)/8
+    *** Failers
+ 0: **
+    A\x{300}\x{301}\x{302}
+No match
+
+/^\X{2,3}(.)/8
+    A\x{300}\x{301}B\x{300}X
+ 0: A\x{300}\x{301}B\x{300}X
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}
+ 0: A\x{300}\x{301}B\x{300}C
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}X
+ 0: A\x{300}\x{301}B\x{300}C\x{300}\x{301}X
+ 1: A\x{300}\x{301}B\x{300}C
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}DA\x{300}X
+ 0: A\x{300}\x{301}B\x{300}C\x{300}\x{301}D
+ 1: A\x{300}\x{301}B\x{300}C
+    
+/^\X{2,3}?(.)/8
+    A\x{300}\x{301}B\x{300}X
+ 0: A\x{300}\x{301}B\x{300}X
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}
+ 0: A\x{300}\x{301}B\x{300}C
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}X
+ 0: A\x{300}\x{301}B\x{300}C\x{300}\x{301}X
+ 1: A\x{300}\x{301}B\x{300}C
+    A\x{300}\x{301}B\x{300}C\x{300}\x{301}DA\x{300}X
+ 0: A\x{300}\x{301}B\x{300}C\x{300}\x{301}D
+ 1: A\x{300}\x{301}B\x{300}C
+
+/^\pN{2,3}X/
+    12X
+ 0: 12X
+    123X
+ 0: 123X
+    *** Failers
+No match
+    X
+No match
+    1X
+No match
+    1234X     
+No match
+
+/\x{100}/i8
+    \x{100}   
+ 0: \x{100}
+    \x{101} 
+ 0: \x{101}
+    
+/ End / 
index c013978e2342ca510b5cde2264cf1d963d87b631..955e104a6a84191faf41cafd831b456e1e6d2e12 100644 (file)
@@ -2,6 +2,10 @@
 *     libucp - Unicode Property Table handler    *
 *************************************************/
 
+
+#ifndef _UCP_H
+#define _UCP_H
+
 /* These are the character categories that are returned by ucp_findchar */
 
 enum {
@@ -49,10 +53,8 @@ enum {
   ucp_Zs     /* Space separator */
 };
 
-/* For use in PCRE we make this function static so that there is no conflict if
-PCRE is linked with an application that makes use of an external version -
-assuming an external version is ever released... */
+extern int ucp_findchar(const int, int *, int *);
 
-static int ucp_findchar(const int, int *, int *);
+#endif
 
 /* End of ucp.h */
similarity index 89%
rename from ext/pcre/pcrelib/ucp.c
rename to ext/pcre/pcrelib/ucp_findchar.c
index 3d69653bb658d680c68d217ded431a7b956413f7..1f451172f9ce95bd73adf486d024c69b4c5f5eb3 100644 (file)
@@ -2,12 +2,13 @@
 *     libucp - Unicode Property Table handler    *
 *************************************************/
 
-/* This function provides a fast way of obtaining the basic Unicode properties
-of a character, using a compact binary tree that occupies less than 100K bytes.
+/* Copyright (c) University of Cambridge 2004 */
 
-           Copyright (c) 2004 University of Cambridge
+/* This little library provides a fast way of obtaining the basic Unicode
+properties of a character, using a compact binary tree that occupies less than
+100K bytes.
 
--------------------------------------------------------------------------------
+-----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
 
@@ -33,7 +34,7 @@ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
+-----------------------------------------------------------------------------
 */
 
 
@@ -42,6 +43,14 @@ POSSIBILITY OF SUCH DAMAGE.
 #include "ucptable.c"          /* The table itself */
 
 
+/* In some environments, external functions have to be preceded by some magic.
+In my world (Unix), they do not. Use a macro to deal with this. */
+
+#ifndef EXPORT
+#define EXPORT
+#endif
+
+
 
 /*************************************************
 *         Search table and return data           *
@@ -59,7 +68,7 @@ Arguments:
 Returns:      the character type category or -1 if not found
 */
 
-static int
+EXPORT int
 ucp_findchar(const int c, int *type_ptr, int *case_ptr)
 {
 cnode *node = ucp_table;
@@ -148,4 +157,4 @@ switch ((*type_ptr = ((node->f0 & f0_typemask) >> f0_typeshift)))
   }
 }
 
-/* End of ucp.c */
+/* End of ucp_findchar.c */