diff --git a/ChangeLog b/ChangeLog index c0a8a69..a3d8cfe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -121,6 +121,9 @@ the option applies only to unrecognized or malformed escape sequences. tests such as (?(VERSION>=0)...) when the version test was true. Incorrect processing or a crash could result. +30. When PCRE2_UTF is set, allow non-ASCII letters and decimal digits in group +names, as Perl does. + Version 10.32 10-September-2018 ------------------------------- diff --git a/doc/html/pcre2_substring_nametable_scan.html b/doc/html/pcre2_substring_nametable_scan.html index 5a44ea9..277affa 100644 --- a/doc/html/pcre2_substring_nametable_scan.html +++ b/doc/html/pcre2_substring_nametable_scan.html @@ -27,8 +27,8 @@ DESCRIPTION

This convenience function finds, for a compiled pattern, the first and last -entries for a given name in the table that translates capturing parenthesis -names into numbers. +entries for a given name in the table that translates capture group names into +numbers.

   code    Compiled regular expression
   name    Name whose entries required
diff --git a/doc/html/pcre2api.html b/doc/html/pcre2api.html
index 018a077..bbfaeaa 100644
--- a/doc/html/pcre2api.html
+++ b/doc/html/pcre2api.html
@@ -49,7 +49,7 @@ please consult the man page, in case the conversion went wrong.
 
  • EXTRACTING A LIST OF ALL CAPTURED SUBSTRINGS
  • EXTRACTING CAPTURED SUBSTRINGS BY NAME
  • CREATING A NEW STRING WITH SUBSTITUTIONS -
  • DUPLICATE SUBPATTERN NAMES +
  • DUPLICATE CAPTURE GROUP NAMES
  • FINDING ALL POSSIBLE MATCHES AT ONE POSITION
  • MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
  • SEE ALSO @@ -1490,10 +1490,10 @@ independent of the setting of PCRE2_DOTALL.
       PCRE2_DUPNAMES
     
    -If this bit is set, names used to identify capturing subpatterns need not be -unique. This can be helpful for certain types of pattern when it is known that -only one instance of the named subpattern can ever be matched. There are more -details of named subpatterns below; see also the +If this bit is set, names used to identify capture groups need not be unique. +This can be helpful for certain types of pattern when it is known that only one +instance of the named group can ever be matched. There are more details of +named capture groups below; see also the pcre2pattern documentation.
    @@ -1526,11 +1526,11 @@ the end of the subject.
     If this bit is set, most white space characters in the pattern are totally
     ignored except when escaped or inside a character class. However, white space
     is not allowed within sequences such as (?> that introduce various
    -parenthesized subpatterns, nor within numerical quantifiers such as {1,3}.
    -Ignorable white space is permitted between an item and a following quantifier
    -and between a quantifier and a following + that indicates possessiveness.
    -PCRE2_EXTENDED is equivalent to Perl's /x option, and it can be changed within
    -a pattern by a (?x) option setting.
    +parenthesized groups, nor within numerical quantifiers such as {1,3}. Ignorable
    +white space is permitted between an item and a following quantifier and between
    +a quantifier and a following + that indicates possessiveness. PCRE2_EXTENDED is
    +equivalent to Perl's /x option, and it can be changed within a pattern by a
    +(?x) option setting.
     

    When PCRE2 is compiled without Unicode support, PCRE2_EXTENDED recognizes as @@ -1606,7 +1606,7 @@ error.

       PCRE2_MATCH_UNSET_BACKREF
     
    -If this option is set, a backreference to an unset subpattern group matches an +If this option is set, a backreference to an unset capture group matches an empty string (by default this causes the current matching alternative to fail). A pattern such as (\1)(a) succeeds when this option is set (assuming it can find an "a" in the subject), whereas it fails by default, for Perl @@ -1668,7 +1668,7 @@ If this option is set, it disables the use of numbered capturing parentheses 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). This is the same as Perl's /n option. -Note that, when this option is set, references to capturing groups +Note that, when this option is set, references to capture groups (backreferences or recursion/subroutine calls) may only refer to named groups, though the reference can be by name or by number.
    @@ -1687,7 +1687,7 @@ purposes.
     If this option is set, it disables an optimization that is applied when .* is
     the first significant item in a top-level branch of a pattern, and all the
     other branches also start with .* or with \A or \G or ^. The optimization is
    -automatically disabled for .* if it is inside an atomic group or a capturing
    +automatically disabled for .* if it is inside an atomic group or a capture
     group that is the subject of a backreference, or if the pattern contains
     (*PRUNE) or (*SKIP). When the optimization is not disabled, such a pattern is
     automatically anchored if PCRE2_DOTALL is set for all the .* items and
    @@ -2066,7 +2066,7 @@ When .* is the first significant item, anchoring is possible only when all the
     following are true:
     
       .* is not in an atomic group
    -  .* is not in a capturing group that is the subject of a backreference
    +  .* is not in a capture group that is the subject of a backreference
       PCRE2_DOTALL is in force for .*
       Neither (*PRUNE) nor (*SKIP) appears in the pattern
       PCRE2_NO_DOTSTAR_ANCHOR is not set
    @@ -2077,12 +2077,12 @@ options returned for PCRE2_INFO_ALLOPTIONS.
       PCRE2_INFO_BACKREFMAX
     
    Return the number of the highest backreference in the pattern. The third -argument should point to an uint32_t variable. Named subpatterns acquire -numbers as well as names, and these count towards the highest backreference. -Backreferences such as \4 or \g{12} match the captured characters of the -given group, but in addition, the check that a capturing group is set in a -conditional subpattern such as (?(3)a|b) is also a backreference. Zero is -returned if there are no backreferences. +argument should point to an uint32_t variable. Named capture groups +acquire numbers as well as names, and these count towards the highest +backreference. Backreferences such as \4 or \g{12} match the captured +characters of the given group, but in addition, the check that a capture +group is set in a conditional group such as (?(3)a|b) is also a backreference. +Zero is returned if there are no backreferences.
       PCRE2_INFO_BSR
     
    @@ -2093,9 +2093,9 @@ that \R matches only CR, LF, or CRLF.
       PCRE2_INFO_CAPTURECOUNT
     
    -Return the highest capturing subpattern number in the pattern. In patterns -where (?| is not used, this is also the total number of capturing subpatterns. -The third argument should point to an uint32_t variable. +Return the highest capture group number in the pattern. In patterns where (?| +is not used, this is also the total number of capture groups. The third +argument should point to an uint32_t variable.
       PCRE2_INFO_DEPTHLIMIT
     
    @@ -2143,7 +2143,7 @@ Return the size (in bytes) of the data frames that are used to remember backtracking positions when the pattern is processed by pcre2_match() without the use of JIT. The third argument should point to a size_t variable. The frame size depends on the number of capturing parentheses in the -pattern. Each additional capturing group adds two PCRE2_SIZE variables. +pattern. Each additional capture group adds two PCRE2_SIZE variables.
       PCRE2_INFO_HASBACKSLASHC
     
    @@ -2267,20 +2267,20 @@ the parenthesis number. The rest of the entry is the corresponding name, zero terminated.

    -The names are in alphabetical order. If (?| is used to create multiple groups -with the same number, as described in the -section on duplicate subpattern numbers +The names are in alphabetical order. If (?| is used to create multiple capture +groups with the same number, as described in the +section on duplicate group numbers in the pcre2pattern page, the groups may be given the same name, but there is only one entry in the table. Different names for groups of the same number are not permitted.

    -Duplicate names for subpatterns with different numbers are permitted, but only -if PCRE2_DUPNAMES is set. They appear in the table in the order in which they -were found in the pattern. In the absence of (?| this is the order of +Duplicate names for capture groups with different numbers are permitted, but +only if PCRE2_DUPNAMES is set. They appear in the table in the order in which +they were found in the pattern. In the absence of (?| this is the order of increasing number; when (?| is used this is not necessarily the case because -later subpatterns may have lower numbers. +later capture groups may have lower numbers.

    As a simple example of the name/number table, consider the following pattern @@ -2289,16 +2289,16 @@ space - including newlines - is ignored):

       (?<date> (?<year>(\d\d)?\d\d) - (?<month>\d\d) - (?<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, with non-printing -bytes shows in hexadecimal, and undefined bytes shown as ??: +There are four named capture groups, 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 ??:
       00 01 d  a  t  e  00 ??
       00 05 d  a  y  00 ?? ??
       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 capture groups using the name-to-number map, remember that the length of the entries is likely to be different for each compiled pattern.
    @@ -2741,12 +2741,12 @@ valid newline sequence and explicit \r or \n escapes appear in the pattern.
     In general, a pattern matches a certain portion of the subject, and in
     addition, further substrings from the subject may be picked out by
     parenthesized parts of the pattern. Following the usage in Jeffrey Friedl's
    -book, this is called "capturing" in what follows, and the phrase "capturing
    -subpattern" or "capturing group" is used for a fragment of a pattern that picks
    -out a substring. PCRE2 supports several other kinds of parenthesized subpattern
    -that do not cause substrings to be captured. The pcre2_pattern_info()
    -function can be used to find out how many capturing subpatterns there are in a
    -compiled pattern.
    +book, this is called "capturing" in what follows, and the phrase "capture
    +group" (Perl terminology) is used for a fragment of a pattern that picks out a
    +substring. PCRE2 supports several other kinds of parenthesized group that do
    +not cause substrings to be captured. The pcre2_pattern_info() function
    +can be used to find out how many capture groups there are in a compiled
    +pattern.
     

    You can use auxiliary functions for accessing captured substrings @@ -2795,9 +2795,8 @@ For example, if the pattern (?=ab\K) is matched against "ab", the start and end offset values for the match are 2 and 0.

    -If a capturing subpattern group is matched repeatedly within a single match -operation, it is the last portion of the subject that it matched that is -returned. +If a capture group is matched repeatedly within a single match operation, it is +the last portion of the subject that it matched that is returned.

    If the ovector is too small to hold all the captured substring offsets, as much @@ -2806,21 +2805,20 @@ substrings are not of interest, pcre2_match() may be called with a match data block whose ovector is of minimum length (that is, one pair).

    -It is possible for 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) the return from the -function is 4, and subpatterns 1 and 3 are matched, but 2 is not. When this -happens, both values in the offset pairs corresponding to unused subpatterns -are set to PCRE2_UNSET. +It is possible for capture group number n+1 to match some part of the +subject when group n has not been used at all. For example, if the string +"abc" is matched against the pattern (a|(z))(bc) the return from the function +is 4, and groups 1 and 3 are matched, but 2 is not. When this happens, both +values in the offset pairs corresponding to unused groups are set to +PCRE2_UNSET.

    -Offset values that correspond to unused subpatterns at the end of the -expression are also set to PCRE2_UNSET. For example, if the string "abc" is -matched against the pattern (abc)(x(yz)?)? subpatterns 2 and 3 are not matched. -The return from the function is 2, because the highest used capturing -subpattern number is 1. The offsets for for the second and third capturing -subpatterns (assuming the vector is large enough, of course) are set to -PCRE2_UNSET. +Offset values that correspond to unused groups at the end of the expression are +also set to PCRE2_UNSET. For example, if the string "abc" is matched against +the pattern (abc)(x(yz)?)? groups 2 and 3 are not matched. The return from the +function is 2, because the highest used capture group number is 1. The offsets +for for the second and third capture groupss (assuming the vector is large +enough, of course) are set to PCRE2_UNSET.

    Elements in the ovector that do not correspond to capturing parentheses in the @@ -2993,11 +2991,11 @@ as NULL.

    This error is returned when pcre2_match() detects a recursion loop within the pattern. Specifically, it means that either the whole pattern or a -subpattern has been called recursively for the second time at the same position -in the subject string. Some simple patterns that might do this are detected and -faulted at compile time, but more complicated cases, in particular mutual -recursions between two different subpatterns, cannot be detected until matching -is attempted. +capture group has been called recursively for the second time at the same +position in the subject string. Some simple patterns that might do this are +detected and faulted at compile time, but more complicated cases, in particular +mutual recursions between two different groups, cannot be detected until +matching is attempted.


    OBTAINING A TEXTUAL ERROR MESSAGE

    @@ -3074,7 +3072,7 @@ The pcre2_substring_copy_bynumber() function copies a captured substring into a supplied buffer, whereas pcre2_substring_get_bynumber() copies it into new memory, obtained using the same memory allocation function that was used for the match data block. The first two arguments of these functions are a -pointer to the match data block and a capturing group number. +pointer to the match data block and a capture group number.

    The final arguments of pcre2_substring_copy_bynumber() are a pointer to @@ -3150,9 +3148,9 @@ calling pcre2_substring_list_free().

    If this function encounters 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, it returns an empty string. This -can be distinguished from a genuine zero-length substring by inspecting the +capture group number n+1 matches some part of the subject, but group +n has not been used at all, it returns an empty string. This can be +distinguished from a genuine zero-length substring by inspecting the appropriate offset in the ovector, which contain PCRE2_UNSET for unset substrings, or by calling pcre2_substring_length_bynumber().

    @@ -3182,21 +3180,21 @@ For example, for this pattern:
       (a+)b(?<xxx>\d+)...
     
    -the number of the subpattern called "xxx" is 2. If the name is known to be +the number of the capture group called "xxx" is 2. If the name is known to be unique (PCRE2_DUPNAMES was not set), you can find the number from the name by calling pcre2_substring_number_from_name(). The first argument is the compiled pattern, and the second is the name. The yield of the function is the -subpattern number, PCRE2_ERROR_NOSUBSTRING if there is no subpattern of that -name, or PCRE2_ERROR_NOUNIQUESUBSTRING if there is more than one subpattern of -that name. Given the number, you can extract the substring directly from the -ovector, or use one of the "bynumber" functions described above. +group number, PCRE2_ERROR_NOSUBSTRING if there is no group with that name, or +PCRE2_ERROR_NOUNIQUESUBSTRING if there is more than one group with that name. +Given the number, you can extract the substring directly from the ovector, or +use one of the "bynumber" functions described above.

    For convenience, there are also "byname" functions that correspond to the "bynumber" functions, the only difference being that the second argument is a name instead of a number. If PCRE2_DUPNAMES is set and there are duplicate names, these functions scan all the groups with the given name, and return the -first named string that is set. +captured substring from the first named group that is set.

    If there are no groups with the given name, PCRE2_ERROR_NOSUBSTRING is @@ -3207,13 +3205,13 @@ set, PCRE2_ERROR_UNSET is returned.

    Warning: If the pattern uses the (?| feature to set up multiple -subpatterns with the same number, as described in the -section on duplicate subpattern numbers +capture groups with the same number, as described in the +section on duplicate group numbers in the pcre2pattern -page, you cannot use names to distinguish the different subpatterns, because +page, you cannot use names to distinguish the different capture groups, because names are not included in the compiled code. The matching process uses only -numbers. For this reason, the use of different names for subpatterns of the +numbers. For this reason, the use of different names for groups with the same number causes an error at compile time.


    CREATING A NEW STRING WITH SUBSTITUTIONS
    @@ -3276,7 +3274,7 @@ length is in code units, not bytes. In the replacement string, which is interpreted as a UTF string in UTF mode, and is checked for UTF validity unless the PCRE2_NO_UTF_CHECK option is set, a dollar character is an escape character that can specify the insertion of -characters from capturing groups or names from (*MARK) or other control verbs +characters from capture groups or names from (*MARK) or other control verbs in the pattern. The following forms are always recognized:
       $$                  insert a dollar character
    @@ -3345,13 +3343,13 @@ efficient to allocate a large buffer and free the excess afterwards, instead of
     using PCRE2_SUBSTITUTE_OVERFLOW_LENGTH.
     

    -PCRE2_SUBSTITUTE_UNKNOWN_UNSET causes references to capturing groups that do +PCRE2_SUBSTITUTE_UNKNOWN_UNSET causes references to capture groups that do not appear in the pattern to be treated as unset groups. This option should be used with care, because it means that a typo in a group name or number no longer causes the PCRE2_ERROR_NOSUBSTRING error.

    -PCRE2_SUBSTITUTE_UNSET_EMPTY causes unset capturing groups (including unknown +PCRE2_SUBSTITUTE_UNSET_EMPTY causes unset capture groups (including unknown groups when PCRE2_SUBSTITUTE_UNKNOWN_UNSET is set) to be treated as empty strings when inserted as described above. If this option is not set, an attempt to insert an unset group causes the PCRE2_ERROR_UNSET error. This option does @@ -3379,7 +3377,7 @@ terminating a \Q quoted sequence) reverts to no case forcing. The sequences \u and \l force the next character (if it is a letter) to upper or lower case, respectively, and then the state automatically reverts to no case forcing. Case forcing applies to all inserted characters, including those from -captured groups and letters within \Q...\E quoted sequences. +capture groups and letters within \Q...\E quoted sequences.

    Note that case forcing sequences such as \U...\E do not nest. For example, @@ -3388,7 +3386,8 @@ effect.

    The second effect of setting PCRE2_SUBSTITUTE_EXTENDED is to add more -flexibility to group substitution. The syntax is similar to that used by Bash: +flexibility to capture group substitution. The syntax is similar to that used +by Bash:

       ${<n>:-<string>}
       ${<n>:+<string1>:<string2>}
    @@ -3518,20 +3517,21 @@ PCRE2_SUBSTITUTE_GLOBAL is not set), the the rest of the input is copied to the
     output and the call to pcre2_substitute() exits, returning the number of
     matches so far.
     

    -
    DUPLICATE SUBPATTERN NAMES
    +
    DUPLICATE CAPTURE GROUP NAMES

    int pcre2_substring_nametable_scan(const pcre2_code *code, PCRE2_SPTR name, PCRE2_SPTR *first, PCRE2_SPTR *last);

    -When a pattern is compiled with the PCRE2_DUPNAMES option, names for -subpatterns are not required to be unique. Duplicate names are always allowed -for subpatterns with the same number, created by using the (?| feature. Indeed, -if such subpatterns are named, they are required to use the same names. +When a pattern is compiled with the PCRE2_DUPNAMES option, names for capture +groups are not required to be unique. Duplicate names are always allowed for +groups with the same number, created by using the (?| feature. Indeed, if such +groups are named, they are required to use the same names.

    -Normally, patterns with duplicate names are such that in any one match, only -one of the named subpatterns participates. An example is shown in the +Normally, patterns that use duplicate names are such that in any one match, +only one of each set of identically-named groups participates. An example is +shown in the pcre2pattern documentation.

    @@ -3703,9 +3703,8 @@ the three matched strings are On success, the yield of the function is a number greater than zero, which is the number of matched substrings. The offsets of the substrings are returned in the ovector, and can be extracted by number in the same way as for -pcre2_match(), but the numbers bear no relation to any capturing groups -that may exist in the pattern, because DFA matching does not support group -capture. +pcre2_match(), but the numbers bear no relation to any capture groups +that may exist in the pattern, because DFA matching does not support capturing.

    Calls to the convenience functions that extract substrings by name @@ -3747,7 +3746,7 @@ a backreference.

    This return is given if pcre2_dfa_match() encounters a condition item that uses a backreference for the condition, or a test for recursion in a -specific group. These are not supported. +specific capture group. These are not supported.
       PCRE2_ERROR_DFA_WSSIZE
     
    @@ -3756,9 +3755,9 @@ This return is given if pcre2_dfa_match() runs out of space in the
       PCRE2_ERROR_DFA_RECURSE
     
    -When a recursive subpattern is processed, the matching function calls itself -recursively, using private memory for the ovector and workspace. This -error is given if the internal ovector is not large enough. This should be +When a recursion or subroutine call is processed, the matching function calls +itself recursively, using private memory for the ovector and workspace. +This error is given if the internal ovector is not large enough. This should be extremely rare, as a vector of size 1000 is used.
       PCRE2_ERROR_DFA_BADRESTART
    @@ -3785,7 +3784,7 @@ Cambridge, England.
     


    REVISION

    -Last updated: 04 January 2019 +Last updated: 04 February 2019
    Copyright © 1997-2019 University of Cambridge.
    diff --git a/doc/html/pcre2callout.html b/doc/html/pcre2callout.html index bc26812..899a476 100644 --- a/doc/html/pcre2callout.html +++ b/doc/html/pcre2callout.html @@ -151,7 +151,7 @@ branch, automatic anchoring occurs if all branches are anchorable.

    This optimization is disabled, however, if .* is in an atomic group or if there -is a backreference to the capturing group in which it appears. It is also +is a backreference to the capture group in which it appears. It is also disabled if the pattern contains (*PRUNE) or (*SKIP). However, the presence of callouts does not affect it.

    @@ -354,8 +354,8 @@ callout before an assertion such as (?=ab) the length is 3. For an an alternation bar or a closing parenthesis, the length is one, unless a closing parenthesis is followed by a quantifier, in which case its length is included. (This changed in release 10.23. In earlier releases, before an opening -parenthesis the length was that of the entire subpattern, and before an -alternation bar or a closing parenthesis the length was zero.) +parenthesis the length was that of the entire group, and before an alternation +bar or a closing parenthesis the length was zero.)

    The pattern_position and next_item_length fields are intended to @@ -471,9 +471,9 @@ Cambridge, England.


    REVISION

    -Last updated: 17 September 2018 +Last updated: 03 February 2019
    -Copyright © 1997-2018 University of Cambridge. +Copyright © 1997-2019 University of Cambridge.

    Return to the PCRE2 index page. diff --git a/doc/html/pcre2compat.html b/doc/html/pcre2compat.html index f593204..f110e33 100644 --- a/doc/html/pcre2compat.html +++ b/doc/html/pcre2compat.html @@ -36,10 +36,9 @@ assertion just once). Perl allows some repeat quantifiers on other assertions, for example, \b* (but not \b{3}), but these do not seem to have any use.

    -3. Capturing subpatterns that occur inside negative lookaround assertions are -counted, but their entries in the offsets vector are set only when a negative -assertion is a condition that has a matching branch (that is, the condition is -false). +3. Capture groups that occur inside negative lookaround assertions are counted, +but their entries in the offsets vector are set only when a negative assertion +is a condition that has a matching branch (that is, the condition is false).

    4. The following Perl escape sequences are not supported: \F, \l, \L, \u, @@ -94,13 +93,13 @@ to PCRE2 release 10.23, but from release 10.30 this changed, and backtracking into subroutine calls is now supported, as in Perl.

    -9. If any of the backtracking control verbs are used in a subpattern that is -called as a subroutine (whether or not recursively), their effect is confined -to that subpattern; it does not extend to the surrounding pattern. This is not -always the case in Perl. In particular, if (*THEN) is present in a group that -is called as a subroutine, its action is limited to that group, even if the -group does not contain any | characters. Note that such subpatterns are -processed as anchored at the point where they are tested. +9. If any of the backtracking control verbs are used in a group that is called +as a subroutine (whether or not recursively), their effect is confined to that +group; it does not extend to the surrounding pattern. This is not always the +case in Perl. In particular, if (*THEN) is present in a group that is called as +a subroutine, its action is limited to that group, even if the group does not +contain any | characters. Note that such groups are processed as anchored +at the point where they are tested.

    10. If a pattern contains more than one backtracking control verb, the first @@ -120,22 +119,21 @@ the pattern /^(a(b)?)+$/ in Perl leaves $2 unset, but in PCRE2 it is set to "b".

    -13. PCRE2's handling of duplicate subpattern numbers and duplicate subpattern -names is not as general as Perl's. This is a consequence of the fact the PCRE2 -works internally just with numbers, using an external table to translate -between numbers and names. In particular, a pattern such as (?|(?<a>A)|(?<b>B), -where the two capturing parentheses have the same number but different names, -is not supported, and causes an error at compile time. If it were allowed, it -would not be possible to distinguish which parentheses matched, because both -names map to capturing subpattern number 1. To avoid this confusing situation, -an error is given at compile time. +13. PCRE2's handling of duplicate capture group numbers and names is not as +general as Perl's. This is a consequence of the fact the PCRE2 works internally +just with numbers, using an external table to translate between numbers and +names. In particular, a pattern such as (?|(?<a>A)|(?<b>B), where the two +capture groups have the same number but different names, is not supported, and +causes an error at compile time. If it were allowed, it would not be possible +to distinguish which group matched, because both names map to capture group +number 1. To avoid this confusing situation, an error is given at compile time.

    14. Perl used to recognize comments in some places that PCRE2 does not, for -example, between the ( and ? at the start of a subpattern. If the /x modifier -is set, Perl allowed white space between ( and ? though the latest Perls give -an error (for a while it was just deprecated). There may still be some cases -where Perl behaves differently. +example, between the ( and ? at the start of a group. If the /x modifier is +set, Perl allowed white space between ( and ? though the latest Perls give an +error (for a while it was just deprecated). There may still be some cases where +Perl behaves differently.

    15. Perl, when in warning mode, gives warnings for character classes such as @@ -235,9 +233,9 @@ Cambridge, England. REVISION

    -Last updated: 28 July 2018 +Last updated: 03 February 2019
    -Copyright © 1997-2018 University of Cambridge. +Copyright © 1997-2019 University of Cambridge.

    Return to the PCRE2 index page. diff --git a/doc/html/pcre2limits.html b/doc/html/pcre2limits.html index d90cdc3..c8bc01b 100644 --- a/doc/html/pcre2limits.html +++ b/doc/html/pcre2limits.html @@ -50,17 +50,17 @@ All values in repeating quantifiers must be less than 65536. The maximum length of a lookbehind assertion is 65535 characters.

    -There is no limit to the number of parenthesized subpatterns, but there can be -no more than 65535 capturing subpatterns. There is, however, a limit to the -depth of nesting of parenthesized subpatterns of all kinds. This is imposed in -order to limit the amount of system stack used at compile time. The default -limit can be specified when PCRE2 is built; if not, the default is set to 250. -An application can change this limit by calling pcre2_set_parens_nest_limit() -to set the limit in a compile context. +There is no limit to the number of parenthesized groups, but there can be no +more than 65535 capture groups, and there is a limit to the depth of nesting of +parenthesized subpatterns of all kinds. This is imposed in order to limit the +amount of system stack used at compile time. The default limit can be specified +when PCRE2 is built; if not, the default is set to 250. An application can +change this limit by calling pcre2_set_parens_nest_limit() to set the limit in +a compile context.

    -The maximum length of name for a named subpattern is 32 code units, and the -maximum number of named subpatterns is 10000. +The maximum length of name for a named capture group is 32 code units, and the +maximum number of such groups is 10000.

    The maximum length of a name in a (*MARK), (*PRUNE), (*SKIP), or (*THEN) verb @@ -86,9 +86,9 @@ Cambridge, England. REVISION

    -Last updated: 30 March 2017 +Last updated: 02 February 2019
    -Copyright © 1997-2017 University of Cambridge. +Copyright © 1997-2019 University of Cambridge.

    Return to the PCRE2 index page. diff --git a/doc/html/pcre2pattern.html b/doc/html/pcre2pattern.html index 7ccb32f..d57dcea 100644 --- a/doc/html/pcre2pattern.html +++ b/doc/html/pcre2pattern.html @@ -26,18 +26,18 @@ please consult the man page, in case the conversion went wrong.

  • COMPATIBILITY FEATURE FOR WORD BOUNDARIES
  • VERTICAL BAR
  • INTERNAL OPTION SETTING -
  • SUBPATTERNS -
  • DUPLICATE SUBPATTERN NUMBERS -
  • NAMED SUBPATTERNS +
  • GROUPS +
  • DUPLICATE GROUP NUMBERS +
  • NAMED CAPTURE GROUPS
  • REPETITION
  • ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS
  • BACKREFERENCES
  • ASSERTIONS
  • SCRIPT RUNS -
  • CONDITIONAL SUBPATTERNS +
  • CONDITIONAL GROUPS
  • COMMENTS
  • RECURSIVE PATTERNS -
  • SUBPATTERNS AS SUBROUTINES +
  • GROUPS AS SUBROUTINES
  • ONIGURUMA SUBROUTINE SYNTAX
  • CALLOUTS
  • BACKTRACKING CONTROL @@ -63,13 +63,13 @@ by O'Reilly, covers regular expressions in great detail. This description of PCRE2's regular expressions is intended as reference material.

    -This document discusses the patterns that are supported by PCRE2 when its main -matching function, pcre2_match(), is used. PCRE2 also has an alternative -matching function, pcre2_dfa_match(), which matches using a different -algorithm that is not Perl-compatible. Some of the features discussed below are -not available when DFA matching is used. The advantages and disadvantages of -the alternative function, and how it differs from the normal function, are -discussed in the +This document discusses the regular expression patterns that are supported by +PCRE2 when its main matching function, pcre2_match(), is used. PCRE2 also +has an alternative matching function, pcre2_dfa_match(), which matches +using a different algorithm that is not Perl-compatible. Some of the features +discussed below are not available when DFA matching is used. The advantages and +disadvantages of the alternative function, and how it differs from the normal +function, are discussed in the pcre2matching page.

    @@ -183,8 +183,8 @@ also an explicit memory limit that can be set.

    These facilities are provided to catch runaway matches that are provoked by -patterns with huge matching trees (a typical example is a pattern with nested -unlimited repeats applied to a long string that does not match). When one of +patterns with huge matching trees. A common example is a pattern with nested +unlimited repeats applied to a long string that does not match. When one of these limits is reached, pcre2_match() gives an error return. The limits can also be set by items at the start of the pattern of the form

    @@ -290,10 +290,10 @@ caseless matching is specified (the PCRE2_CASELESS option), letters are matched
     independently of case.
     

    -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. +The power of regular expressions comes from the ability to include wild cards, +character classes, 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 recognized @@ -307,14 +307,11 @@ are as follows: . match any character except newline (by default) [ start character class definition | start of alternative branch - ( start subpattern - ) end subpattern - ? extends the meaning of ( - also 0 or 1 quantifier - also quantifier minimizer + ( start group or control verb + ) end group or control verb * 0 or more quantifier - + 1 or more quantifier - also "possessive quantifier" + + 1 or more quantifier; also "possessive quantifier" + ? 0 or 1 quantifier; also quantifier minimizer { start min/max quantifier

    Part of a pattern that is in square brackets is called a "character class". In @@ -323,7 +320,7 @@ a character class the only metacharacters are: \ general escape character ^ negate the class, but only if the first character - indicates character range - [ POSIX character class (only if followed by POSIX syntax) + [ POSIX character class (if followed by POSIX syntax) ] terminates the character class
  • The following sections describe the use of each of the metacharacters. @@ -331,7 +328,7 @@ 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 -character that is not a number or a letter, it takes away any special meaning +character that is not a digit or a letter, 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.

    @@ -343,7 +340,7 @@ precede a non-alphanumeric with backslash to specify that it stands for itself. In particular, if you want to match a backslash, you write \\.

    -In a UTF mode, only ASCII numbers and letters have any special meaning after a +In a UTF mode, only ASCII digits and letters have any special meaning after a backslash. All other characters (in particular, those whose code points are greater than 127) are treated as literals.

    @@ -355,13 +352,13 @@ escaping backslash can be used to include a white space or # character as part of the pattern.

    -If you want to remove the special meaning from a sequence of characters, you -can do so by putting them between \Q and \E. This is different from Perl in -that $ and @ are handled as literals in \Q...\E sequences in PCRE2, whereas -in Perl, $ and @ cause variable interpolation. Also, Perl does "double-quotish -backslash interpolation" on any backslashes between \Q and \E which, its -documentation says, "may lead to confusing results". PCRE2 treats a backslash -between \Q and \E just like any other character. Note the following examples: +If you want to treat all characters in a sequence as literals, you can do so by +putting them between \Q and \E. This is different from Perl in that $ and @ +are handled as literals in \Q...\E sequences in PCRE2, whereas in Perl, $ and +@ cause variable interpolation. Also, Perl does "double-quotish backslash +interpolation" on any backslashes between \Q and \E which, its documentation +says, "may lead to confusing results". PCRE2 treats a backslash between \Q and +\E just like any other character. Note the following examples:

       Pattern            PCRE2 matches   Perl matches
     
    @@ -386,8 +383,8 @@ A second use of backslash provides a way of encoding non-printing characters
     in patterns in a visible manner. There is no restriction on the appearance of
     non-printing characters in a pattern, but when a pattern is being prepared by
     text editing, it is often easier to use one of the following escape sequences
    -than the binary character it represents. In an ASCII or Unicode environment,
    -these escapes are as follows:
    +instead of the binary character it represents. In an ASCII or Unicode
    +environment, these escapes are as follows:
     
       \a          alarm, that is, the BEL character (hex 07)
       \cx         "control-x", where x is any printable ASCII character
    @@ -475,12 +472,12 @@ and Perl has changed over time, causing PCRE2 also to change.
     

    Outside a character class, PCRE2 reads the digit and any following digits as a decimal number. If the number is less than 10, begins with the digit 8 or 9, or -if there are at least that many previous capturing left parentheses in the -expression, the entire sequence is taken as a backreference. A -description of how this works is given +if there are at least that many previous capture groups in the expression, the +entire sequence is taken as a backreference. A description of how this +works is given later, following the discussion of -parenthesized subpatterns. +parenthesized groups. Otherwise, up to three octal digits are read to form a character code.

    @@ -490,7 +487,7 @@ backslash, using them to generate a data character. Any subsequent digits stand for themselves. For example, outside a character class:

       \040   is another way of writing an ASCII space
    -  \40    is the same, provided there are fewer than 40 previous capturing subpatterns
    +  \40    is the same, provided there are fewer than 40 previous capture groups
       \7     is always a backreference
       \11    might be a backreference, or another way of writing a tab
       \011   is always a tab
    @@ -515,7 +512,9 @@ If the PCRE2_ALT_BSUX option is set, the interpretation of \x is as just
     described only when it is followed by two hexadecimal digits. Otherwise, it
     matches a literal "x" character. In this mode, support for code points greater
     than 256 is provided by \u, which must be followed by four hexadecimal digits;
    -otherwise it matches a literal "u" character.
    +otherwise it matches a literal "u" character. This syntax makes PCRE2 behave 
    +like ECMAscript (aka JavaScript). Code points greater than 0xFFFF are not
    +supported.
     

    Characters whose value is less than 256 can be defined by either of the two @@ -574,7 +573,7 @@ in braces, is an absolute or relative backreference. A named backreference can be coded as \g{name}. Backreferences are discussed later, following the discussion of -parenthesized subpatterns. +parenthesized groups.


    Absolute and relative subroutine calls @@ -582,11 +581,11 @@ Absolute and relative subroutine calls

    For compatibility with Oniguruma, the non-Perl syntax \g followed by a name or a number enclosed either in angle brackets or single quotes, is an alternative -syntax for referencing a subpattern as a "subroutine". Details are discussed +syntax for referencing a capture group as a subroutine. Details are discussed later. Note that \g{...} (Perl syntax) and \g<...> (Oniguruma syntax) are not synonymous. The former is a backreference; the latter is a -subroutine +subroutine call.


    @@ -753,21 +752,22 @@ Unicode character properties

    When PCRE2 is built with Unicode support (the default), three additional escape -sequences that match characters with specific properties are available. In -8-bit non-UTF-8 mode, these sequences are of course limited to testing -characters whose code points are less than 256, but they do work in this mode. -In 32-bit non-UTF mode, code points greater than 0x10ffff (the Unicode limit) -may be encountered. These are all treated as being in the Unknown script and -with an unassigned type. The extra escape sequences are: +sequences that match characters with specific properties are available. They +can be used in any mode, though in 8-bit and 16-bit non-UTF modes these +sequences are of course limited to testing characters whose code points are +less than U+0100 and U+10000, respectively. In 32-bit non-UTF mode, code points +greater than 0x10ffff (the Unicode limit) may be encountered. These are all +treated as being in the Unknown script and with an unassigned type. The extra +escape sequences are:

       \p{xx}   a character with the xx property
       \P{xx}   a character without the xx property
       \X       a Unicode extended grapheme cluster
     
    -The property names represented by xx above are limited to the Unicode -script names, the general category properties, "Any", which matches any -character (including newline), and some special PCRE2 properties (described -in the +The property names represented by xx above are case-sensitive. There is +support for Unicode script names, Unicode general category properties, "Any", +which matches any character (including newline), and some special PCRE2 +properties (described in the next section). Other Perl properties such as "InMusicalSymbols" are not supported by PCRE2. Note that \P{Any} does not match any characters, so always causes a match @@ -1003,12 +1003,14 @@ the Lu, Ll, or Lt property, in other words, a letter that is not classified as a modifier or "other".

    -The Cs (Surrogate) property applies only to characters in the range U+D800 to -U+DFFF. Such characters are not valid in Unicode strings and so -cannot be tested by PCRE2, unless UTF validity checking has been turned off -(see the discussion of PCRE2_NO_UTF_CHECK in the +The Cs (Surrogate) property applies only to characters whose code points are in +the range U+D800 to U+DFFF. These characters are no different to any other +character when PCRE2 is not in UTF mode (using the 16-bit or 32-bit library). +However, they are not valid in Unicode strings and so cannot be tested by PCRE2 +in UTF mode, unless UTF validity checking has been turned off (see the +discussion of PCRE2_NO_UTF_CHECK in the pcre2api -page). Perl does not support the Cs property. +page).

    The long synonyms for property names that Perl supports (such as \p{Letter}) @@ -1138,7 +1140,7 @@ a lookbehind assertion However, in this case, the part of the subject before the real match does not have to be of fixed length, as lookbehind assertions do. The use of \K does not interfere with the setting of -captured substrings. +captured substrings. For example, when the pattern

       (foo)\Kbar
    @@ -1166,7 +1168,7 @@ Simple assertions
     The final use of backslash is for certain simple assertions. An assertion
     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
    +groups for more complicated assertions is described
     below.
     The backslashed assertions are:
     
    @@ -1186,12 +1188,12 @@ character. If any other of these assertions appears in a character class, an
     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. In a UTF mode, the meanings
    -of \w and \W can be changed by setting the PCRE2_UCP option. When this is
    -done, it also affects \b and \B. Neither PCRE2 nor Perl has a separate "start
    -of word" or "end of word" metasequence. However, whatever follows \b normally
    -determines which it is. For example, the fragment \ba matches "a" at the start
    -of a word.
    +first or last character matches \w, respectively. When PCRE2 is built with 
    +Unicode support, the meanings of \w and \W can be changed by setting the
    +PCRE2_UCP option. When this is done, it also affects \b and \B. Neither PCRE2
    +nor Perl has a separate "start of word" or "end of word" metasequence. However,
    +whatever follows \b normally determines which it is. For example, the fragment
    +\ba matches "a" at the start of a word.
     

    The \A, \Z, and \z assertions differ from the traditional circumflex and @@ -1386,7 +1388,7 @@ could be used with a UTF-8 string (ignore white space and line breaks):

    In this example, a group that starts with (?| resets the capturing parentheses numbers in each alternative (see -"Duplicate Subpattern Numbers" +"Duplicate Group Numbers" below). The assertions at the start of each branch check the next UTF-8 character for values whose encoding uses 1, 2, 3, or 4 bytes, respectively. The character's individual bytes are then captured by the appropriate number of @@ -1632,10 +1634,10 @@ the pattern matches either "gilbert" or "sullivan". Any number of alternatives may appear, and an empty alternative is permitted (matching the empty string). The matching process tries each alternative in turn, from left to right, and the first one -that succeeds is used. If the alternatives are within a subpattern -(defined below), +that succeeds is used. If the alternatives are within a group +(defined below), "succeeds" means matching the rest of the main pattern as well as the -alternative in the subpattern. +alternative in the group.


    INTERNAL OPTION SETTING

    @@ -1678,16 +1680,16 @@ respectively. However, these are not unset by (?^).

    When one of these option changes occurs at top level (that is, not inside -subpattern parentheses), the change applies to the remainder of the pattern -that follows. An option change within a subpattern (see below for a description -of subpatterns) affects only that part of the subpattern that follows it, so +group parentheses), the change applies to the remainder of the pattern +that follows. An option change within a group (see below for a description +of groups) affects only that part of the group that follows it, so

       (a(?i)b)c
     
    matches abc and aBc and no other strings (assuming PCRE2_CASELESS is not used). By this means, options can be made to have different settings in different parts of the pattern. Any changes made in one alternative do carry on -into subsequent branches within the same subpattern. For example, +into subsequent branches within the same group. For example,
       (a(?i)b|c)
     
    @@ -1698,7 +1700,7 @@ behaviour otherwise.

    As a convenient shorthand, if any option settings are required at the start of -a non-capturing subpattern (see the next section), the option letters may +a non-capturing group (see the next section), the option letters may appear between the "?" and the ":". Thus the two patterns

       (?i:saturday|sunday)
    @@ -1707,21 +1709,22 @@ appear between the "?" and the ":". Thus the two patterns
     match exactly the same set of strings.
     

    -Note: There are other PCRE2-specific options that can be set by the -application when the compiling function is called. The pattern can contain -special leading sequences such as (*CRLF) to override what the application has -set or what has been defaulted. Details are given in the section entitled +Note: There are other PCRE2-specific options, applying to the whole +pattern, which can be set by the application when the compiling function is +called. In addition, the pattern can contain special leading sequences such as +(*CRLF) to override what the application has set or what has been defaulted. +Details are given in the section entitled "Newline sequences" above. There are also the (*UTF) and (*UCP) leading sequences that can be used to set UTF and Unicode property modes; they are equivalent to setting the PCRE2_UTF and PCRE2_UCP options, respectively. However, the application can set the PCRE2_NEVER_UTF and PCRE2_NEVER_UCP options, which lock out the use of the (*UTF) and (*UCP) sequences. -

    -
    SUBPATTERNS
    +

    +
    GROUPS

    -Subpatterns are delimited by parentheses (round brackets), which can be nested. -Turning part of a pattern into a subpattern does two things: +Groups are delimited by parentheses (round brackets), which can be nested. +Turning part of a pattern into a group does two things:

    1. It localizes a set of alternatives. For example, the pattern @@ -1732,16 +1735,16 @@ matches "cataract", "caterpillar", or "cat". Without the parentheses, it would match "cataract", "erpillar" or an empty string.

    -2. It sets up the subpattern as a capturing subpattern. This means that, when -the whole pattern matches, the portion of the subject string that matched the -subpattern is passed back to the caller, separately from the portion that -matched the whole pattern. (This applies only to the traditional matching -function; the DFA matching function does not support capturing.) +2. It creates a "capture group". This means that, when the whole pattern +matches, the portion of the subject string that matched the group is passed +back to the caller, separately from the portion that matched the whole pattern. +(This applies only to the traditional matching function; the DFA matching +function does not support capturing.)

    Opening parentheses are counted from left to right (starting from 1) to obtain -numbers for the capturing subpatterns. For example, if the string "the red -king" is matched against the pattern +numbers for capture groups. For example, if the string "the red king" is +matched against the pattern

       the ((red|white) (king|queen))
     
    @@ -1750,36 +1753,35 @@ the captured substrings are "red king", "red", and "king", and are numbered 1,

    The fact that plain parentheses fulfil two functions is not always helpful. -There are often times when a grouping subpattern is required without a -capturing requirement. If an opening parenthesis is followed by a question mark -and a colon, the subpattern does not do any capturing, and is not counted when -computing the number of any subsequent capturing subpatterns. For example, if -the string "the white queen" is matched against the pattern +There are often times when grouping is required without capturing. If an +opening parenthesis is followed by a question mark and a colon, the group +does not do any capturing, and is not counted when computing the number of any +subsequent capture groups. For example, if the string "the white queen" +is matched against the pattern

       the ((?:red|white) (king|queen))
     
    the captured substrings are "white queen" and "queen", and are numbered 1 and -2. The maximum number of capturing subpatterns is 65535. +2. The maximum number of capture groups is 65535.

    As a convenient shorthand, if any option settings are required at the start of -a non-capturing subpattern, the option letters may appear between the "?" and -the ":". Thus the two patterns +a non-capturing group, the option letters may appear between the "?" and the +":". Thus the two patterns

       (?i:saturday|sunday)
       (?:(?i)saturday|sunday)
     
    match exactly the same set of strings. Because alternative branches are tried -from left to right, and options are not reset until the end of the subpattern -is reached, an option setting in one branch does affect subsequent branches, so +from left to right, and options are not reset until the end of the group is +reached, an option setting in one branch does affect subsequent branches, so the above patterns match "SUNDAY" as well as "Saturday". -

    -
    DUPLICATE SUBPATTERN NUMBERS
    +

    +
    DUPLICATE GROUP NUMBERS

    -Perl 5.10 introduced a feature whereby each alternative in a subpattern uses -the same numbers for its capturing parentheses. Such a subpattern starts with -(?| and is itself a non-capturing subpattern. For example, consider this -pattern: +Perl 5.10 introduced a feature whereby each alternative in a group uses the +same numbers for its capturing parentheses. Such a group starts with (?| and is +itself a non-capturing group. For example, consider this pattern:

       (?|(Sat)ur|(Sun))day
     
    @@ -1789,7 +1791,7 @@ at captured substring number one, whichever alternative matched. This construct is useful when you want to capture part, but not all, of one of a number of alternatives. Inside a (?| group, parentheses are numbered as usual, but the number is reset at the start of each branch. The numbers of any capturing -parentheses that follow the subpattern start after the highest number used in +parentheses that follow the whole group start after the highest number used in any branch. The following example is taken from the Perl documentation. The numbers underneath show in which buffer the captured content will be stored.
    @@ -1797,13 +1799,12 @@ numbers underneath show in which buffer the captured content will be stored.
       / ( a )  (?| x ( y ) z | (p (q) r) | (t) u (v) ) ( z ) /x
       # 1            2         2  3        2     3     4
     
    -A backreference to a numbered subpattern uses the most recent value that is -set for that number by any subpattern. The following pattern matches "abcabc" -or "defdef": +A backreference to a capture group uses the most recent value that is set for +the group. The following pattern matches "abcabc" or "defdef":
       /(?|(abc)|(def))\1/
     
    -In contrast, a subroutine call to a numbered subpattern always refers to the +In contrast, a subroutine call to a capture group always refers to the first one in the pattern with the given number. The following pattern matches "abcabc" or "defabc":
    @@ -1815,29 +1816,35 @@ of computing an absolute group number.
     

    If a condition test -for a subpattern's having matched refers to a non-unique number, the test is -true if any of the subpatterns of that number have matched. +for a group's having matched refers to a non-unique number, the test is +true if any group with that number has matched.

    An alternative approach to using this "branch reset" feature is to use -duplicate named subpatterns, as described in the next section. +duplicate named groups, as described in the next section.

    -
    NAMED SUBPATTERNS
    +
    NAMED CAPTURE GROUPS

    -Identifying capturing parentheses by number is simple, but it can be very hard -to keep track of the numbers in complicated patterns. Furthermore, if an -expression is modified, the numbers may change. To help with this difficulty, -PCRE2 supports the naming of capturing subpatterns. This feature was not added -to Perl until release 5.10. Python had the feature earlier, and PCRE1 -introduced it at release 4.0, using the Python syntax. PCRE2 supports both the -Perl and the Python syntax. +Identifying capture groups by number is simple, but it can be very hard to keep +track of the numbers in complicated patterns. Furthermore, if an expression is +modified, the numbers may change. To help with this difficulty, PCRE2 supports +the naming of capture groups. This feature was not added to Perl until release +5.10. Python had the feature earlier, and PCRE1 introduced it at release 4.0, +using the Python syntax. PCRE2 supports both the Perl and the Python syntax.

    -In PCRE2, a capturing subpattern can be named in one of three ways: -(?<name>...) or (?'name'...) as in Perl, or (?P<name>...) as in Python. Names -consist of up to 32 alphanumeric characters and underscores, but must start -with a non-digit. References to capturing parentheses from other parts of the -pattern, such as +In PCRE2, a capture group can be named in one of three ways: (?<name>...) or +(?'name'...) as in Perl, or (?P<name>...) as in Python. Names may be up to 32 +code units long. When PCRE2_UTF is not set, they may contain only ASCII +alphanumeric characters and underscores, but must start with a non-digit. When +PCRE2_UTF is set, the syntax of group names is extended to allow any Unicode +letter or Unicode decimal digit. In other words, group names must match one of +these patterns: +

    +  ^[_A-Za-z][_A-Za-z0-9]*\z   when PCRE2_UTF is not set
    +  ^[_\p{L}][_\p{L}\p{Nd}]*\z  when PCRE2_UTF is set
    +
    +References to capture groups from other parts of the pattern, such as backreferences, recursion, and @@ -1845,18 +1852,18 @@ and can all be made by name as well as by number.

    -Named capturing parentheses are allocated numbers as well as names, exactly as -if the names were not present. In both PCRE2 and Perl, capturing subpatterns +Named capture groups are allocated numbers as well as names, exactly as +if the names were not present. In both PCRE2 and Perl, capture groups are primarily identified by numbers; any names are just aliases for these numbers. The PCRE2 API provides function calls for extracting the complete name-to-number translation table from a compiled pattern, as well as convenience functions for extracting captured substrings by name.

    -Warning: When more than one subpattern has the same number, as described -in the previous section, a name given to one of them applies to all of them. -Perl allows identically numbered subpatterns to have different names. Consider -this pattern, where there are two capturing subpatterns, both numbered 1: +Warning: When more than one capture group has the same number, as +described in the previous section, a name given to one of them applies to all +of them. Perl allows identically numbered groups to have different names. +Consider this pattern, where there are two capture groups, both numbered 1:

       (?|(?<AA>aa)|(?<BB>bb))
     
    @@ -1871,21 +1878,21 @@ pattern:
       (?|(?<AA>aa)|(bb))
     
    -Although the second subpattern number 1 is not explicitly named, the name AA is -still an alias for subpattern 1. Whether the pattern matches "aa" or "bb", a +Although the second group number 1 is not explicitly named, the name AA is +still an alias for any group 1. Whether the pattern matches "aa" or "bb", a reference by name to group AA yields the matched string.

    By default, a name must be unique within a pattern, except that duplicate names -are permitted for subpatterns with the same number, for example: +are permitted for groups with the same number, for example:

       (?|(?<AA>aa)|(?<AA>bb))
     
    The duplicate name constraint can be disabled by setting the PCRE2_DUPNAMES option at compile time, or by the use of (?J) within the pattern. Duplicate -names can be useful for patterns where only one instance of the named -parentheses can match. Suppose you want to match the name of a weekday, either -as a 3-letter abbreviation or as the full name, and in both cases you want to +names can be useful for patterns where only one instance of the named capture +group can match. Suppose you want to match the name of a weekday, either as a +3-letter abbreviation or as the full name, and in both cases you want to extract the abbreviation. This pattern (ignoring the line breaks) does the job:
       (?<DN>Mon|Fri|Sun)(?:day)?|
    @@ -1894,26 +1901,26 @@ extract the abbreviation. This pattern (ignoring the line breaks) does the job:
       (?<DN>Thu)(?:rsday)?|
       (?<DN>Sat)(?:urday)?
     
    -There are five capturing substrings, but only one is ever set after a match. -The convenience functions for extracting the data by name returns the substring -for the first (and in this example, the only) subpattern of that name that -matched. This saves searching to find which numbered subpattern it was. (An -alternative way of solving this problem is to use a "branch reset" subpattern, -as described in the previous section.) +There are five capture groups, but only one is ever set after a match. The +convenience functions for extracting the data by name returns the substring for +the first (and in this example, the only) group of that name that matched. This +saves searching to find which numbered group it was. (An alternative way of +solving this problem is to use a "branch reset" group, as described in the +previous section.)

    -If you make a backreference to a non-unique named subpattern from elsewhere in -the pattern, the subpatterns to which the name refers are checked in the order -in which they appear in the overall pattern. The first one that is set is used -for the reference. For example, this pattern matches both "foofoo" and -"barbar" but not "foobar" or "barfoo": +If you make a backreference to a non-unique named group from elsewhere in the +pattern, the groups to which the name refers are checked in the order in which +they appear in the overall pattern. The first one that is set is used for the +reference. For example, this pattern matches both "foofoo" and "barbar" but not +"foobar" or "barfoo":

       (?:(?<n>foo)|(?<n>bar))\k<n>
     
     

    -If you make a subroutine call to a non-unique named subpattern, the one that +If you make a subroutine call to a non-unique named group, the one that corresponds to the first occurrence of the name is used. In the absence of duplicate numbers this is the one with the lowest number.

    @@ -1921,11 +1928,11 @@ duplicate numbers this is the one with the lowest number. If you use a named reference in a condition test (see the section about conditions -below), either to check whether a subpattern has matched, or to check for -recursion, all subpatterns with the same name are tested. If the condition is -true for any one of them, the overall condition is true. This is the same -behaviour as testing by number. For further details of the interfaces for -handling named subpatterns, see the +below), either to check whether a capture group has matched, or to check for +recursion, all groups with the same name are tested. If the condition is true +for any one of them, the overall condition is true. This is the same behaviour +as testing by number. For further details of the interfaces for handling named +capture groups, see the pcre2api documentation.

    @@ -1937,18 +1944,18 @@ items: a literal data character the dot metacharacter the \C escape sequence - the \X escape sequence the \R escape sequence + the \X escape sequence an escape such as \d or \pL that matches a single character a character class a backreference - a parenthesized subpattern (including most assertions) - a subroutine call to a subpattern (recursive or otherwise) + a parenthesized group (including most assertions) + a subroutine call (recursive or otherwise)
    The general repetition quantifier specifies a minimum and maximum number of permitted matches, by giving the two numbers in curly brackets (braces), separated by a comma. The numbers must be less than 65536, and the first must -be less than or equal to the second. For example: +be less than or equal to the second. For example,
       z{2,4}
     
    @@ -1978,12 +1985,12 @@ several code units long (and they may be of different lengths).

    The quantifier {0} is permitted, causing the expression to behave as if the previous item and the quantifier were not present. This may be useful for -subpatterns that are referenced as -subroutines +capture groups that are referenced as +subroutines from elsewhere in the pattern (but see also the section entitled -"Defining subpatterns for use by reference only" -below). Items other than subpatterns that have a {0} quantifier are omitted -from the compiled pattern. +"Defining capture groups for use by reference only" +below). Except for parenthesized groups, items that have a {0} quantifier are +omitted from the compiled pattern.

    For convenience, the three most common quantifiers have single-character @@ -1993,23 +2000,23 @@ abbreviations: + is equivalent to {1,} ? is equivalent to {0,1}

    -It is possible to construct infinite loops by following a subpattern that can -match no characters with a quantifier that has no upper limit, for example: +It is possible to construct infinite loops by following a group that can match +no characters with a quantifier that has no upper limit, for example:
       (a?)*
     
    Earlier versions of Perl and PCRE1 used to give an error at compile time for such patterns. However, because there are cases where this can be useful, such -patterns are now accepted, but if any repetition of the subpattern does in fact +patterns are now accepted, but if any repetition of the group does in fact match no characters, the loop is forcibly broken.

    -By default, the quantifiers are "greedy", that is, they match as much as -possible (up to the maximum number of permitted times), without causing the -rest of the pattern to fail. The classic example of where this gives problems -is in trying to match comments in C programs. These appear between /* and */ -and within the comment, individual * and / characters may appear. An attempt to -match C comments by applying the pattern +By default, quantifiers are "greedy", that is, they match as much as possible +(up to the maximum number of permitted times), without causing the rest of the +pattern to fail. The classic example of where this gives problems is in trying +to match comments in C programs. These appear between /* and */ and within the +comment, individual * and / characters may appear. An attempt to match C +comments by applying the pattern

       /\*.*\*/
     
    @@ -2018,11 +2025,9 @@ to the string /* first comment */ not comment /* second comment */
    fails, because it matches the entire string owing to the greediness of the .* -item. -

    -

    -If a quantifier is followed by a question mark, it ceases to be greedy, and -instead matches the minimum number of times possible, so the pattern +item. However, if a quantifier is followed by a question mark, it ceases to be +greedy, and instead matches the minimum number of times possible, so the +pattern

       /\*.*?\*/
     
    @@ -2043,7 +2048,7 @@ greedy by following them with a question mark. In other words, it inverts the default behaviour.

    -When a parenthesized subpattern is quantified with a minimum repeat count that +When a parenthesized group is quantified with a minimum repeat count that is greater than 1 or with a limited maximum, more memory is required for the compiled pattern, in proportion to the size of the minimum or maximum.

    @@ -2083,15 +2088,14 @@ It matches "ab" in the subject "aab". The use of the backtracking control verbs PCRE2_NO_DOTSTAR_ANCHOR, to do so explicitly.

    -When a capturing subpattern is repeated, the value captured is the substring -that matched the final iteration. For example, after +When a capture group is repeated, the value captured is the substring that +matched the final iteration. For example, after

       (tweedle[dume]{3}\s*)+
     
    has matched "tweedledum tweedledee" the value of the captured substring is -"tweedledee". However, if there are nested capturing subpatterns, the -corresponding captured values may have been set in previous iterations. For -example, after +"tweedledee". However, if there are nested capture groups, the corresponding +captured values may have been set in previous iterations. For example, after
       (a|(b))+
     
    @@ -2115,7 +2119,7 @@ After matching all 6 digits and then failing to match "foo", the normal action of the matcher is to try again with only 5 digits matching the \d+ item, and then with 4, and so on, before ultimately failing. "Atomic grouping" (a term taken from Jeffrey Friedl's book) provides the means for specifying -that once a subpattern has matched, it is not to be re-evaluated in this way. +that once a group has matched, it is not to be re-evaluated in this way.

    If we use atomic grouping for the previous example, the matcher gives up @@ -2129,26 +2133,26 @@ be easier to remember:

       (*atomic:\d+)foo
     
    -This kind of parenthesis "locks up" the part of the pattern it contains once -it has matched, and a failure further into the pattern is prevented from -backtracking into it. Backtracking past it to previous items, however, works as -normal. +This kind of parenthesized group "locks up" the part of the pattern it +contains once it has matched, and a failure further into the pattern is +prevented from backtracking into it. Backtracking past it to previous items, +however, works as normal.

    -An alternative description is that a subpattern of this type matches exactly -the string of characters that an identical standalone pattern would match, if +An alternative description is that a group of this type matches exactly the +string of characters that an identical standalone pattern would match, if anchored at the current point in the subject string.

    -Atomic grouping subpatterns are not capturing subpatterns. Simple cases such as -the above example can be thought of as a maximizing repeat that must swallow -everything it can. So, while both \d+ and \d+? are prepared to adjust the -number of digits they match in order to make the rest of the pattern match, -(?>\d+) can only match an entire sequence of digits. +Atomic groups are not capture groups. Simple cases such as the above example +can be thought of as a maximizing repeat that must swallow everything it can. +So, while both \d+ and \d+? are prepared to adjust the number of digits they +match in order to make the rest of the pattern match, (?>\d+) can only match +an entire sequence of digits.

    Atomic groups in general can of course contain arbitrarily complicated -subpatterns, and can be nested. However, when the subpattern for an atomic +expressions, and can be nested. However, when the contents of an atomic group is just a single repeated item, as in the example above, a simpler notation, called a "possessive quantifier" can be used. This consists of an additional + character following a quantifier. Using this notation, the @@ -2171,8 +2175,8 @@ difference; possessive quantifiers should be slightly faster. The possessive quantifier syntax is an extension to the Perl 5.8 syntax. Jeffrey Friedl originated the idea (and the name) in the first edition of his book. Mike McCloskey liked it, so implemented it when he built Sun's Java -package, and PCRE1 copied it from there. It ultimately found its way into Perl -at release 5.10. +package, and PCRE1 copied it from there. It found its way into Perl at release +5.10.

    PCRE2 has an optimization that automatically "possessifies" certain simple @@ -2182,10 +2186,9 @@ This feature can be disabled by the PCRE2_NO_AUTOPOSSESS option, or starting the pattern with (*NO_AUTO_POSSESS).

    -When a pattern contains an unlimited repeat inside a subpattern that can itself -be repeated an unlimited number of times, the use of an atomic group is the -only way to avoid some failing matches taking a very long time indeed. The -pattern +When a pattern contains an unlimited repeat inside a group that can itself be +repeated an unlimited number of times, the use of an atomic group is the only +way to avoid some failing matches taking a very long time indeed. The pattern

       (\D+|<\d+>)*[!?]
     
    @@ -2211,28 +2214,27 @@ sequences of non-digits cannot be broken, and failure happens quickly.
    BACKREFERENCES

    Outside a character class, a backslash followed by a digit greater than 0 (and -possibly further digits) is a backreference to a capturing subpattern earlier -(that is, to its left) in the pattern, provided there have been that many -previous capturing left parentheses. +possibly further digits) is a backreference to a capture group earlier (that +is, to its left) in the pattern, provided there have been that many previous +capture groups.

    However, if the decimal number following the backslash is less than 8, it is -always taken as a backreference, and causes an error only if there are not -that many capturing left parentheses in the entire pattern. In other words, the -parentheses that are referenced need not be to the left of the reference for -numbers less than 8. A "forward backreference" of this type can make sense -when a repetition is involved and the subpattern to the right has participated -in an earlier iteration. +always taken as a backreference, and causes an error only if there are not that +many capture groups in the entire pattern. In other words, the group that is +referenced need not be to the left of the reference for numbers less than 8. A +"forward backreference" of this type can make sense when a repetition is +involved and the group to the right has participated in an earlier iteration.

    -It is not possible to have a numerical "forward backreference" to a subpattern -whose number is 8 or more using this syntax because a sequence such as \50 is +It is not possible to have a numerical "forward backreference" to a group whose +number is 8 or more using this syntax because a sequence such as \50 is interpreted as a character defined in octal. See the subsection entitled "Non-printing characters" above -for further details of the handling of digits following a backslash. There is -no such problem when named parentheses are used. A backreference to any -subpattern is possible using named parentheses (see below). +for further details of the handling of digits following a backslash. Other +forms of backreferencing do not suffer from this restriction. In particular, +there is no problem when named capture groups are used (see below).

    Another way of avoiding the ambiguity inherent in the use of digits following a @@ -2250,22 +2252,22 @@ the reference. A signed number is a relative reference. Consider this example:

       (abc(def)ghi)\g{-1}
     
    -The sequence \g{-1} is a reference to the most recently started capturing -subpattern before \g, that is, is it equivalent to \2 in this example. -Similarly, \g{-2} would be equivalent to \1. The use of relative references -can be helpful in long patterns, and also in patterns that are created by -joining together fragments that contain references within themselves. +The sequence \g{-1} is a reference to the most recently started capture group +before \g, that is, is it equivalent to \2 in this example. Similarly, +\g{-2} would be equivalent to \1. The use of relative references can be +helpful in long patterns, and also in patterns that are created by joining +together fragments that contain references within themselves.

    -The sequence \g{+1} is a reference to the next capturing subpattern. This kind -of forward reference can be useful it patterns that repeat. Perl does not -support the use of + in this way. +The sequence \g{+1} is a reference to the next capture group. This kind of +forward reference can be useful in patterns that repeat. Perl does not support +the use of + in this way.

    -A backreference matches whatever actually matched the capturing subpattern in -the current subject string, rather than anything matching the subpattern -itself (see -"Subpatterns as subroutines" +A backreference matches whatever actually most recently matched the capture +group in the current subject string, rather than anything at all that matches +the group (see +"Groups as subroutines" below for a way of doing that). So the pattern

       (sens|respons)e and \1ibility
    @@ -2277,28 +2279,28 @@ backreference, the case of letters is relevant. For example,
       ((?i)rah)\s+\1
     
    matches "rah rah" and "RAH RAH", but not "RAH rah", even though the original -capturing subpattern is matched caselessly. +capture group is matched caselessly.

    -There are several different ways of writing backreferences to named -subpatterns. The .NET syntax \k{name} and the Perl syntax \k<name> or -\k'name' are supported, as is the Python syntax (?P=name). Perl 5.10's unified +There are several different ways of writing backreferences to named capture +groups. The .NET syntax \k{name} and the Perl syntax \k<name> or \k'name' +are supported, as is the Python syntax (?P=name). Perl 5.10's unified backreference syntax, in which \g can be used for both numeric and named -references, is also supported. We could rewrite the above example in any of -the following ways: +references, is also supported. We could rewrite the above example in any of the +following ways:

       (?<p1>(?i)rah)\s+\k<p1>
       (?'p1'(?i)rah)\s+\k{p1}
       (?P<p1>(?i)rah)\s+(?P=p1)
       (?<p1>(?i)rah)\s+\g{p1}
     
    -A subpattern that is referenced by name may appear in the pattern before or +A capture group that is referenced by name may appear in the pattern before or after the reference.

    -There may be more than one backreference to the same subpattern. If a -subpattern has not actually been used in a particular match, any backreferences -to it always fail by default. For example, the pattern +There may be more than one backreference to the same group. If a group has not +actually been used in a particular match, backreferences to it always fail by +default. For example, the pattern

       (a|(bc))\2
     
    @@ -2307,12 +2309,11 @@ PCRE2_MATCH_UNSET_BACKREF option is set at compile time, a backreference to an unset value matches an empty string.

    -Because there may be many capturing parentheses in a pattern, all digits -following a backslash are taken as part of a potential backreference number. -If the pattern continues with a digit character, some delimiter must be used to -terminate the backreference. If the PCRE2_EXTENDED or PCRE2_EXTENDED_MORE -option is set, this can be white space. Otherwise, the \g{ syntax or an empty -comment (see +Because there may be many capture groups in a pattern, all digits following a +backslash are taken as part of a potential backreference number. If the pattern +continues with a digit character, some delimiter must be used to terminate the +backreference. If the PCRE2_EXTENDED or PCRE2_EXTENDED_MORE option is set, this +can be white space. Otherwise, the \g{} syntax or an empty comment (see "Comments" below) can be used.

    @@ -2320,19 +2321,18 @@ below) can be used. Recursive backreferences

    -A backreference that occurs inside the parentheses to which it refers fails -when the subpattern is first used, so, for example, (a\1) never matches. -However, such references can be useful inside repeated subpatterns. For -example, the pattern +A backreference that occurs inside the group to which it refers fails when the +group is first used, so, for example, (a\1) never matches. However, such +references can be useful inside repeated groups. For example, the pattern

       (a|b\1)+
     
    matches any number of "a"s and also "aba", "ababbaa" etc. At each iteration of -the subpattern, the backreference matches the character string corresponding -to the previous iteration. In order for this to work, the pattern must be such -that the first iteration does not need to match the backreference. This can be -done using alternation, as in the example above, or by a quantifier with a -minimum of zero. +the group, the backreference matches the character string corresponding to the +previous iteration. In order for this to work, the pattern must be such that +the first iteration does not need to match the backreference. This can be done +using alternation, as in the example above, or by a quantifier with a minimum +of zero.

    Backreferences of this type cause the group that they reference to be treated @@ -2349,27 +2349,27 @@ coded as \b, \B, \A, \G, \Z, \z, ^ and $ are described above.

    -More complicated assertions are coded as subpatterns. There are two kinds: -those that look ahead of the current position in the subject string, and those -that look behind it, and in each case an assertion may be positive (must match -for the assertion to be true) or negative (must not match for the assertion to -be true). An assertion subpattern is matched in the normal way, and if it is -true, matching continues after it, but with the matching position in the -subject string is was it was before the assertion was processed. +More complicated assertions are coded as parenthesized groups. There are two +kinds: those that look ahead of the current position in the subject string, and +those that look behind it, and in each case an assertion may be positive (must +match for the assertion to be true) or negative (must not match for the +assertion to be true). An assertion group is matched in the normal way, +and if it is true, matching continues after it, but with the matching position +in the subject string is was it was before the assertion was processed.

    A lookaround assertion may also appear as the condition in a -conditional subpattern +conditional group (see below). In this case, the result of matching the assertion determines which branch of the condition is followed.

    -Assertion subpatterns are not capturing subpatterns. If an assertion contains -capturing subpatterns within it, these are counted for the purposes of -numbering the capturing subpatterns in the whole pattern. Within each branch of -an assertion, locally captured substrings may be referenced in the usual way. -For example, a sequence such as (.)\g{-1} can be used to check that two -adjacent characters are the same. +Assertion groups are not capture groups. If an assertion contains capture +groups within it, these are counted for the purposes of numbering the capture +groups in the whole pattern. Within each branch of an assertion, locally +captured substrings may be referenced in the usual way. For example, a sequence +such as (.)\g{-1} can be used to check that two adjacent characters are the +same.

    When a branch within an assertion fails to match, any substrings that were @@ -2384,24 +2384,24 @@ For a positive assertion, internally captured substrings in the successful branch are retained, and matching continues with the next pattern item after the assertion. For a negative assertion, a matching branch means that the assertion is not true. If such an assertion is being used as a condition in a -conditional subpattern +conditional group (see below), captured substrings are retained, because matching continues with the "no" branch of the condition. For other failing negative assertions, control passes to the previous backtracking point, thus discarding any captured strings within the assertion.

    -For compatibility with Perl, most assertion subpatterns may be repeated; though -it makes no sense to assert the same thing several times, the side effect of -capturing parentheses may occasionally be useful. However, an assertion that -forms the condition for a conditional subpattern may not be quantified. In -practice, for other assertions, there only three cases: +For compatibility with Perl, most assertion groups may be repeated; though it +makes no sense to assert the same thing several times, the side effect of +capturing may occasionally be useful. However, an assertion that forms the +condition for a conditional group may not be quantified. In practice, for +other assertions, there only three cases:

    (1) If the quantifier is {0}, the assertion is never obeyed during matching. -However, it may contain internal capturing parenthesized groups that are called -from elsewhere via the -subroutine mechanism. +However, it may contain internal capture groups that are called from elsewhere +via the +subroutine mechanism.

    (2) If quantifier is {0,n} where n is greater than zero, it is treated as if it @@ -2427,9 +2427,9 @@ following synonyms: (*positive_lookbehind: or (*plb: is the same as (?<= (*negative_lookbehind: or (*nlb: is the same as (?<!

    -For example, (*pla:foo) is the same assertion as (?=foo). However, in the -following sections, the various assertions are described using the original -symbolic forms. +For example, (*pla:foo) is the same assertion as (?=foo). In the following +sections, the various assertions are described using the original symbolic +forms.


    Lookahead assertions @@ -2513,9 +2513,9 @@ because it makes it impossible to calculate the length of the lookbehind. The permitted in lookbehinds.

    -"Subroutine" +"Subroutine" calls (see below) such as (?2) or (?&X) are permitted in lookbehinds, as long -as the subpattern matches a fixed-length string. However, +as the called capture group matches a fixed-length string. However, recursion, that is, a "subroutine" call into a group that is already active, is not supported. @@ -2524,10 +2524,10 @@ is not supported. Perl does not support backreferences in lookbehinds. PCRE2 does support them, but only if certain conditions are met. The PCRE2_MATCH_UNSET_BACKREF option must not be set, there must be no use of (?| in the pattern (it creates -duplicate subpattern numbers), and if the backreference is by name, the name -must be unique. Of course, the referenced subpattern must itself be of fixed -length. The following pattern matches words containing at least two characters -that begin and end with the same character: +duplicate group numbers), and if the backreference is by name, the name +must be unique. Of course, the referenced group must itself match a fixed +length substring. The following pattern matches words containing at least two +characters that begin and end with the same character:

        \b(\w)\w++(?<=\1)
     
    @@ -2653,15 +2653,15 @@ parentheses.

    Warning: The (*ACCEPT) control verb (see below) -should not be used within a script run subpattern, because it causes an -immediate exit from the subpattern, bypassing the script run checking. +should not be used within a script run group, because it causes an immediate +exit from the group, bypassing the script run checking.

    -
    CONDITIONAL SUBPATTERNS
    +
    CONDITIONAL GROUPS

    -It is possible to cause the matching process to obey a subpattern -conditionally or to choose between two alternative subpatterns, depending on -the result of an assertion, or whether a specific capturing subpattern has -already been matched. The two possible forms of conditional subpattern are: +It is possible to cause the matching process to obey a pattern fragment +conditionally or to choose between two alternative fragments, depending on +the result of an assertion, or whether a specific capture group has +already been matched. The two possible forms of conditional group are:

       (?(condition)yes-pattern)
       (?(condition)yes-pattern|no-pattern)
    @@ -2669,36 +2669,34 @@ already been matched. The two possible forms of conditional subpattern are:
     If the condition is satisfied, the yes-pattern is used; otherwise the
     no-pattern (if present) is used. An absent no-pattern is equivalent to an empty
     string (it always matches). If there are more than two alternatives in the
    -subpattern, a compile-time error occurs. Each of the two alternatives may
    -itself contain nested subpatterns of any form, including conditional
    -subpatterns; the restriction to two alternatives applies only at the level of
    -the condition. This pattern fragment is an example where the alternatives are
    -complex:
    +group, a compile-time error occurs. Each of the two alternatives may itself
    +contain nested groups of any form, including conditional groups; the
    +restriction to two alternatives applies only at the level of the condition
    +itself. This pattern fragment is an example where the alternatives are complex:
     
       (?(1) (A|B|C) | (D | (?(2)E|F) | E) )
     
     

    -There are five kinds of condition: references to subpatterns, references to +There are five kinds of condition: references to capture groups, references to recursion, two pseudo-conditions called DEFINE and VERSION, and assertions.


    -Checking for a used subpattern by number +Checking for a used capture group by number

    If the text between the parentheses consists of a sequence of digits, the -condition is true if a capturing subpattern of that number has previously -matched. If there is more than one capturing subpattern with the same number -(see the earlier -section about duplicate subpattern numbers), +condition is true if a capture group of that number has previously matched. If +there is more than one capture group with the same number (see the earlier +section about duplicate group numbers), the condition is true if any of them have matched. An alternative notation is -to precede the digits with a plus or minus sign. In this case, the subpattern -number is relative rather than absolute. The most recently opened parentheses -can be referenced by (?(-1), the next most recent by (?(-2), and so on. Inside -loops it can also make sense to refer to subsequent groups. The next -parentheses to be opened can be referenced as (?(+1), and so on. (The value -zero in any of these forms is not used; it provokes a compile-time error.) +to precede the digits with a plus or minus sign. In this case, the group number +is relative rather than absolute. The most recently opened capture group can be +referenced by (?(-1), the next most recent by (?(-2), and so on. Inside loops +it can also make sense to refer to subsequent groups. The next capture group +can be referenced as (?(+1), and so on. (The value zero in any of these forms +is not used; it provokes a compile-time error.)

    Consider the following pattern, which contains non-significant white space to @@ -2710,12 +2708,12 @@ three parts for ease of discussion: The first part matches an optional opening parenthesis, and if that character is present, sets it as the first captured substring. The second part matches one or more characters that are not parentheses. The third part is a -conditional subpattern that tests whether or not the first set of parentheses -matched. If they did, that is, if subject started with an opening parenthesis, +conditional group that tests whether or not the first capture group +matched. If it did, that is, if subject started with an opening parenthesis, the condition is true, and so the yes-pattern is executed and a closing parenthesis is required. Otherwise, since no-pattern is not present, the -subpattern matches nothing. In other words, this pattern matches a sequence of -non-parentheses, optionally enclosed in parentheses. +conditional group matches nothing. In other words, this pattern matches a +sequence of non-parentheses, optionally enclosed in parentheses.

    If you were embedding this pattern in a larger one, you could use a relative @@ -2726,22 +2724,20 @@ reference: This makes the fragment independent of the parentheses in the larger pattern.


    -Checking for a used subpattern by name +Checking for a used capture group by name

    Perl uses the syntax (?(<name>)...) or (?('name')...) to test for a used -subpattern by name. For compatibility with earlier versions of PCRE1, which had -this facility before Perl, the syntax (?(name)...) is also recognized. Note, -however, that undelimited names consisting of the letter R followed by digits -are ambiguous (see the following section). -

    -

    -Rewriting the above example to use a named subpattern gives this: +capture group by name. For compatibility with earlier versions of PCRE1, which +had this facility before Perl, the syntax (?(name)...) is also recognized. +Note, however, that undelimited names consisting of the letter R followed by +digits are ambiguous (see the following section). Rewriting the above example +to use a named group gives this:

       (?<OPEN> \( )?    [^()]+    (?(<OPEN>) \) )
     
    If the name used in a condition of this kind is a duplicate, the test is -applied to all subpatterns of the same name, and is true if any one of them has +applied to all groups of the same name, and is true if any one of them has matched.


    @@ -2753,20 +2749,20 @@ the pattern to another, whether or not it is actually recursive. See the sections entitled "Recursive patterns" and -"Subpatterns as subroutines" -below for details of recursion and subpattern calls. +"Groups as subroutines" +below for details of recursion and subroutine calls.

    -If a condition is the string (R), and there is no subpattern with the name R, -the condition is true if matching is currently in a recursion or subroutine -call to the whole pattern or any subpattern. If digits follow the letter R, and -there is no subpattern with that name, the condition is true if the most recent -call is into a subpattern with the given number, which must exist somewhere in -the overall pattern. This is a contrived example that is equivalent to a+b: +If a condition is the string (R), and there is no capture group with the name +R, the condition is true if matching is currently in a recursion or subroutine +call to the whole pattern or any capture group. If digits follow the letter R, +and there is no group with that name, the condition is true if the most recent +call is into a group with the given number, which must exist somewhere in the +overall pattern. This is a contrived example that is equivalent to a+b:

       ((?(R1)a+|(?1)b))
     
    -However, in both cases, if there is a subpattern with a matching name, the +However, in both cases, if there is a capture group with a matching name, the condition tests for its being set, as described in the section above, instead of testing for recursion. For example, creating a group with the name R1 by adding (?<R1>) to the above pattern completely changes its meaning. @@ -2776,28 +2772,28 @@ If a name preceded by ampersand follows the letter R, for example:
       (?(R&name)...)
     
    -the condition is true if the most recent recursion is into a subpattern of that -name (which must exist within the pattern). +the condition is true if the most recent recursion is into a group of that name +(which must exist within the pattern).

    This condition does not check the entire recursion stack. It tests only the current level. If the name used in a condition of this kind is a duplicate, the -test is applied to all subpatterns of the same name, and is true if any one of +test is applied to all groups of the same name, and is true if any one of them is the most recent recursion.

    At "top level", all these recursion test conditions are false.


    -Defining subpatterns for use by reference only +Defining capture groups for use by reference only

    If the condition is the string (DEFINE), the condition is always false, even if there is a group with the name DEFINE. In this case, there may be only one -alternative in the subpattern. It is always skipped if control reaches this -point in the pattern; the idea of DEFINE is that it can be used to define -subroutines that can be referenced from elsewhere. (The use of -subroutines +alternative in the rest of the conditional group. It is always skipped if +control reaches this point in the pattern; the idea of DEFINE is that it can be +used to define subroutines that can be referenced from elsewhere. (The use of +subroutines is described below.) For example, a pattern to match an IPv4 address such as "192.168.23.245" could be written like this (ignore white space and line breaks): @@ -2834,10 +2830,10 @@ than two digits. Assertion conditions

    -If the condition is not in any of the above formats, it must be an assertion. -This may be a positive or negative lookahead or lookbehind assertion. Consider -this pattern, again containing non-significant white space, and with the two -alternatives on the second line: +If the condition is not in any of the above formats, it must be a parenthesized +assertion. This may be a positive or negative lookahead or lookbehind +assertion. Consider this pattern, again containing non-significant white space, +and with the two alternatives on the second line:

       (?(?=[^a-z]*[a-z])
       \d{2}-[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} )
    @@ -2850,18 +2846,18 @@ against the second. This pattern matches strings in one of the two forms
     dd-aaa-dd or dd-dd-dd, where aaa are letters and dd are digits.
     

    -When an assertion that is a condition contains capturing subpatterns, any +When an assertion that is a condition contains capture groups, any capturing that occurs in a matching branch is retained afterwards, for both positive and negative assertions, because matching always continues after the assertion, whether it succeeds or fails. (Compare non-conditional assertions, -when captures are retained only for positive assertions that succeed.) +for which captures are retained only for positive assertions that succeed.)


    COMMENTS

    There are two ways of including comments in patterns that are processed by PCRE2. In both cases, the start of the comment must not be in a character class, nor in the middle of any other sequence of related characters such as -(?: or a subpattern name or number. The characters that make up a comment play +(?: or a group name or number. The characters that make up a comment play no part in the pattern matching.

    @@ -2908,14 +2904,14 @@ recursively to the pattern in which it appears.

    Obviously, PCRE2 cannot support the interpolation of Perl code. Instead, it supports special syntax for recursion of the entire pattern, and also for -individual subpattern recursion. After its introduction in PCRE1 and Python, +individual capture group recursion. After its introduction in PCRE1 and Python, this kind of recursion was subsequently introduced into Perl at release 5.10.

    A special item that consists of (? followed by a number greater than zero and a -closing parenthesis is a recursive subroutine call of the subpattern of the -given number, provided that it occurs inside that subpattern. (If not, it is a -non-recursive subroutine +closing parenthesis is a recursive subroutine call of the capture group of the +given number, provided that it occurs inside that group. (If not, it is a +non-recursive subroutine call, which is described in the next section.) The special item (?R) or (?0) is a recursive call of the entire regular expression.

    @@ -2949,13 +2945,13 @@ capturing parentheses leftwards from the point at which it is encountered.

    Be aware however, that if -duplicate subpattern numbers -are in use, relative references refer to the earliest subpattern with the +duplicate capture group numbers +are in use, relative references refer to the earliest group with the appropriate number. Consider, for example:

       (?|(a)|(b)) (c) (?-2)
     
    -The first two capturing groups (a) and (b) are both numbered 1, and group (c) +The first two capture groups (a) and (b) are both numbered 1, and group (c) is number 2. When the reference (?-2) is encountered, the second most recently opened parentheses has the number 1, but it is the first such group (the (a) group) to which the recursion refers. This would be the same if an absolute @@ -2963,10 +2959,10 @@ reference (?1) was used. In other words, relative references are just a shorthand for computing a group number.

    -It is also possible to refer to subsequently opened parentheses, by writing +It is also possible to refer to subsequent capture groups, by writing references such as (?+2). However, these cannot be recursive because the reference is not inside the parentheses that are referenced. They are always -non-recursive subroutine +non-recursive subroutine calls, as described in the next section.

    @@ -2976,7 +2972,7 @@ rewrite the above example as follows:

       (?<pn> \( ( [^()]++ | (?&pn) )* \) )
     
    -If there is more than one subpattern with the same name, the earliest one is +If there is more than one group with the same name, the earliest one is used.

    @@ -3002,9 +2998,9 @@ documentation). If the pattern above is matched against (ab(cd)ef)

    the value for the inner capturing parentheses (numbered 2) is "ef", which is -the last value taken on at the top level. If a capturing subpattern is not -matched at the top level, its final captured value is unset, even if it was -(temporarily) set at a deeper level during the matching process. +the last value taken on at the top level. If a capture group is not matched at +the top level, its final captured value is unset, even if it was (temporarily) +set at a deeper level during the matching process.

    Do not confuse the (?R) item with the condition (R), which tests for recursion. @@ -3014,9 +3010,9 @@ recursing), whereas any characters are permitted at the outer level.

       < (?: (?(R) \d++  | [^<>]*+) | (?R)) * >
     
    -In this pattern, (?(R) is the start of a conditional subpattern, with two -different alternatives for the recursive and non-recursive cases. The (?R) item -is the actual recursive call. +In this pattern, (?(R) is the start of a conditional group, with two different +alternatives for the recursive and non-recursive cases. The (?R) item is the +actual recursive call.


    Differences in recursion processing between PCRE2 and Perl @@ -3026,7 +3022,7 @@ Some former differences between PCRE2 and Perl no longer exist.

    Before release 10.30, recursion processing in PCRE2 differed from Perl in that -a recursive subpattern call was always treated as an atomic group. That is, +a recursive subroutine call was always treated as an atomic group. That is, once it had matched some of the subject string, it was never re-entered, even if it contained untried alternatives and there was a subsequent matching failure. (Historical note: PCRE implemented recursion before Perl did.) @@ -3062,7 +3058,7 @@ Perl takes so long that you think it has gone into a loop.

    Another way in which PCRE2 and Perl used to differ in their recursion processing is in the handling of captured values. Formerly in Perl, when a -subpattern was called recursively or as a subpattern (see the next section), it +group was called recursively or as a subroutine (see the next section), it had no access to any values that were captured outside the recursion, whereas in PCRE2 these values can be referenced. Consider this pattern:

    @@ -3073,16 +3069,15 @@ the second group, when the backreference \1 fails to match "b", the second
     alternative matches "a" and then recurses. In the recursion, \1 does now match
     "b" and so the whole match succeeds. This match used to fail in Perl, but in
     later versions (I tried 5.024) it now works.
    -

    -
    SUBPATTERNS AS SUBROUTINES
    +

    +
    GROUPS AS SUBROUTINES

    -If the syntax for a recursive subpattern call (either by number or by -name) is used outside the parentheses to which it refers, it operates a bit -like a subroutine in a programming language. More accurately, PCRE2 treats the -referenced subpattern as an independent subpattern which it tries to match at -the current matching position. The called subpattern may be defined before or -after the reference. A numbered reference can be absolute or relative, as in -these examples: +If the syntax for a recursive group call (either by number or by name) is used +outside the parentheses to which it refers, it operates a bit like a subroutine +in a programming language. More accurately, PCRE2 treats the referenced group +as an independent subpattern which it tries to match at the current matching +position. The called group may be defined before or after the reference. A +numbered reference can be absolute or relative, as in these examples:

       (...(absolute)...)...(?2)...
       (...(relative)...)...(?-1)...
    @@ -3107,19 +3102,19 @@ occur. However, any capturing parentheses that are set during the subroutine
     call revert to their previous values afterwards.
     

    -Processing options such as case-independence are fixed when a subpattern is +Processing options such as case-independence are fixed when a group is defined, so if it is used as a subroutine, such options cannot be changed for different calls. For example, consider this pattern:

       (abc)(?i:(?-1))
     
    It matches "abcabc". It does not match "abcABC" because the change of -processing option does not affect the called subpattern. +processing option does not affect the called group.

    The behaviour of backtracking control verbs -in subpatterns when called as subroutines is described in the section entitled +in groups when called as subroutines is described in the section entitled "Backtracking verbs in subroutines" below.

    @@ -3127,8 +3122,8 @@ below.

    For compatibility with Oniguruma, the non-Perl syntax \g followed by a name or a number enclosed either in angle brackets or single quotes, is an alternative -syntax for referencing a subpattern as a subroutine, possibly recursively. Here -are two of the examples used above, rewritten using this syntax: +syntax for calling a group as a subroutine, possibly recursively. Here are two +of the examples used above, rewritten using this syntax:

       (?<pn> \( ( (?>[^()]+) | \g<pn> )* \) )
       (sens|respons)e and \g'1'ibility
    @@ -3265,7 +3260,7 @@ The behaviour of these verbs in
     repeated groups,
     assertions,
     and in
    -subpatterns called as subroutines
    +capture groups called as subroutines
     (whether or not recursively) is documented below.
     


    @@ -3299,8 +3294,8 @@ The following verbs act as soon as they are encountered. (*ACCEPT) or (*ACCEPT:NAME)
    This verb causes the match to end successfully, skipping the remainder of the -pattern. However, when it is inside a subpattern that is called as a -subroutine, only that subpattern is ended successfully. Matching then continues +pattern. However, when it is inside a capture group that is called as a +subroutine, only that group is ended successfully. Matching then continues at the outer level. If (*ACCEPT) in triggered in a positive assertion, the assertion succeeds; in a negative assertion, the assertion fails.

    @@ -3314,9 +3309,8 @@ This matches "AB", "AAD", or "ACD"; when it matches "AB", "B" is captured by the outer parentheses.

    -Warning: (*ACCEPT) should not be used within a script run subpattern, -because it causes an immediate exit from the subpattern, bypassing the script -run checking. +Warning: (*ACCEPT) should not be used within a script run group, because +it causes an immediate exit from the group, bypassing the script run checking.

       (*FAIL) or (*FAIL:NAME)
     
    @@ -3563,31 +3557,29 @@ caller. However, (*SKIP:NAME) searches only for names set with (*MARK), ignoring those set by other backtracking verbs.

    -A subpattern that does not contain a | character is just a part of the -enclosing alternative; it is not a nested alternation with only one -alternative. The effect of (*THEN) extends beyond such a subpattern to the -enclosing alternative. Consider this pattern, where A, B, etc. are complex -pattern fragments that do not contain any | characters at this level: +A group that does not contain a | character is just a part of the enclosing +alternative; it is not a nested alternation with only one alternative. The +effect of (*THEN) extends beyond such a group to the enclosing alternative. +Consider this pattern, where A, B, etc. are complex pattern fragments that do +not contain any | characters at this level:

       A (B(*THEN)C) | D
     
    If A and B are matched, but there is a failure in C, matching does not backtrack into A; instead it moves to the next alternative, that is, D. -However, if the subpattern containing (*THEN) is given an alternative, it +However, if the group containing (*THEN) is given an alternative, it behaves differently:
       A (B(*THEN)C | (*FAIL)) | D
     
    -The effect of (*THEN) is now confined to the inner subpattern. After a failure -in C, matching moves to (*FAIL), which causes the whole subpattern to fail -because there are no more alternatives to try. In this case, matching does now -backtrack into A. +The effect of (*THEN) is now confined to the inner group. After a failure in C, +matching moves to (*FAIL), which causes the whole group to fail because there +are no more alternatives to try. In this case, matching does backtrack into A.

    -Note that a conditional subpattern is not considered as having two -alternatives, because only one is ever used. In other words, the | character in -a conditional subpattern has a different meaning. Ignoring white space, -consider: +Note that a conditional group is not considered as having two alternatives, +because only one is ever used. In other words, the | character in a conditional +group has a different meaning. Ignoring white space, consider:

       ^.*? (?(?=a) a | b(*THEN)c )
     
    @@ -3595,7 +3587,7 @@ If the subject is "ba", this pattern does not match. Because .*? is ungreedy, it initially matches zero characters. The condition (?=a) then fails, the character "b" is matched, but "c" is not. At this point, matching does not backtrack to .*? as might perhaps be expected from the presence of the | -character. The conditional subpattern is part of the single alternative that +character. The conditional group is part of the single alternative that comprises the whole pattern, and so the match fails. (If there was a backtrack into .*?, allowing it to match "b", the match would succeed.)

    @@ -3651,7 +3643,7 @@ Backtracking verbs in assertions (*FAIL) in any assertion has its normal effect: it forces an immediate backtrack. The behaviour of the other backtracking verbs depends on whether or not the assertion is standalone or acting as the condition in a conditional -subpattern. +group.

    (*ACCEPT) in a standalone positive assertion causes the assertion to succeed @@ -3690,29 +3682,28 @@ the assertion to be true, without considering any further alternative branches. Backtracking verbs in subroutines

    -These behaviours occur whether or not the subpattern is called recursively. +These behaviours occur whether or not the group is called recursively.

    -(*ACCEPT) in a subpattern called as a subroutine causes the subroutine match to +(*ACCEPT) in a group called as a subroutine causes the subroutine match to succeed without any further processing. Matching then continues after the subroutine call. Perl documents this behaviour. Perl's treatment of the other verbs in subroutines is different in some cases.

    -(*FAIL) in a subpattern called as a subroutine has its normal effect: it forces +(*FAIL) in a group called as a subroutine has its normal effect: it forces an immediate backtrack.

    (*COMMIT), (*SKIP), and (*PRUNE) cause the subroutine match to fail when -triggered by being backtracked to in a subpattern called as a subroutine. There -is then a backtrack at the outer level. +triggered by being backtracked to in a group called as a subroutine. There is +then a backtrack at the outer level.

    (*THEN), when triggered, skips to the next alternative in the innermost -enclosing group within the subpattern that has alternatives (its normal -behaviour). However, if there is no such group within the subroutine -subpattern, the subroutine match fails and there is a backtrack at the outer -level. +enclosing group that has alternatives (its normal behaviour). However, if there +is no such group within the subroutine's group, the subroutine match fails and +there is a backtrack at the outer level.


    SEE ALSO

    @@ -3730,9 +3721,9 @@ Cambridge, England.


    REVISION

    -Last updated: 27 November 2018 +Last updated: 04 February 2019
    -Copyright © 1997-2018 University of Cambridge. +Copyright © 1997-2019 University of Cambridge.

    Return to the PCRE2 index page. diff --git a/doc/html/pcre2perform.html b/doc/html/pcre2perform.html index f823c12..80d716c 100644 --- a/doc/html/pcre2perform.html +++ b/doc/html/pcre2perform.html @@ -31,9 +31,9 @@ of them. Patterns are compiled by PCRE2 into a reasonably efficient interpretive code, so that most simple patterns do not use much memory for storing the compiled version. However, there is one case where the memory usage of a compiled -pattern can be unexpectedly large. If a parenthesized subpattern has a -quantifier with a minimum greater than 1 and/or a limited maximum, the whole -subpattern is repeated in the compiled code. For example, the pattern +pattern can be unexpectedly large. If a parenthesized group has a quantifier +with a minimum greater than 1 and/or a limited maximum, the whole group is +repeated in the compiled code. For example, the pattern

       (abc|def){2,4}
     
    @@ -252,9 +252,9 @@ Cambridge, England.


    REVISION

    -Last updated: 25 April 2018 +Last updated: 03 February 2019
    -Copyright © 1997-2018 University of Cambridge. +Copyright © 1997-2019 University of Cambridge.

    Return to the PCRE2 index page. diff --git a/doc/html/pcre2syntax.html b/doc/html/pcre2syntax.html index e7a5df3..73da500 100644 --- a/doc/html/pcre2syntax.html +++ b/doc/html/pcre2syntax.html @@ -424,20 +424,23 @@ but some of them use Unicode properties if PCRE2_UCP is set. You can use
    CAPTURING

    -  (...)           capturing group
    -  (?<name>...)    named capturing group (Perl)
    -  (?'name'...)    named capturing group (Perl)
    -  (?P<name>...)   named capturing group (Python)
    -  (?:...)         non-capturing group
    -  (?|...)         non-capturing group; reset group numbers for
    -                   capturing groups in each alternative
    -
    + (...) capture group + (?<name>...) named capture group (Perl) + (?'name'...) named capture group (Perl) + (?P<name>...) named capture group (Python) + (?:...) non-capture group + (?|...) non-capture group; reset group numbers for + capture groups in each alternative +
    +In non-UTF modes, names may contain underscores and ASCII letters and digits; +in UTF modes, any Unicode letters and Unicode decimal digits are permitted. In +both cases, a name must not start with a digit.


    ATOMIC GROUPS

    -  (?>...)         atomic, non-capturing group
    -  (*atomic:...)   atomic, non-capturing group
    +  (?>...)         atomic non-capture group
    +  (*atomic:...)   atomic non-capture group
     


    COMMENT
    @@ -465,7 +468,7 @@ of the group. Unsetting x or xx unsets both. Several options may be set at once, and a mixture of setting and unsetting such as (?i-x) is allowed, but there may be only one hyphen. Setting (but no unsetting) is allowed after (?^ for example -(?^in). An option setting may appear at the start of a non-capturing group, for +(?^in). An option setting may appear at the start of a non-capture group, for example (?i:...).

    @@ -565,19 +568,19 @@ Each top-level branch of a lookbehind must be of a fixed length.

       (?R)            recurse whole pattern
    -  (?n)            call subpattern by absolute number
    -  (?+n)           call subpattern by relative number
    -  (?-n)           call subpattern by relative number
    -  (?&name)        call subpattern by name (Perl)
    -  (?P>name)       call subpattern by name (Python)
    -  \g<name>        call subpattern by name (Oniguruma)
    -  \g'name'        call subpattern by name (Oniguruma)
    -  \g<n>           call subpattern by absolute number (Oniguruma)
    -  \g'n'           call subpattern by absolute number (Oniguruma)
    -  \g<+n>          call subpattern by relative number (PCRE2 extension)
    -  \g'+n'          call subpattern by relative number (PCRE2 extension)
    -  \g<-n>          call subpattern by relative number (PCRE2 extension)
    -  \g'-n'          call subpattern by relative number (PCRE2 extension)
    +  (?n)            call subroutine by absolute number
    +  (?+n)           call subroutine by relative number
    +  (?-n)           call subroutine by relative number
    +  (?&name)        call subroutine by name (Perl)
    +  (?P>name)       call subroutine by name (Python)
    +  \g<name>        call subroutine by name (Oniguruma)
    +  \g'name'        call subroutine by name (Oniguruma)
    +  \g<n>           call subroutine by absolute number (Oniguruma)
    +  \g'n'           call subroutine by absolute number (Oniguruma)
    +  \g<+n>          call subroutine by relative number (PCRE2 extension)
    +  \g'+n'          call subroutine by relative number (PCRE2 extension)
    +  \g<-n>          call subroutine by relative number (PCRE2 extension)
    +  \g'-n'          call subroutine by relative number (PCRE2 extension)
     


    CONDITIONAL PATTERNS
    @@ -595,7 +598,7 @@ Each top-level branch of a lookbehind must be of a fixed length. (?(R) overall recursion condition (?(Rn) specific numbered group recursion condition (?(R&name) specific named group recursion condition - (?(DEFINE) define subpattern for reference + (?(DEFINE) define groups for reference (?(VERSION[>]=n.m) test PCRE2 version (?(assert) assertion condition
    @@ -657,9 +660,9 @@ Cambridge, England.


    REVISION

    -Last updated: 10 October 2018 +Last updated: 03 February 2019
    -Copyright © 1997-2018 University of Cambridge. +Copyright © 1997-2019 University of Cambridge.

    Return to the PCRE2 index page. diff --git a/doc/html/pcre2test.html b/doc/html/pcre2test.html index 03bfa8b..db5001f 100644 --- a/doc/html/pcre2test.html +++ b/doc/html/pcre2test.html @@ -716,14 +716,14 @@ information is obtained from the pcre2_pattern_info() function. Here are some typical examples:

         re> /(?i)(^a|^b)/m,info
    -  Capturing subpattern count = 1
    +  Capture group count = 1
       Compile options: multiline
       Overall options: caseless multiline
       First code unit at start or follows newline
       Subject length lower bound = 1
     
         re> /(?i)abc/info
    -  Capturing subpattern count = 0
    +  Capture group count = 0
       Compile options: <none>
       Overall options: caseless
       First code unit = 'a' (caseless)
    @@ -1353,8 +1353,8 @@ Testing substring extraction functions
     

    The copy and get modifiers can be used to test the pcre2_substring_copy_xxx() and pcre2_substring_get_xxx() functions. -They can be given more than once, and each can specify a group name or number, -for example: +They can be given more than once, and each can specify a capture group name or +number, for example:

        abcd\=copy=1,copy=3,get=G1
     
    @@ -2075,9 +2075,9 @@ Cambridge, England.


    REVISION

    -Last updated: 12 November 2018 +Last updated: 03 February 2019
    -Copyright © 1997-2018 University of Cambridge. +Copyright © 1997-2019 University of Cambridge.

    Return to the PCRE2 index page. diff --git a/doc/html/pcre2unicode.html b/doc/html/pcre2unicode.html index e446182..53a2e11 100644 --- a/doc/html/pcre2unicode.html +++ b/doc/html/pcre2unicode.html @@ -38,10 +38,11 @@ UNICODE PROPERTY SUPPORT

    When PCRE2 is built with Unicode support, the escape sequences \p{..}, -\P{..}, and \X can be used. The Unicode 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, the Unicode script names such as Arabic or Han, and -the derived properties Any and L&. Full lists are given in the +\P{..}, and \X can be used. This is not dependent on the PCRE2_UTF setting. +The Unicode 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, the +Unicode script names such as Arabic or Han, and the derived properties Any and +L&. Full lists are given in the pcre2pattern and pcre2syntax @@ -73,11 +74,17 @@ In UTF modes, the dot metacharacter matches one UTF character instead of a single code unit.

    +In UTF modes, capture group names are not restricted to ASCII, and may contain +any Unicode letters and decimal digits, as well as underscore. +

    +

    The escape sequence \C can be used to match a single code unit in a UTF mode, but its use can lead to some strange effects because it breaks up multi-unit characters (see the description of \C in the pcre2pattern -documentation). +documentation). For this reason, there is a build-time option that disables +support for \C completely. There is also a less draconian compile-time option +for locking out the use of \C when a pattern is compiled.

    The use of \C is not supported by the alternative matching function @@ -410,9 +417,9 @@ Cambridge, England. REVISION

    -Last updated: 12 October 2018 +Last updated: 03 February 2019
    -Copyright © 1997-2018 University of Cambridge. +Copyright © 1997-2019 University of Cambridge.

    Return to the PCRE2 index page. diff --git a/doc/pcre2.txt b/doc/pcre2.txt index 332a4b8..27cf928 100644 --- a/doc/pcre2.txt +++ b/doc/pcre2.txt @@ -1475,11 +1475,11 @@ COMPILING A PATTERN PCRE2_DUPNAMES - If this bit is set, names used to identify capturing subpatterns need - not be unique. This can be helpful for certain types of pattern when it - is known that only one instance of the named subpattern can ever be - matched. There are more details of named subpatterns below; see also - the pcre2pattern documentation. + If this bit is set, names used to identify capture groups need not be + unique. This can be helpful for certain types of pattern when it is + known that only one instance of the named group can ever be matched. + There are more details of named capture groups below; see also the + pcre2pattern documentation. PCRE2_ENDANCHORED @@ -1510,12 +1510,12 @@ COMPILING A PATTERN If this bit is set, most white space characters in the pattern are totally ignored except when escaped or inside a character class. How- ever, white space is not allowed within sequences such as (?> that - introduce various parenthesized subpatterns, nor within numerical quan- - tifiers such as {1,3}. Ignorable white space is permitted between an - item and a following quantifier and between a quantifier and a follow- - ing + that indicates possessiveness. PCRE2_EXTENDED is equivalent to - Perl's /x option, and it can be changed within a pattern by a (?x) - option setting. + introduce various parenthesized groups, nor within numerical quanti- + fiers such as {1,3}. Ignorable white space is permitted between an item + and a following quantifier and between a quantifier and a following + + that indicates possessiveness. PCRE2_EXTENDED is equivalent to Perl's + /x option, and it can be changed within a pattern by a (?x) option set- + ting. When PCRE2 is compiled without Unicode support, PCRE2_EXTENDED recog- nizes as white space only those characters with code points less than @@ -1588,7 +1588,7 @@ COMPILING A PATTERN PCRE2_MATCH_UNSET_BACKREF - If this option is set, a backreference to an unset subpattern group + If this option is set, a backreference to an unset capture group matches an empty string (by default this causes the current matching alternative to fail). A pattern such as (\1)(a) succeeds when this option is set (assuming it can find an "a" in the subject), whereas it @@ -1654,7 +1654,7 @@ COMPILING A PATTERN ? behaves as if it were followed by ?: but named parentheses can still be used for capturing (and they acquire numbers in the usual way). This is the same as Perl's /n option. Note that, when this option is set, - references to capturing groups (backreferences or recursion/subroutine + references to capture groups (backreferences or recursion/subroutine calls) may only refer to named groups, though the reference can be by name or by number. @@ -1674,9 +1674,9 @@ COMPILING A PATTERN .* is the first significant item in a top-level branch of a pattern, and all the other branches also start with .* or with \A or \G or ^. The optimization is automatically disabled for .* if it is inside an - atomic group or a capturing group that is the subject of a backrefer- - ence, or if the pattern contains (*PRUNE) or (*SKIP). When the opti- - mization is not disabled, such a pattern is automatically anchored if + atomic group or a capture group that is the subject of a backreference, + or if the pattern contains (*PRUNE) or (*SKIP). When the optimization + is not disabled, such a pattern is automatically anchored if PCRE2_DOTALL is set for all the .* items and PCRE2_MULTILINE is not set for any ^ items. Otherwise, the fact that any match must start either at the start of the subject or following a newline is remembered. Like @@ -2038,7 +2038,7 @@ INFORMATION ABOUT A COMPILED PATTERN all the following are true: .* is not in an atomic group - .* is not in a capturing group that is the subject + .* is not in a capture group that is the subject of a backreference PCRE2_DOTALL is in force for .* Neither (*PRUNE) nor (*SKIP) appears in the pattern @@ -2050,12 +2050,12 @@ INFORMATION ABOUT A COMPILED PATTERN PCRE2_INFO_BACKREFMAX Return the number of the highest backreference in the pattern. The - third argument should point to an uint32_t variable. Named subpatterns - acquire numbers as well as names, and these count towards the highest - backreference. Backreferences such as \4 or \g{12} match the captured - characters of the given group, but in addition, the check that a cap- - turing group is set in a conditional subpattern such as (?(3)a|b) is - also a backreference. Zero is returned if there are no backreferences. + third argument should point to an uint32_t variable. Named capture + groups acquire numbers as well as names, and these count towards the + highest backreference. Backreferences such as \4 or \g{12} match the + captured characters of the given group, but in addition, the check that + a capture group is set in a conditional group such as (?(3)a|b) is also + a backreference. Zero is returned if there are no backreferences. PCRE2_INFO_BSR @@ -2066,9 +2066,9 @@ INFORMATION ABOUT A COMPILED PATTERN PCRE2_INFO_CAPTURECOUNT - Return the highest capturing subpattern number in the pattern. In pat- - terns where (?| is not used, this is also the total number of capturing - subpatterns. The third argument should point to an uint32_t variable. + Return the highest capture group number in the pattern. In patterns + where (?| is not used, this is also the total number of capture groups. + The third argument should point to an uint32_t variable. PCRE2_INFO_DEPTHLIMIT @@ -2118,8 +2118,8 @@ INFORMATION ABOUT A COMPILED PATTERN backtracking positions when the pattern is processed by pcre2_match() without the use of JIT. The third argument should point to a size_t variable. The frame size depends on the number of capturing parentheses - in the pattern. Each additional capturing group adds two PCRE2_SIZE - variables. + in the pattern. Each additional capture group adds two PCRE2_SIZE vari- + ables. PCRE2_INFO_HASBACKSLASHC @@ -2245,26 +2245,27 @@ INFORMATION ABOUT A COMPILED PATTERN The rest of the entry is the corresponding name, zero terminated. The names are in alphabetical order. If (?| is used to create multiple - groups with the same number, as described in the section on duplicate - subpattern numbers in the pcre2pattern page, the groups may be given - the same name, but there is only one entry in the table. Different - names for groups of the same number are not permitted. + capture groups with the same number, as described in the section on + duplicate group numbers in the pcre2pattern page, the groups may be + given the same name, but there is only one entry in the table. Differ- + ent names for groups of the same number are not permitted. - Duplicate names for subpatterns with different numbers are permitted, - but only if PCRE2_DUPNAMES is set. They appear in the table in the + Duplicate names for capture groups with different numbers are permit- + ted, but only if PCRE2_DUPNAMES is set. They appear in the table in the order in which they were found in the pattern. In the absence of (?| this is the order of increasing number; when (?| is used this is not - necessarily the case because later subpatterns may have lower numbers. + necessarily the case because later capture groups may have lower num- + bers. - As a simple example of the name/number table, consider the following - pattern after compilation by the 8-bit library (assume PCRE2_EXTENDED + As a simple example of the name/number table, consider the following + pattern after compilation by the 8-bit library (assume PCRE2_EXTENDED is set, so white space - including newlines - is ignored): (? (?(\d\d)?\d\d) - (?\d\d) - (?\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 capture groups, 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 ??: @@ -2273,8 +2274,8 @@ INFORMATION ABOUT A COMPILED 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 - name-to-number map, remember that the length of the entries is likely + When writing code to extract data from named capture groups using the + name-to-number map, remember that the length of the entries is likely to be different for each compiled pattern. PCRE2_INFO_NEWLINE @@ -2293,14 +2294,14 @@ INFORMATION ABOUT A COMPILED PATTERN PCRE2_INFO_SIZE - Return the size of the compiled pattern in bytes (for all three - libraries). The third argument should point to a size_t variable. This - value includes the size of the general data block that precedes the - code units of the compiled pattern itself. The value that is used when - pcre2_compile() is getting memory in which to place the compiled pat- - tern may be slightly larger than the value returned by this option, - because there are cases where the code that calculates the size has to - over-estimate. Processing a pattern with the JIT compiler does not + Return the size of the compiled pattern in bytes (for all three + libraries). The third argument should point to a size_t variable. This + value includes the size of the general data block that precedes the + code units of the compiled pattern itself. The value that is used when + pcre2_compile() is getting memory in which to place the compiled pat- + tern may be slightly larger than the value returned by this option, + because there are cases where the code that calculates the size has to + over-estimate. Processing a pattern with the JIT compiler does not alter the value returned by this option. @@ -2311,30 +2312,30 @@ INFORMATION ABOUT A PATTERN'S CALLOUTS void *user_data); A script language that supports the use of string arguments in callouts - might like to scan all the callouts in a pattern before running the + might like to scan all the callouts in a pattern before running the match. This can be done by calling pcre2_callout_enumerate(). The first - argument is a pointer to a compiled pattern, the second points to a - callback function, and the third is arbitrary user data. The callback - function is called for every callout in the pattern in the order in + argument is a pointer to a compiled pattern, the second points to a + callback function, and the third is arbitrary user data. The callback + function is called for every callout in the pattern in the order in which they appear. Its first argument is a pointer to a callout enumer- - ation block, and its second argument is the user_data value that was - passed to pcre2_callout_enumerate(). The contents of the callout enu- - meration block are described in the pcre2callout documentation, which + ation block, and its second argument is the user_data value that was + passed to pcre2_callout_enumerate(). The contents of the callout enu- + meration block are described in the pcre2callout documentation, which also gives further details about callouts. SERIALIZATION AND PRECOMPILING - It is possible to save compiled patterns on disc or elsewhere, and - reload them later, subject to a number of restrictions. The host on - which the patterns are reloaded must be running the same version of + It is possible to save compiled patterns on disc or elsewhere, and + reload them later, subject to a number of restrictions. The host on + which the patterns are reloaded must be running the same version of PCRE2, with the same code unit width, and must also have the same endi- - anness, pointer width, and PCRE2_SIZE type. Before compiled patterns - can be saved, they must be converted to a "serialized" form, which in - the case of PCRE2 is really just a bytecode dump. The functions whose - names begin with pcre2_serialize_ are used for converting to and from - the serialized form. They are described in the pcre2serialize documen- - tation. Note that PCRE2 serialization does not convert compiled pat- + anness, pointer width, and PCRE2_SIZE type. Before compiled patterns + can be saved, they must be converted to a "serialized" form, which in + the case of PCRE2 is really just a bytecode dump. The functions whose + names begin with pcre2_serialize_ are used for converting to and from + the serialized form. They are described in the pcre2serialize documen- + tation. Note that PCRE2 serialization does not convert compiled pat- terns to an abstract format like Java or .NET serialization. @@ -2348,60 +2349,60 @@ THE MATCH DATA BLOCK void pcre2_match_data_free(pcre2_match_data *match_data); - Information about a successful or unsuccessful match is placed in a - match data block, which is an opaque structure that is accessed by - function calls. In particular, the match data block contains a vector - of offsets into the subject string that define the matched part of the - subject and any substrings that were captured. This is known as the + Information about a successful or unsuccessful match is placed in a + match data block, which is an opaque structure that is accessed by + function calls. In particular, the match data block contains a vector + of offsets into the subject string that define the matched part of the + subject and any substrings that were captured. This is known as the ovector. - Before calling pcre2_match(), pcre2_dfa_match(), or pcre2_jit_match() + Before calling pcre2_match(), pcre2_dfa_match(), or pcre2_jit_match() you must create a match data block by calling one of the creation func- - tions above. For pcre2_match_data_create(), the first argument is the - number of pairs of offsets in the ovector. One pair of offsets is + tions above. For pcre2_match_data_create(), the first argument is the + number of pairs of offsets in the ovector. One pair of offsets is required to identify the string that matched the whole pattern, with an - additional pair for each captured substring. For example, a value of 4 - creates enough space to record the matched portion of the subject plus - three captured substrings. A minimum of at least 1 pair is imposed by + additional pair for each captured substring. For example, a value of 4 + creates enough space to record the matched portion of the subject plus + three captured substrings. A minimum of at least 1 pair is imposed by pcre2_match_data_create(), so it is always possible to return the over- all matched string. The second argument of pcre2_match_data_create() is a pointer to a gen- - eral context, which can specify custom memory management for obtaining + eral context, which can specify custom memory management for obtaining the memory for the match data block. If you are not using custom memory management, pass NULL, which causes malloc() to be used. - For pcre2_match_data_create_from_pattern(), the first argument is a + For pcre2_match_data_create_from_pattern(), the first argument is a pointer to a compiled pattern. The ovector is created to be exactly the right size to hold all the substrings a pattern might capture. The sec- - ond argument is again a pointer to a general context, but in this case + ond argument is again a pointer to a general context, but in this case if NULL is passed, the memory is obtained using the same allocator that was used for the compiled pattern (custom or default). - A match data block can be used many times, with the same or different - compiled patterns. You can extract information from a match data block + A match data block can be used many times, with the same or different + compiled patterns. You can extract information from a match data block after a match operation has finished, using functions that are - described in the sections on matched strings and other match data + described in the sections on matched strings and other match data below. - When a call of pcre2_match() fails, valid data is available in the - match block only when the error is PCRE2_ERROR_NOMATCH, - PCRE2_ERROR_PARTIAL, or one of the error codes for an invalid UTF + When a call of pcre2_match() fails, valid data is available in the + match block only when the error is PCRE2_ERROR_NOMATCH, + PCRE2_ERROR_PARTIAL, or one of the error codes for an invalid UTF string. Exactly what is available depends on the error, and is detailed below. - When one of the matching functions is called, pointers to the compiled - pattern and the subject string are set in the match data block so that - they can be referenced by the extraction functions after a successful + When one of the matching functions is called, pointers to the compiled + pattern and the subject string are set in the match data block so that + they can be referenced by the extraction functions after a successful match. After running a match, you must not free a compiled pattern or a - subject string until after all operations on the match data block (for - that match) have taken place, unless, in the case of the subject - string, you have used the PCRE2_COPY_MATCHED_SUBJECT option, which is - described in the section entitled "Option bits for pcre2_match()" + subject string until after all operations on the match data block (for + that match) have taken place, unless, in the case of the subject + string, you have used the PCRE2_COPY_MATCHED_SUBJECT option, which is + described in the section entitled "Option bits for pcre2_match()" below. - When a match data block itself is no longer needed, it should be freed - by calling pcre2_match_data_free(). If this function is called with a + When a match data block itself is no longer needed, it should be freed + by calling pcre2_match_data_free(). If this function is called with a NULL argument, it returns immediately, without doing anything. @@ -2412,15 +2413,15 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION uint32_t options, pcre2_match_data *match_data, pcre2_match_context *mcontext); - The function pcre2_match() is called to match a subject string against - a compiled pattern, which is passed in the code argument. You can call + The function pcre2_match() is called to match a subject string against + a compiled pattern, which is passed in the code argument. You can call pcre2_match() with the same code argument as many times as you like, in - order to find multiple matches in the subject string or to match dif- + order to find multiple matches in the subject string or to match dif- ferent subject strings with the same pattern. - 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 section + 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 section about the pcre2_dfa_match() function. Here is an example of a simple call to pcre2_match(): @@ -2435,205 +2436,205 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION md, /* the match data block */ NULL); /* a match context; NULL means use defaults */ - If the subject string is zero-terminated, the length can be given as + If the subject string is zero-terminated, the length can be given as PCRE2_ZERO_TERMINATED. A match context must be provided if certain less common matching parameters are to be changed. For details, see the sec- tion on the match context above. The string to be matched by pcre2_match() - The subject string is passed to pcre2_match() as a pointer in subject, - a length in length, and a starting offset in startoffset. The length - and offset are in code units, not characters. That is, they are in - bytes for the 8-bit library, 16-bit code units for the 16-bit library, - and 32-bit code units for the 32-bit library, whether or not UTF pro- + The subject string is passed to pcre2_match() as a pointer in subject, + a length in length, and a starting offset in startoffset. The length + and offset are in code units, not characters. That is, they are in + bytes for the 8-bit library, 16-bit code units for the 16-bit library, + and 32-bit code units for the 32-bit library, whether or not UTF pro- cessing is enabled. If startoffset is greater than the length of the subject, pcre2_match() - returns PCRE2_ERROR_BADOFFSET. When the starting offset is zero, the - search for a match starts at the beginning of the subject, and this is + returns PCRE2_ERROR_BADOFFSET. 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. In UTF-8 or UTF-16 mode, the starting off- - set must point to the start of a character, or to the end of the sub- - ject (in UTF-32 mode, one code unit equals one character, so all off- - sets are valid). Like the pattern string, the subject may contain + set must point to the start of a character, or to the end of the sub- + ject (in UTF-32 mode, one code unit equals one character, so all off- + sets are valid). Like the pattern string, the subject may contain binary zeros. - A non-zero starting offset is useful when searching for another match - in the same subject by calling pcre2_match() again after a previous - success. Setting startoffset differs from passing over a shortened - string and setting PCRE2_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 pcre2_match() again after a previous + success. Setting startoffset differs from passing over a shortened + string and setting PCRE2_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.) + 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 pcre2_match() - finds the first occurrence. If pcre2_match() is called again with just - the remainder of the subject, namely "issipi", it does not match, + finds the first occurrence. If pcre2_match() 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 pcre2_match() is passed the entire + to be a word boundary. However, if pcre2_match() 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. - Finding all the matches in a subject is tricky when the pattern can + Finding all the matches in a subject is tricky when the pattern can match an empty string. It is possible to emulate Perl's /g behaviour by - first trying the match again at the same offset, with the - PCRE2_NOTEMPTY_ATSTART and PCRE2_ANCHORED options, and then if that - fails, advancing the starting offset and trying an ordinary match - again. There is some code that demonstrates how to do this in the - pcre2demo sample program. In the most general case, you have to check - to see if the newline convention recognizes CRLF as a newline, and if - so, and the current character is CR followed by LF, advance the start- + first trying the match again at the same offset, with the + PCRE2_NOTEMPTY_ATSTART and PCRE2_ANCHORED options, and then if that + fails, advancing the starting offset and trying an ordinary match + again. There is some code that demonstrates how to do this in the + pcre2demo sample program. In the most general case, you have to check + to see if the newline convention recognizes CRLF as a newline, and if + so, and the current character is CR followed by LF, advance the start- ing offset by two characters instead of one. If a non-zero starting offset is passed when the pattern is anchored, a single attempt to match at the given offset is made. This can only suc- - ceed if the pattern does not require the match to be at the start of - the subject. In other words, the anchoring must be the result of set- - ting the PCRE2_ANCHORED option or the use of .* with PCRE2_DOTALL, not + ceed if the pattern does not require the match to be at the start of + the subject. In other words, the anchoring must be the result of set- + ting the PCRE2_ANCHORED option or the use of .* with PCRE2_DOTALL, not by starting the pattern with ^ or \A. Option bits for pcre2_match() The unused bits of the options argument for pcre2_match() must be zero. - The only bits that may be set are PCRE2_ANCHORED, - PCRE2_COPY_MATCHED_SUBJECT, PCRE2_ENDANCHORED, PCRE2_NOTBOL, - PCRE2_NOTEOL, PCRE2_NOTEMPTY, PCRE2_NOTEMPTY_ATSTART, PCRE2_NO_JIT, - PCRE2_NO_UTF_CHECK, PCRE2_PARTIAL_HARD, and PCRE2_PARTIAL_SOFT. Their + The only bits that may be set are PCRE2_ANCHORED, + PCRE2_COPY_MATCHED_SUBJECT, PCRE2_ENDANCHORED, PCRE2_NOTBOL, + PCRE2_NOTEOL, PCRE2_NOTEMPTY, PCRE2_NOTEMPTY_ATSTART, PCRE2_NO_JIT, + PCRE2_NO_UTF_CHECK, PCRE2_PARTIAL_HARD, and PCRE2_PARTIAL_SOFT. Their action is described below. - Setting PCRE2_ANCHORED or PCRE2_ENDANCHORED at match time is not sup- - ported by the just-in-time (JIT) compiler. If it is set, JIT matching - is disabled and the interpretive code in pcre2_match() is run. Apart - from PCRE2_NO_JIT (obviously), the remaining options are supported for + Setting PCRE2_ANCHORED or PCRE2_ENDANCHORED at match time is not sup- + ported by the just-in-time (JIT) compiler. If it is set, JIT matching + is disabled and the interpretive code in pcre2_match() is run. Apart + from PCRE2_NO_JIT (obviously), the remaining options are supported for JIT matching. PCRE2_ANCHORED The PCRE2_ANCHORED option limits pcre2_match() to matching at the first - matching position. If a pattern was compiled with PCRE2_ANCHORED, or - turned out to be anchored by virtue of its contents, it cannot be made - unachored at matching time. Note that setting the option at match time + matching position. If a pattern was compiled with PCRE2_ANCHORED, or + turned out to be anchored by virtue of its contents, it cannot be made + unachored at matching time. Note that setting the option at match time disables JIT matching. PCRE2_COPY_MATCHED_SUBJECT - By default, a pointer to the subject is remembered in the match data - block so that, after a successful match, it can be referenced by the - substring extraction functions. This means that the subject's memory - must not be freed until all such operations are complete. For some - applications where the lifetime of the subject string is not guaran- - teed, it may be necessary to make a copy of the subject string, but it + By default, a pointer to the subject is remembered in the match data + block so that, after a successful match, it can be referenced by the + substring extraction functions. This means that the subject's memory + must not be freed until all such operations are complete. For some + applications where the lifetime of the subject string is not guaran- + teed, it may be necessary to make a copy of the subject string, but it is wasteful to do this unless the match is successful. After a success- - ful match, if PCRE2_COPY_MATCHED_SUBJECT is set, the subject is copied - and the new pointer is remembered in the match data block instead of - the original subject pointer. The memory allocator that was used for - the match block itself is used. The copy is automatically freed when - pcre2_match_data_free() is called to free the match data block. It is + ful match, if PCRE2_COPY_MATCHED_SUBJECT is set, the subject is copied + and the new pointer is remembered in the match data block instead of + the original subject pointer. The memory allocator that was used for + the match block itself is used. The copy is automatically freed when + pcre2_match_data_free() is called to free the match data block. It is also automatically freed if the match data block is re-used for another match operation. PCRE2_ENDANCHORED - If the PCRE2_ENDANCHORED option is set, any string that pcre2_match() - matches must be right at the end of the subject string. Note that set- + If the PCRE2_ENDANCHORED option is set, any string that pcre2_match() + matches must be right at the end of the subject string. Note that set- ting the option at match time disables JIT matching. PCRE2_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 having set PCRE2_MULTILINE at + the beginning of a line, so the circumflex metacharacter should not + match before it. Setting this without having set PCRE2_MULTILINE at compile time causes circumflex never to match. This option affects only the behaviour of the circumflex metacharacter. It does not affect \A. PCRE2_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- - out having set PCRE2_MULTILINE at compile time causes dollar never to + 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 having set PCRE2_MULTILINE at compile time causes dollar never to match. This option affects only the behaviour of the dollar metacharac- ter. It does not affect \Z or \z. PCRE2_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 an + is applied to a string not beginning with "a" or "b", it matches an empty string at the start of the subject. With PCRE2_NOTEMPTY set, this - match is not valid, so pcre2_match() searches further into the string + match is not valid, so pcre2_match() searches further into the string for occurrences of "a" or "b". PCRE2_NOTEMPTY_ATSTART - This is like PCRE2_NOTEMPTY, except that it locks out an empty string + This is like PCRE2_NOTEMPTY, except that it locks out an empty string match only at the first matching position, that is, at the start of the - subject plus the starting offset. An empty string match later in the - subject is permitted. If the pattern is anchored, such a match can + subject plus the starting offset. An empty string match later in the + subject is permitted. If the pattern is anchored, such a match can occur only if the pattern contains \K. PCRE2_NO_JIT - By default, if a pattern has been successfully processed by - pcre2_jit_compile(), JIT is automatically used when pcre2_match() is - called with options that JIT supports. Setting PCRE2_NO_JIT disables + By default, if a pattern has been successfully processed by + pcre2_jit_compile(), JIT is automatically used when pcre2_match() is + called with options that JIT supports. Setting PCRE2_NO_JIT disables the use of JIT; it forces matching to be done by the interpreter. PCRE2_NO_UTF_CHECK When PCRE2_UTF is set at compile time, the validity of the subject as a - UTF string is checked by default when pcre2_match() is subsequently - called. If a non-zero starting offset is given, the check is applied - only to that part of the subject that could be inspected during match- - ing, and there is a check that the starting offset points to the first - code unit of a character or to the end of the subject. If there are no - lookbehind assertions in the pattern, the check starts at the starting - offset. Otherwise, it starts at the length of the longest lookbehind + UTF string is checked by default when pcre2_match() is subsequently + called. If a non-zero starting offset is given, the check is applied + only to that part of the subject that could be inspected during match- + ing, and there is a check that the starting offset points to the first + code unit of a character or to the end of the subject. If there are no + lookbehind assertions in the pattern, the check starts at the starting + offset. Otherwise, it starts at the length of the longest lookbehind before the starting offset, or at the start of the subject if there are - not that many characters before the starting offset. Note that the + not that many characters before the starting offset. Note that the sequences \b and \B are one-character lookbehinds. The check is carried out before any other processing takes place, and a - negative error code is returned if the check fails. There are several - UTF error codes for each code unit width, corresponding to different - problems with the code unit sequence. There are discussions about the - validity of UTF-8 strings, UTF-16 strings, and UTF-32 strings in the + negative error code is returned if the check fails. There are several + UTF error codes for each code unit width, corresponding to different + problems with the code unit sequence. There are discussions about the + validity of UTF-8 strings, UTF-16 strings, and UTF-32 strings in the pcre2unicode page. - If you know that your subject is valid, and you want to skip these - checks for performance reasons, you can set the PCRE2_NO_UTF_CHECK - option when calling pcre2_match(). You might want to do this for the + If you know that your subject is valid, and you want to skip these + checks for performance reasons, you can set the PCRE2_NO_UTF_CHECK + option when calling pcre2_match(). You might want to do this for the second and subsequent calls to pcre2_match() if you are making repeated calls to find other matches in the same subject string. - Warning: When PCRE2_NO_UTF_CHECK is set, the effect of passing an - invalid string as a subject, or an invalid value of startoffset, is + Warning: When PCRE2_NO_UTF_CHECK is set, the effect of passing an + invalid string as a subject, or an invalid value of startoffset, is undefined. Your program may crash or loop indefinitely. PCRE2_PARTIAL_HARD PCRE2_PARTIAL_SOFT - These options turn on the partial matching feature. A partial match - occurs if the end of the subject string is reached successfully, but - there are not enough subject characters to complete the match. If this - happens when PCRE2_PARTIAL_SOFT (but not PCRE2_PARTIAL_HARD) is set, - matching continues by testing any remaining alternatives. Only if no - complete match can be found is PCRE2_ERROR_PARTIAL returned instead of - PCRE2_ERROR_NOMATCH. In other words, PCRE2_PARTIAL_SOFT specifies that - the caller is prepared to handle a partial match, but only if no com- + These options turn on the partial matching feature. A partial match + occurs if the end of the subject string is reached successfully, but + there are not enough subject characters to complete the match. If this + happens when PCRE2_PARTIAL_SOFT (but not PCRE2_PARTIAL_HARD) is set, + matching continues by testing any remaining alternatives. Only if no + complete match can be found is PCRE2_ERROR_PARTIAL returned instead of + PCRE2_ERROR_NOMATCH. In other words, PCRE2_PARTIAL_SOFT specifies that + the caller is prepared to handle a partial match, but only if no com- plete match can be found. - If PCRE2_PARTIAL_HARD is set, it overrides PCRE2_PARTIAL_SOFT. In this - case, if a partial match is found, pcre2_match() immediately returns - PCRE2_ERROR_PARTIAL, without considering any other alternatives. In + If PCRE2_PARTIAL_HARD is set, it overrides PCRE2_PARTIAL_SOFT. In this + case, if a partial match is found, pcre2_match() immediately returns + PCRE2_ERROR_PARTIAL, without considering any other alternatives. In other words, when PCRE2_PARTIAL_HARD is set, a partial match is consid- ered to be more important that an alternative complete match. @@ -2643,38 +2644,38 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION NEWLINE HANDLING WHEN MATCHING - When PCRE2 is built, a default newline convention is set; this is usu- - ally the standard convention for the operating system. The default can - be overridden in a compile context by calling pcre2_set_newline(). It - can also be overridden by starting a pattern string with, for example, - (*CRLF), as described in the section on newline conventions in the - pcre2pattern page. During matching, the newline choice affects the be- - haviour of the dot, circumflex, and dollar metacharacters. It may also - alter the way the match starting position is advanced after a match + When PCRE2 is built, a default newline convention is set; this is usu- + ally the standard convention for the operating system. The default can + be overridden in a compile context by calling pcre2_set_newline(). It + can also be overridden by starting a pattern string with, for example, + (*CRLF), as described in the section on newline conventions in the + pcre2pattern page. During matching, the newline choice affects the be- + haviour of the dot, circumflex, and dollar metacharacters. It may also + alter the way the match starting position is advanced after a match failure for an unanchored pattern. When PCRE2_NEWLINE_CRLF, PCRE2_NEWLINE_ANYCRLF, or PCRE2_NEWLINE_ANY is - set as the newline convention, and a match attempt for an unanchored + set as the newline convention, and a match attempt for an unanchored pattern fails when the current starting position is at a CRLF sequence, - and the pattern contains no explicit matches for CR or LF characters, - the match position is advanced by two characters instead of one, in + and the pattern contains no explicit matches for CR or LF characters, + the match position is advanced by two characters instead of one, in other words, to after the CRLF. The above rule is a compromise that makes the most common cases work as - expected. For example, if the pattern is .+A (and the PCRE2_DOTALL + expected. For example, if the pattern is .+A (and the PCRE2_DOTALL option is not set), it does not match the string "\r\nA" because, after - failing at the start, it skips both the CR and the LF before retrying. - However, the pattern [\r\n]A does match that string, because it con- + failing at the start, it skips both the CR and the LF before retrying. + However, the pattern [\r\n]A does match that string, because it con- tains an explicit CR or LF reference, and so advances only by one char- acter after the first failure. An explicit match for CR of LF is either a literal appearance of one of - those characters in the pattern, or one of the \r or \n or equivalent + those characters in the pattern, or one of the \r or \n or equivalent octal or hexadecimal escape sequences. Implicit matches such as [^X] do - not count, nor does \s, even though it includes CR and LF in the char- + not count, nor does \s, even though it includes CR and LF in the char- acters that it matches. - Notwithstanding the above, anomalous effects may still occur when CRLF + Notwithstanding the above, anomalous effects may still occur when CRLF is a valid newline sequence and explicit \r or \n escapes appear in the pattern. @@ -2685,82 +2686,82 @@ HOW PCRE2_MATCH() RETURNS A STRING AND CAPTURED SUBSTRINGS PCRE2_SIZE *pcre2_get_ovector_pointer(pcre2_match_data *match_data); - In general, a pattern matches a certain portion of the subject, and in - addition, further substrings from the subject may be picked out by - parenthesized parts of the pattern. Following the usage in Jeffrey - Friedl's book, this is called "capturing" in what follows, and the - phrase "capturing subpattern" or "capturing group" is used for a frag- - ment of a pattern that picks out a substring. PCRE2 supports several - other kinds of parenthesized subpattern that do not cause substrings to - be captured. The pcre2_pattern_info() function can be used to find out - how many capturing subpatterns there are in a compiled pattern. + In general, a pattern matches a certain portion of the subject, and in + addition, further substrings from the subject may be picked out by + parenthesized parts of the pattern. Following the usage in Jeffrey + Friedl's book, this is called "capturing" in what follows, and the + phrase "capture group" (Perl terminology) is used for a fragment of a + pattern that picks out a substring. PCRE2 supports several other kinds + of parenthesized group that do not cause substrings to be captured. The + pcre2_pattern_info() function can be used to find out how many capture + groups there are in a compiled pattern. - You can use auxiliary functions for accessing captured substrings by + You can use auxiliary functions for accessing captured substrings by number or by name, as described in sections below. Alternatively, you can make direct use of the vector of PCRE2_SIZE val- - ues, called the ovector, which contains the offsets of captured - strings. It is part of the match data block. The function - pcre2_get_ovector_pointer() returns the address of the ovector, and + ues, called the ovector, which contains the offsets of captured + strings. It is part of the match data block. The function + pcre2_get_ovector_pointer() returns the address of the ovector, and pcre2_get_ovector_count() returns the number of pairs of values it con- tains. Within the ovector, the first in each pair of values is set to the off- set of the first code unit of a substring, and the second is set to the - offset of the first code unit after the end of a substring. These val- - ues are always code unit offsets, not character offsets. That is, they - are byte offsets in the 8-bit library, 16-bit offsets in the 16-bit + offset of the first code unit after the end of a substring. These val- + ues are always code unit offsets, not character offsets. That is, they + are byte offsets in the 8-bit library, 16-bit offsets in the 16-bit library, and 32-bit offsets in the 32-bit library. - After a partial match (error return PCRE2_ERROR_PARTIAL), only the - first pair of offsets (that is, ovector[0] and ovector[1]) are set. - They identify the part of the subject that was partially matched. See + After a partial match (error return PCRE2_ERROR_PARTIAL), only the + first pair of offsets (that is, ovector[0] and ovector[1]) are set. + They identify the part of the subject that was partially matched. See the pcre2partial documentation for details of partial matching. - After a fully successful match, the first pair of offsets identifies - the portion of the subject string that was matched by the entire pat- - tern. The next pair is used for the first captured substring, and so - on. The value returned by pcre2_match() is one more than the highest - numbered pair that has been set. For example, if two substrings have - been captured, the returned value is 3. If there are no captured sub- + After a fully successful match, the first pair of offsets identifies + the portion of the subject string that was matched by the entire pat- + tern. The next pair is used for the first captured substring, and so + on. The value returned by pcre2_match() is one more than the highest + numbered pair that has been set. For example, if two substrings have + been captured, the returned value is 3. If there are no captured sub- strings, the return value from a successful match is 1, indicating that just the first pair of offsets has been set. - If a pattern uses the \K escape sequence within a positive assertion, + If a pattern uses the \K escape sequence within a positive assertion, the reported start of a successful match can be greater than the end of - the match. For example, if the pattern (?=ab\K) is matched against + the match. For example, if the pattern (?=ab\K) is matched against "ab", the start and end offset values for the match are 2 and 0. - If a capturing subpattern group is matched repeatedly within a single - match operation, it is the last portion of the subject that it matched - that is returned. + If a capture group is matched repeatedly within a single match opera- + tion, it is the last portion of the subject that it matched that is + returned. If the ovector is too small to hold all the captured substring offsets, - as much as possible is filled in, and the function returns a value of - zero. If captured substrings are not of interest, pcre2_match() may be + as much as possible is filled in, and the function returns a value of + zero. If captured substrings are not of interest, pcre2_match() may be called with a match data block whose ovector is of minimum length (that is, one pair). - It is possible for 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) the - return from the function is 4, and subpatterns 1 and 3 are matched, but - 2 is not. When this happens, both values in the offset pairs corre- - sponding to unused subpatterns are set to PCRE2_UNSET. + It is possible for capture group number n+1 to match some part of the + subject when group n has not been used at all. For example, if the + string "abc" is matched against the pattern (a|(z))(bc) the return from + the function is 4, and groups 1 and 3 are matched, but 2 is not. When + this happens, both values in the offset pairs corresponding to unused + groups are set to PCRE2_UNSET. - Offset values that correspond to unused subpatterns at the end of the - expression are also set to PCRE2_UNSET. For example, if the string - "abc" is matched against the pattern (abc)(x(yz)?)? subpatterns 2 and 3 - are not matched. The return from the function is 2, because the high- - est used capturing subpattern number is 1. The offsets for for the sec- - ond and third capturing subpatterns (assuming the vector is large - enough, of course) are set to PCRE2_UNSET. + Offset values that correspond to unused groups at the end of the + expression are also set to PCRE2_UNSET. For example, if the string + "abc" is matched against the pattern (abc)(x(yz)?)? groups 2 and 3 are + not matched. The return from the function is 2, because the highest + used capture group number is 1. The offsets for for the second and + third capture groupss (assuming the vector is large enough, of course) + are set to PCRE2_UNSET. Elements in the ovector that do not correspond to capturing parentheses in the pattern are never changed. That is, if a pattern contains n cap- turing parentheses, no more than ovector[0] to ovector[2n+1] are set by - pcre2_match(). The other elements retain whatever values they previ- - ously had. After a failed match attempt, the contents of the ovector + pcre2_match(). The other elements retain whatever values they previ- + ously had. After a failed match attempt, the contents of the ovector are unchanged. @@ -2770,69 +2771,69 @@ OTHER INFORMATION ABOUT A MATCH PCRE2_SIZE pcre2_get_startchar(pcre2_match_data *match_data); - As well as the offsets in the ovector, other information about a match - is retained in the match data block and can be retrieved by the above - functions in appropriate circumstances. If they are called at other + As well as the offsets in the ovector, other information about a match + is retained in the match data block and can be retrieved by the above + functions in appropriate circumstances. If they are called at other times, the result is undefined. - After a successful match, a partial match (PCRE2_ERROR_PARTIAL), or a - failure to match (PCRE2_ERROR_NOMATCH), a mark name may be available. - The function pcre2_get_mark() can be called to access this name, which - can be specified in the pattern by any of the backtracking control + After a successful match, a partial match (PCRE2_ERROR_PARTIAL), or a + failure to match (PCRE2_ERROR_NOMATCH), a mark name may be available. + The function pcre2_get_mark() can be called to access this name, which + can be specified in the pattern by any of the backtracking control verbs, not just (*MARK). The same function applies to all the verbs. It returns a pointer to the zero-terminated name, which is within the com- piled pattern. If no name is available, NULL is returned. The length of - the name (excluding the terminating zero) is stored in the code unit - that precedes the name. You should use this length instead of relying + the name (excluding the terminating zero) is stored in the code unit + that precedes the name. You should use this length instead of relying on the terminating zero if the name might contain a binary zero. - After a successful match, the name that is returned is the last mark + After a successful match, the name that is returned is the last mark name encountered on the matching path through the pattern. Instances of - backtracking verbs without names do not count. Thus, for example, if + backtracking verbs without names do not count. Thus, for example, if the matching path contains (*MARK:A)(*PRUNE), the name "A" is returned. - After a "no match" or a partial match, the last encountered name is + After a "no match" or a partial match, the last encountered name is returned. For example, consider this pattern: ^(*MARK:A)((*MARK:B)a|b)c - When it matches "bc", the returned name is A. The B mark is "seen" in - the first branch of the group, but it is not on the matching path. On - the other hand, when this pattern fails to match "bx", the returned + When it matches "bc", the returned name is A. The B mark is "seen" in + the first branch of the group, but it is not on the matching path. On + the other hand, when this pattern fails to match "bx", the returned name is B. - Warning: By default, certain start-of-match optimizations are used to - give a fast "no match" result in some situations. For example, if the - anchoring is removed from the pattern above, there is an initial check - for the presence of "c" in the subject before running the matching + Warning: By default, certain start-of-match optimizations are used to + give a fast "no match" result in some situations. For example, if the + anchoring is removed from the pattern above, there is an initial check + for the presence of "c" in the subject before running the matching engine. This check fails for "bx", causing a match failure without see- ing any marks. You can disable the start-of-match optimizations by set- - ting the PCRE2_NO_START_OPTIMIZE option for pcre2_compile() or by + ting the PCRE2_NO_START_OPTIMIZE option for pcre2_compile() or by starting the pattern with (*NO_START_OPT). - After a successful match, a partial match, or one of the invalid UTF - errors (for example, PCRE2_ERROR_UTF8_ERR5), pcre2_get_startchar() can + After a successful match, a partial match, or one of the invalid UTF + errors (for example, PCRE2_ERROR_UTF8_ERR5), pcre2_get_startchar() can be called. After a successful or partial match it returns the code unit - offset of the character at which the match started. For a non-partial - match, this can be different to the value of ovector[0] if the pattern - contains the \K escape sequence. After a partial match, however, this - value is always the same as ovector[0] because \K does not affect the + offset of the character at which the match started. For a non-partial + match, this can be different to the value of ovector[0] if the pattern + contains the \K escape sequence. After a partial match, however, this + value is always the same as ovector[0] because \K does not affect the result of a partial match. - After a UTF check failure, pcre2_get_startchar() can be used to obtain + After a UTF check failure, pcre2_get_startchar() can be used to obtain the code unit offset of the invalid UTF character. Details are given in the pcre2unicode page. ERROR RETURNS FROM pcre2_match() - If pcre2_match() fails, it returns a negative number. This can be con- - verted to a text string by calling the pcre2_get_error_message() func- - tion (see "Obtaining a textual error message" below). Negative error - codes are also returned by other functions, and are documented with - them. The codes are given names in the header file. If UTF checking is + If pcre2_match() fails, it returns a negative number. This can be con- + verted to a text string by calling the pcre2_get_error_message() func- + tion (see "Obtaining a textual error message" below). Negative error + codes are also returned by other functions, and are documented with + them. The codes are given names in the header file. If UTF checking is in force and an invalid UTF subject string is detected, one of a number - of UTF-specific negative error codes is returned. Details are given in - the pcre2unicode page. The following are the other errors that may be + of UTF-specific negative error codes is returned. Details are given in + the pcre2unicode page. The following are the other errors that may be returned by pcre2_match(): PCRE2_ERROR_NOMATCH @@ -2841,20 +2842,20 @@ ERROR RETURNS FROM pcre2_match() PCRE2_ERROR_PARTIAL - 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 pcre2partial documentation for details of partial matching. PCRE2_ERROR_BADMAGIC PCRE2 stores a 4-byte "magic number" at the start of the compiled code, - to catch the case when it is passed a junk pointer. This is the error + to catch the case when it is passed a junk pointer. This is the error that is returned when the magic number is not present. PCRE2_ERROR_BADMODE - This error is given when a compiled pattern is passed to a function in - a library of a different code unit width, for example, a pattern com- - piled by the 8-bit library is passed to a 16-bit or 32-bit library + This error is given when a compiled pattern is passed to a function in + a library of a different code unit width, for example, a pattern com- + piled by the 8-bit library is passed to a 16-bit or 32-bit library function. PCRE2_ERROR_BADOFFSET @@ -2868,15 +2869,15 @@ ERROR RETURNS FROM pcre2_match() PCRE2_ERROR_BADUTFOFFSET The UTF code unit sequence that was passed as a subject was checked and - found to be valid (the PCRE2_NO_UTF_CHECK option was not set), but the - value of startoffset did not point to the beginning of a UTF character + found to be valid (the PCRE2_NO_UTF_CHECK option was not set), but the + value of startoffset did not point to the beginning of a UTF character or the end of the subject. PCRE2_ERROR_CALLOUT - This error is never generated by pcre2_match() itself. It is provided - for use by callout functions that want to cause pcre2_match() or - pcre2_callout_enumerate() to return a distinctive error code. See the + This error is never generated by pcre2_match() itself. It is provided + for use by callout functions that want to cause pcre2_match() or + pcre2_callout_enumerate() to return a distinctive error code. See the pcre2callout documentation for details. PCRE2_ERROR_DEPTHLIMIT @@ -2889,14 +2890,14 @@ ERROR RETURNS FROM pcre2_match() PCRE2_ERROR_INTERNAL - 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 PCRE2 or by overwriting of the compiled pattern. PCRE2_ERROR_JIT_STACKLIMIT - This error is returned when a pattern that was successfully studied - using JIT is being matched, but the memory available for the just-in- - time processing stack is not large enough. See the pcre2jit documenta- + This error is returned when a pattern that was successfully studied + using JIT is being matched, but the memory available for the just-in- + time processing stack is not large enough. See the pcre2jit documenta- tion for more details. PCRE2_ERROR_MATCHLIMIT @@ -2905,11 +2906,11 @@ ERROR RETURNS FROM pcre2_match() PCRE2_ERROR_NOMEMORY - If a pattern contains many nested backtracking points, heap memory is - used to remember them. This error is given when the memory allocation - function (default or custom) fails. Note that a different error, - PCRE2_ERROR_HEAPLIMIT, is given if the amount of memory needed exceeds - the heap limit. PCRE2_ERROR_NOMEMORY is also returned if + If a pattern contains many nested backtracking points, heap memory is + used to remember them. This error is given when the memory allocation + function (default or custom) fails. Note that a different error, + PCRE2_ERROR_HEAPLIMIT, is given if the amount of memory needed exceeds + the heap limit. PCRE2_ERROR_NOMEMORY is also returned if PCRE2_COPY_MATCHED_SUBJECT is set and memory allocation fails. PCRE2_ERROR_NULL @@ -2918,13 +2919,13 @@ ERROR RETURNS FROM pcre2_match() PCRE2_ERROR_RECURSELOOP - This error is returned when pcre2_match() detects a recursion loop - within the pattern. Specifically, it means that either the whole pat- - tern or a subpattern has been called recursively for the second time at - the same position in the subject string. Some simple patterns that - might do this are detected and faulted at compile time, but more com- - plicated cases, in particular mutual recursions between two different - subpatterns, cannot be detected until matching is attempted. + This error is returned when pcre2_match() detects a recursion loop + within the pattern. Specifically, it means that either the whole pat- + tern or a capture group has been called recursively for the second time + at the same position in the subject string. Some simple patterns that + might do this are detected and faulted at compile time, but more com- + plicated cases, in particular mutual recursions between two different + groups, cannot be detected until matching is attempted. OBTAINING A TEXTUAL ERROR MESSAGE @@ -2932,20 +2933,20 @@ OBTAINING A TEXTUAL ERROR MESSAGE int pcre2_get_error_message(int errorcode, PCRE2_UCHAR *buffer, PCRE2_SIZE bufflen); - A text message for an error code from any PCRE2 function (compile, - match, or auxiliary) can be obtained by calling pcre2_get_error_mes- - sage(). The code is passed as the first argument, with the remaining - two arguments specifying a code unit buffer and its length in code - units, into which the text message is placed. The message is returned - in code units of the appropriate width for the library that is being + A text message for an error code from any PCRE2 function (compile, + match, or auxiliary) can be obtained by calling pcre2_get_error_mes- + sage(). The code is passed as the first argument, with the remaining + two arguments specifying a code unit buffer and its length in code + units, into which the text message is placed. The message is returned + in code units of the appropriate width for the library that is being used. - The returned message is terminated with a trailing zero, and the func- - tion returns the number of code units used, excluding the trailing + The returned message is terminated with a trailing zero, and the func- + tion returns the number of code units used, excluding the trailing zero. If the error number is unknown, the negative error code - PCRE2_ERROR_BADDATA is returned. If the buffer is too small, the mes- - sage is truncated (but still with a trailing zero), and the negative - error code PCRE2_ERROR_NOMEMORY is returned. None of the messages are + PCRE2_ERROR_BADDATA is returned. If the buffer is too small, the mes- + sage is truncated (but still with a trailing zero), and the negative + error code PCRE2_ERROR_NOMEMORY is returned. None of the messages are very long; a buffer size of 120 code units is ample. @@ -2964,40 +2965,40 @@ EXTRACTING CAPTURED SUBSTRINGS BY NUMBER void pcre2_substring_free(PCRE2_UCHAR *buffer); - Captured substrings can be accessed directly by using the ovector as + Captured substrings can be accessed directly by using the ovector as described above. For convenience, auxiliary functions are provided for - extracting captured substrings as new, separate, zero-terminated + extracting captured substrings as new, separate, zero-terminated strings. 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 + and has a further zero added on the end, but the result is not, of course, a C string. The functions in this section identify substrings by number. The number zero refers to the entire matched substring, with higher numbers refer- - ring to substrings captured by parenthesized groups. After a partial - match, only substring zero is available. An attempt to extract any - other substring gives the error PCRE2_ERROR_PARTIAL. The next section + ring to substrings captured by parenthesized groups. After a partial + match, only substring zero is available. An attempt to extract any + other substring gives the error PCRE2_ERROR_PARTIAL. The next section describes similar functions for extracting captured substrings by name. - If a pattern uses the \K escape sequence within a positive assertion, + If a pattern uses the \K escape sequence within a positive assertion, the reported start of a successful match can be greater than the end of - the match. For example, if the pattern (?=ab\K) is matched against - "ab", the start and end offset values for the match are 2 and 0. In - this situation, calling these functions with a zero substring number + the match. For example, if the pattern (?=ab\K) is matched against + "ab", the start and end offset values for the match are 2 and 0. In + this situation, calling these functions with a zero substring number extracts a zero-length empty string. - You can find the length in code units of a captured substring without - extracting it by calling pcre2_substring_length_bynumber(). The first - argument is a pointer to the match data block, the second is the group - number, and the third is a pointer to a variable into which the length - is placed. If you just want to know whether or not the substring has + You can find the length in code units of a captured substring without + extracting it by calling pcre2_substring_length_bynumber(). The first + argument is a pointer to the match data block, the second is the group + number, and the third is a pointer to a variable into which the length + is placed. If you just want to know whether or not the substring has been captured, you can pass the third argument as NULL. - The pcre2_substring_copy_bynumber() function copies a captured sub- - string into a supplied buffer, whereas pcre2_substring_get_bynumber() - copies it into new memory, obtained using the same memory allocation - function that was used for the match data block. The first two argu- - ments of these functions are a pointer to the match data block and a - capturing group number. + The pcre2_substring_copy_bynumber() function copies a captured sub- + string into a supplied buffer, whereas pcre2_substring_get_bynumber() + copies it into new memory, obtained using the same memory allocation + function that was used for the match data block. The first two argu- + ments of these functions are a pointer to the match data block and a + capture group number. The final arguments of pcre2_substring_copy_bynumber() are a pointer to the buffer and a pointer to a variable that contains its length in code @@ -3005,25 +3006,25 @@ EXTRACTING CAPTURED SUBSTRINGS BY NUMBER for the extracted substring, excluding the terminating zero. For pcre2_substring_get_bynumber() the third and fourth arguments point - to variables that are updated with a pointer to the new memory and the - number of code units that comprise the substring, again excluding the - terminating zero. When the substring is no longer needed, the memory + to variables that are updated with a pointer to the new memory and the + number of code units that comprise the substring, again excluding the + terminating zero. When the substring is no longer needed, the memory should be freed by calling pcre2_substring_free(). - The return value from all these functions is zero for success, or a - negative error code. If the pattern match failed, the match failure - code is returned. If a substring number greater than zero is used - after a partial match, PCRE2_ERROR_PARTIAL is returned. Other possible + The return value from all these functions is zero for success, or a + negative error code. If the pattern match failed, the match failure + code is returned. If a substring number greater than zero is used + after a partial match, PCRE2_ERROR_PARTIAL is returned. Other possible error codes are: PCRE2_ERROR_NOMEMORY - The buffer was too small for pcre2_substring_copy_bynumber(), or the + The buffer was too small for pcre2_substring_copy_bynumber(), or the attempt to get memory failed for pcre2_substring_get_bynumber(). PCRE2_ERROR_NOSUBSTRING - There is no substring with that number in the pattern, that is, the + There is no substring with that number in the pattern, that is, the number is greater than the number of capturing parentheses. PCRE2_ERROR_UNAVAILABLE @@ -3034,8 +3035,8 @@ EXTRACTING CAPTURED SUBSTRINGS BY NUMBER PCRE2_ERROR_UNSET - The substring did not participate in the match. For example, if the - pattern is (abc)|(def) and the subject is "def", and the ovector con- + The substring did not participate in the match. For example, if the + pattern is (abc)|(def) and the subject is "def", and the ovector con- tains at least two capturing slots, substring number 1 is unset. @@ -3046,33 +3047,32 @@ EXTRACTING A LIST OF ALL CAPTURED SUBSTRINGS void pcre2_substring_list_free(PCRE2_SPTR *list); - The pcre2_substring_list_get() function extracts all available sub- - strings and builds a list of pointers to them. It also (optionally) - builds a second list that contains their lengths (in code units), + The pcre2_substring_list_get() function extracts all available sub- + strings and builds a list of pointers to them. It also (optionally) + builds a second list that contains their lengths (in code units), excluding a terminating zero that is added to each of them. All this is done in a single block of memory that is obtained using the same memory allocation function that was used to get the match data block. - This function must be called only after a successful match. If called + This function must be called only after a successful match. If called after a partial match, the error code PCRE2_ERROR_PARTIAL is returned. - The address of the memory block is returned via listptr, which is also + 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 pointer. The address of the list of lengths is returned via - lengthsptr. If your strings do not contain binary zeros and you do not + by a NULL pointer. The address of the list of lengths is returned via + lengthsptr. If your strings do not contain binary zeros and you do not therefore need the lengths, you may supply NULL as the lengthsptr argu- - ment to disable the creation of a list of lengths. The yield of the - function is zero if all went well, or PCRE2_ERROR_NOMEMORY if the mem- - ory block could not be obtained. When the list is no longer needed, it + ment to disable the creation of a list of lengths. The yield of the + function is zero if all went well, or PCRE2_ERROR_NOMEMORY if the mem- + ory block could not be obtained. When the list is no longer needed, it should be freed by calling pcre2_substring_list_free(). If this function encounters 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, it returns an empty string. - This can be distinguished from a genuine zero-length substring by - inspecting the appropriate offset in the ovector, which contain - PCRE2_UNSET for unset substrings, or by calling pcre2_sub- - string_length_bynumber(). + when capture group number n+1 matches some part of the subject, but + group n has not been used at all, it returns an empty string. This can + be distinguished from a genuine zero-length substring by inspecting the + appropriate offset in the ovector, which contain PCRE2_UNSET for unset + substrings, or by calling pcre2_substring_length_bynumber(). EXTRACTING CAPTURED SUBSTRINGS BY NAME @@ -3096,34 +3096,35 @@ EXTRACTING CAPTURED SUBSTRINGS BY NAME (a+)b(?\d+)... - the number of the subpattern called "xxx" is 2. If the name is known to - be unique (PCRE2_DUPNAMES was not set), you can find the number from + the number of the capture group called "xxx" is 2. If the name is known + to be unique (PCRE2_DUPNAMES was not set), you can find the number from the name by calling pcre2_substring_number_from_name(). The first argu- ment is the compiled pattern, and the second is the name. The yield of - the function is the subpattern number, PCRE2_ERROR_NOSUBSTRING if there - is no subpattern of that name, or PCRE2_ERROR_NOUNIQUESUBSTRING if - there is more than one subpattern of that name. Given the number, you - can extract the substring directly from the ovector, or use one of the - "bynumber" functions described above. + the function is the group number, PCRE2_ERROR_NOSUBSTRING if there is + no group with that name, or PCRE2_ERROR_NOUNIQUESUBSTRING if there is + more than one group with that name. Given the number, you can extract + the substring directly from the ovector, or use one of the "bynumber" + functions described above. For convenience, there are also "byname" functions that correspond to the "bynumber" functions, the only difference being that the second argument is a name instead of a number. If PCRE2_DUPNAMES is set and there are duplicate names, these functions scan all the groups with the - given name, and return the first named string that is set. + given name, and return the captured substring from the first named + group that is set. - If there are no groups with the given name, PCRE2_ERROR_NOSUBSTRING is - returned. If all groups with the name have numbers that are greater - than the number of slots in the ovector, PCRE2_ERROR_UNAVAILABLE is - returned. If there is at least one group with a slot in the ovector, + If there are no groups with the given name, PCRE2_ERROR_NOSUBSTRING is + returned. If all groups with the name have numbers that are greater + than the number of slots in the ovector, PCRE2_ERROR_UNAVAILABLE is + returned. If there is at least one group with a slot in the ovector, but no group is found to be set, PCRE2_ERROR_UNSET is returned. - Warning: If the pattern uses the (?| feature to set up multiple subpat- - terns with the same number, as described in the section on duplicate - subpattern numbers in the pcre2pattern page, you cannot use names to - distinguish the different subpatterns, because names are not included - in the compiled code. The matching process uses only numbers. For this - reason, the use of different names for subpatterns of the same number + Warning: If the pattern uses the (?| feature to set up multiple capture + groups with the same number, as described in the section on duplicate + group numbers in the pcre2pattern page, you cannot use names to distin- + guish the different capture groups, because names are not included in + the compiled code. The matching process uses only numbers. For this + reason, the use of different names for groups with the same number causes an error at compile time. @@ -3136,91 +3137,91 @@ CREATING A NEW STRING WITH SUBSTITUTIONS PCRE2_SIZE rlength, PCRE2_UCHAR *outputbuffer, PCRE2_SIZE *outlengthptr); - This function calls pcre2_match() and then makes a copy of the subject - string in outputbuffer, replacing one or more parts that were matched + This function calls pcre2_match() and then makes a copy of the subject + string in outputbuffer, replacing one or more parts that were matched with the replacement string, whose length is supplied in rlength. This - can be given as PCRE2_ZERO_TERMINATED for a zero-terminated string. - The default is to perform just one replacement, but there is an option - that requests multiple replacements (see PCRE2_SUBSTITUTE_GLOBAL below + can be given as PCRE2_ZERO_TERMINATED for a zero-terminated string. + The default is to perform just one replacement, but there is an option + that requests multiple replacements (see PCRE2_SUBSTITUTE_GLOBAL below for details). - Matches in which a \K item in a lookahead in the pattern causes the - match to end before it starts are not supported, and give rise to an + Matches in which a \K item in a lookahead in the pattern causes the + match to end before it starts are not supported, and give rise to an error return. For global replacements, matches in which \K in a lookbe- - hind causes the match to start earlier than the point that was reached + hind causes the match to start earlier than the point that was reached in the previous iteration are also not supported. - The first seven arguments of pcre2_substitute() are the same as for + The first seven arguments of pcre2_substitute() are the same as for pcre2_match(), except that the partial matching options are not permit- - ted, and match_data may be passed as NULL, in which case a match data - block is obtained and freed within this function, using memory manage- - ment functions from the match context, if provided, or else those that + ted, and match_data may be passed as NULL, in which case a match data + block is obtained and freed within this function, using memory manage- + ment functions from the match context, if provided, or else those that were used to allocate memory for the compiled code. - If an external match_data block is provided, its contents afterwards - are those set by the final call to pcre2_match(). For global changes, - this will have ended in a matching error. The contents of the ovector + If an external match_data block is provided, its contents afterwards + are those set by the final call to pcre2_match(). For global changes, + this will have ended in a matching error. The contents of the ovector within the match data block may or may not have been changed. - The outlengthptr argument must point to a variable that contains the - length, in code units, of the output buffer. If the function is suc- - cessful, the value is updated to contain the length of the new string, + The outlengthptr argument must point to a variable that contains the + length, in code units, of the output buffer. If the function is suc- + cessful, the value is updated to contain the length of the new string, excluding the trailing zero that is automatically added. - If the function is not successful, the value set via outlengthptr - depends on the type of error. For syntax errors in the replacement - string, the value is the offset in the replacement string where the - error was detected. For other errors, the value is PCRE2_UNSET by - default. This includes the case of the output buffer being too small, - unless PCRE2_SUBSTITUTE_OVERFLOW_LENGTH is set (see below), in which - case the value is the minimum length needed, including space for the - trailing zero. Note that in order to compute the required length, - pcre2_substitute() has to simulate all the matching and copying, + If the function is not successful, the value set via outlengthptr + depends on the type of error. For syntax errors in the replacement + string, the value is the offset in the replacement string where the + error was detected. For other errors, the value is PCRE2_UNSET by + default. This includes the case of the output buffer being too small, + unless PCRE2_SUBSTITUTE_OVERFLOW_LENGTH is set (see below), in which + case the value is the minimum length needed, including space for the + trailing zero. Note that in order to compute the required length, + pcre2_substitute() has to simulate all the matching and copying, instead of giving an error return as soon as the buffer overflows. Note also that the length is in code units, not bytes. - In the replacement string, which is interpreted as a UTF string in UTF - mode, and is checked for UTF validity unless the PCRE2_NO_UTF_CHECK + In the replacement string, which is interpreted as a UTF string in UTF + mode, and is checked for UTF validity unless the PCRE2_NO_UTF_CHECK option is set, a dollar character is an escape character that can spec- - ify the insertion of characters from capturing groups or names from - (*MARK) or other control verbs in the pattern. The following forms are + ify the insertion of characters from capture groups or names from + (*MARK) or other control verbs in the pattern. The following forms are always recognized: $$ insert a dollar character $ or ${} insert the contents of group $*MARK or ${*MARK} insert a control verb name - Either a group number or a group name can be given for . Curly - brackets are required only if the following character would be inter- + Either a group number or a group name can be given for . Curly + brackets are required only if the following character would be inter- preted as part of the number or name. The number may be zero to include - the entire matched string. For example, if the pattern a(b)c is - matched with "=abc=" and the replacement string "+$1$0$1+", the result + the entire matched string. For example, if the pattern a(b)c is + matched with "=abc=" and the replacement string "+$1$0$1+", the result is "=+babcb+=". - $*MARK inserts the name from the last encountered backtracking control - verb on the matching path that has a name. (*MARK) must always include - a name, but the other verbs need not. For example, in the case of + $*MARK inserts the name from the last encountered backtracking control + verb on the matching path that has a name. (*MARK) must always include + a name, but the other verbs need not. For example, in the case of (*MARK:A)(*PRUNE) the name inserted is "A", but for (*MARK:A)(*PRUNE:B) - the relevant name is "B". This facility can be used to perform simple + the relevant name is "B". This facility can be used to perform simple simultaneous substitutions, as this pcre2test example shows: /(*MARK:pear)apple|(*MARK:orange)lemon/g,replace=${*MARK} apple lemon 2: pear orange - As well as the usual options for pcre2_match(), a number of additional + As well as the usual options for pcre2_match(), a number of additional options can be set in the options argument of pcre2_substitute(). PCRE2_SUBSTITUTE_GLOBAL causes the function to iterate over the subject - string, replacing every matching substring. If this option is not set, - only the first matching substring is replaced. The search for matches - takes place in the original subject string (that is, previous replace- - ments do not affect it). Iteration is implemented by advancing the - startoffset value for each search, which is always passed the entire + string, replacing every matching substring. If this option is not set, + only the first matching substring is replaced. The search for matches + takes place in the original subject string (that is, previous replace- + ments do not affect it). Iteration is implemented by advancing the + startoffset value for each search, which is always passed the entire subject string. If an offset limit is set in the match context, search- ing stops when that limit is reached. - You can restrict the effect of a global substitution to a portion of + You can restrict the effect of a global substitution to a portion of the subject string by setting either or both of startoffset and an off- set limit. Here is a pcre2test example: @@ -3228,36 +3229,35 @@ CREATING A NEW STRING WITH SUBSTITUTIONS ABC ABC ABC ABC\=offset=3,offset_limit=12 2: ABC A!C A!C ABC - When continuing with global substitutions after matching a substring + When continuing with global substitutions after matching a substring with zero length, an attempt to find a non-empty match at the same off- set is performed. If this is not successful, the offset is advanced by one character except when CRLF is a valid newline sequence and the next - two characters are CR, LF. In this case, the offset is advanced by two + two characters are CR, LF. In this case, the offset is advanced by two characters. - PCRE2_SUBSTITUTE_OVERFLOW_LENGTH changes what happens when the output + PCRE2_SUBSTITUTE_OVERFLOW_LENGTH changes what happens when the output buffer is too small. The default action is to return PCRE2_ERROR_NOMEM- - ORY immediately. If this option is set, however, pcre2_substitute() + ORY immediately. If this option is set, however, pcre2_substitute() continues to go through the motions of matching and substituting (with- - out, of course, writing anything) in order to compute the size of buf- - fer that is needed. This value is passed back via the outlengthptr - variable, with the result of the function still being + out, of course, writing anything) in order to compute the size of buf- + fer that is needed. This value is passed back via the outlengthptr + variable, with the result of the function still being PCRE2_ERROR_NOMEMORY. - Passing a buffer size of zero is a permitted way of finding out how - much memory is needed for given substitution. However, this does mean + Passing a buffer size of zero is a permitted way of finding out how + much memory is needed for given substitution. However, this does mean that the entire operation is carried out twice. Depending on the appli- - cation, it may be more efficient to allocate a large buffer and free - the excess afterwards, instead of using PCRE2_SUBSTITUTE_OVER- + cation, it may be more efficient to allocate a large buffer and free + the excess afterwards, instead of using PCRE2_SUBSTITUTE_OVER- FLOW_LENGTH. - PCRE2_SUBSTITUTE_UNKNOWN_UNSET causes references to capturing groups - that do not appear in the pattern to be treated as unset groups. This - option should be used with care, because it means that a typo in a - group name or number no longer causes the PCRE2_ERROR_NOSUBSTRING - error. + PCRE2_SUBSTITUTE_UNKNOWN_UNSET causes references to capture groups that + do not appear in the pattern to be treated as unset groups. This option + should be used with care, because it means that a typo in a group name + or number no longer causes the PCRE2_ERROR_NOSUBSTRING error. - PCRE2_SUBSTITUTE_UNSET_EMPTY causes unset capturing groups (including + PCRE2_SUBSTITUTE_UNSET_EMPTY causes unset capture groups (including unknown groups when PCRE2_SUBSTITUTE_UNKNOWN_UNSET is set) to be treated as empty strings when inserted as described above. If this option is not set, an attempt to insert an unset group causes the @@ -3283,7 +3283,7 @@ CREATING A NEW STRING WITH SUBSTITUTIONS no case forcing. The sequences \u and \l force the next character (if it is a letter) to upper or lower case, respectively, and then the state automatically reverts to no case forcing. Case forcing applies to - all inserted characters, including those from captured groups and let- + all inserted characters, including those from capture groups and let- ters within \Q...\E quoted sequences. Note that case forcing sequences such as \U...\E do not nest. For exam- @@ -3291,8 +3291,8 @@ CREATING A NEW STRING WITH SUBSTITUTIONS \E has no effect. The second effect of setting PCRE2_SUBSTITUTE_EXTENDED is to add more - flexibility to group substitution. The syntax is similar to that used - by Bash: + flexibility to capture group substitution. The syntax is similar to + that used by Bash: ${:-} ${:+:} @@ -3411,20 +3411,20 @@ CREATING A NEW STRING WITH SUBSTITUTIONS ing the number of matches so far. -DUPLICATE SUBPATTERN NAMES +DUPLICATE CAPTURE GROUP NAMES int pcre2_substring_nametable_scan(const pcre2_code *code, PCRE2_SPTR name, PCRE2_SPTR *first, PCRE2_SPTR *last); When a pattern is compiled with the PCRE2_DUPNAMES option, names for - subpatterns are not required to be unique. Duplicate names are always - allowed for subpatterns with the same number, created by using the (?| - feature. Indeed, if such subpatterns are named, they are required to - use the same names. + capture groups are not required to be unique. Duplicate names are + always allowed for groups with the same number, created by using the + (?| feature. Indeed, if such groups are named, they are required to use + the same names. - Normally, patterns with duplicate names are such that in any one match, - only one of the named subpatterns participates. An example is shown in - the pcre2pattern documentation. + Normally, patterns that use duplicate names are such that in any one + match, only one of each set of identically-named groups participates. + An example is shown in the pcre2pattern documentation. When duplicates are present, pcre2_substring_copy_byname() and pcre2_substring_get_byname() return the first substring corresponding @@ -3583,8 +3583,8 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION which is the number of matched substrings. The offsets of the sub- strings are returned in the ovector, and can be extracted by number in the same way as for pcre2_match(), but the numbers bear no relation to - any capturing groups that may exist in the pattern, because DFA match- - ing does not support group capture. + any capture groups that may exist in the pattern, because DFA matching + does not support capturing. Calls to the convenience functions that extract substrings by name return the error PCRE2_ERROR_DFA_UFUNC (unsupported function) if used @@ -3621,7 +3621,7 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION This return is given if pcre2_dfa_match() encounters a condition item that uses a backreference for the condition, or a test for recursion in - a specific group. These are not supported. + a specific capture group. These are not supported. PCRE2_ERROR_DFA_WSSIZE @@ -3630,22 +3630,23 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION PCRE2_ERROR_DFA_RECURSE - When a recursive subpattern is processed, the matching function calls - itself recursively, using private memory for the ovector and workspace. - This error is given if the internal ovector is not large enough. This - should be extremely rare, as a vector of size 1000 is used. + When a recursion or subroutine call is processed, the matching function + calls itself recursively, using private memory for the ovector and + workspace. This error is given if the internal ovector is not large + enough. This should be extremely rare, as a vector of size 1000 is + used. PCRE2_ERROR_DFA_BADRESTART - When pcre2_dfa_match() is called with the PCRE2_DFA_RESTART option, - some plausibility checks are made on the contents of the workspace, - which should contain data about the previous partial match. If any of + When pcre2_dfa_match() is called with the PCRE2_DFA_RESTART option, + some plausibility checks are made on the contents of the workspace, + which should contain data about the previous partial match. If any of these checks fail, this error is given. SEE ALSO - pcre2build(3), pcre2callout(3), pcre2demo(3), pcre2matching(3), + pcre2build(3), pcre2callout(3), pcre2demo(3), pcre2matching(3), pcre2partial(3), pcre2posix(3), pcre2sample(3), pcre2unicode(3). @@ -3658,7 +3659,7 @@ AUTHOR REVISION - Last updated: 04 January 2019 + Last updated: 04 February 2019 Copyright (c) 1997-2019 University of Cambridge. ------------------------------------------------------------------------------ @@ -4362,7 +4363,7 @@ MISSING CALLOUTS all branches are anchorable. This optimization is disabled, however, if .* is in an atomic group or - if there is a backreference to the capturing group in which it appears. + if there is a backreference to the capture group in which it appears. It is also disabled if the pattern contains (*PRUNE) or (*SKIP). How- ever, the presence of callouts does not affect it. @@ -4546,8 +4547,8 @@ THE CALLOUT INTERFACE the length is one, unless a closing parenthesis is followed by a quan- tifier, in which case its length is included. (This changed in release 10.23. In earlier releases, before an opening parenthesis the length - was that of the entire subpattern, and before an alternation bar or a - closing parenthesis the length was zero.) + was that of the entire group, and before an alternation bar or a clos- + ing parenthesis the length was zero.) The pattern_position and next_item_length fields are intended to help in distinguishing between different automatic callouts, which all have @@ -4659,8 +4660,8 @@ AUTHOR REVISION - Last updated: 17 September 2018 - Copyright (c) 1997-2018 University of Cambridge. + Last updated: 03 February 2019 + Copyright (c) 1997-2019 University of Cambridge. ------------------------------------------------------------------------------ @@ -4689,10 +4690,10 @@ DIFFERENCES BETWEEN PCRE2 AND PERL repeat quantifiers on other assertions, for example, \b* (but not \b{3}), but these do not seem to have any use. - 3. Capturing subpatterns that occur inside negative lookaround asser- - tions are counted, but their entries in the offsets vector are set only - when a negative assertion is a condition that has a matching branch - (that is, the condition is false). + 3. Capture groups that occur inside negative lookaround assertions are + counted, but their entries in the offsets vector are set only when a + negative assertion is a condition that has a matching branch (that is, + the condition is false). 4. The following Perl escape sequences are not supported: \F, \l, \L, \u, \U, and \N when followed by a character name. \N on its own, match- @@ -4744,14 +4745,14 @@ DIFFERENCES BETWEEN PCRE2 AND PERL groups up to PCRE2 release 10.23, but from release 10.30 this changed, and backtracking into subroutine calls is now supported, as in Perl. - 9. If any of the backtracking control verbs are used in a subpattern - that is called as a subroutine (whether or not recursively), their - effect is confined to that subpattern; it does not extend to the sur- - rounding pattern. This is not always the case in Perl. In particular, - if (*THEN) is present in a group that is called as a subroutine, its - action is limited to that group, even if the group does not contain any - | characters. Note that such subpatterns are processed as anchored at - the point where they are tested. + 9. If any of the backtracking control verbs are used in a group that is + called as a subroutine (whether or not recursively), their effect is + confined to that group; it does not extend to the surrounding pattern. + This is not always the case in Perl. In particular, if (*THEN) is + present in a group that is called as a subroutine, its action is lim- + ited to that group, even if the group does not contain any | charac- + ters. Note that such groups are processed as anchored at the point + where they are tested. 10. If a pattern contains more than one backtracking control verb, the first one that is backtracked onto acts. For example, in the pattern @@ -4767,91 +4768,90 @@ DIFFERENCES BETWEEN PCRE2 AND PERL matching "aba" against the pattern /^(a(b)?)+$/ in Perl leaves $2 unset, but in PCRE2 it is set to "b". - 13. PCRE2's handling of duplicate subpattern numbers and duplicate sub- - pattern names is not as general as Perl's. This is a consequence of the - fact the PCRE2 works internally just with numbers, using an external - table to translate between numbers and names. In particular, a pattern - such as (?|(?A)|(?B), where the two capturing parentheses have - the same number but different names, is not supported, and causes an - error at compile time. If it were allowed, it would not be possible to - distinguish which parentheses matched, because both names map to cap- - turing subpattern number 1. To avoid this confusing situation, an error - is given at compile time. + 13. PCRE2's handling of duplicate capture group numbers and names is + not as general as Perl's. This is a consequence of the fact the PCRE2 + works internally just with numbers, using an external table to trans- + late between numbers and names. In particular, a pattern such as + (?|(?A)|(?B), where the two capture groups have the same number + but different names, is not supported, and causes an error at compile + time. If it were allowed, it would not be possible to distinguish which + group matched, because both names map to capture group number 1. To + avoid this confusing situation, an error is given at compile time. 14. Perl used to recognize comments in some places that PCRE2 does not, - for example, between the ( and ? at the start of a subpattern. If the - /x modifier is set, Perl allowed white space between ( and ? though the - latest Perls give an error (for a while it was just deprecated). There + for example, between the ( and ? at the start of a group. If the /x + modifier is set, Perl allowed white space between ( and ? though the + latest Perls give an error (for a while it was just deprecated). There may still be some cases where Perl behaves differently. - 15. Perl, when in warning mode, gives warnings for character classes - such as [A-\d] or [a-[:digit:]]. It then treats the hyphens as liter- + 15. Perl, when in warning mode, gives warnings for character classes + such as [A-\d] or [a-[:digit:]]. It then treats the hyphens as liter- als. PCRE2 has no warning features, so it gives an error in these cases because they are almost certainly user mistakes. - 16. In PCRE2, the upper/lower case character properties Lu and Ll are - not affected when case-independent matching is specified. For example, + 16. In PCRE2, the upper/lower case character properties Lu and Ll are + not affected when case-independent matching is specified. For example, \p{Lu} always matches an upper case letter. I think Perl has changed in - this respect; in the release at the time of writing (5.24), \p{Lu} and + this respect; in the release at the time of writing (5.24), \p{Lu} and \p{Ll} match all letters, regardless of case, when case independence is specified. - 17. PCRE2 provides some extensions to the Perl regular expression - facilities. Perl 5.10 includes new features that are not in earlier - versions of Perl, some of which (such as named parentheses) were in + 17. PCRE2 provides some extensions to the Perl regular expression + facilities. Perl 5.10 includes new features that are not in earlier + versions of Perl, some of which (such as named parentheses) were in PCRE2 for some time before. This list is with respect to Perl 5.26: - (a) Although lookbehind assertions in PCRE2 must match fixed length - strings, each alternative branch of a lookbehind assertion can match a - different length of string. Perl requires them all to have the same + (a) Although lookbehind assertions in PCRE2 must match fixed length + strings, each alternative branch of a lookbehind assertion can match a + different length of string. Perl requires them all to have the same length. (b) From PCRE2 10.23, backreferences to groups of fixed length are sup- - ported in lookbehinds, provided that there is no possibility of refer- - encing a non-unique number or name. Perl does not support backrefer- + ported in lookbehinds, provided that there is no possibility of refer- + encing a non-unique number or name. Perl does not support backrefer- ences in lookbehinds. - (c) If PCRE2_DOLLAR_ENDONLY is set and PCRE2_MULTILINE is not set, the + (c) If PCRE2_DOLLAR_ENDONLY is set and PCRE2_MULTILINE is not set, the $ meta-character matches only at the very end of the string. - (d) A backslash followed by a letter with no special meaning is + (d) A backslash followed by a letter with no special meaning is faulted. (Perl can be made to issue a warning.) - (e) If PCRE2_UNGREEDY is set, the greediness of the repetition quanti- + (e) If PCRE2_UNGREEDY is set, the greediness of the repetition quanti- fiers is inverted, that is, by default they are not greedy, but if fol- lowed by a question mark they are. - (f) PCRE2_ANCHORED can be used at matching time to force a pattern to + (f) PCRE2_ANCHORED can be used at matching time to force a pattern to be tried only at the first matching position in the subject string. - (g) The PCRE2_NOTBOL, PCRE2_NOTEOL, PCRE2_NOTEMPTY and + (g) The PCRE2_NOTBOL, PCRE2_NOTEOL, PCRE2_NOTEMPTY and PCRE2_NOTEMPTY_ATSTART options have no Perl equivalents. - (h) The \R escape sequence can be restricted to match only CR, LF, or + (h) The \R escape sequence can be restricted to match only CR, LF, or CRLF by the PCRE2_BSR_ANYCRLF option. - (i) The callout facility is PCRE2-specific. Perl supports codeblocks + (i) The callout facility is PCRE2-specific. Perl supports codeblocks and variable interpolation, but not general hooks on every match. (j) The partial matching facility is PCRE2-specific. - (k) The alternative matching function (pcre2_dfa_match() matches in a + (k) The alternative matching function (pcre2_dfa_match() matches in a different way and is not Perl-compatible. - (l) PCRE2 recognizes some special sequences such as (*CR) or (*NO_JIT) - at the start of a pattern that set overall options that cannot be + (l) PCRE2 recognizes some special sequences such as (*CR) or (*NO_JIT) + at the start of a pattern that set overall options that cannot be changed within the pattern. - 18. The Perl /a modifier restricts /d numbers to pure ascii, and the - /aa modifier restricts /i case-insensitive matching to pure ascii, - ignoring Unicode rules. This separation cannot be represented with + 18. The Perl /a modifier restricts /d numbers to pure ascii, and the + /aa modifier restricts /i case-insensitive matching to pure ascii, + ignoring Unicode rules. This separation cannot be represented with PCRE2_UCP. 19. Perl has different limits than PCRE2. See the pcre2limit documenta- tion for details. Perl went with 5.10 from recursion to iteration keep- ing the intermediate matches on the heap, which is ~10% slower but does - not fall into any stack-overflow limit. PCRE2 made a similar change at - release 10.30, and also has many build-time and run-time customizable + not fall into any stack-overflow limit. PCRE2 made a similar change at + release 10.30, and also has many build-time and run-time customizable limits. @@ -4864,8 +4864,8 @@ AUTHOR REVISION - Last updated: 28 July 2018 - Copyright (c) 1997-2018 University of Cambridge. + Last updated: 03 February 2019 + Copyright (c) 1997-2019 University of Cambridge. ------------------------------------------------------------------------------ @@ -5306,23 +5306,22 @@ SIZE AND OTHER LIMITATIONS The maximum length of a lookbehind assertion is 65535 characters. - There is no limit to the number of parenthesized subpatterns, but there - can be no more than 65535 capturing subpatterns. There is, however, a - limit to the depth of nesting of parenthesized subpatterns of all - kinds. This is imposed in order to limit the amount of system stack - used at compile time. The default limit can be specified when PCRE2 is - built; if not, the default is set to 250. An application can change - this limit by calling pcre2_set_parens_nest_limit() to set the limit in - a compile context. + There is no limit to the number of parenthesized groups, but there can + be no more than 65535 capture groups, and there is a limit to the depth + of nesting of parenthesized subpatterns of all kinds. This is imposed + in order to limit the amount of system stack used at compile time. The + default limit can be specified when PCRE2 is built; if not, the default + is set to 250. An application can change this limit by calling + pcre2_set_parens_nest_limit() to set the limit in a compile context. - The maximum length of name for a named subpattern is 32 code units, and - the maximum number of named subpatterns is 10000. + The maximum length of name for a named capture group is 32 code units, + and the maximum number of such groups is 10000. - The maximum length of a name in a (*MARK), (*PRUNE), (*SKIP), or - (*THEN) verb is 255 code units for the 8-bit library and 65535 code + The maximum length of a name in a (*MARK), (*PRUNE), (*SKIP), or + (*THEN) verb is 255 code units for the 8-bit library and 65535 code units for the 16-bit and 32-bit libraries. - The maximum length of a string argument to a callout is the largest + The maximum length of a string argument to a callout is the largest number a 32-bit unsigned integer can hold. @@ -5335,8 +5334,8 @@ AUTHOR REVISION - Last updated: 30 March 2017 - Copyright (c) 1997-2017 University of Cambridge. + Last updated: 02 February 2019 + Copyright (c) 1997-2019 University of Cambridge. ------------------------------------------------------------------------------ @@ -6025,22 +6024,23 @@ PCRE2 REGULAR EXPRESSION DETAILS great detail. This description of PCRE2's regular expressions is intended as reference material. - This document discusses the patterns that are supported by PCRE2 when - its main matching function, pcre2_match(), is used. PCRE2 also has an - alternative matching function, pcre2_dfa_match(), which matches using a - different algorithm that is not Perl-compatible. Some of the features - discussed below are not available when DFA matching is used. The advan- - tages and disadvantages of the alternative function, and how it differs - from the normal function, are discussed in the pcre2matching page. + This document discusses the regular expression patterns that are sup- + ported by PCRE2 when its main matching function, pcre2_match(), is + used. PCRE2 also has an alternative matching function, + pcre2_dfa_match(), which matches using a different algorithm that is + not Perl-compatible. Some of the features discussed below are not + available when DFA matching is used. The advantages and disadvantages + of the alternative function, and how it differs from the normal func- + tion, are discussed in the pcre2matching page. SPECIAL START-OF-PATTERN ITEMS - A number of options that can be passed to pcre2_compile() can also be + A number of options that can be passed to pcre2_compile() can also be set by special items at the start of a pattern. These are not Perl-com- - patible, but are provided to make these options accessible to pattern - writers who are not able to change the program that processes the pat- - tern. Any number of these items may appear, but they must all be + patible, but are provided to make these options accessible to pattern + writers who are not able to change the program that processes the pat- + tern. Any number of these items may appear, but they must all be together right at the start of the pattern string, and the letters must be in upper case. @@ -6048,86 +6048,86 @@ SPECIAL START-OF-PATTERN ITEMS In the 8-bit and 16-bit PCRE2 libraries, characters may be coded either as single code units, or as multiple UTF-8 or UTF-16 code units. UTF-32 - can be specified for the 32-bit library, in which case it constrains - the character values to valid Unicode code points. To process UTF - strings, PCRE2 must be built to include Unicode support (which is the - default). When using UTF strings you must either call the compiling - function with the PCRE2_UTF option, or the pattern must start with the - special sequence (*UTF), which is equivalent to setting the relevant + can be specified for the 32-bit library, in which case it constrains + the character values to valid Unicode code points. To process UTF + strings, PCRE2 must be built to include Unicode support (which is the + default). When using UTF strings you must either call the compiling + function with the PCRE2_UTF option, or the pattern must start with the + special sequence (*UTF), which is equivalent to setting the relevant option. How setting a UTF mode affects pattern matching is mentioned in - several places below. There is also a summary of features in the + several places below. There is also a summary of features in the pcre2unicode page. Some applications that allow their users to supply patterns may wish to - restrict them to non-UTF data for security reasons. If the - PCRE2_NEVER_UTF option is passed to pcre2_compile(), (*UTF) is not + restrict them to non-UTF data for security reasons. If the + PCRE2_NEVER_UTF option is passed to pcre2_compile(), (*UTF) is not allowed, and its appearance in a pattern causes an error. Unicode property support - Another special sequence that may appear at the start of a pattern is - (*UCP). This has the same effect as setting the PCRE2_UCP option: it - causes sequences such as \d and \w to use Unicode properties to deter- + Another special sequence that may appear at the start of a pattern is + (*UCP). This has the same effect as setting the PCRE2_UCP option: it + causes sequences such as \d and \w to use Unicode properties to deter- mine character types, instead of recognizing only characters with codes less than 256 via a lookup table. Some applications that allow their users to supply patterns may wish to - restrict them for security reasons. If the PCRE2_NEVER_UCP option is + restrict them for security reasons. If the PCRE2_NEVER_UCP option is passed to pcre2_compile(), (*UCP) is not allowed, and its appearance in a pattern causes an error. Locking out empty string matching Starting a pattern with (*NOTEMPTY) or (*NOTEMPTY_ATSTART) has the same - effect as passing the PCRE2_NOTEMPTY or PCRE2_NOTEMPTY_ATSTART option + effect as passing the PCRE2_NOTEMPTY or PCRE2_NOTEMPTY_ATSTART option to whichever matching function is subsequently called to match the pat- - tern. These options lock out the matching of empty strings, either + tern. These options lock out the matching of empty strings, either entirely, or only at the start of the subject. Disabling auto-possessification - If a pattern starts with (*NO_AUTO_POSSESS), it has the same effect as - setting the PCRE2_NO_AUTO_POSSESS option. This stops PCRE2 from making - quantifiers possessive when what follows cannot match the repeated + If a pattern starts with (*NO_AUTO_POSSESS), it has the same effect as + setting the PCRE2_NO_AUTO_POSSESS option. This stops PCRE2 from making + quantifiers possessive when what follows cannot match the repeated item. For example, by default a+b is treated as a++b. For more details, see the pcre2api documentation. Disabling start-up optimizations - If a pattern starts with (*NO_START_OPT), it has the same effect as + If a pattern starts with (*NO_START_OPT), it has the same effect as setting the PCRE2_NO_START_OPTIMIZE option. This disables several opti- - mizations for quickly reaching "no match" results. For more details, + mizations for quickly reaching "no match" results. For more details, see the pcre2api documentation. Disabling automatic anchoring - If a pattern starts with (*NO_DOTSTAR_ANCHOR), it has the same effect - as setting the PCRE2_NO_DOTSTAR_ANCHOR option. This disables optimiza- + If a pattern starts with (*NO_DOTSTAR_ANCHOR), it has the same effect + as setting the PCRE2_NO_DOTSTAR_ANCHOR option. This disables optimiza- tions that apply to patterns whose top-level branches all start with .* - (match any number of arbitrary characters). For more details, see the + (match any number of arbitrary characters). For more details, see the pcre2api documentation. Disabling JIT compilation - If a pattern that starts with (*NO_JIT) is successfully compiled, an - attempt by the application to apply the JIT optimization by calling + If a pattern that starts with (*NO_JIT) is successfully compiled, an + attempt by the application to apply the JIT optimization by calling pcre2_jit_compile() is ignored. Setting match resource limits The pcre2_match() function contains a counter that is incremented every time it goes round its main loop. The caller of pcre2_match() can set a - limit on this counter, which therefore limits the amount of computing + limit on this counter, which therefore limits the amount of computing resource used for a match. The maximum depth of nested backtracking can - also be limited; this indirectly restricts the amount of heap memory - that is used, but there is also an explicit memory limit that can be + also be limited; this indirectly restricts the amount of heap memory + that is used, but there is also an explicit memory limit that can be set. - These facilities are provided to catch runaway matches that are pro- - voked by patterns with huge matching trees (a typical example is a pat- - tern with nested unlimited repeats applied to a long string that does - not match). When one of these limits is reached, pcre2_match() gives an - error return. The limits can also be set by items at the start of the + These facilities are provided to catch runaway matches that are pro- + voked by patterns with huge matching trees. A common example is a pat- + tern with nested unlimited repeats applied to a long string that does + not match. When one of these limits is reached, pcre2_match() gives an + error return. The limits can also be set by items at the start of the pattern of the form (*LIMIT_HEAP=d) @@ -6135,35 +6135,35 @@ SPECIAL START-OF-PATTERN ITEMS (*LIMIT_DEPTH=d) where d is any number of decimal digits. However, the value of the set- - ting must be less than the value set (or defaulted) by the caller of - pcre2_match() for it to have any effect. In other words, the pattern - writer can lower the limits set by the programmer, but not raise them. - If there is more than one setting of one of these limits, the lower - value is used. The heap limit is specified in kibibytes (units of 1024 + ting must be less than the value set (or defaulted) by the caller of + pcre2_match() for it to have any effect. In other words, the pattern + writer can lower the limits set by the programmer, but not raise them. + If there is more than one setting of one of these limits, the lower + value is used. The heap limit is specified in kibibytes (units of 1024 bytes). - Prior to release 10.30, LIMIT_DEPTH was called LIMIT_RECURSION. This + Prior to release 10.30, LIMIT_DEPTH was called LIMIT_RECURSION. This name is still recognized for backwards compatibility. The heap limit applies only when the pcre2_match() or pcre2_dfa_match() interpreters are used for matching. It does not apply to JIT. The match - limit is used (but in a different way) when JIT is being used, or when + limit is used (but in a different way) when JIT is being used, or when pcre2_dfa_match() is called, to limit computing resource usage by those - matching functions. The depth limit is ignored by JIT but is relevant - for DFA matching, which uses function recursion for recursions within - the pattern and for lookaround assertions and atomic groups. In this + matching functions. The depth limit is ignored by JIT but is relevant + for DFA matching, which uses function recursion for recursions within + the pattern and for lookaround assertions and atomic groups. In this case, the depth limit controls the depth of such recursion. Newline conventions - PCRE2 supports six different conventions for indicating line breaks in - strings: a single CR (carriage return) character, a single LF (line- + PCRE2 supports six different conventions for indicating line breaks in + strings: a single CR (carriage return) character, a single LF (line- feed) character, the two-character sequence CRLF, any of the three pre- - ceding, any Unicode newline sequence, or the NUL character (binary - zero). The pcre2api page has further discussion about newlines, and + ceding, any Unicode newline sequence, or the NUL character (binary + zero). The pcre2api page has further discussion about newlines, and shows how to set the newline convention when calling pcre2_compile(). - It is also possible to specify a newline convention by starting a pat- + It is also possible to specify a newline convention by starting a pat- tern string with one of the following sequences: (*CR) carriage return @@ -6174,7 +6174,7 @@ SPECIAL START-OF-PATTERN ITEMS (*NUL) the NUL character (binary zero) These override the default and the options given to the compiling func- - tion. For example, on a Unix system where LF is the default newline + tion. For example, on a Unix system where LF is the default newline sequence, the pattern (*CR)a.b @@ -6183,39 +6183,39 @@ SPECIAL START-OF-PATTERN ITEMS no longer a newline. If more than one of these settings is present, the last one is used. - The newline convention affects where the circumflex and dollar asser- + The newline convention affects where the circumflex and dollar asser- tions are true. It also affects the interpretation of the dot metachar- - acter when PCRE2_DOTALL is not set, and the behaviour of \N when not - followed by an opening brace. However, it does not affect what the \R - escape sequence matches. By default, this is any Unicode newline + acter when PCRE2_DOTALL is not set, and the behaviour of \N when not + followed by an opening brace. However, it does not affect what the \R + escape sequence matches. By default, this is any Unicode newline sequence, for Perl compatibility. However, this can be changed; see the next section and the description of \R in the section entitled "Newline - sequences" below. A change of \R setting can be combined with a change + sequences" below. A change of \R setting can be combined with a change of newline convention. Specifying what \R matches It is possible to restrict \R to match only CR, LF, or CRLF (instead of - the complete set of Unicode line endings) by setting the option - PCRE2_BSR_ANYCRLF at compile time. This effect can also be achieved by - starting a pattern with (*BSR_ANYCRLF). For completeness, (*BSR_UNI- + the complete set of Unicode line endings) by setting the option + PCRE2_BSR_ANYCRLF at compile time. This effect can also be achieved by + starting a pattern with (*BSR_ANYCRLF). For completeness, (*BSR_UNI- CODE) is also recognized, corresponding to PCRE2_BSR_UNICODE. EBCDIC CHARACTER CODES - PCRE2 can be compiled to run in an environment that uses EBCDIC as its - character code instead of ASCII or Unicode (typically a mainframe sys- - tem). In the sections below, character code values are ASCII or Uni- + PCRE2 can be compiled to run in an environment that uses EBCDIC as its + character code instead of ASCII or Unicode (typically a mainframe sys- + tem). In the sections below, character code values are ASCII or Uni- code; in an EBCDIC environment these characters may have different code values, and there are no code points greater than 255. CHARACTERS AND METACHARACTERS - A regular expression is a pattern that is matched against a subject - string from left to right. Most characters stand for themselves in a - pattern, and match the corresponding characters in the subject. As a + A regular expression is a pattern that is matched against a subject + string from left to right. Most characters stand for themselves in a + pattern, and match the corresponding characters in the subject. As a trivial example, the pattern The quick brown fox @@ -6224,10 +6224,11 @@ CHARACTERS AND METACHARACTERS caseless matching is specified (the PCRE2_CASELESS option), letters are matched independently of case. - 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. + The power of regular expressions comes from the ability to include wild + cards, character classes, 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 @@ -6240,14 +6241,11 @@ CHARACTERS AND METACHARACTERS . match any character except newline (by default) [ start character class definition | start of alternative branch - ( start subpattern - ) end subpattern - ? extends the meaning of ( - also 0 or 1 quantifier - also quantifier minimizer + ( start group or control verb + ) end group or control verb * 0 or more quantifier - + 1 or more quantifier - also "possessive quantifier" + + 1 or more quantifier; also "possessive quantifier" + ? 0 or 1 quantifier; also quantifier minimizer { start min/max quantifier Part of a pattern that is in square brackets is called a "character @@ -6256,8 +6254,7 @@ CHARACTERS AND METACHARACTERS \ general escape character ^ negate the class, but only if the first character - indicates character range - [ POSIX character class (only if followed by POSIX - syntax) + [ POSIX character class (if followed by POSIX syntax) ] terminates the character class The following sections describe the use of each of the metacharacters. @@ -6266,7 +6263,7 @@ CHARACTERS AND METACHARACTERS BACKSLASH The backslash character has several uses. Firstly, if it is followed by - a character that is not a number or a letter, it takes away any special + a character that is not a digit or a letter, 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. @@ -6277,7 +6274,7 @@ BACKSLASH that it stands for itself. In particular, if you want to match a back- slash, you write \\. - In a UTF mode, only ASCII numbers and letters have any special meaning + In a UTF mode, only ASCII digits and letters have any special meaning after a backslash. All other characters (in particular, those whose code points are greater than 127) are treated as literals. @@ -6287,14 +6284,14 @@ BACKSLASH are ignored. An escaping backslash can be used to include a white space or # character as part of the pattern. - If you want to remove the special meaning from a sequence of charac- - ters, you can do so by putting them between \Q and \E. This is differ- - ent from Perl in that $ and @ are handled as literals in \Q...\E - sequences in PCRE2, whereas in Perl, $ and @ cause variable interpola- - tion. Also, Perl does "double-quotish backslash interpolation" on any - backslashes between \Q and \E which, its documentation says, "may lead - to confusing results". PCRE2 treats a backslash between \Q and \E just - like any other character. Note the following examples: + If you want to treat all characters in a sequence as literals, you can + do so by putting them between \Q and \E. This is different from Perl in + that $ and @ are handled as literals in \Q...\E sequences in PCRE2, + whereas in Perl, $ and @ cause variable interpolation. Also, Perl does + "double-quotish backslash interpolation" on any backslashes between \Q + and \E which, its documentation says, "may lead to confusing results". + PCRE2 treats a backslash between \Q and \E just like any other charac- + ter. Note the following examples: Pattern PCRE2 matches Perl matches @@ -6319,8 +6316,9 @@ BACKSLASH acters in patterns in a visible manner. There is no restriction on the appearance of non-printing characters in a pattern, but when a pattern is being prepared by text editing, it is often easier to use one of the - following escape sequences than the binary character it represents. In - an ASCII or Unicode environment, these escapes are as follows: + following escape sequences instead of the binary character it repre- + sents. In an ASCII or Unicode environment, these escapes are as fol- + lows: \a alarm, that is, the BEL character (hex 07) \cx "control-x", where x is any printable ASCII character @@ -6337,58 +6335,58 @@ BACKSLASH \N{U+hhh..} character with Unicode hex code point hhh.. \uhhhh character with hex code hhhh (when PCRE2_ALT_BSUX is set) - There are some legacy applications where the escape sequence \r is + There are some legacy applications where the escape sequence \r is expected to match a newline. If the PCRE2_EXTRA_ESCAPED_CR_IS_LF option - is set, \r in a pattern is converted to \n so that it matches a LF + is set, \r in a pattern is converted to \n so that it matches a LF (linefeed) instead of a CR (carriage return) character. - The \N{U+hhh..} escape sequence is recognized only when the PCRE2_UTF + The \N{U+hhh..} escape sequence is recognized only when the PCRE2_UTF option is set, that is, when PCRE2 is operating in a Unicode mode. Perl - also uses \N{name} to specify characters by Unicode name; PCRE2 does - not support this. Note that when \N is not followed by an opening - brace (curly bracket) it has an entirely different meaning, matching + also uses \N{name} to specify characters by Unicode name; PCRE2 does + not support this. Note that when \N is not followed by an opening + brace (curly bracket) it has an entirely different meaning, matching any character that is not a newline. - The precise effect of \cx on ASCII characters is as follows: if x is a - lower case letter, it is converted to upper case. Then bit 6 of the + The precise effect of \cx on ASCII characters is as follows: if x is a + lower case letter, it is converted to upper case. Then bit 6 of the character (hex 40) is inverted. Thus \cA to \cZ become hex 01 to hex 1A - (A is 41, Z is 5A), but \c{ becomes hex 3B ({ is 7B), and \c; becomes - hex 7B (; is 3B). If the code unit following \c has a value less than + (A is 41, Z is 5A), but \c{ becomes hex 3B ({ is 7B), and \c; becomes + hex 7B (; is 3B). If the code unit following \c has a value less than 32 or greater than 126, a compile-time error occurs. - When PCRE2 is compiled in EBCDIC mode, \N{U+hhh..} is not supported. + When PCRE2 is compiled in EBCDIC mode, \N{U+hhh..} is not supported. \a, \e, \f, \n, \r, and \t generate the appropriate EBCDIC code values. The \c escape is processed as specified for Perl in the perlebcdic doc- - ument. The only characters that are allowed after \c are A-Z, a-z, or - one of @, [, \, ], ^, _, or ?. Any other character provokes a compile- - time error. The sequence \c@ encodes character code 0; after \c the - letters (in either case) encode characters 1-26 (hex 01 to hex 1A); [, - \, ], ^, and _ encode characters 27-31 (hex 1B to hex 1F), and \c? + ument. The only characters that are allowed after \c are A-Z, a-z, or + one of @, [, \, ], ^, _, or ?. Any other character provokes a compile- + time error. The sequence \c@ encodes character code 0; after \c the + letters (in either case) encode characters 1-26 (hex 01 to hex 1A); [, + \, ], ^, and _ encode characters 27-31 (hex 1B to hex 1F), and \c? becomes either 255 (hex FF) or 95 (hex 5F). - Thus, apart from \c?, these escapes generate the same character code - values as they do in an ASCII environment, though the meanings of the - values mostly differ. For example, \cG always generates code value 7, + Thus, apart from \c?, these escapes generate the same character code + values as they do in an ASCII environment, though the meanings of the + values mostly differ. For example, \cG always generates code value 7, which is BEL in ASCII but DEL in EBCDIC. - The sequence \c? generates DEL (127, hex 7F) in an ASCII environment, - but because 127 is not a control character in EBCDIC, Perl makes it - generate the APC character. Unfortunately, there are several variants - of EBCDIC. In most of them the APC character has the value 255 (hex - FF), but in the one Perl calls POSIX-BC its value is 95 (hex 5F). If + The sequence \c? generates DEL (127, hex 7F) in an ASCII environment, + but because 127 is not a control character in EBCDIC, Perl makes it + generate the APC character. Unfortunately, there are several variants + of EBCDIC. In most of them the APC character has the value 255 (hex + FF), but in the one Perl calls POSIX-BC its value is 95 (hex 5F). If certain other characters have POSIX-BC values, PCRE2 makes \c? generate 95; otherwise it generates 255. - After \0 up to two further octal digits are read. If there are fewer - than two digits, just those that are present are used. Thus the + After \0 up to two further octal digits are read. If there are fewer + than two digits, just those that are present are used. Thus the sequence \0\x\015 specifies two binary zeros followed by a CR character (code value 13). Make sure you supply two digits after the initial zero if the pattern character that follows is itself an octal digit. - The escape \o must be followed by a sequence of octal digits, enclosed - in braces. An error occurs if this is not the case. This escape is a - recent addition to Perl; it provides way of specifying character code - points as octal numbers greater than 0777, and it also allows octal + The escape \o must be followed by a sequence of octal digits, enclosed + in braces. An error occurs if this is not the case. This escape is a + recent addition to Perl; it provides way of specifying character code + points as octal numbers greater than 0777, and it also allows octal numbers and backreferences to be unambiguously specified. For greater clarity and unambiguity, it is best to avoid following \ by @@ -6401,21 +6399,21 @@ BACKSLASH Outside a character class, PCRE2 reads the digit and any following dig- its as a decimal number. If the number is less than 10, begins with the - digit 8 or 9, or if there are at least that many previous capturing - left parentheses in the expression, the entire sequence is taken as a - backreference. A description of how this works is given later, follow- - ing the discussion of parenthesized subpatterns. Otherwise, up to - three octal digits are read to form a character code. + digit 8 or 9, or if there are at least that many previous capture + groups in the expression, the entire sequence is taken as a backrefer- + ence. A description of how this works is given later, following the + discussion of parenthesized groups. Otherwise, up to three octal dig- + its are read to form a character code. - Inside a character class, PCRE2 handles \8 and \9 as the literal char- - acters "8" and "9", and otherwise reads up to three octal digits fol- + Inside a character class, PCRE2 handles \8 and \9 as the literal char- + acters "8" and "9", and otherwise reads up to three octal digits fol- lowing the backslash, using them to generate a data character. Any sub- - sequent digits stand for themselves. For example, outside a character + sequent digits stand for themselves. For example, outside a character class: \040 is another way of writing an ASCII space \40 is the same, provided there are fewer than 40 - previous capturing subpatterns + previous capture groups \7 is always a backreference \11 might be a backreference, or another way of writing a tab @@ -6427,22 +6425,23 @@ BACKSLASH the value 255 (decimal) \81 is always a backreference - Note that octal values of 100 or greater that are specified using this - syntax must not be introduced by a leading zero, because no more than + Note that octal values of 100 or greater that are specified using this + syntax must not be introduced by a leading zero, because no more than three octal digits are ever read. - By default, after \x that is not followed by {, from zero to two hexa- - decimal digits are read (letters can be in upper or lower case). Any + By default, after \x that is not followed by {, from zero to two hexa- + decimal digits are read (letters can be in upper or lower case). Any number of hexadecimal digits may appear between \x{ and }. If a charac- - ter other than a hexadecimal digit appears between \x{ and }, or if + ter other than a hexadecimal digit appears between \x{ and }, or if there is no terminating }, an error occurs. - If the PCRE2_ALT_BSUX option is set, the interpretation of \x is as + If the PCRE2_ALT_BSUX option is set, the interpretation of \x is as just described only when it is followed by two hexadecimal digits. Oth- - erwise, it matches a literal "x" character. In this mode, support for - code points greater than 256 is provided by \u, which must be followed - by four hexadecimal digits; otherwise it matches a literal "u" charac- - ter. + erwise, it matches a literal "x" character. In this mode, support for + code points greater than 256 is provided by \u, which must be followed + by four hexadecimal digits; otherwise it matches a literal "u" charac- + ter. This syntax makes PCRE2 behave like ECMAscript (aka JavaScript). + Code points greater than 0xFFFF are not supported. Characters whose value is less than 256 can be defined by either of the two syntaxes for \x (or by \u in PCRE2_ALT_BSUX mode). There is no dif- @@ -6490,13 +6489,13 @@ BACKSLASH The sequence \g followed by a signed or unsigned number, optionally enclosed in braces, is an absolute or relative backreference. A named backreference can be coded as \g{name}. Backreferences are discussed - later, following the discussion of parenthesized subpatterns. + later, following the discussion of parenthesized groups. Absolute and relative subroutine calls For compatibility with Oniguruma, the non-Perl syntax \g followed by a name or a number enclosed either in angle brackets or single quotes, is - an alternative syntax for referencing a subpattern as a "subroutine". + an alternative syntax for referencing a capture group as a subroutine. Details are discussed later. Note that \g{...} (Perl syntax) and \g<...> (Oniguruma syntax) are not synonymous. The former is a backref- erence; the latter is a subroutine call. @@ -6653,23 +6652,25 @@ BACKSLASH When PCRE2 is built with Unicode support (the default), three addi- tional escape sequences that match characters with specific properties - are available. In 8-bit non-UTF-8 mode, these sequences are of course - limited to testing characters whose code points are less than 256, but - they do work in this mode. In 32-bit non-UTF mode, code points greater - than 0x10ffff (the Unicode limit) may be encountered. These are all - treated as being in the Unknown script and with an unassigned type. The - extra escape sequences are: + are available. They can be used in any mode, though in 8-bit and 16-bit + non-UTF modes these sequences are of course limited to testing charac- + ters whose code points are less than U+0100 and U+10000, respectively. + In 32-bit non-UTF mode, code points greater than 0x10ffff (the Unicode + limit) may be encountered. These are all treated as being in the + Unknown script and with an unassigned type. The extra escape sequences + are: \p{xx} a character with the xx property \P{xx} a character without the xx property \X a Unicode extended grapheme cluster - The property names represented by xx above are limited to the Unicode - script names, the general category properties, "Any", which matches any - character (including newline), and some special PCRE2 properties - (described in the next section). Other Perl properties such as "InMu- - sicalSymbols" are not supported by PCRE2. Note that \P{Any} does not - match any characters, so always causes a match failure. + The property names represented by xx above are case-sensitive. There is + support for Unicode script names, Unicode general category properties, + "Any", which matches any character (including newline), and some spe- + cial PCRE2 properties (described in the next section). Other Perl + properties such as "InMusicalSymbols" are not supported by PCRE2. Note + that \P{Any} does not match any characters, so always causes a match + failure. Sets of Unicode characters are defined as belonging to certain scripts. A character from one of these sets can be matched using a script name. @@ -6772,11 +6773,13 @@ BACKSLASH has the Lu, Ll, or Lt property, in other words, a letter that is not classified as a modifier or "other". - The Cs (Surrogate) property applies only to characters in the range - U+D800 to U+DFFF. Such characters are not valid in Unicode strings and - so cannot be tested by PCRE2, unless UTF validity checking has been - turned off (see the discussion of PCRE2_NO_UTF_CHECK in the pcre2api - page). Perl does not support the Cs property. + The Cs (Surrogate) property applies only to characters whose code + points are in the range U+D800 to U+DFFF. These characters are no dif- + ferent to any other character when PCRE2 is not in UTF mode (using the + 16-bit or 32-bit library). However, they are not valid in Unicode + strings and so cannot be tested by PCRE2 in UTF mode, unless UTF valid- + ity checking has been turned off (see the discussion of + PCRE2_NO_UTF_CHECK in the pcre2api page). The long synonyms for property names that Perl supports (such as \p{Letter}) are not supported by PCRE2, nor is it permitted to prefix @@ -6917,8 +6920,8 @@ BACKSLASH The final 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. - The backslashed assertions are: + use of groups for more complicated assertions is described below. The + backslashed assertions are: \b matches at a word boundary \B matches when not at a word boundary @@ -6935,183 +6938,184 @@ BACKSLASH 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. In a - UTF mode, the meanings of \w and \W can be changed by setting the - PCRE2_UCP option. When this is done, it also affects \b and \B. Neither - PCRE2 nor Perl has a separate "start of word" or "end of word" metase- - quence. However, whatever follows \b normally determines which it is. - For example, the fragment \ba matches "a" at the start of a word. + string if the first or last character matches \w, respectively. When + PCRE2 is built with Unicode support, the meanings of \w and \W can be + changed by setting the PCRE2_UCP option. When this is done, it also + affects \b and \B. Neither PCRE2 nor Perl has a separate "start of + word" or "end of word" metasequence. However, whatever follows \b nor- + mally determines which it is. For example, the fragment \ba matches "a" + at the start of a word. - 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- - tions are not affected by the PCRE2_NOTBOL or PCRE2_NOTEOL options, - which affect only the behaviour of the circumflex and dollar metachar- - acters. However, if the startoffset argument of pcre2_match() is non- - zero, indicating 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 at the end of the string + 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 PCRE2_NOTBOL or PCRE2_NOTEOL options, + which affect only the behaviour of the circumflex and dollar metachar- + acters. However, if the startoffset argument of pcre2_match() is non- + zero, indicating 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 at the end of the string as well as at the very end, 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 matching process, as specified by the startoff- - set argument of pcre2_match(). It differs from \A when the value of - startoffset is non-zero. By calling pcre2_match() multiple times with - appropriate arguments, you can mimic Perl's /g option, and it is in + The \G assertion is true only when the current matching position is at + the start point of the matching process, as specified by the startoff- + set argument of pcre2_match(). It differs from \A when the value of + startoffset is non-zero. By calling pcre2_match() multiple times with + appropriate arguments, you can mimic Perl's /g option, and it is in this kind of implementation where \G can be useful. - Note, however, that PCRE2's implementation of \G, being true at the - starting character of the matching process, is subtly different from - Perl's, which defines it as true at the end of the previous match. In - Perl, these can be different when the previously matched string was + Note, however, that PCRE2's implementation of \G, being true at the + starting character of the matching process, is subtly different from + Perl's, which defines it as true at the end of the previous match. In + Perl, these can be different when the previously matched string was empty. Because PCRE2 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. CIRCUMFLEX AND DOLLAR - The circumflex and dollar metacharacters are zero-width assertions. - That is, they test for a particular condition being true without con- + The circumflex and dollar metacharacters are zero-width assertions. + That is, they test for a particular condition being true without con- suming any characters from the subject string. These two metacharacters - are concerned with matching the starts and ends of lines. If the new- - line convention is set so that only the two-character sequence CRLF is - recognized as a newline, isolated CR and LF characters are treated as + are concerned with matching the starts and ends of lines. If the new- + line convention is set so that only the two-character sequence CRLF is + recognized as a newline, isolated CR and LF characters are treated as ordinary data characters, and are not recognized as newlines. 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 pcre2_match() is non-zero, or if PCRE2_NOTBOL is set, circum- - flex can never match if the PCRE2_MULTILINE option is unset. Inside a - character class, circumflex has an entirely different meaning (see + 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 pcre2_match() is non-zero, or if PCRE2_NOTBOL is set, circum- + flex can never match if the PCRE2_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.) - The 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 at the end of the string (by default), unless + The 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 at the end of the string (by default), unless PCRE2_NOTEOL is set. Note, however, that it does not actually match the newline. Dollar need not be the last character of the pattern if a num- ber 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 charac- + branch in which it appears. Dollar has no special meaning in a charac- ter class. - The meaning of dollar can be changed so that it matches only at the - very end of the string, by setting the PCRE2_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 PCRE2_DOLLAR_ENDONLY option at compile time. This does not affect the \Z assertion. The meanings of the circumflex and dollar metacharacters are changed if - the PCRE2_MULTILINE option is set. When this is the case, a dollar - character matches before any newlines in the string, as well as at the - very end, and a circumflex matches immediately after internal newlines - as well as at the start of the subject string. It does not match after - a newline that ends the string, for compatibility with Perl. However, + the PCRE2_MULTILINE option is set. When this is the case, a dollar + character matches before any newlines in the string, as well as at the + very end, and a circumflex matches immediately after internal newlines + as well as at the start of the subject string. It does not match after + a newline that ends the string, for compatibility with Perl. However, this can be changed by setting the PCRE2_ALT_CIRCUMFLEX option. - For example, the pattern /^abc$/ matches the subject string "def\nabc" - (where \n represents a newline) in multiline 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 - pcre2_match() is non-zero. The PCRE2_DOLLAR_ENDONLY option is ignored + For example, the pattern /^abc$/ matches the subject string "def\nabc" + (where \n represents a newline) in multiline 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 + pcre2_match() is non-zero. The PCRE2_DOLLAR_ENDONLY option is ignored if PCRE2_MULTILINE is set. - When the newline convention (see "Newline conventions" below) recog- - nizes the two-character sequence CRLF as a newline, this is preferred, - even if the single characters CR and LF are also recognized as new- - lines. For example, if the newline convention is "any", a multiline - mode circumflex matches before "xyz" in the string "abc\r\nxyz" rather - than after CR, even though CR on its own is a valid newline. (It also + When the newline convention (see "Newline conventions" below) recog- + nizes the two-character sequence CRLF as a newline, this is preferred, + even if the single characters CR and LF are also recognized as new- + lines. For example, if the newline convention is "any", a multiline + mode circumflex matches before "xyz" in the string "abc\r\nxyz" rather + than after CR, even though CR on its own is a valid newline. (It also matches at the very start of the string, of course.) - 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 or not PCRE2_MULTILINE is + 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 or not PCRE2_MULTILINE is set. FULL STOP (PERIOD, DOT) AND \N Outside a character class, a dot in the pattern matches any one charac- - ter in the subject string except (by default) a character that signi- + ter in the subject string except (by default) a character that signi- fies the end of a line. - When a line ending is defined as a single character, dot never matches - that character; when the two-character sequence CRLF is used, dot does - not match CR if it is immediately followed by LF, but otherwise it - matches all characters (including isolated CRs and LFs). When any Uni- - code line endings are being recognized, dot does not match CR or LF or + When a line ending is defined as a single character, dot never matches + that character; when the two-character sequence CRLF is used, dot does + not match CR if it is immediately followed by LF, but otherwise it + matches all characters (including isolated CRs and LFs). When any Uni- + code line endings are being recognized, dot does not match CR or LF or any of the other line ending characters. - The behaviour of dot with regard to newlines can be changed. If the - PCRE2_DOTALL option is set, a dot matches any one character, without - exception. If the two-character sequence CRLF is present in the sub- + The behaviour of dot with regard to newlines can be changed. If the + PCRE2_DOTALL option is set, a dot matches any one character, without + exception. If the two-character sequence CRLF is present in the sub- ject string, it takes two dots to match it. - The handling of dot is entirely independent of the handling of circum- - flex and dollar, the only relationship being that they both involve + The handling of dot is entirely independent of the handling of circum- + flex and dollar, the only relationship being that they both involve newlines. Dot has no special meaning in a character class. - The escape sequence \N when not followed by an opening brace behaves - like a dot, except that it is not affected by the PCRE2_DOTALL option. - In other words, it matches any character except one that signifies the + The escape sequence \N when not followed by an opening brace behaves + like a dot, except that it is not affected by the PCRE2_DOTALL option. + In other words, it matches any character except one that signifies the end of a line. When \N is followed by an opening brace it has a different meaning. See - the section entitled "Non-printing characters" above for details. Perl - also uses \N{name} to specify characters by Unicode name; PCRE2 does + the section entitled "Non-printing characters" above for details. Perl + also uses \N{name} to specify characters by Unicode name; PCRE2 does not support this. MATCHING A SINGLE CODE UNIT - Outside a character class, the escape sequence \C matches any one code - unit, whether or not a UTF mode is set. In the 8-bit library, one code - unit is one byte; in the 16-bit library it is a 16-bit unit; in the - 32-bit library it is a 32-bit unit. Unlike a dot, \C always matches - line-ending characters. The feature is provided in Perl in order to + Outside a character class, the escape sequence \C matches any one code + unit, whether or not a UTF mode is set. In the 8-bit library, one code + unit is one byte; in the 16-bit library it is a 16-bit unit; in the + 32-bit library it is a 32-bit unit. Unlike a dot, \C always matches + line-ending characters. The feature is provided in Perl in order to match individual bytes in UTF-8 mode, but it is unclear how it can use- fully be used. - Because \C breaks up characters into individual code units, matching - one unit with \C in UTF-8 or UTF-16 mode means that the rest of the - string may start with a malformed UTF character. This has undefined + Because \C breaks up characters into individual code units, matching + one unit with \C in UTF-8 or UTF-16 mode means that the rest of the + string may start with a malformed UTF character. This has undefined results, because PCRE2 assumes that it is matching character by charac- - ter in a valid UTF string (by default it checks the subject string's - validity at the start of processing unless the PCRE2_NO_UTF_CHECK + ter in a valid UTF string (by default it checks the subject string's + validity at the start of processing unless the PCRE2_NO_UTF_CHECK option is used). - An application can lock out the use of \C by setting the - PCRE2_NEVER_BACKSLASH_C option when compiling a pattern. It is also + An application can lock out the use of \C by setting the + PCRE2_NEVER_BACKSLASH_C option when compiling a pattern. It is also possible to build PCRE2 with the use of \C permanently disabled. - PCRE2 does not allow \C to appear in lookbehind assertions (described - below) in UTF-8 or UTF-16 modes, because this would make it impossible - to calculate the length of the lookbehind. Neither the alternative + PCRE2 does not allow \C to appear in lookbehind assertions (described + below) in UTF-8 or UTF-16 modes, because this would make it impossible + to calculate the length of the lookbehind. Neither the alternative matching function pcre2_dfa_match() nor the JIT optimizer support \C in these UTF modes. The former gives a match-time error; the latter fails to optimize and so the match is always run using the interpreter. - In the 32-bit library, however, \C is always supported (when not - explicitly locked out) because it always matches a single code unit, + In the 32-bit library, however, \C is always supported (when not + explicitly locked out) because it always matches a single code unit, whether or not UTF-32 is specified. In general, the \C escape sequence is best avoided. However, one way of - using it that avoids the problem of malformed UTF-8 or UTF-16 charac- - ters is to use a lookahead to check the length of the next character, - as in this pattern, which could be used with a UTF-8 string (ignore + using it that avoids the problem of malformed UTF-8 or UTF-16 charac- + ters is to use a lookahead to check the length of the next character, + as in this pattern, which could be used with a UTF-8 string (ignore white space and line breaks): (?| (?=[\x00-\x7f])(\C) | @@ -7119,11 +7123,11 @@ MATCHING A SINGLE CODE UNIT (?=[\x{800}-\x{ffff}])(\C)(\C)(\C) | (?=[\x{10000}-\x{1fffff}])(\C)(\C)(\C)(\C)) - In this example, a group that starts with (?| resets the capturing - parentheses numbers in each alternative (see "Duplicate Subpattern Num- - bers" below). The assertions at the start of each branch check the next - UTF-8 character for values whose encoding uses 1, 2, 3, or 4 bytes, - respectively. The character's individual bytes are then captured by the + In this example, a group that starts with (?| resets the capturing + parentheses numbers in each alternative (see "Duplicate Group Numbers" + below). The assertions at the start of each branch check the next UTF-8 + character for values whose encoding uses 1, 2, 3, or 4 bytes, respec- + tively. The character's individual bytes are then captured by the appropriate number of \C groups. @@ -7131,115 +7135,115 @@ 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 by default. If a closing square bracket is required as a member + cial by default. 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 circumflex, if present) or escaped with a backslash. This - means that, by default, an empty class cannot be defined. However, if - the PCRE2_ALLOW_EMPTY_CLASS option is set, a closing square bracket at + an initial circumflex, if present) or escaped with a backslash. This + means that, by default, an empty class cannot be defined. However, if + the PCRE2_ALLOW_EMPTY_CLASS option is set, a closing square bracket at the start does end the (empty) class. - A character class matches a single character in the subject. A matched + A character class matches a single character in the subject. 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 + 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 + 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. - Characters in a class may be specified by their code points using \o, - \x, or \N{U+hh..} in the usual way. When caseless matching is set, any - letters in a class represent both their upper case and lower case ver- - sions, so for example, a caseless [aeiou] matches "A" as well as "a", - and a caseless [^aeiou] does not match "A", whereas a caseful version + Characters in a class may be specified by their code points using \o, + \x, or \N{U+hh..} in the usual way. When caseless matching is set, any + letters in a class represent both their upper case and lower case ver- + sions, 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. - Characters that might indicate line breaks are never treated in any - special way when matching character classes, whatever line-ending - sequence is in use, and whatever setting of the PCRE2_DOTALL and - PCRE2_MULTILINE options is used. A class such as [^a] always matches + Characters that might indicate line breaks are never treated in any + special way when matching character classes, whatever line-ending + sequence is in use, and whatever setting of the PCRE2_DOTALL and + PCRE2_MULTILINE options is used. A class such as [^a] always matches one of these characters. The generic character type escape sequences \d, \D, \h, \H, \p, \P, \s, - \S, \v, \V, \w, and \W may appear in a character class, and add the - characters that they match to the class. For example, [\dABCDEF] - matches any hexadecimal digit. In UTF modes, the PCRE2_UCP option - affects the meanings of \d, \s, \w and their upper case partners, just - as it does when they appear outside a character class, as described in - the section entitled "Generic character types" above. The escape - sequence \b has a different meaning inside a character class; it - matches the backspace character. The sequences \B, \R, and \X are not - special inside a character class. Like any other unrecognized escape - sequences, they cause an error. The same is true for \N when not fol- + \S, \v, \V, \w, and \W may appear in a character class, and add the + characters that they match to the class. For example, [\dABCDEF] + matches any hexadecimal digit. In UTF modes, the PCRE2_UCP option + affects the meanings of \d, \s, \w and their upper case partners, just + as it does when they appear outside a character class, as described in + the section entitled "Generic character types" above. The escape + sequence \b has a different meaning inside a character class; it + matches the backspace character. The sequences \B, \R, and \X are not + special inside a character class. Like any other unrecognized escape + sequences, they cause an error. The same is true for \N when not fol- lowed by an opening brace. - The minus (hyphen) character can be used to specify a range of charac- - ters in a character class. For example, [d-m] matches any letter - between d and m, inclusive. If a minus character is required in a - class, it must be escaped with a backslash or appear in a position - where it cannot be interpreted as indicating a range, typically as the + The minus (hyphen) character can be used to specify a range of charac- + ters in a character class. For example, [d-m] matches any letter + between d and m, inclusive. If a minus character is required in a + class, it must be escaped with a backslash or appear in a position + where it cannot be interpreted as indicating a range, typically as the first or last character in the class, or immediately after a range. For - example, [b-d-z] matches letters in the range b to d, a hyphen charac- + example, [b-d-z] matches letters in the range b to d, a hyphen charac- ter, or z. Perl treats a hyphen as a literal if it appears before or after a POSIX class (see below) or before or after a character type escape such as as - \d or \H. However, unless the hyphen is the last character in the - class, Perl outputs a warning in its warning mode, as this is most - likely a user error. As PCRE2 has no facility for warning, an error is + \d or \H. However, unless the hyphen is the last character in the + class, Perl outputs a warning in its warning mode, as this is most + likely a user error. As PCRE2 has no facility for warning, an error is given in these cases. It is not possible to have the literal character "]" as the end charac- - ter of a range. A pattern such as [W-]46] is interpreted as a class of - two characters ("W" and "-") followed by a literal string "46]", so it - would match "W46]" or "-46]". However, if the "]" is escaped with a - backslash it is interpreted as the end of range, so [W-\]46] is inter- - preted as a class containing a range followed by two other characters. - The octal or hexadecimal representation of "]" can also be used to end + ter of a range. A pattern such as [W-]46] is interpreted as a class of + two characters ("W" and "-") followed by a literal string "46]", so it + would match "W46]" or "-46]". However, if the "]" is escaped with a + backslash it is interpreted as the end of range, so [W-\]46] is inter- + preted as a class containing a range followed by two other characters. + The octal or hexadecimal representation of "]" can also be used to end a range. Ranges normally include all code points between the start and end char- - acters, inclusive. They can also be used for code points specified + acters, inclusive. They can also be used for code points specified numerically, for example [\000-\037]. Ranges can include any characters - that are valid for the current mode. In any UTF mode, the so-called - "surrogate" characters (those whose code points lie between 0xd800 and - 0xdfff inclusive) may not be specified explicitly by default (the - PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES option disables this check). How- + that are valid for the current mode. In any UTF mode, the so-called + "surrogate" characters (those whose code points lie between 0xd800 and + 0xdfff inclusive) may not be specified explicitly by default (the + PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES option disables this check). How- ever, ranges such as [\x{d7ff}-\x{e000}], which include the surrogates, are always permitted. - There is a special case in EBCDIC environments for ranges whose end + There is a special case in EBCDIC environments for ranges whose end points are both specified as literal letters in the same case. For com- - patibility with Perl, EBCDIC code points within the range that are not - letters are omitted. For example, [h-k] matches only four characters, + patibility with Perl, EBCDIC code points within the range that are not + letters are omitted. For example, [h-k] matches only four characters, even though the codes for h and k are 0x88 and 0x92, a range of 11 code - points. However, if the range is specified numerically, for example, + points. However, if the range is specified numerically, for example, [\x88-\x92] or [h-\x92], all code points are included. If a range that includes letters is used when caseless matching is set, it matches the letters in either case. For example, [W-c] is equivalent - to [][\\^_`wxyzabc], matched caselessly, and in a non-UTF mode, if - character tables for a French locale are in use, [\xc8-\xcb] matches + to [][\\^_`wxyzabc], matched caselessly, and in a non-UTF mode, if + character tables for a French locale are in use, [\xc8-\xcb] matches accented E characters in both cases. - A circumflex can conveniently be used with the upper case character - types to specify a more restricted set of characters than the matching - lower case type. For example, the class [^\W_] matches any letter or + A circumflex can conveniently be used with the upper case character + types to specify a more restricted set of characters than the matching + lower case type. For example, the class [^\W_] matches any letter or digit, but not underscore, whereas [\w] includes underscore. A positive character class should be read as "something OR something OR ..." and a negative class as "NOT something AND NOT something AND NOT ...". - The only metacharacters that are recognized in character classes are - backslash, hyphen (only where it can be interpreted as specifying a - range), circumflex (only at the start), opening square bracket (only - when it can be interpreted as introducing a POSIX class name, or for a - special compatibility feature - see the next two sections), and the + The only metacharacters that are recognized in character classes are + backslash, hyphen (only where it can be interpreted as specifying a + range), circumflex (only at the start), opening square bracket (only + when it can be interpreted as introducing a POSIX class name, or for a + special compatibility feature - see the next two sections), and the terminating closing square bracket. However, escaping other non- alphanumeric characters does no harm. @@ -7247,7 +7251,7 @@ SQUARE BRACKETS AND CHARACTER CLASSES POSIX CHARACTER CLASSES Perl supports the POSIX notation for character classes. This uses names - enclosed by [: and :] within the enclosing square brackets. PCRE2 also + enclosed by [: and :] within the enclosing square brackets. PCRE2 also supports this notation. For example, [01[:alpha:]%] @@ -7270,13 +7274,13 @@ POSIX CHARACTER CLASSES word "word" characters (same as \w) xdigit hexadecimal digits - The default "space" characters are HT (9), LF (10), VT (11), FF (12), - CR (13), and space (32). If locale-specific matching is taking place, - the list of space characters may be different; there may be fewer or + The default "space" characters are HT (9), LF (10), VT (11), FF (12), + CR (13), and space (32). If locale-specific matching is taking place, + the list of space characters may be different; there may be fewer or more of them. "Space" and \s match the same set of characters. - The name "word" is a Perl extension, and "blank" is a GNU extension - from Perl 5.8. Another Perl extension is negation, which is indicated + The name "word" is a Perl extension, and "blank" is a GNU extension + from Perl 5.8. Another Perl extension is negation, which is indicated by a ^ character after the colon. For example, [12[:^digit:]] @@ -7287,9 +7291,9 @@ POSIX CHARACTER CLASSES By default, characters with values greater than 127 do not match any of the POSIX character classes, although this may be different for charac- - ters in the range 128-255 when locale-specific matching is happening. - However, if the PCRE2_UCP option is passed to pcre2_compile(), some of - the classes are changed so that Unicode character properties are used. + ters in the range 128-255 when locale-specific matching is happening. + However, if the PCRE2_UCP option is passed to pcre2_compile(), some of + the classes are changed so that Unicode character properties are used. This is achieved by replacing certain POSIX classes with other sequences, as follows: @@ -7303,10 +7307,10 @@ POSIX CHARACTER CLASSES [:upper:] becomes \p{Lu} [:word:] becomes \p{Xwd} - Negated versions, such as [:^alpha:] use \P instead of \p. Three other + Negated versions, such as [:^alpha:] use \P instead of \p. Three other POSIX classes are handled specially in UCP mode: - [:graph:] This matches characters that have glyphs that mark the page + [:graph:] This matches characters that have glyphs that mark the page when printed. In Unicode property terms, it matches all char- acters with the L, M, N, P, S, or Cf properties, except for: @@ -7315,60 +7319,60 @@ POSIX CHARACTER CLASSES U+2066 - U+2069 Various "isolate"s - [:print:] This matches the same characters as [:graph:] plus space - characters that are not controls, that is, characters with + [:print:] This matches the same characters as [:graph:] plus space + characters that are not controls, that is, characters with the Zs property. [:punct:] This matches all characters that have the Unicode P (punctua- - tion) property, plus those characters with code points less + tion) property, plus those characters with code points less than 256 that have the S (Symbol) property. - The other POSIX classes are unchanged, and match only characters with + The other POSIX classes are unchanged, and match only characters with code points less than 256. COMPATIBILITY FEATURE FOR WORD BOUNDARIES - In the POSIX.2 compliant library that was included in 4.4BSD Unix, the - ugly syntax [[:<:]] and [[:>:]] is used for matching "start of word" + In the POSIX.2 compliant library that was included in 4.4BSD Unix, the + ugly syntax [[:<:]] and [[:>:]] is used for matching "start of word" and "end of word". PCRE2 treats these items as follows: [[:<:]] is converted to \b(?=\w) [[:>:]] is converted to \b(?<=\w) Only these exact character sequences are recognized. A sequence such as - [a[:<:]b] provokes error for an unrecognized POSIX class name. This - support is not compatible with Perl. It is provided to help migrations + [a[:<:]b] provokes error for an unrecognized POSIX class name. This + support is not compatible with Perl. It is provided to help migrations from other environments, and is best not used in any new patterns. Note - that \b matches at the start and the end of a word (see "Simple asser- - tions" above), and in a Perl-style pattern the preceding or following - character normally shows which is wanted, without the need for the - assertions that are used above in order to give exactly the POSIX be- + that \b matches at the start and the end of a word (see "Simple asser- + tions" above), and in a Perl-style pattern the preceding or following + character normally shows which is wanted, without the need for the + assertions that are used above in order to give exactly the POSIX be- haviour. VERTICAL BAR - Vertical bar characters are used to separate alternative patterns. For + Vertical bar characters are used to separate alternative patterns. For example, the pattern gilbert|sullivan - matches either "gilbert" or "sullivan". Any number of alternatives may - appear, and an empty alternative is permitted (matching the empty + matches either "gilbert" or "sullivan". Any number of alternatives may + appear, and an empty alternative is permitted (matching the empty string). The matching process tries each alternative in turn, from left - to right, and the first one that succeeds is used. If the alternatives - are within a subpattern (defined below), "succeeds" means matching the - rest of the main pattern as well as the alternative in the subpattern. + to right, and the first one that succeeds is used. If the alternatives + are within a group (defined below), "succeeds" means matching the rest + of the main pattern as well as the alternative in the group. INTERNAL OPTION SETTING - The settings of the PCRE2_CASELESS, PCRE2_MULTILINE, PCRE2_DOTALL, - PCRE2_EXTENDED, PCRE2_EXTENDED_MORE, and PCRE2_NO_AUTO_CAPTURE options - can be changed from within the pattern by a sequence of letters - enclosed between "(?" and ")". These options are Perl-compatible, and - are described in detail in the pcre2api documentation. The option let- + The settings of the PCRE2_CASELESS, PCRE2_MULTILINE, PCRE2_DOTALL, + PCRE2_EXTENDED, PCRE2_EXTENDED_MORE, and PCRE2_NO_AUTO_CAPTURE options + can be changed from within the pattern by a sequence of letters + enclosed between "(?" and ")". These options are Perl-compatible, and + are described in detail in the pcre2api documentation. The option let- ters are: i for PCRE2_CASELESS @@ -7379,72 +7383,73 @@ INTERNAL OPTION SETTING xx for PCRE2_EXTENDED_MORE For example, (?im) sets caseless, multiline matching. It is also possi- - ble to unset these options by preceding the relevant letters with a + ble to unset these options by preceding the relevant letters with a hyphen, for example (?-im). The two "extended" options are not indepen- dent; unsetting either one cancels the effects of both of them. - A combined setting and unsetting such as (?im-sx), which sets - PCRE2_CASELESS and PCRE2_MULTILINE while unsetting PCRE2_DOTALL and - PCRE2_EXTENDED, is also permitted. Only one hyphen may appear in the - options string. If a letter appears both before and after the hyphen, - the option is unset. An empty options setting "(?)" is allowed. Need- + A combined setting and unsetting such as (?im-sx), which sets + PCRE2_CASELESS and PCRE2_MULTILINE while unsetting PCRE2_DOTALL and + PCRE2_EXTENDED, is also permitted. Only one hyphen may appear in the + options string. If a letter appears both before and after the hyphen, + the option is unset. An empty options setting "(?)" is allowed. Need- less to say, it has no effect. - If the first character following (? is a circumflex, it causes all of - the above options to be unset. Thus, (?^) is equivalent to (?-imnsx). - Letters may follow the circumflex to cause some options to be re- + If the first character following (? is a circumflex, it causes all of + the above options to be unset. Thus, (?^) is equivalent to (?-imnsx). + Letters may follow the circumflex to cause some options to be re- instated, but a hyphen may not appear. - The PCRE2-specific options PCRE2_DUPNAMES and PCRE2_UNGREEDY can be - changed in the same way as the Perl-compatible options by using the + The PCRE2-specific options PCRE2_DUPNAMES and PCRE2_UNGREEDY can be + changed in the same way as the Perl-compatible options by using the characters J and U respectively. However, these are not unset by (?^). - When one of these option changes occurs at top level (that is, not - inside subpattern parentheses), the change applies to the remainder of - the pattern that follows. An option change within a subpattern (see - below for a description of subpatterns) affects only that part of the - subpattern that follows it, so + When one of these option changes occurs at top level (that is, not + inside group parentheses), the change applies to the remainder of the + pattern that follows. An option change within a group (see below for a + description of groups) affects only that part of the group that follows + it, so (a(?i)b)c - matches abc and aBc and no other strings (assuming PCRE2_CASELESS is - not used). By this means, options can be made to have different set- + matches abc and aBc and no other strings (assuming PCRE2_CASELESS is + not used). By this means, options can be made to have different set- tings in different parts of the pattern. Any changes made in one alter- - native do carry on into subsequent branches within the same subpattern. - For example, + native do carry on into subsequent branches within the same group. For + example, (a(?i)b|c) - matches "ab", "aB", "c", and "C", even though when matching "C" the - first branch is abandoned before the option setting. This is because - the effects of option settings happen at compile time. There would be + matches "ab", "aB", "c", and "C", even though when matching "C" the + first branch is abandoned before the option setting. This is because + the effects of option settings happen at compile time. There would be some very weird behaviour otherwise. - As a convenient shorthand, if any option settings are required at the - start of a non-capturing subpattern (see the next section), the option - letters may appear between the "?" and the ":". Thus the two patterns + As a convenient shorthand, if any option settings are required at the + start of a non-capturing group (see the next section), the option let- + ters may appear between the "?" and the ":". Thus the two patterns (?i:saturday|sunday) (?:(?i)saturday|sunday) match exactly the same set of strings. - Note: There are other PCRE2-specific options that can be set by the - application when the compiling function is called. The pattern can con- - tain special leading sequences such as (*CRLF) to override what the - application has set or what has been defaulted. Details are given in - the section entitled "Newline sequences" above. There are also the - (*UTF) and (*UCP) leading sequences that can be used to set UTF and - Unicode property modes; they are equivalent to setting the PCRE2_UTF - and PCRE2_UCP options, respectively. However, the application can set - the PCRE2_NEVER_UTF and PCRE2_NEVER_UCP options, which lock out the use - of the (*UTF) and (*UCP) sequences. + Note: There are other PCRE2-specific options, applying to the whole + pattern, which can be set by the application when the compiling func- + tion is called. In addition, the pattern can contain special leading + sequences such as (*CRLF) to override what the application has set or + what has been defaulted. Details are given in the section entitled + "Newline sequences" above. There are also the (*UTF) and (*UCP) leading + sequences that can be used to set UTF and Unicode property modes; they + are equivalent to setting the PCRE2_UTF and PCRE2_UCP options, respec- + tively. However, the application can set the PCRE2_NEVER_UTF and + PCRE2_NEVER_UCP options, which lock out the use of the (*UTF) and + (*UCP) sequences. -SUBPATTERNS +GROUPS - Subpatterns are delimited by parentheses (round brackets), which can be - nested. Turning part of a pattern into a subpattern does two things: + Groups are delimited by parentheses (round brackets), which can be + nested. Turning part of a pattern into a group does two things: 1. It localizes a set of alternatives. For example, the pattern @@ -7453,55 +7458,53 @@ SUBPATTERNS matches "cataract", "caterpillar", or "cat". Without the parentheses, it would match "cataract", "erpillar" or an empty string. - 2. It sets up the subpattern as a capturing subpattern. This means - that, when the whole pattern matches, the portion of the subject string - that matched the subpattern is passed back to the caller, separately - from the portion that matched the whole pattern. (This applies only to - the traditional matching function; the DFA matching function does not - support capturing.) + 2. It creates a "capture group". This means that, when the whole pat- + tern matches, the portion of the subject string that matched the group + is passed back to the caller, separately from the portion that matched + the whole pattern. (This applies only to the traditional matching + function; the DFA matching function does not support capturing.) Opening parentheses are counted from left to right (starting from 1) to - obtain numbers for the capturing subpatterns. For example, if the - string "the red king" is matched against the pattern + obtain numbers for capture groups. For example, if the string "the red + king" is matched against the pattern the ((red|white) (king|queen)) the captured substrings are "red king", "red", and "king", and are num- bered 1, 2, and 3, respectively. - The fact that plain parentheses fulfil two functions is not always - helpful. There are often times when a grouping subpattern is required - without a capturing requirement. If an opening parenthesis is followed - by a question mark and a colon, the subpattern does not do any captur- - ing, and is not counted when computing the number of any subsequent - capturing subpatterns. For example, if the string "the white queen" is - matched against the pattern + The fact that plain parentheses fulfil two functions is not always + helpful. There are often times when grouping is required without cap- + turing. If an opening parenthesis is followed by a question mark and a + colon, the group does not do any capturing, and is not counted when + computing the number of any subsequent capture groups. For example, if + the string "the white queen" is matched against the pattern the ((?:red|white) (king|queen)) the captured substrings are "white queen" and "queen", and are numbered - 1 and 2. The maximum number of capturing subpatterns is 65535. + 1 and 2. The maximum number of capture groups is 65535. As a convenient shorthand, if any option settings are required at the - start of a non-capturing subpattern, the option letters may appear - between the "?" and the ":". Thus the two patterns + start of a non-capturing group, the option letters may appear between + the "?" and the ":". Thus the two patterns (?i:saturday|sunday) (?:(?i)saturday|sunday) match exactly the same set of strings. Because alternative branches are tried from left to right, and options are not reset until the end of - the subpattern is reached, an option setting in one branch does affect - subsequent branches, so the above patterns match "SUNDAY" as well as - "Saturday". + the group is reached, an option setting in one branch does affect sub- + sequent branches, so the above patterns match "SUNDAY" as well as "Sat- + urday". -DUPLICATE SUBPATTERN NUMBERS +DUPLICATE GROUP NUMBERS - Perl 5.10 introduced a feature whereby each alternative in a subpattern - uses the same numbers for its capturing parentheses. Such a subpattern - starts with (?| and is itself a non-capturing subpattern. For example, - consider this pattern: + Perl 5.10 introduced a feature whereby each alternative in a group uses + the same numbers for its capturing parentheses. Such a group starts + with (?| and is itself a non-capturing group. For example, consider + this pattern: (?|(Sat)ur|(Sun))day @@ -7512,7 +7515,7 @@ DUPLICATE SUBPATTERN NUMBERS not all, of one of a number of alternatives. Inside a (?| group, paren- theses are numbered as usual, but the number is reset at the start of each branch. The numbers of any capturing parentheses that follow the - subpattern start after the highest number used in any branch. The fol- + whole group start after the highest number used in any branch. The fol- lowing example is taken from the Perl documentation. The numbers under- neath show in which buffer the captured content will be stored. @@ -7520,90 +7523,94 @@ DUPLICATE SUBPATTERN NUMBERS / ( a ) (?| x ( y ) z | (p (q) r) | (t) u (v) ) ( z ) /x # 1 2 2 3 2 3 4 - A backreference to a numbered subpattern uses the most recent value - that is set for that number by any subpattern. The following pattern - matches "abcabc" or "defdef": + A backreference to a capture group uses the most recent value that is + set for the group. The following pattern matches "abcabc" or "defdef": /(?|(abc)|(def))\1/ - In contrast, a subroutine call to a numbered subpattern always refers - to the first one in the pattern with the given number. The following - pattern matches "abcabc" or "defabc": + In contrast, a subroutine call to a capture group always refers to the + first one in the pattern with the given number. The following pattern + matches "abcabc" or "defabc": /(?|(abc)|(def))(?1)/ A relative reference such as (?-1) is no different: it is just a conve- nient way of computing an absolute group number. - If a condition test for a subpattern's having matched refers to a non- - unique number, the test is true if any of the subpatterns of that num- - ber have matched. + If a condition test for a group's having matched refers to a non-unique + number, the test is true if any group with that number has matched. An alternative approach to using this "branch reset" feature is to use - duplicate named subpatterns, as described in the next section. + duplicate named groups, as described in the next section. -NAMED SUBPATTERNS +NAMED CAPTURE GROUPS - Identifying capturing parentheses by number is simple, but it can be - very hard to keep track of the numbers in complicated patterns. Fur- - thermore, if an expression is modified, the numbers may change. To help - with this difficulty, PCRE2 supports the naming of capturing subpat- - terns. This feature was not added to Perl until release 5.10. Python - had the feature earlier, and PCRE1 introduced it at release 4.0, using - the Python syntax. PCRE2 supports both the Perl and the Python syntax. + Identifying capture groups by number is simple, but it can be very hard + to keep track of the numbers in complicated patterns. Furthermore, if + an expression is modified, the numbers may change. To help with this + difficulty, PCRE2 supports the naming of capture groups. This feature + was not added to Perl until release 5.10. Python had the feature ear- + lier, and PCRE1 introduced it at release 4.0, using the Python syntax. + PCRE2 supports both the Perl and the Python syntax. - In PCRE2, a capturing subpattern can be named in one of three ways: + In PCRE2, a capture group can be named in one of three ways: (?...) or (?'name'...) as in Perl, or (?P...) as in Python. - Names consist of up to 32 alphanumeric characters and underscores, but - must start with a non-digit. References to capturing parentheses from - other parts of the pattern, such as backreferences, recursion, and con- - ditions, can all be made by name as well as by number. + Names may be up to 32 code units long. When PCRE2_UTF is not set, they + may contain only ASCII alphanumeric characters and underscores, but + must start with a non-digit. When PCRE2_UTF is set, the syntax of group + names is extended to allow any Unicode letter or Unicode decimal digit. + In other words, group names must match one of these patterns: - Named capturing parentheses are allocated numbers as well as names, - exactly as if the names were not present. In both PCRE2 and Perl, cap- - turing subpatterns are primarily identified by numbers; any names are - just aliases for these numbers. The PCRE2 API provides function calls - for extracting the complete name-to-number translation table from a - compiled pattern, as well as convenience functions for extracting cap- - tured substrings by name. + ^[_A-Za-z][_A-Za-z0-9]*\z when PCRE2_UTF is not set + ^[_\p{L}][_\p{L}\p{Nd}]*\z when PCRE2_UTF is set - Warning: When more than one subpattern has the same number, as - described in the previous section, a name given to one of them applies - to all of them. Perl allows identically numbered subpatterns to have - different names. Consider this pattern, where there are two capturing - subpatterns, both numbered 1: + References to capture groups from other parts of the pattern, such as + backreferences, recursion, and conditions, can all be made by name as + well as by number. + + Named capture groups are allocated numbers as well as names, exactly as + if the names were not present. In both PCRE2 and Perl, capture groups + are primarily identified by numbers; any names are just aliases for + these numbers. The PCRE2 API provides function calls for extracting the + complete name-to-number translation table from a compiled pattern, as + well as convenience functions for extracting captured substrings by + name. + + Warning: When more than one capture group has the same number, as + described in the previous section, a name given to one of them applies + to all of them. Perl allows identically numbered groups to have differ- + ent names. Consider this pattern, where there are two capture groups, + both numbered 1: (?|(?aa)|(?bb)) - Perl allows this, with both names AA and BB as aliases of group 1. + Perl allows this, with both names AA and BB as aliases of group 1. Thus, after a successful match, both names yield the same value (either "aa" or "bb"). - In an attempt to reduce confusion, PCRE2 does not allow the same group + In an attempt to reduce confusion, PCRE2 does not allow the same group number to be associated with more than one name. The example above pro- - vokes a compile-time error. However, there is still scope for confu- + vokes a compile-time error. However, there is still scope for confu- sion. Consider this pattern: (?|(?aa)|(bb)) - Although the second subpattern number 1 is not explicitly named, the - name AA is still an alias for subpattern 1. Whether the pattern matches - "aa" or "bb", a reference by name to group AA yields the matched - string. + Although the second group number 1 is not explicitly named, the name AA + is still an alias for any group 1. Whether the pattern matches "aa" or + "bb", a reference by name to group AA yields the matched string. By default, a name must be unique within a pattern, except that dupli- - cate names are permitted for subpatterns with the same number, for - example: + cate names are permitted for groups with the same number, for example: (?|(?aa)|(?bb)) The duplicate name constraint can be disabled by setting the PCRE2_DUP- NAMES option at compile time, or by the use of (?J) within the pattern. - Duplicate names can be useful for patterns where only one instance of - the named parentheses can match. Suppose you want to match the name of - a weekday, either as a 3-letter abbreviation or as the full name, and - in both cases you want to extract the abbreviation. This pattern + Duplicate names can be useful for patterns where only one instance of + the named capture group can match. Suppose you want to match the name + of a weekday, either as a 3-letter abbreviation or as the full name, + and in both cases you want to extract the abbreviation. This pattern (ignoring the line breaks) does the job: (?Mon|Fri|Sun)(?:day)?| @@ -7612,33 +7619,32 @@ NAMED SUBPATTERNS (?Thu)(?:rsday)?| (?Sat)(?:urday)? - There are five capturing substrings, but only one is ever set after a - match. The convenience functions for extracting the data by name - returns the substring for the first (and in this example, the only) - subpattern of that name that matched. This saves searching to find - which numbered subpattern it was. (An alternative way of solving this - problem is to use a "branch reset" subpattern, as described in the pre- - vious section.) + There are five capture groups, but only one is ever set after a match. + The convenience functions for extracting the data by name returns the + substring for the first (and in this example, the only) group of that + name that matched. This saves searching to find which numbered group it + was. (An alternative way of solving this problem is to use a "branch + reset" group, as described in the previous section.) - If you make a backreference to a non-unique named subpattern from else- - where in the pattern, the subpatterns to which the name refers are - checked in the order in which they appear in the overall pattern. The - first one that is set is used for the reference. For example, this pat- - tern matches both "foofoo" and "barbar" but not "foobar" or "barfoo": + If you make a backreference to a non-unique named group from elsewhere + in the pattern, the groups to which the name refers are checked in the + order in which they appear in the overall pattern. The first one that + is set is used for the reference. For example, this pattern matches + both "foofoo" and "barbar" but not "foobar" or "barfoo": (?:(?foo)|(?bar))\k - If you make a subroutine call to a non-unique named subpattern, the one - that corresponds to the first occurrence of the name is used. In the - absence of duplicate numbers this is the one with the lowest number. + If you make a subroutine call to a non-unique named group, the one that + corresponds to the first occurrence of the name is used. In the absence + of duplicate numbers this is the one with the lowest number. If you use a named reference in a condition test (see the section about - conditions below), either to check whether a subpattern has matched, or - to check for recursion, all subpatterns with the same name are tested. - If the condition is true for any one of them, the overall condition is + conditions below), either to check whether a capture group has matched, + or to check for recursion, all groups with the same name are tested. If + the condition is true for any one of them, the overall condition is true. This is the same behaviour as testing by number. For further - details of the interfaces for handling named subpatterns, see the + details of the interfaces for handling named capture groups, see the pcre2api documentation. @@ -7650,18 +7656,18 @@ REPETITION a literal data character the dot metacharacter the \C escape sequence - the \X escape sequence the \R escape sequence + the \X escape sequence an escape such as \d or \pL that matches a single character a character class a backreference - a parenthesized subpattern (including most assertions) - a subroutine call to a subpattern (recursive or otherwise) + a parenthesized group (including most assertions) + a subroutine call (recursive or otherwise) The general repetition quantifier specifies a minimum and maximum num- ber of permitted matches, by giving the two numbers in curly brackets (braces), separated by a comma. The numbers must be less than 65536, - and the first must be less than or equal to the second. For example: + and the first must be less than or equal to the second. For example, z{2,4} @@ -7691,34 +7697,34 @@ REPETITION The quantifier {0} is permitted, causing the expression to behave as if the previous item and the quantifier were not present. This may be use- - ful for subpatterns that are referenced as subroutines from elsewhere - in the pattern (but see also the section entitled "Defining subpatterns - for use by reference only" below). Items other than subpatterns that - have a {0} quantifier are omitted from the compiled pattern. + ful for capture groups that are referenced as subroutines from else- + where in the pattern (but see also the section entitled "Defining cap- + ture groups for use by reference only" below). Except for parenthesized + groups, items that have a {0} quantifier are omitted from the compiled + pattern. - For convenience, the three most common quantifiers have single-charac- + For convenience, the three most common quantifiers have single-charac- ter abbreviations: * is equivalent to {0,} + is equivalent to {1,} ? is equivalent to {0,1} - It is possible to construct infinite loops by following a subpattern - that can match no characters with a quantifier that has no upper limit, - for example: + It is possible to construct infinite loops by following a group that + can match no characters with a quantifier that has no upper limit, for + example: (a?)* - Earlier versions of Perl and PCRE1 used to give an error at compile + Earlier versions of Perl and PCRE1 used to give an error at compile time for such patterns. However, because there are cases where this can be useful, such patterns are now accepted, but if any repetition of the - subpattern does in fact match no characters, the loop is forcibly bro- - ken. + group does in fact match no characters, the loop is forcibly broken. - By default, the quantifiers are "greedy", that is, they match as much - as possible (up to the maximum number of permitted times), without - causing the rest of the pattern to fail. The classic example of where - this gives problems is in trying to match comments in C programs. These + By default, quantifiers are "greedy", that is, they match as much as + possible (up to the maximum number of permitted times), without causing + the rest of the pattern to fail. The classic example of where this + gives problems is in trying to match comments in C programs. These appear between /* and */ and within the comment, individual * and / characters may appear. An attempt to match C comments by applying the pattern @@ -7730,11 +7736,9 @@ REPETITION /* first comment */ not comment /* second comment */ fails, because it matches the entire string owing to the greediness of - the .* item. - - If a quantifier is followed by a question mark, it ceases to be greedy, - and instead matches the minimum number of times possible, so the pat- - tern + the .* item. However, if a quantifier is followed by a question mark, + it ceases to be greedy, and instead matches the minimum number of times + possible, so the pattern /\*.*?\*/ @@ -7754,8 +7758,8 @@ REPETITION can be made greedy by following them with a question mark. In other words, it inverts the default behaviour. - When a parenthesized subpattern is quantified with a minimum repeat - count that is greater than 1 or with a limited maximum, more memory is + When a parenthesized group is quantified with a minimum repeat count + that is greater than 1 or with a limited maximum, more memory is required for the compiled pattern, in proportion to the size of the minimum or maximum. @@ -7791,15 +7795,15 @@ REPETITION trol verbs (*PRUNE) and (*SKIP) also disable this optimization, and there is an option, PCRE2_NO_DOTSTAR_ANCHOR, to do so explicitly. - When a capturing subpattern is repeated, the value captured is the sub- - string that matched the final iteration. For example, after + When a capture group is repeated, the value captured is the substring + that matched the final iteration. For example, after (tweedle[dume]{3}\s*)+ has matched "tweedledum tweedledee" the value of the captured substring - is "tweedledee". However, if there are nested capturing subpatterns, - the corresponding captured values may have been set in previous itera- - tions. For example, after + is "tweedledee". However, if there are nested capture groups, the cor- + responding captured values may have been set in previous iterations. + For example, after (a|(b))+ @@ -7825,8 +7829,8 @@ ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS action of the matcher is to try again with only 5 digits matching the \d+ item, and then with 4, and so on, before ultimately failing. "Atomic grouping" (a term taken from Jeffrey Friedl's book) provides - the means for specifying that once a subpattern has matched, it is not - to be re-evaluated in this way. + the means for specifying that once a group has matched, it is not to be + re-evaluated in this way. If we use atomic grouping for the previous example, the matcher gives up immediately on failing to match "foo" the first time. The notation @@ -7839,28 +7843,27 @@ ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS (*atomic:\d+)foo - This kind of parenthesis "locks up" the part of the pattern it con- - tains once it has matched, and a failure further into the pattern is + This kind of parenthesized group "locks up" the part of the pattern it + contains once it has matched, and a failure further into the pattern is prevented from backtracking into it. Backtracking past it to previous items, however, works as normal. - An alternative description is that a subpattern of this type matches - exactly the string of characters that an identical standalone pattern - would match, if anchored at the current point in the subject string. + An alternative description is that a group of this type matches exactly + the string of characters that an identical standalone pattern would + match, if anchored at the current point in the subject string. - Atomic grouping subpatterns are not capturing subpatterns. Simple cases - such as the above example can be thought of as a maximizing repeat that - must swallow everything it can. So, while both \d+ and \d+? are pre- - pared to adjust the number of digits they match in order to make the - rest of the pattern match, (?>\d+) can only match an entire sequence of - digits. + Atomic groups are not capture groups. Simple cases such as the above + example can be thought of as a maximizing repeat that must swallow + everything it can. So, while both \d+ and \d+? are prepared to adjust + the number of digits they match in order to make the rest of the pat- + tern match, (?>\d+) can only match an entire sequence of digits. - Atomic groups in general can of course contain arbitrarily complicated - subpatterns, and can be nested. However, when the subpattern for an - atomic group is just a single repeated item, as in the example above, a - simpler notation, called a "possessive quantifier" can be used. This - consists of an additional + character following a quantifier. Using - this notation, the previous example can be rewritten as + Atomic groups in general can of course contain arbitrarily complicated + expressions, and can be nested. However, when the contents of an atomic + group is just a single repeated item, as in the example above, a sim- + pler notation, called a "possessive quantifier" can be used. This con- + sists of an additional + character following a quantifier. Using this + notation, the previous example can be rewritten as \d++foo @@ -7869,46 +7872,46 @@ ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS (abc|xyz){2,3}+ - Possessive quantifiers are always greedy; the setting of the - PCRE2_UNGREEDY option is ignored. They are a convenient notation for - the simpler forms of atomic group. However, there is no difference in + Possessive quantifiers are always greedy; the setting of the + PCRE2_UNGREEDY option is ignored. They are a convenient notation for + the simpler forms of atomic group. However, there is no difference in the meaning of a possessive quantifier and the equivalent atomic group, - though there may be a performance difference; possessive quantifiers + though there may be a performance difference; possessive quantifiers should be slightly faster. - The possessive quantifier syntax is an extension to the Perl 5.8 syn- - tax. Jeffrey Friedl originated the idea (and the name) in the first + The possessive quantifier syntax is an extension to the Perl 5.8 syn- + tax. Jeffrey Friedl originated the idea (and the name) in the first edition of his book. Mike McCloskey liked it, so implemented it when he - built Sun's Java package, and PCRE1 copied it from there. It ultimately - found its way into Perl at release 5.10. + built Sun's Java package, and PCRE1 copied it from there. It found its + way into Perl at release 5.10. - PCRE2 has an optimization that automatically "possessifies" certain - simple pattern constructs. For example, the sequence A+B is treated as - A++B because there is no point in backtracking into a sequence of A's + PCRE2 has an optimization that automatically "possessifies" certain + simple pattern constructs. For example, the sequence A+B is treated as + A++B because there is no point in backtracking into a sequence of A's when B must follow. This feature can be disabled by the PCRE2_NO_AUTO- POSSESS option, or starting the pattern with (*NO_AUTO_POSSESS). - When a pattern contains an unlimited repeat inside a subpattern that - can itself be repeated an unlimited number of times, the use of an - atomic group is the only way to avoid some failing matches taking a - very long time indeed. The pattern + When a pattern contains an unlimited repeat inside a group that can + itself be repeated an unlimited number of times, the use of an atomic + group is the only way to avoid some failing matches taking a very long + time indeed. The pattern (\D+|<\d+>)*[!?] - matches an unlimited number of substrings that either consist of non- - digits, or digits enclosed in <>, followed by either ! or ?. When it + matches an unlimited number of substrings that either consist of non- + digits, or digits enclosed in <>, followed by either ! or ?. When it matches, it runs quickly. However, if it is applied to aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - it takes a long time before reporting failure. This is because the - string can be divided between the internal \D+ repeat and the external - * repeat in a large number of ways, and all have to be tried. (The - example uses [!?] rather than a single character at the end, because - both PCRE2 and Perl have an optimization that allows for fast failure - when a single character is used. They remember the last single charac- - ter that is required for a match, and fail early if it is not present - in the string.) If the pattern is changed so that it uses an atomic + it takes a long time before reporting failure. This is because the + string can be divided between the internal \D+ repeat and the external + * repeat in a large number of ways, and all have to be tried. (The + example uses [!?] rather than a single character at the end, because + both PCRE2 and Perl have an optimization that allows for fast failure + when a single character is used. They remember the last single charac- + ter that is required for a match, and fail early if it is not present + in the string.) If the pattern is changed so that it uses an atomic group, like this: ((?>\D+)|<\d+>)*[!?] @@ -7919,26 +7922,25 @@ ATOMIC GROUPING AND POSSESSIVE QUANTIFIERS BACKREFERENCES Outside a character class, a backslash followed by a digit greater than - 0 (and possibly further digits) is a backreference to a capturing sub- - pattern earlier (that is, to its left) in the pattern, provided there - have been that many previous capturing left parentheses. + 0 (and possibly further digits) is a backreference to a capture group + earlier (that is, to its left) in the pattern, provided there have been + that many previous capture groups. - However, if the decimal number following the backslash is less than 8, - it is always taken as a backreference, and causes an error only if - there are not that many capturing left parentheses in the entire pat- - tern. In other words, the parentheses that are referenced need not be - to the left of the reference for numbers less than 8. A "forward back- - reference" of this type can make sense when a repetition is involved - and the subpattern to the right has participated in an earlier itera- - tion. + However, if the decimal number following the backslash is less than 8, + it is always taken as a backreference, and causes an error only if + there are not that many capture groups in the entire pattern. In other + words, the group that is referenced need not be to the left of the ref- + erence for numbers less than 8. A "forward backreference" of this type + can make sense when a repetition is involved and the group to the right + has participated in an earlier iteration. It is not possible to have a numerical "forward backreference" to a - subpattern whose number is 8 or more using this syntax because a - sequence such as \50 is interpreted as a character defined in octal. - See the subsection entitled "Non-printing characters" above for further - details of the handling of digits following a backslash. There is no - such problem when named parentheses are used. A backreference to any - subpattern is possible using named parentheses (see below). + group whose number is 8 or more using this syntax because a sequence + such as \50 is interpreted as a character defined in octal. See the + subsection entitled "Non-printing characters" above for further details + of the handling of digits following a backslash. Other forms of back- + referencing do not suffer from this restriction. In particular, there + is no problem when named capture groups are used (see below). Another way of avoiding the ambiguity inherent in the use of digits following a backslash is to use the \g escape sequence. This escape @@ -7956,21 +7958,21 @@ BACKREFERENCES (abc(def)ghi)\g{-1} - The sequence \g{-1} is a reference to the most recently started captur- - ing subpattern before \g, that is, is it equivalent to \2 in this exam- - ple. Similarly, \g{-2} would be equivalent to \1. The use of relative - references can be helpful in long patterns, and also in patterns that - are created by joining together fragments that contain references - within themselves. + The sequence \g{-1} is a reference to the most recently started capture + group before \g, that is, is it equivalent to \2 in this example. Simi- + larly, \g{-2} would be equivalent to \1. The use of relative references + can be helpful in long patterns, and also in patterns that are created + by joining together fragments that contain references within them- + selves. - The sequence \g{+1} is a reference to the next capturing subpattern. - This kind of forward reference can be useful it patterns that repeat. - Perl does not support the use of + in this way. + The sequence \g{+1} is a reference to the next capture group. This kind + of forward reference can be useful in patterns that repeat. Perl does + not support the use of + in this way. - A backreference matches whatever actually matched the capturing subpat- - tern in the current subject string, rather than anything matching the - subpattern itself (see "Subpatterns as subroutines" below for a way of - doing that). So the pattern + A backreference matches whatever actually most recently matched the + capture group in the current subject string, rather than anything at + all that matches the group (see "Groups as subroutines" below for a way + of doing that). So the pattern (sens|respons)e and \1ibility @@ -7982,26 +7984,26 @@ BACKREFERENCES ((?i)rah)\s+\1 matches "rah rah" and "RAH RAH", but not "RAH rah", even though the - original capturing subpattern is matched caselessly. + original capture group is matched caselessly. There are several different ways of writing backreferences to named - subpatterns. The .NET syntax \k{name} and the Perl syntax \k or - \k'name' are supported, as is the Python syntax (?P=name). Perl 5.10's - unified backreference syntax, in which \g can be used for both numeric - and named references, is also supported. We could rewrite the above - example in any of the following ways: + capture groups. The .NET syntax \k{name} and the Perl syntax \k + or \k'name' are supported, as is the Python syntax (?P=name). Perl + 5.10's unified backreference syntax, in which \g can be used for both + numeric and named references, is also supported. We could rewrite the + above example in any of the following ways: (?(?i)rah)\s+\k (?'p1'(?i)rah)\s+\k{p1} (?P(?i)rah)\s+(?P=p1) (?(?i)rah)\s+\g{p1} - A subpattern that is referenced by name may appear in the pattern + A capture group that is referenced by name may appear in the pattern before or after the reference. - There may be more than one backreference to the same subpattern. If a - subpattern has not actually been used in a particular match, any back- - references to it always fail by default. For example, the pattern + There may be more than one backreference to the same group. If a group + has not actually been used in a particular match, backreferences to it + always fail by default. For example, the pattern (a|(bc))\2 @@ -8009,90 +8011,88 @@ BACKREFERENCES the PCRE2_MATCH_UNSET_BACKREF option is set at compile time, a backref- erence to an unset value matches an empty string. - Because there may be many capturing parentheses in a pattern, all dig- - its following a backslash are taken as part of a potential backrefer- - ence number. If the pattern continues with a digit character, some - delimiter must be used to terminate the backreference. If the - PCRE2_EXTENDED or PCRE2_EXTENDED_MORE option is set, this can be white - space. Otherwise, the \g{ syntax or an empty comment (see "Comments" - below) can be used. + Because there may be many capture groups in a pattern, all digits fol- + lowing a backslash are taken as part of a potential backreference num- + ber. If the pattern continues with a digit character, some delimiter + must be used to terminate the backreference. If the PCRE2_EXTENDED or + PCRE2_EXTENDED_MORE option is set, this can be white space. Otherwise, + the \g{} syntax or an empty comment (see "Comments" below) can be used. Recursive backreferences - A backreference that occurs inside the parentheses to which it refers - fails when the subpattern is first used, so, for example, (a\1) never - matches. However, such references can be useful inside repeated sub- - patterns. For example, the pattern + A backreference that occurs inside the group to which it refers fails + when the group is first used, so, for example, (a\1) never matches. + However, such references can be useful inside repeated groups. For + example, the pattern (a|b\1)+ matches any number of "a"s and also "aba", "ababbaa" etc. At each iter- - ation of the subpattern, the backreference matches the character string - corresponding to the previous iteration. In order for this to work, the - pattern must be such that the first iteration does not need to match - the backreference. This can be done using alternation, as in the exam- + ation of the group, the backreference matches the character string cor- + responding to the previous iteration. In order for this to work, the + pattern must be such that the first iteration does not need to match + the backreference. This can be done using alternation, as in the exam- ple above, or by a quantifier with a minimum of zero. - Backreferences of this type cause the group that they reference to be - treated as an atomic group. Once the whole group has been matched, a - subsequent matching failure cannot cause backtracking into the middle + Backreferences of this type cause the group that they reference to be + treated as an atomic group. Once the whole group has been matched, a + subsequent matching failure cannot cause backtracking into the middle of the group. ASSERTIONS - An assertion is a test on the characters following or preceding the + An assertion is a test on the characters following or preceding the current matching point that does not consume any characters. The simple - assertions coded as \b, \B, \A, \G, \Z, \z, ^ and $ are described + assertions coded as \b, \B, \A, \G, \Z, \z, ^ and $ are described above. - More complicated assertions are coded as subpatterns. There are two - kinds: those that look ahead of the current position in the subject - string, and those that look behind it, and in each case an assertion - may be positive (must match for the assertion to be true) or negative - (must not match for the assertion to be true). An assertion subpattern - is matched in the normal way, and if it is true, matching continues - after it, but with the matching position in the subject string is was - it was before the assertion was processed. + More complicated assertions are coded as parenthesized groups. There + are two kinds: those that look ahead of the current position in the + subject string, and those that look behind it, and in each case an + assertion may be positive (must match for the assertion to be true) or + negative (must not match for the assertion to be true). An assertion + group is matched in the normal way, and if it is true, matching contin- + ues after it, but with the matching position in the subject string is + was it was before the assertion was processed. - A lookaround assertion may also appear as the condition in a condi- - tional subpattern (see below). In this case, the result of matching the + A lookaround assertion may also appear as the condition in a condi- + tional group (see below). In this case, the result of matching the assertion determines which branch of the condition is followed. - Assertion subpatterns are not capturing subpatterns. If an assertion - contains capturing subpatterns within it, these are counted for the - purposes of numbering the capturing subpatterns in the whole pattern. - Within each branch of an assertion, locally captured substrings may be - referenced in the usual way. For example, a sequence such as (.)\g{-1} - can be used to check that two adjacent characters are the same. + Assertion groups are not capture groups. If an assertion contains cap- + ture groups within it, these are counted for the purposes of numbering + the capture groups in the whole pattern. Within each branch of an + assertion, locally captured substrings may be referenced in the usual + way. For example, a sequence such as (.)\g{-1} can be used to check + that two adjacent characters are the same. - When a branch within an assertion fails to match, any substrings that - were captured are discarded (as happens with any pattern branch that - fails to match). A negative assertion is true only when all its + When a branch within an assertion fails to match, any substrings that + were captured are discarded (as happens with any pattern branch that + fails to match). A negative assertion is true only when all its branches fail to match; this means that no captured substrings are ever - retained after a successful negative assertion. When an assertion con- + retained after a successful negative assertion. When an assertion con- tains a matching branch, what happens depends on the type of assertion. - For a positive assertion, internally captured substrings in the suc- - cessful branch are retained, and matching continues with the next pat- - tern item after the assertion. For a negative assertion, a matching - branch means that the assertion is not true. If such an assertion is - being used as a condition in a conditional subpattern (see below), cap- - tured substrings are retained, because matching continues with the "no" + For a positive assertion, internally captured substrings in the suc- + cessful branch are retained, and matching continues with the next pat- + tern item after the assertion. For a negative assertion, a matching + branch means that the assertion is not true. If such an assertion is + being used as a condition in a conditional group (see below), captured + substrings are retained, because matching continues with the "no" branch of the condition. For other failing negative assertions, control passes to the previous backtracking point, thus discarding any captured strings within the assertion. - For compatibility with Perl, most assertion subpatterns may be - repeated; though it makes no sense to assert the same thing several - times, the side effect of capturing parentheses may occasionally be - useful. However, an assertion that forms the condition for a condi- - tional subpattern may not be quantified. In practice, for other asser- - tions, there only three cases: + For compatibility with Perl, most assertion groups may be repeated; + though it makes no sense to assert the same thing several times, the + side effect of capturing may occasionally be useful. However, an asser- + tion that forms the condition for a conditional group may not be quan- + tified. In practice, for other assertions, there only three cases: (1) If the quantifier is {0}, the assertion is never obeyed during - matching. However, it may contain internal capturing parenthesized - groups that are called from elsewhere via the subroutine mechanism. + matching. However, it may contain internal capture groups that are + called from elsewhere via the subroutine mechanism. (2) If quantifier is {0,n} where n is greater than zero, it is treated as if it were {0,1}. At run time, the rest of the pattern match is @@ -8116,9 +8116,9 @@ ASSERTIONS (*positive_lookbehind: or (*plb: is the same as (?<= (*negative_lookbehind: or (*nlb: is the same as (?)...) or (?('name')...) to test for a - used subpattern by name. For compatibility with earlier versions of - PCRE1, which had this facility before Perl, the syntax (?(name)...) is - also recognized. Note, however, that undelimited names consisting of - the letter R followed by digits are ambiguous (see the following sec- - tion). - - Rewriting the above example to use a named subpattern gives this: + Perl uses the syntax (?()...) or (?('name')...) to test for a + used capture group by name. For compatibility with earlier versions of + PCRE1, which had this facility before Perl, the syntax (?(name)...) is + also recognized. Note, however, that undelimited names consisting of + the letter R followed by digits are ambiguous (see the following sec- + tion). Rewriting the above example to use a named group gives this: (? \( )? [^()]+ (?() \) ) - If the name used in a condition of this kind is a duplicate, the test - is applied to all subpatterns of the same name, and is true if any one - of them has matched. + If the name used in a condition of this kind is a duplicate, the test + is applied to all groups of the same name, and is true if any one of + them has matched. Checking for pattern recursion - "Recursion" in this sense refers to any subroutine-like call from one - part of the pattern to another, whether or not it is actually recur- - sive. See the sections entitled "Recursive patterns" and "Subpatterns - as subroutines" below for details of recursion and subpattern calls. + "Recursion" in this sense refers to any subroutine-like call from one + part of the pattern to another, whether or not it is actually recur- + sive. See the sections entitled "Recursive patterns" and "Groups as + subroutines" below for details of recursion and subroutine calls. - If a condition is the string (R), and there is no subpattern with the - name R, the condition is true if matching is currently in a recursion - or subroutine call to the whole pattern or any subpattern. If digits - follow the letter R, and there is no subpattern with that name, the - condition is true if the most recent call is into a subpattern with the - given number, which must exist somewhere in the overall pattern. This + If a condition is the string (R), and there is no capture group with + the name R, the condition is true if matching is currently in a recur- + sion or subroutine call to the whole pattern or any capture group. If + digits follow the letter R, and there is no group with that name, the + condition is true if the most recent call is into a group with the + given number, which must exist somewhere in the overall pattern. This is a contrived example that is equivalent to a+b: ((?(R1)a+|(?1)b)) - However, in both cases, if there is a subpattern with a matching name, - the condition tests for its being set, as described in the section - above, instead of testing for recursion. For example, creating a group - with the name R1 by adding (?) to the above pattern completely - changes its meaning. + However, in both cases, if there is a capture group with a matching + name, the condition tests for its being set, as described in the sec- + tion above, instead of testing for recursion. For example, creating a + group with the name R1 by adding (?) to the above pattern com- + pletely changes its meaning. If a name preceded by ampersand follows the letter R, for example: (?(R&name)...) - the condition is true if the most recent recursion is into a subpattern - of that name (which must exist within the pattern). + the condition is true if the most recent recursion is into a group of + that name (which must exist within the pattern). This condition does not check the entire recursion stack. It tests only - the current level. If the name used in a condition of this kind is a - duplicate, the test is applied to all subpatterns of the same name, and - is true if any one of them is the most recent recursion. + the current level. If the name used in a condition of this kind is a + duplicate, the test is applied to all groups of the same name, and is + true if any one of them is the most recent recursion. At "top level", all these recursion test conditions are false. - Defining subpatterns for use by reference only + Defining capture groups for use by reference only If the condition is the string (DEFINE), the condition is always false, - even if there is a group with the name DEFINE. In this case, there may - be only one alternative in the subpattern. It is always skipped if con- - trol reaches this point in the pattern; the idea of DEFINE is that it - can be used to define subroutines that can be referenced from else- - where. (The use of subroutines is described below.) For example, a pat- - tern to match an IPv4 address such as "192.168.23.245" could be written - like this (ignore white space and line breaks): + even if there is a group with the name DEFINE. In this case, there may + be only one alternative in the rest of the conditional group. It is + always skipped if control reaches this point in the pattern; the idea + of DEFINE is that it can be used to define subroutines that can be ref- + erenced from elsewhere. (The use of subroutines is described below.) + For example, a pattern to match an IPv4 address such as + "192.168.23.245" could be written like this (ignore white space and + line breaks): (?(DEFINE) (? 2[0-4]\d | 25[0-5] | 1\d\d | [1-9]?\d) ) \b (?&byte) (\.(?&byte)){3} \b @@ -8488,71 +8486,72 @@ CONDITIONAL SUBPATTERNS Assertion conditions - If the condition is not in any of the above formats, it must be an - assertion. This may be a positive or negative lookahead or lookbehind - assertion. Consider this pattern, again containing non-significant - white space, and with the two alternatives on the second line: + If the condition is not in any of the above formats, it must be a + parenthesized assertion. This may be a positive or negative lookahead + or lookbehind assertion. Consider this pattern, again containing non- + significant white space, and with the two alternatives on the second + line: (?(?=[^a-z]*[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) - The condition is a positive lookahead assertion that matches an - optional sequence of non-letters followed by a letter. In other words, - it tests for the presence of at least one letter in the subject. If a - letter is found, the subject is matched against the first alternative; - otherwise it is matched against the second. This pattern matches - strings in one of the two forms dd-aaa-dd or dd-dd-dd, where aaa are + The condition is a positive lookahead assertion that matches an + optional sequence of non-letters followed by a letter. In other words, + it tests for the presence of at least one letter in the subject. If a + letter is found, the subject is matched against the first alternative; + otherwise it is matched against the second. This pattern matches + strings in one of the two forms dd-aaa-dd or dd-dd-dd, where aaa are letters and dd are digits. - When an assertion that is a condition contains capturing subpatterns, - any capturing that occurs in a matching branch is retained afterwards, - for both positive and negative assertions, because matching always con- - tinues after the assertion, whether it succeeds or fails. (Compare non- - conditional assertions, when captures are retained only for positive - assertions that succeed.) + When an assertion that is a condition contains capture groups, any cap- + turing that occurs in a matching branch is retained afterwards, for + both positive and negative assertions, because matching always contin- + ues after the assertion, whether it succeeds or fails. (Compare non- + conditional assertions, for which captures are retained only for posi- + tive assertions that succeed.) COMMENTS There are two ways of including comments in patterns that are processed - by PCRE2. In both cases, the start of the comment must not be in a - character class, nor in the middle of any other sequence of related - characters such as (?: or a subpattern name or number. The characters - that make up a comment play no part in the pattern matching. + by PCRE2. In both cases, the start of the comment must not be in a + character class, nor in the middle of any other sequence of related + characters such as (?: or a group name or number. The characters that + make up a comment play no part in the pattern matching. - The sequence (?# marks the start of a comment that continues up to the - next closing parenthesis. Nested parentheses are not permitted. If the - PCRE2_EXTENDED or PCRE2_EXTENDED_MORE option is set, an unescaped # - character also introduces a comment, which in this case continues to - immediately after the next newline character or character sequence in + The sequence (?# marks the start of a comment that continues up to the + next closing parenthesis. Nested parentheses are not permitted. If the + PCRE2_EXTENDED or PCRE2_EXTENDED_MORE option is set, an unescaped # + character also introduces a comment, which in this case continues to + immediately after the next newline character or character sequence in the pattern. Which characters are interpreted as newlines is controlled - by an option passed to the compiling function or by a special sequence + by an option passed to the compiling function or by a special sequence at the start of the pattern, as described in the section entitled "New- line conventions" above. Note that the end of this type of comment is a - literal newline sequence in the pattern; escape sequences that happen + literal newline sequence in the pattern; escape sequences that happen to represent a newline do not count. For example, consider this pattern - when PCRE2_EXTENDED is set, and the default newline convention (a sin- + when PCRE2_EXTENDED is set, and the default newline convention (a sin- gle linefeed character) is in force: abc #comment \n still comment - On encountering the # character, pcre2_compile() skips along, looking - for a newline in the pattern. The sequence \n is still literal at this - stage, so it does not terminate the comment. Only an actual character + On encountering the # character, pcre2_compile() skips along, looking + for a newline in the pattern. The sequence \n is still literal at this + stage, so it does not terminate the comment. Only an actual character with the code value 0x0a (the default newline) does so. RECURSIVE PATTERNS - Consider the problem of matching a string in parentheses, allowing for - unlimited nested parentheses. Without the use of recursion, the best - that can be done is to use a pattern that matches up to some fixed - depth of nesting. It is not possible to handle an arbitrary nesting + Consider the problem of matching a string in parentheses, allowing for + unlimited nested parentheses. Without the use of recursion, the best + that can be done is to use a pattern that matches up to some fixed + depth of nesting. It is not possible to handle an arbitrary nesting depth. For some time, Perl has provided a facility that allows regular expres- - sions to recurse (amongst other things). It does this by interpolating - Perl code in the expression at run time, and the code can refer to the + sions to recurse (amongst other things). It does this by interpolating + Perl code in the expression at run time, and the code can refer to the expression itself. A Perl pattern using code interpolation to solve the parentheses problem can be created like this: @@ -8562,64 +8561,63 @@ RECURSIVE PATTERNS refers recursively to the pattern in which it appears. Obviously, PCRE2 cannot support the interpolation of Perl code. - Instead, it supports special syntax for recursion of the entire pat- - tern, and also for individual subpattern recursion. After its introduc- - tion in PCRE1 and Python, this kind of recursion was subsequently + Instead, it supports special syntax for recursion of the entire pat- + tern, and also for individual capture group recursion. After its intro- + duction in PCRE1 and Python, this kind of recursion was subsequently introduced into Perl at release 5.10. - A special item that consists of (? followed by a number greater than - zero and a closing parenthesis is a recursive subroutine call of the - subpattern of the given number, provided that it occurs inside that - subpattern. (If not, it is a non-recursive subroutine call, which is - described in the next section.) The special item (?R) or (?0) is a + A special item that consists of (? followed by a number greater than + zero and a closing parenthesis is a recursive subroutine call of the + capture group of the given number, provided that it occurs inside that + group. (If not, it is a non-recursive subroutine call, which is + described in the next section.) The special item (?R) or (?0) is a recursive call of the entire regular expression. - This PCRE2 pattern solves the nested parentheses problem (assume the + This PCRE2 pattern solves the nested parentheses problem (assume the PCRE2_EXTENDED option is set so that white space is ignored): \( ( [^()]++ | (?R) )* \) - First it matches an opening parenthesis. Then it matches any number of - substrings which can either be a sequence of non-parentheses, or a - recursive match of the pattern itself (that is, a correctly parenthe- + First it matches an opening parenthesis. Then it matches any number of + substrings which can either be a sequence of non-parentheses, or a + recursive match of the pattern itself (that is, a correctly parenthe- sized substring). Finally there is a closing parenthesis. Note the use of a possessive quantifier to avoid backtracking into sequences of non- parentheses. - If this were part of a larger pattern, you would not want to recurse + If this were part of a larger pattern, you would not want to recurse the entire pattern, so instead you could use this: ( \( ( [^()]++ | (?1) )* \) ) - We have put the pattern into parentheses, and caused the recursion to + We have put the pattern into parentheses, and caused the recursion to refer to them instead of the whole pattern. - In a larger pattern, keeping track of parenthesis numbers can be - tricky. This is made easier by the use of relative references. Instead + In a larger pattern, keeping track of parenthesis numbers can be + tricky. This is made easier by the use of relative references. Instead of (?1) in the pattern above you can write (?-2) to refer to the second - most recently opened parentheses preceding the recursion. In other - words, a negative number counts capturing parentheses leftwards from + most recently opened parentheses preceding the recursion. In other + words, a negative number counts capturing parentheses leftwards from the point at which it is encountered. - Be aware however, that if duplicate subpattern numbers are in use, rel- - ative references refer to the earliest subpattern with the appropriate + Be aware however, that if duplicate capture group numbers are in use, + relative references refer to the earliest group with the appropriate number. Consider, for example: (?|(a)|(b)) (c) (?-2) - The first two capturing groups (a) and (b) are both numbered 1, and - group (c) is number 2. When the reference (?-2) is encountered, the - second most recently opened parentheses has the number 1, but it is the - first such group (the (a) group) to which the recursion refers. This - would be the same if an absolute reference (?1) was used. In other - words, relative references are just a shorthand for computing a group - number. + The first two capture groups (a) and (b) are both numbered 1, and group + (c) is number 2. When the reference (?-2) is encountered, the second + most recently opened parentheses has the number 1, but it is the first + such group (the (a) group) to which the recursion refers. This would be + the same if an absolute reference (?1) was used. In other words, rela- + tive references are just a shorthand for computing a group number. - It is also possible to refer to subsequently opened parentheses, by - writing references such as (?+2). However, these cannot be recursive - because the reference is not inside the parentheses that are refer- - enced. They are always non-recursive subroutine calls, as described in - the next section. + It is also possible to refer to subsequent capture groups, by writing + references such as (?+2). However, these cannot be recursive because + the reference is not inside the parentheses that are referenced. They + are always non-recursive subroutine calls, as described in the next + section. An alternative approach is to use named parentheses. The Perl syntax for this is (?&name); PCRE1's earlier syntax (?P>name) is also sup- @@ -8627,8 +8625,8 @@ RECURSIVE PATTERNS (? \( ( [^()]++ | (?&pn) )* \) ) - If there is more than one subpattern with the same name, the earliest - one is used. + If there is more than one group with the same name, the earliest one is + used. The example pattern that we have been looking at contains nested unlim- ited repeats, and so the use of a possessive quantifier for matching @@ -8650,10 +8648,10 @@ RECURSIVE PATTERNS (ab(cd)ef) the value for the inner capturing parentheses (numbered 2) is "ef", - which is the last value taken on at the top level. If a capturing sub- - pattern is not matched at the top level, its final captured value is - unset, even if it was (temporarily) set at a deeper level during the - matching process. + which is the last value taken on at the top level. If a capture group + is not matched at the top level, its final captured value is unset, + even if it was (temporarily) set at a deeper level during the matching + process. Do not confuse the (?R) item with the condition (R), which tests for recursion. Consider this pattern, which matches text in angle brack- @@ -8663,16 +8661,16 @@ RECURSIVE PATTERNS < (?: (?(R) \d++ | [^<>]*+) | (?R)) * > - In this pattern, (?(R) is the start of a conditional subpattern, with - two different alternatives for the recursive and non-recursive cases. - The (?R) item is the actual recursive call. + In this pattern, (?(R) is the start of a conditional group, with two + different alternatives for the recursive and non-recursive cases. The + (?R) item is the actual recursive call. Differences in recursion processing between PCRE2 and Perl Some former differences between PCRE2 and Perl no longer exist. Before release 10.30, recursion processing in PCRE2 differed from Perl - in that a recursive subpattern call was always treated as an atomic + in that a recursive subroutine call was always treated as an atomic group. That is, once it had matched some of the subject string, it was never re-entered, even if it contained untried alternatives and there was a subsequent matching failure. (Historical note: PCRE implemented @@ -8709,10 +8707,10 @@ RECURSIVE PATTERNS Another way in which PCRE2 and Perl used to differ in their recursion processing is in the handling of captured values. Formerly in Perl, - when a subpattern was called recursively or as a subpattern (see the - next section), it had no access to any values that were captured out- - side the recursion, whereas in PCRE2 these values can be referenced. - Consider this pattern: + when a group was called recursively or as a subroutine (see the next + section), it had no access to any values that were captured outside the + recursion, whereas in PCRE2 these values can be referenced. Consider + this pattern: ^(.)(\1|a(?2)) @@ -8723,15 +8721,15 @@ RECURSIVE PATTERNS to fail in Perl, but in later versions (I tried 5.024) it now works. -SUBPATTERNS AS SUBROUTINES +GROUPS AS SUBROUTINES - If the syntax for a recursive subpattern call (either by number or by - name) is used outside the parentheses to which it refers, it operates a - bit like a subroutine in a programming language. More accurately, PCRE2 - treats the referenced subpattern as an independent subpattern which it - tries to match at the current matching position. The called subpattern - may be defined before or after the reference. A numbered reference can - be absolute or relative, as in these examples: + If the syntax for a recursive group call (either by number or by name) + is used outside the parentheses to which it refers, it operates a bit + like a subroutine in a programming language. More accurately, PCRE2 + treats the referenced group as an independent subpattern which it tries + to match at the current matching position. The called group may be + defined before or after the reference. A numbered reference can be + absolute or relative, as in these examples: (...(absolute)...)...(?2)... (...(relative)...)...(?-1)... @@ -8755,27 +8753,27 @@ SUBPATTERNS AS SUBROUTINES calls can now occur. However, any capturing parentheses that are set during the subroutine call revert to their previous values afterwards. - Processing options such as case-independence are fixed when a subpat- - tern is defined, so if it is used as a subroutine, such options cannot - be changed for different calls. For example, consider this pattern: + Processing options such as case-independence are fixed when a group is + defined, so if it is used as a subroutine, such options cannot be + changed for different calls. For example, consider this pattern: (abc)(?i:(?-1)) It matches "abcabc". It does not match "abcABC" because the change of - processing option does not affect the called subpattern. + processing option does not affect the called group. - The behaviour of backtracking control verbs in subpatterns when called - as subroutines is described in the section entitled "Backtracking verbs - in subroutines" below. + The behaviour of backtracking control verbs in groups when called as + subroutines is described in the section entitled "Backtracking verbs in + subroutines" below. ONIGURUMA SUBROUTINE SYNTAX For compatibility with Oniguruma, the non-Perl syntax \g followed by a name or a number enclosed either in angle brackets or single quotes, is - an alternative syntax for referencing a subpattern as a subroutine, - possibly recursively. Here are two of the examples used above, rewrit- - ten using this syntax: + an alternative syntax for calling a group as a subroutine, possibly + recursively. Here are two of the examples used above, rewritten using + this syntax: (? \( ( (?>[^()]+) | \g )* \) ) (sens|respons)e and \g'1'ibility @@ -8905,8 +8903,8 @@ BACKTRACKING CONTROL by the DFA matching function. The behaviour of these verbs in repeated groups, assertions, and in - subpatterns called as subroutines (whether or not recursively) is docu- - mented below. + capture groups called as subroutines (whether or not recursively) is + documented below. Optimizations that affect backtracking verbs @@ -8931,8 +8929,8 @@ BACKTRACKING CONTROL (*ACCEPT) or (*ACCEPT:NAME) This verb causes the match to end successfully, skipping the remainder - of the pattern. However, when it is inside a subpattern that is called - as a subroutine, only that subpattern is ended successfully. Matching + of the pattern. However, when it is inside a capture group that is + called as a subroutine, only that group is ended successfully. Matching then continues at the outer level. If (*ACCEPT) in triggered in a posi- tive assertion, the assertion succeeds; in a negative assertion, the assertion fails. @@ -8945,8 +8943,8 @@ BACKTRACKING CONTROL This matches "AB", "AAD", or "ACD"; when it matches "AB", "B" is cap- tured by the outer parentheses. - Warning: (*ACCEPT) should not be used within a script run subpattern, - because it causes an immediate exit from the subpattern, bypassing the + Warning: (*ACCEPT) should not be used within a script run group, + because it causes an immediate exit from the group, bypassing the script run checking. (*FAIL) or (*FAIL:NAME) @@ -9184,10 +9182,10 @@ BACKTRACKING CONTROL to the caller. However, (*SKIP:NAME) searches only for names set with (*MARK), ignoring those set by other backtracking verbs. - A subpattern that does not contain a | character is just a part of the + A group that does not contain a | character is just a part of the enclosing alternative; it is not a nested alternation with only one - alternative. The effect of (*THEN) extends beyond such a subpattern to - the enclosing alternative. Consider this pattern, where A, B, etc. are + alternative. The effect of (*THEN) extends beyond such a group to the + enclosing alternative. Consider this pattern, where A, B, etc. are complex pattern fragments that do not contain any | characters at this level: @@ -9195,20 +9193,20 @@ BACKTRACKING CONTROL If A and B are matched, but there is a failure in C, matching does not backtrack into A; instead it moves to the next alternative, that is, D. - However, if the subpattern containing (*THEN) is given an alternative, - it behaves differently: + However, if the group containing (*THEN) is given an alternative, it + behaves differently: A (B(*THEN)C | (*FAIL)) | D - The effect of (*THEN) is now confined to the inner subpattern. After a - failure in C, matching moves to (*FAIL), which causes the whole subpat- - tern to fail because there are no more alternatives to try. In this - case, matching does now backtrack into A. + The effect of (*THEN) is now confined to the inner group. After a fail- + ure in C, matching moves to (*FAIL), which causes the whole group to + fail because there are no more alternatives to try. In this case, + matching does backtrack into A. - Note that a conditional subpattern is not considered as having two - alternatives, because only one is ever used. In other words, the | - character in a conditional subpattern has a different meaning. Ignoring - white space, consider: + Note that a conditional group is not considered as having two alterna- + tives, because only one is ever used. In other words, the | character + in a conditional group has a different meaning. Ignoring white space, + consider: ^.*? (?(?=a) a | b(*THEN)c ) @@ -9216,10 +9214,10 @@ BACKTRACKING CONTROL ungreedy, it initially matches zero characters. The condition (?=a) then fails, the character "b" is matched, but "c" is not. At this point, matching does not backtrack to .*? as might perhaps be expected - from the presence of the | character. The conditional subpattern is - part of the single alternative that comprises the whole pattern, and so - the match fails. (If there was a backtrack into .*?, allowing it to - match "b", the match would succeed.) + from the presence of the | character. The conditional group is part of + the single alternative that comprises the whole pattern, and so the + match fails. (If there was a backtrack into .*?, allowing it to match + "b", the match would succeed.) The verbs just described provide four different "strengths" of control when subsequent matching fails. (*THEN) is the weakest, carrying on the @@ -9266,7 +9264,7 @@ BACKTRACKING CONTROL (*FAIL) in any assertion has its normal effect: it forces an immediate backtrack. The behaviour of the other backtracking verbs depends on whether or not the assertion is standalone or acting as the condition - in a conditional subpattern. + in a conditional group. (*ACCEPT) in a standalone positive assertion causes the assertion to succeed without any further processing; captured strings and a mark @@ -9299,26 +9297,24 @@ BACKTRACKING CONTROL Backtracking verbs in subroutines - These behaviours occur whether or not the subpattern is called recur- - sively. + These behaviours occur whether or not the group is called recursively. - (*ACCEPT) in a subpattern called as a subroutine causes the subroutine - match to succeed without any further processing. Matching then contin- - ues after the subroutine call. Perl documents this behaviour. Perl's - treatment of the other verbs in subroutines is different in some cases. + (*ACCEPT) in a group called as a subroutine causes the subroutine match + to succeed without any further processing. Matching then continues + after the subroutine call. Perl documents this behaviour. Perl's treat- + ment of the other verbs in subroutines is different in some cases. - (*FAIL) in a subpattern called as a subroutine has its normal effect: - it forces an immediate backtrack. + (*FAIL) in a group called as a subroutine has its normal effect: it + forces an immediate backtrack. - (*COMMIT), (*SKIP), and (*PRUNE) cause the subroutine match to fail - when triggered by being backtracked to in a subpattern called as a sub- - routine. There is then a backtrack at the outer level. + (*COMMIT), (*SKIP), and (*PRUNE) cause the subroutine match to fail + when triggered by being backtracked to in a group called as a subrou- + tine. There is then a backtrack at the outer level. (*THEN), when triggered, skips to the next alternative in the innermost - enclosing group within the subpattern that has alternatives (its normal - behaviour). However, if there is no such group within the subroutine - subpattern, the subroutine match fails and there is a backtrack at the - outer level. + enclosing group that has alternatives (its normal behaviour). However, + if there is no such group within the subroutine's group, the subroutine + match fails and there is a backtrack at the outer level. SEE ALSO @@ -9336,8 +9332,8 @@ AUTHOR REVISION - Last updated: 27 November 2018 - Copyright (c) 1997-2018 University of Cambridge. + Last updated: 04 February 2019 + Copyright (c) 1997-2019 University of Cambridge. ------------------------------------------------------------------------------ @@ -9361,9 +9357,9 @@ COMPILED PATTERN MEMORY USAGE code, so that most simple patterns do not use much memory for storing the compiled version. However, there is one case where the memory usage of a compiled pattern can be unexpectedly large. If a parenthesized - subpattern has a quantifier with a minimum greater than 1 and/or a lim- - ited maximum, the whole subpattern is repeated in the compiled code. - For example, the pattern + group has a quantifier with a minimum greater than 1 and/or a limited + maximum, the whole group is repeated in the compiled code. For example, + the pattern (abc|def){2,4} @@ -9571,8 +9567,8 @@ AUTHOR REVISION - Last updated: 25 April 2018 - Copyright (c) 1997-2018 University of Cambridge. + Last updated: 03 February 2019 + Copyright (c) 1997-2019 University of Cambridge. ------------------------------------------------------------------------------ @@ -10441,19 +10437,23 @@ ALTERNATION CAPTURING - (...) capturing group - (?...) named capturing group (Perl) - (?'name'...) named capturing group (Perl) - (?P...) named capturing group (Python) - (?:...) non-capturing group - (?|...) non-capturing group; reset group numbers for - capturing groups in each alternative + (...) capture group + (?...) named capture group (Perl) + (?'name'...) named capture group (Perl) + (?P...) named capture group (Python) + (?:...) non-capture group + (?|...) non-capture group; reset group numbers for + capture groups in each alternative + + In non-UTF modes, names may contain underscores and ASCII letters and + digits; in UTF modes, any Unicode letters and Unicode decimal digits + are permitted. In both cases, a name must not start with a digit. ATOMIC GROUPS - (?>...) atomic, non-capturing group - (*atomic:...) atomic, non-capturing group + (?>...) atomic non-capture group + (*atomic:...) atomic non-capture group COMMENT @@ -10480,7 +10480,7 @@ OPTION SETTING a mixture of setting and unsetting such as (?i-x) is allowed, but there may be only one hyphen. Setting (but no unsetting) is allowed after (?^ for example (?^in). An option setting may appear at the start of a non- - capturing group, for example (?i:...). + capture group, for example (?i:...). The following are recognized only at the very start of a pattern or after one of the newline or \R options with similar syntax. More than @@ -10577,19 +10577,19 @@ BACKREFERENCES SUBROUTINE REFERENCES (POSSIBLY RECURSIVE) (?R) recurse whole pattern - (?n) call subpattern by absolute number - (?+n) call subpattern by relative number - (?-n) call subpattern by relative number - (?&name) call subpattern by name (Perl) - (?P>name) call subpattern by name (Python) - \g call subpattern by name (Oniguruma) - \g'name' call subpattern by name (Oniguruma) - \g call subpattern by absolute number (Oniguruma) - \g'n' call subpattern by absolute number (Oniguruma) - \g<+n> call subpattern by relative number (PCRE2 extension) - \g'+n' call subpattern by relative number (PCRE2 extension) - \g<-n> call subpattern by relative number (PCRE2 extension) - \g'-n' call subpattern by relative number (PCRE2 extension) + (?n) call subroutine by absolute number + (?+n) call subroutine by relative number + (?-n) call subroutine by relative number + (?&name) call subroutine by name (Perl) + (?P>name) call subroutine by name (Python) + \g call subroutine by name (Oniguruma) + \g'name' call subroutine by name (Oniguruma) + \g call subroutine by absolute number (Oniguruma) + \g'n' call subroutine by absolute number (Oniguruma) + \g<+n> call subroutine by relative number (PCRE2 extension) + \g'+n' call subroutine by relative number (PCRE2 extension) + \g<-n> call subroutine by relative number (PCRE2 extension) + \g'-n' call subroutine by relative number (PCRE2 extension) CONDITIONAL PATTERNS @@ -10606,7 +10606,7 @@ CONDITIONAL PATTERNS (?(R) overall recursion condition (?(Rn) specific numbered group recursion condition (?(R&name) specific named group recursion condition - (?(DEFINE) define subpattern for reference + (?(DEFINE) define groups for reference (?(VERSION[>]=n.m) test PCRE2 version (?(assert) assertion condition @@ -10670,8 +10670,8 @@ AUTHOR REVISION - Last updated: 10 October 2018 - Copyright (c) 1997-2018 University of Cambridge. + Last updated: 03 February 2019 + Copyright (c) 1997-2019 University of Cambridge. ------------------------------------------------------------------------------ @@ -10704,66 +10704,73 @@ UNICODE AND UTF SUPPORT UNICODE PROPERTY SUPPORT When PCRE2 is built with Unicode support, the escape sequences \p{..}, - \P{..}, and \X can be used. The Unicode 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, the Unicode script names such - as Arabic or Han, and the derived properties Any and L&. Full lists are - given in the pcre2pattern and pcre2syntax documentation. Only the short - names for properties are supported. For example, \p{L} matches a let- - ter. Its Perl synonym, \p{Letter}, is not supported. Furthermore, in - Perl, many properties may optionally be prefixed by "Is", for compati- - bility with Perl 5.6. PCRE2 does not support this. + \P{..}, and \X can be used. This is not dependent on the PCRE2_UTF set- + ting. The Unicode 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, the Unicode script names such as Arabic or Han, + and the derived properties Any and L&. Full lists are given in the + pcre2pattern and pcre2syntax documentation. Only the short names for + properties are supported. For example, \p{L} matches a letter. Its Perl + synonym, \p{Letter}, is not supported. Furthermore, in Perl, many + properties may optionally be prefixed by "Is", for compatibility with + Perl 5.6. PCRE2 does not support this. WIDE CHARACTERS AND UTF MODES Code points less than 256 can be specified in patterns by either braced or unbraced hexadecimal escape sequences (for example, \x{b3} or \xb3). - Larger values have to use braced sequences. Unbraced octal code points + Larger values have to use braced sequences. Unbraced octal code points up to \777 are also recognized; larger ones can be coded using \o{...}. - The escape sequence \N{U+} is recognized as another way of - specifying a Unicode character by code point in a UTF mode. It is not + The escape sequence \N{U+} is recognized as another way of + specifying a Unicode character by code point in a UTF mode. It is not allowed in non-UTF modes. - In UTF modes, repeat quantifiers apply to complete UTF characters, not + In UTF modes, repeat quantifiers apply to complete UTF characters, not to individual code units. - In UTF modes, the dot metacharacter matches one UTF character instead + In UTF modes, the dot metacharacter matches one UTF character instead of a single code unit. + In UTF modes, capture group names are not restricted to ASCII, and may + contain any Unicode letters and decimal digits, as well as underscore. + The escape sequence \C can be used to match a single code unit in a UTF mode, but its use can lead to some strange effects because it breaks up multi-unit characters (see the description of \C in the pcre2pattern - documentation). + documentation). For this reason, there is a build-time option that dis- + ables support for \C completely. There is also a less draconian com- + pile-time option for locking out the use of \C when a pattern is com- + piled. - The use of \C is not supported by the alternative matching function + The use of \C is not supported by the alternative matching function pcre2_dfa_match() when in UTF-8 or UTF-16 mode, that is, when a charac- - ter may consist of more than one code unit. The use of \C in these - modes provokes a match-time error. Also, the JIT optimization does not + ter may consist of more than one code unit. The use of \C in these + modes provokes a match-time error. Also, the JIT optimization does not support \C in these modes. If JIT optimization is requested for a UTF-8 - or UTF-16 pattern that contains \C, it will not succeed, and so when + or UTF-16 pattern that contains \C, it will not succeed, and so when pcre2_match() is called, the matching will be carried out by the normal interpretive function. The character escapes \b, \B, \d, \D, \s, \S, \w, and \W correctly test - characters of any code value, but, by default, the characters that - PCRE2 recognizes as digits, spaces, or word characters remain the same - set as in non-UTF mode, all with code points less than 256. This - remains true even when PCRE2 is built to include Unicode support, - because to do otherwise would slow down matching in many common cases. - Note that this also applies to \b and \B, because they are defined in - terms of \w and \W. If you want to test for a wider sense of, say, - "digit", you can use explicit Unicode property tests such as \p{Nd}. - Alternatively, if you set the PCRE2_UCP option, the way that the char- - acter escapes work is changed so that Unicode properties are used to + characters of any code value, but, by default, the characters that + PCRE2 recognizes as digits, spaces, or word characters remain the same + set as in non-UTF mode, all with code points less than 256. This + remains true even when PCRE2 is built to include Unicode support, + because to do otherwise would slow down matching in many common cases. + Note that this also applies to \b and \B, because they are defined in + terms of \w and \W. If you want to test for a wider sense of, say, + "digit", you can use explicit Unicode property tests such as \p{Nd}. + Alternatively, if you set the PCRE2_UCP option, the way that the char- + acter escapes work is changed so that Unicode properties are used to determine which characters match. There are more details in the section on generic character types in the pcre2pattern documentation. - Similarly, characters that match the POSIX named character classes are + Similarly, characters that match the POSIX named character classes are all low-valued characters, unless the PCRE2_UCP option is set. - However, the special horizontal and vertical white space matching + However, the special horizontal and vertical white space matching escapes (\h, \H, \v, and \V) do match all the appropriate Unicode char- acters, whether or not PCRE2_UCP is set. @@ -10773,170 +10780,170 @@ CASE-EQUIVALENCE IN UTF MODES Case-insensitive matching in a UTF mode makes use of Unicode properties except for characters whose code points are less than 128 and that have at most two case-equivalent values. For these, a direct table lookup is - used for speed. A few Unicode characters such as Greek sigma have more + used for speed. A few Unicode characters such as Greek sigma have more than two code points that are case-equivalent, and these are treated as such. SCRIPT RUNS - The pattern constructs (*script_run:...) and (*atomic_script_run:...), - with synonyms (*sr:...) and (*asr:...), verify that the string matched - within the parentheses is a script run. In concept, a script run is a - sequence of characters that are all from the same Unicode script. How- + The pattern constructs (*script_run:...) and (*atomic_script_run:...), + with synonyms (*sr:...) and (*asr:...), verify that the string matched + within the parentheses is a script run. In concept, a script run is a + sequence of characters that are all from the same Unicode script. How- ever, because some scripts are commonly used together, and because some - diacritical and other marks are used with multiple scripts, it is not + diacritical and other marks are used with multiple scripts, it is not that simple. Every Unicode character has a Script property, mostly with a value cor- - responding to the name of a script, such as Latin, Greek, or Cyrillic. + responding to the name of a script, such as Latin, Greek, or Cyrillic. There are also three special values: "Unknown" is used for code points that have not been assigned, and also - for the surrogate code points. In the PCRE2 32-bit library, characters - whose code points are greater than the Unicode maximum (U+10FFFF), - which are accessible only in non-UTF mode, are assigned the Unknown + for the surrogate code points. In the PCRE2 32-bit library, characters + whose code points are greater than the Unicode maximum (U+10FFFF), + which are accessible only in non-UTF mode, are assigned the Unknown script. - "Common" is used for characters that are used with many scripts. These - include punctuation, emoji, mathematical, musical, and currency sym- + "Common" is used for characters that are used with many scripts. These + include punctuation, emoji, mathematical, musical, and currency sym- bols, and the ASCII digits 0 to 9. - "Inherited" is used for characters such as diacritical marks that mod- + "Inherited" is used for characters such as diacritical marks that mod- ify a previous character. These are considered to take on the script of the character that they modify. - Some Inherited characters are used with many scripts, but many of them - are only normally used with a small number of scripts. For example, + Some Inherited characters are used with many scripts, but many of them + are only normally used with a small number of scripts. For example, U+102E0 (Coptic Epact thousands mark) is used only with Arabic and Cop- - tic. In order to make it possible to check this, a Unicode property - called Script Extension exists. Its value is a list of scripts that - apply to the character. For the majority of characters, the list con- - tains just one script, the same one as the Script property. However, - for characters such as U+102E0 more than one Script is listed. There - are also some Common characters that have a single, non-Common script + tic. In order to make it possible to check this, a Unicode property + called Script Extension exists. Its value is a list of scripts that + apply to the character. For the majority of characters, the list con- + tains just one script, the same one as the Script property. However, + for characters such as U+102E0 more than one Script is listed. There + are also some Common characters that have a single, non-Common script in their Script Extension list. The next section describes the basic rules for deciding whether a given - string of characters is a script run. Note, however, that there are - some special cases involving the Chinese Han script, and an additional - constraint for decimal digits. These are covered in subsequent sec- + string of characters is a script run. Note, however, that there are + some special cases involving the Chinese Han script, and an additional + constraint for decimal digits. These are covered in subsequent sec- tions. Basic script run rules A string that is less than two characters long is a script run. This is - the only case in which an Unknown character can be part of a script - run. Longer strings are checked using only the Script Extensions prop- + the only case in which an Unknown character can be part of a script + run. Longer strings are checked using only the Script Extensions prop- erty, not the basic Script property. - If a character's Script Extension property is the single value "Inher- + If a character's Script Extension property is the single value "Inher- ited", it is always accepted as part of a script run. This is also true - for the property "Common", subject to the checking of decimal digits + for the property "Common", subject to the checking of decimal digits described below. All the remaining characters in a script run must have - at least one script in common in their Script Extension lists. In set- + at least one script in common in their Script Extension lists. In set- theoretic terminology, the intersection of all the sets of scripts must not be empty. - A simple example is an Internet name such as "google.com". The letters + A simple example is an Internet name such as "google.com". The letters are all in the Latin script, and the dot is Common, so this string is a script run. However, the Cyrillic letter "o" looks exactly the same as - the Latin "o"; a string that looks the same, but with Cyrillic "o"s is + the Latin "o"; a string that looks the same, but with Cyrillic "o"s is not a script run. - More interesting examples involve characters with more than one script + More interesting examples involve characters with more than one script in their Script Extension. Consider the following characters: U+060C Arabic comma U+06D4 Arabic full stop - The first has the Script Extension list Arabic, Hanifi Rohingya, Syr- - iac, and Thaana; the second has just Arabic and Hanifi Rohingya. Both - of them could appear in script runs of either Arabic or Hanifi - Rohingya. The first could also appear in Syriac or Thaana script runs, + The first has the Script Extension list Arabic, Hanifi Rohingya, Syr- + iac, and Thaana; the second has just Arabic and Hanifi Rohingya. Both + of them could appear in script runs of either Arabic or Hanifi + Rohingya. The first could also appear in Syriac or Thaana script runs, but the second could not. The Chinese Han script - The Chinese Han script is commonly used in conjunction with other - scripts for writing certain languages. Japanese uses the Hiragana and - Katakana scripts together with Han; Korean uses Hangul and Han; Tai- - wanese Mandarin uses Bopomofo and Han. These three combinations are - treated as special cases when checking script runs and are, in effect, - "virtual scripts". Thus, a script run may contain a mixture of Hira- - gana, Katakana, and Han, or a mixture of Hangul and Han, or a mixture - of Bopomofo and Han, but not, for example, a mixture of Hangul and - Bopomofo and Han. PCRE2 (like Perl) follows Unicode's Technical Stan- + The Chinese Han script is commonly used in conjunction with other + scripts for writing certain languages. Japanese uses the Hiragana and + Katakana scripts together with Han; Korean uses Hangul and Han; Tai- + wanese Mandarin uses Bopomofo and Han. These three combinations are + treated as special cases when checking script runs and are, in effect, + "virtual scripts". Thus, a script run may contain a mixture of Hira- + gana, Katakana, and Han, or a mixture of Hangul and Han, or a mixture + of Bopomofo and Han, but not, for example, a mixture of Hangul and + Bopomofo and Han. PCRE2 (like Perl) follows Unicode's Technical Stan- dard 39 ("Unicode Security Mechanisms", http://uni- code.org/reports/tr39/) in allowing such mixtures. Decimal digits - Unicode contains many sets of 10 decimal digits in different scripts, - and some scripts (including the Common script) contain more than one - set. Some of these decimal digits them are visually indistinguishable - from the common ASCII digits. In addition to the script checking + Unicode contains many sets of 10 decimal digits in different scripts, + and some scripts (including the Common script) contain more than one + set. Some of these decimal digits them are visually indistinguishable + from the common ASCII digits. In addition to the script checking described above, if a script run contains any decimal digits, they must all come from the same set of 10 adjacent characters. VALIDITY OF UTF STRINGS - When the PCRE2_UTF option is set, the strings passed as patterns and + When the PCRE2_UTF option is set, the strings passed as patterns and subjects are (by default) checked for validity on entry to the relevant - functions. If an invalid UTF string is passed, an negative error code - is returned. The code unit offset to the offending character can be - extracted from the match data block by calling pcre2_get_startchar(), + functions. If an invalid UTF string is passed, an negative error code + is returned. The code unit offset to the offending character can be + extracted from the match data block by calling pcre2_get_startchar(), which is used for this purpose after a UTF error. UTF-16 and UTF-32 strings can indicate their endianness by special code - knows as a byte-order mark (BOM). The PCRE2 functions do not handle + knows as a byte-order mark (BOM). The PCRE2 functions do not handle this, expecting strings to be in host byte order. A UTF string is checked before any other processing takes place. In the - case of pcre2_match() and pcre2_dfa_match() calls with a non-zero - starting offset, the check is applied only to that part of the subject - that could be inspected during matching, and there is a check that the - starting offset points to the first code unit of a character or to the - end of the subject. If there are no lookbehind assertions in the pat- - tern, the check starts at the starting offset. Otherwise, it starts at - the length of the longest lookbehind before the starting offset, or at - the start of the subject if there are not that many characters before - the starting offset. Note that the sequences \b and \B are one-charac- + case of pcre2_match() and pcre2_dfa_match() calls with a non-zero + starting offset, the check is applied only to that part of the subject + that could be inspected during matching, and there is a check that the + starting offset points to the first code unit of a character or to the + end of the subject. If there are no lookbehind assertions in the pat- + tern, the check starts at the starting offset. Otherwise, it starts at + the length of the longest lookbehind before the starting offset, or at + the start of the subject if there are not that many characters before + the starting offset. Note that the sequences \b and \B are one-charac- ter lookbehinds. - In addition to checking the format of the string, there is a check to + In addition to checking the format of the string, there is a check to ensure that all code points lie in the range U+0 to U+10FFFF, excluding - the surrogate area. The so-called "non-character" code points are not + the surrogate area. The so-called "non-character" code points are not excluded because Unicode corrigendum #9 makes it clear that they should not be. - Characters in the "Surrogate Area" of Unicode are reserved for use by - UTF-16, where they are used in pairs to encode code points with values - greater than 0xFFFF. The code points that are encoded by UTF-16 pairs - are available independently in the UTF-8 and UTF-32 encodings. (In - other words, the whole surrogate thing is a fudge for UTF-16 which + Characters in the "Surrogate Area" of Unicode are reserved for use by + UTF-16, where they are used in pairs to encode code points with values + greater than 0xFFFF. The code points that are encoded by UTF-16 pairs + are available independently in the UTF-8 and UTF-32 encodings. (In + other words, the whole surrogate thing is a fudge for UTF-16 which unfortunately messes up UTF-8 and UTF-32.) - In some situations, you may already know that your strings are valid, - and therefore want to skip these checks in order to improve perfor- - mance, for example in the case of a long subject string that is being - scanned repeatedly. If you set the PCRE2_NO_UTF_CHECK option at com- - pile time or at match time, PCRE2 assumes that the pattern or subject + In some situations, you may already know that your strings are valid, + and therefore want to skip these checks in order to improve perfor- + mance, for example in the case of a long subject string that is being + scanned repeatedly. If you set the PCRE2_NO_UTF_CHECK option at com- + pile time or at match time, PCRE2 assumes that the pattern or subject it is given (respectively) contains only valid UTF code unit sequences. - Passing PCRE2_NO_UTF_CHECK to pcre2_compile() just disables the check + Passing PCRE2_NO_UTF_CHECK to pcre2_compile() just disables the check for the pattern; it does not also apply to subject strings. If you want - to disable the check for a subject string you must pass this option to + to disable the check for a subject string you must pass this option to pcre2_match() or pcre2_dfa_match(). - If you pass an invalid UTF string when PCRE2_NO_UTF_CHECK is set, the + If you pass an invalid UTF string when PCRE2_NO_UTF_CHECK is set, the result is undefined and your program may crash or loop indefinitely. - Note that setting PCRE2_NO_UTF_CHECK at compile time does not disable - the error that is given if an escape sequence for an invalid Unicode - code point is encountered in the pattern. If you want to allow escape - sequences such as \x{d800} (a surrogate code point) you can set the + Note that setting PCRE2_NO_UTF_CHECK at compile time does not disable + the error that is given if an escape sequence for an invalid Unicode + code point is encountered in the pattern. If you want to allow escape + sequences such as \x{d800} (a surrogate code point) you can set the PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES extra option. However, this is pos- sible only in UTF-8 and UTF-32 modes, because these values are not rep- resentable in UTF-16. @@ -10951,10 +10958,10 @@ VALIDITY OF UTF STRINGS PCRE2_ERROR_UTF8_ERR4 PCRE2_ERROR_UTF8_ERR5 - The string ends with a truncated UTF-8 character; the code specifies - how many bytes are missing (1 to 5). Although RFC 3629 restricts UTF-8 - characters to be no longer than 4 bytes, the encoding scheme (origi- - nally defined by RFC 2279) allows for up to 6 bytes, and this is + The string ends with a truncated UTF-8 character; the code specifies + how many bytes are missing (1 to 5). Although RFC 3629 restricts UTF-8 + characters to be no longer than 4 bytes, the encoding scheme (origi- + nally defined by RFC 2279) allows for up to 6 bytes, and this is checked first; hence the possibility of 4 or 5 missing bytes. PCRE2_ERROR_UTF8_ERR6 @@ -10964,24 +10971,24 @@ VALIDITY OF UTF STRINGS PCRE2_ERROR_UTF8_ERR10 The two most significant bits of the 2nd, 3rd, 4th, 5th, or 6th byte of - the character do not have the binary value 0b10 (that is, either the + the character do not have the binary value 0b10 (that is, either the most significant bit is 0, or the next bit is 1). PCRE2_ERROR_UTF8_ERR11 PCRE2_ERROR_UTF8_ERR12 - A character that is valid by the RFC 2279 rules is either 5 or 6 bytes + A character that is valid by the RFC 2279 rules is either 5 or 6 bytes long; these code points are excluded by RFC 3629. PCRE2_ERROR_UTF8_ERR13 - A 4-byte character has a value greater than 0x10fff; these code points + A 4-byte character has a value greater than 0x10fff; these code points are excluded by RFC 3629. PCRE2_ERROR_UTF8_ERR14 - A 3-byte character has a value in the range 0xd800 to 0xdfff; this - range of code points are reserved by RFC 3629 for use with UTF-16, and + A 3-byte character has a value in the range 0xd800 to 0xdfff; this + range of code points are reserved by RFC 3629 for use with UTF-16, and so are excluded from UTF-8. PCRE2_ERROR_UTF8_ERR15 @@ -10990,26 +10997,26 @@ VALIDITY OF UTF STRINGS PCRE2_ERROR_UTF8_ERR18 PCRE2_ERROR_UTF8_ERR19 - A 2-, 3-, 4-, 5-, or 6-byte character is "overlong", that is, it codes - for a value that can be represented by fewer bytes, which is invalid. - For example, the two bytes 0xc0, 0xae give the value 0x2e, whose cor- + A 2-, 3-, 4-, 5-, or 6-byte character is "overlong", that is, it codes + for a value that can be represented by fewer bytes, which is invalid. + For example, the two bytes 0xc0, 0xae give the value 0x2e, whose cor- rect coding uses just one byte. PCRE2_ERROR_UTF8_ERR20 The two most significant bits of the first byte of a character have the - binary value 0b10 (that is, the most significant bit is 1 and the sec- - ond is 0). Such a byte can only validly occur as the second or subse- + binary value 0b10 (that is, the most significant bit is 1 and the sec- + ond is 0). Such a byte can only validly occur as the second or subse- quent byte of a multi-byte character. PCRE2_ERROR_UTF8_ERR21 - The first byte of a character has the value 0xfe or 0xff. These values + The first byte of a character has the value 0xfe or 0xff. These values can never occur in a valid UTF-8 string. Errors in UTF-16 strings - The following negative error codes are given for invalid UTF-16 + The following negative error codes are given for invalid UTF-16 strings: PCRE2_ERROR_UTF16_ERR1 Missing low surrogate at end of string @@ -11019,7 +11026,7 @@ VALIDITY OF UTF STRINGS Errors in UTF-32 strings - The following negative error codes are given for invalid UTF-32 + The following negative error codes are given for invalid UTF-32 strings: PCRE2_ERROR_UTF32_ERR1 Surrogate character (0xd800 to 0xdfff) @@ -11035,8 +11042,8 @@ AUTHOR REVISION - Last updated: 12 October 2018 - Copyright (c) 1997-2018 University of Cambridge. + Last updated: 03 February 2019 + Copyright (c) 1997-2019 University of Cambridge. ------------------------------------------------------------------------------ diff --git a/doc/pcre2_substring_nametable_scan.3 b/doc/pcre2_substring_nametable_scan.3 index 4342f98..9ab58cd 100644 --- a/doc/pcre2_substring_nametable_scan.3 +++ b/doc/pcre2_substring_nametable_scan.3 @@ -1,4 +1,4 @@ -.TH PCRE2_SUBSTRING_NAMETABLE_SCAN 3 "21 October 2014" "PCRE2 10.00" +.TH PCRE2_SUBSTRING_NAMETABLE_SCAN 3 "03 February 2019" "PCRE2 10.33" .SH NAME PCRE2 - Perl-compatible regular expressions (revised API) .SH SYNOPSIS @@ -15,8 +15,8 @@ PCRE2 - Perl-compatible regular expressions (revised API) .rs .sp This convenience function finds, for a compiled pattern, the first and last -entries for a given name in the table that translates capturing parenthesis -names into numbers. +entries for a given name in the table that translates capture group names into +numbers. .sp \fIcode\fP Compiled regular expression \fIname\fP Name whose entries required diff --git a/doc/pcre2api.3 b/doc/pcre2api.3 index f20de25..5c9fe82 100644 --- a/doc/pcre2api.3 +++ b/doc/pcre2api.3 @@ -1,4 +1,4 @@ -.TH PCRE2API 3 "04 January 2019" "PCRE2 10.33" +.TH PCRE2API 3 "04 February 2019" "PCRE2 10.33" .SH NAME PCRE2 - Perl-compatible regular expressions (revised API) .sp @@ -1429,10 +1429,10 @@ independent of the setting of PCRE2_DOTALL. .sp PCRE2_DUPNAMES .sp -If this bit is set, names used to identify capturing subpatterns need not be -unique. This can be helpful for certain types of pattern when it is known that -only one instance of the named subpattern can ever be matched. There are more -details of named subpatterns below; see also the +If this bit is set, names used to identify capture groups need not be unique. +This can be helpful for certain types of pattern when it is known that only one +instance of the named group can ever be matched. There are more details of +named capture groups below; see also the .\" HREF \fBpcre2pattern\fP .\" @@ -1466,11 +1466,11 @@ the end of the subject. If this bit is set, most white space characters in the pattern are totally ignored except when escaped or inside a character class. However, white space is not allowed within sequences such as (?> that introduce various -parenthesized subpatterns, nor within numerical quantifiers such as {1,3}. -Ignorable white space is permitted between an item and a following quantifier -and between a quantifier and a following + that indicates possessiveness. -PCRE2_EXTENDED is equivalent to Perl's /x option, and it can be changed within -a pattern by a (?x) option setting. +parenthesized groups, nor within numerical quantifiers such as {1,3}. Ignorable +white space is permitted between an item and a following quantifier and between +a quantifier and a following + that indicates possessiveness. PCRE2_EXTENDED is +equivalent to Perl's /x option, and it can be changed within a pattern by a +(?x) option setting. .P When PCRE2 is compiled without Unicode support, PCRE2_EXTENDED recognizes as white space only those characters with code points less than 256 that are @@ -1547,7 +1547,7 @@ error. .sp PCRE2_MATCH_UNSET_BACKREF .sp -If this option is set, a backreference to an unset subpattern group matches an +If this option is set, a backreference to an unset capture group matches an empty string (by default this causes the current matching alternative to fail). A pattern such as (\e1)(a) succeeds when this option is set (assuming it can find an "a" in the subject), whereas it fails by default, for Perl @@ -1608,7 +1608,7 @@ If this option is set, it disables the use of numbered capturing parentheses 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). This is the same as Perl's /n option. -Note that, when this option is set, references to capturing groups +Note that, when this option is set, references to capture groups (backreferences or recursion/subroutine calls) may only refer to named groups, though the reference can be by name or by number. .sp @@ -1627,7 +1627,7 @@ purposes. If this option is set, it disables an optimization that is applied when .* is the first significant item in a top-level branch of a pattern, and all the other branches also start with .* or with \eA or \eG or ^. The optimization is -automatically disabled for .* if it is inside an atomic group or a capturing +automatically disabled for .* if it is inside an atomic group or a capture group that is the subject of a backreference, or if the pattern contains (*PRUNE) or (*SKIP). When the optimization is not disabled, such a pattern is automatically anchored if PCRE2_DOTALL is set for all the .* items and @@ -2025,7 +2025,7 @@ following are true: .sp .* is not in an atomic group .\" JOIN - .* is not in a capturing group that is the subject + .* is not in a capture group that is the subject of a backreference PCRE2_DOTALL is in force for .* Neither (*PRUNE) nor (*SKIP) appears in the pattern @@ -2037,12 +2037,12 @@ options returned for PCRE2_INFO_ALLOPTIONS. PCRE2_INFO_BACKREFMAX .sp Return the number of the highest backreference in the pattern. The third -argument should point to an \fBuint32_t\fP variable. Named subpatterns acquire -numbers as well as names, and these count towards the highest backreference. -Backreferences such as \e4 or \eg{12} match the captured characters of the -given group, but in addition, the check that a capturing group is set in a -conditional subpattern such as (?(3)a|b) is also a backreference. Zero is -returned if there are no backreferences. +argument should point to an \fBuint32_t\fP variable. Named capture groups +acquire numbers as well as names, and these count towards the highest +backreference. Backreferences such as \e4 or \eg{12} match the captured +characters of the given group, but in addition, the check that a capture +group is set in a conditional group such as (?(3)a|b) is also a backreference. +Zero is returned if there are no backreferences. .sp PCRE2_INFO_BSR .sp @@ -2053,9 +2053,9 @@ that \eR matches only CR, LF, or CRLF. .sp PCRE2_INFO_CAPTURECOUNT .sp -Return the highest capturing subpattern number in the pattern. In patterns -where (?| is not used, this is also the total number of capturing subpatterns. -The third argument should point to an \fBuint32_t\fP variable. +Return the highest capture group number in the pattern. In patterns where (?| +is not used, this is also the total number of capture groups. The third +argument should point to an \fBuint32_t\fP variable. .sp PCRE2_INFO_DEPTHLIMIT .sp @@ -2103,7 +2103,7 @@ Return the size (in bytes) of the data frames that are used to remember backtracking positions when the pattern is processed by \fBpcre2_match()\fP without the use of JIT. The third argument should point to a \fBsize_t\fP variable. The frame size depends on the number of capturing parentheses in the -pattern. Each additional capturing group adds two PCRE2_SIZE variables. +pattern. Each additional capture group adds two PCRE2_SIZE variables. .sp PCRE2_INFO_HASBACKSLASHC .sp @@ -2224,11 +2224,11 @@ library, the pointer points to 32-bit code units, the first of which contains the parenthesis number. The rest of the entry is the corresponding name, zero terminated. .P -The names are in alphabetical order. If (?| is used to create multiple groups -with the same number, as described in the -.\" HTML +The names are in alphabetical order. If (?| is used to create multiple capture +groups with the same number, as described in the +.\" HTML .\" -section on duplicate subpattern numbers +section on duplicate group numbers .\" in the .\" HREF @@ -2237,11 +2237,11 @@ in the page, the groups may be given the same name, but there is only one entry in the table. Different names for groups of the same number are not permitted. .P -Duplicate names for subpatterns with different numbers are permitted, but only -if PCRE2_DUPNAMES is set. They appear in the table in the order in which they -were found in the pattern. In the absence of (?| this is the order of +Duplicate names for capture groups with different numbers are permitted, but +only if PCRE2_DUPNAMES is set. They appear in the table in the order in which +they were found in the pattern. In the absence of (?| this is the order of increasing number; when (?| is used this is not necessarily the case because -later subpatterns may have lower numbers. +later capture groups may have lower numbers. .P As a simple example of the name/number table, consider the following pattern after compilation by the 8-bit library (assume PCRE2_EXTENDED is set, so white @@ -2251,16 +2251,16 @@ space - including newlines - is ignored): (? (?(\ed\ed)?\ed\ed) - (?\ed\ed) - (?\ed\ed) ) .sp -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 ??: +There are four named capture groups, 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 ??: .sp 00 01 d a t e 00 ?? 00 05 d a y 00 ?? ?? 00 04 m o n t h 00 00 02 y e a r 00 ?? .sp -When writing code to extract data from named subpatterns using the +When writing code to extract data from named capture groups using the name-to-number map, remember that the length of the entries is likely to be different for each compiled pattern. .sp @@ -2740,12 +2740,12 @@ valid newline sequence and explicit \er or \en escapes appear in the pattern. In general, a pattern matches a certain portion of the subject, and in addition, further substrings from the subject may be picked out by parenthesized parts of the pattern. Following the usage in Jeffrey Friedl's -book, this is called "capturing" in what follows, and the phrase "capturing -subpattern" or "capturing group" is used for a fragment of a pattern that picks -out a substring. PCRE2 supports several other kinds of parenthesized subpattern -that do not cause substrings to be captured. The \fBpcre2_pattern_info()\fP -function can be used to find out how many capturing subpatterns there are in a -compiled pattern. +book, this is called "capturing" in what follows, and the phrase "capture +group" (Perl terminology) is used for a fragment of a pattern that picks out a +substring. PCRE2 supports several other kinds of parenthesized group that do +not cause substrings to be captured. The \fBpcre2_pattern_info()\fP function +can be used to find out how many capture groups there are in a compiled +pattern. .P You can use auxiliary functions for accessing captured substrings .\" HTML @@ -2798,30 +2798,28 @@ reported start of a successful match can be greater than the end of the match. For example, if the pattern (?=ab\eK) is matched against "ab", the start and end offset values for the match are 2 and 0. .P -If a capturing subpattern group is matched repeatedly within a single match -operation, it is the last portion of the subject that it matched that is -returned. +If a capture group is matched repeatedly within a single match operation, it is +the last portion of the subject that it matched that is returned. .P If the ovector is too small to hold all the captured substring offsets, as much as possible is filled in, and the function returns a value of zero. If captured substrings are not of interest, \fBpcre2_match()\fP may be called with a match data block whose ovector is of minimum length (that is, one pair). .P -It is possible for capturing subpattern number \fIn+1\fP to match some part of -the subject when subpattern \fIn\fP has not been used at all. For example, if -the string "abc" is matched against the pattern (a|(z))(bc) the return from the -function is 4, and subpatterns 1 and 3 are matched, but 2 is not. When this -happens, both values in the offset pairs corresponding to unused subpatterns -are set to PCRE2_UNSET. -.P -Offset values that correspond to unused subpatterns at the end of the -expression are also set to PCRE2_UNSET. For example, if the string "abc" is -matched against the pattern (abc)(x(yz)?)? subpatterns 2 and 3 are not matched. -The return from the function is 2, because the highest used capturing -subpattern number is 1. The offsets for for the second and third capturing -subpatterns (assuming the vector is large enough, of course) are set to +It is possible for capture group number \fIn+1\fP to match some part of the +subject when group \fIn\fP has not been used at all. For example, if the string +"abc" is matched against the pattern (a|(z))(bc) the return from the function +is 4, and groups 1 and 3 are matched, but 2 is not. When this happens, both +values in the offset pairs corresponding to unused groups are set to PCRE2_UNSET. .P +Offset values that correspond to unused groups at the end of the expression are +also set to PCRE2_UNSET. For example, if the string "abc" is matched against +the pattern (abc)(x(yz)?)? groups 2 and 3 are not matched. The return from the +function is 2, because the highest used capture group number is 1. The offsets +for for the second and third capture groupss (assuming the vector is large +enough, of course) are set to PCRE2_UNSET. +.P Elements in the ovector that do not correspond to capturing parentheses in the pattern are never changed. That is, if a pattern contains \fIn\fP capturing parentheses, no more than \fIovector[0]\fP to \fIovector[2n+1]\fP are set by @@ -3006,11 +3004,11 @@ as NULL. .sp This error is returned when \fBpcre2_match()\fP detects a recursion loop within the pattern. Specifically, it means that either the whole pattern or a -subpattern has been called recursively for the second time at the same position -in the subject string. Some simple patterns that might do this are detected and -faulted at compile time, but more complicated cases, in particular mutual -recursions between two different subpatterns, cannot be detected until matching -is attempted. +capture group has been called recursively for the second time at the same +position in the subject string. Some simple patterns that might do this are +detected and faulted at compile time, but more complicated cases, in particular +mutual recursions between two different groups, cannot be detected until +matching is attempted. . . .\" HTML @@ -3090,7 +3088,7 @@ The \fBpcre2_substring_copy_bynumber()\fP function copies a captured substring into a supplied buffer, whereas \fBpcre2_substring_get_bynumber()\fP copies it into new memory, obtained using the same memory allocation function that was used for the match data block. The first two arguments of these functions are a -pointer to the match data block and a capturing group number. +pointer to the match data block and a capture group number. .P The final arguments of \fBpcre2_substring_copy_bynumber()\fP are a pointer to the buffer and a pointer to a variable that contains its length in code units. @@ -3162,9 +3160,9 @@ could not be obtained. When the list is no longer needed, it should be freed by calling \fBpcre2_substring_list_free()\fP. .P If this function encounters a substring that is unset, which can happen when -capturing subpattern number \fIn+1\fP matches some part of the subject, but -subpattern \fIn\fP has not been used at all, it returns an empty string. This -can be distinguished from a genuine zero-length substring by inspecting the +capture group number \fIn+1\fP matches some part of the subject, but group +\fIn\fP has not been used at all, it returns an empty string. This can be +distinguished from a genuine zero-length substring by inspecting the appropriate offset in the ovector, which contain PCRE2_UNSET for unset substrings, or by calling \fBpcre2_substring_length_bynumber()\fP. . @@ -3194,20 +3192,20 @@ For example, for this pattern: .sp (a+)b(?\ed+)... .sp -the number of the subpattern called "xxx" is 2. If the name is known to be +the number of the capture group called "xxx" is 2. If the name is known to be unique (PCRE2_DUPNAMES was not set), you can find the number from the name by calling \fBpcre2_substring_number_from_name()\fP. The first argument is the compiled pattern, and the second is the name. The yield of the function is the -subpattern number, PCRE2_ERROR_NOSUBSTRING if there is no subpattern of that -name, or PCRE2_ERROR_NOUNIQUESUBSTRING if there is more than one subpattern of -that name. Given the number, you can extract the substring directly from the -ovector, or use one of the "bynumber" functions described above. +group number, PCRE2_ERROR_NOSUBSTRING if there is no group with that name, or +PCRE2_ERROR_NOUNIQUESUBSTRING if there is more than one group with that name. +Given the number, you can extract the substring directly from the ovector, or +use one of the "bynumber" functions described above. .P For convenience, there are also "byname" functions that correspond to the "bynumber" functions, the only difference being that the second argument is a name instead of a number. If PCRE2_DUPNAMES is set and there are duplicate names, these functions scan all the groups with the given name, and return the -first named string that is set. +captured substring from the first named group that is set. .P If there are no groups with the given name, PCRE2_ERROR_NOSUBSTRING is returned. If all groups with the name have numbers that are greater than the @@ -3216,18 +3214,18 @@ is at least one group with a slot in the ovector, but no group is found to be set, PCRE2_ERROR_UNSET is returned. .P \fBWarning:\fP If the pattern uses the (?| feature to set up multiple -subpatterns with the same number, as described in the -.\" HTML +capture groups with the same number, as described in the +.\" HTML .\" -section on duplicate subpattern numbers +section on duplicate group numbers .\" in the .\" HREF \fBpcre2pattern\fP .\" -page, you cannot use names to distinguish the different subpatterns, because +page, you cannot use names to distinguish the different capture groups, because names are not included in the compiled code. The matching process uses only -numbers. For this reason, the use of different names for subpatterns of the +numbers. For this reason, the use of different names for groups with the same number causes an error at compile time. . . @@ -3288,7 +3286,7 @@ length is in code units, not bytes. In the replacement string, which is interpreted as a UTF string in UTF mode, and is checked for UTF validity unless the PCRE2_NO_UTF_CHECK option is set, a dollar character is an escape character that can specify the insertion of -characters from capturing groups or names from (*MARK) or other control verbs +characters from capture groups or names from (*MARK) or other control verbs in the pattern. The following forms are always recognized: .sp $$ insert a dollar character @@ -3351,12 +3349,12 @@ operation is carried out twice. Depending on the application, it may be more efficient to allocate a large buffer and free the excess afterwards, instead of using PCRE2_SUBSTITUTE_OVERFLOW_LENGTH. .P -PCRE2_SUBSTITUTE_UNKNOWN_UNSET causes references to capturing groups that do +PCRE2_SUBSTITUTE_UNKNOWN_UNSET causes references to capture groups that do not appear in the pattern to be treated as unset groups. This option should be used with care, because it means that a typo in a group name or number no longer causes the PCRE2_ERROR_NOSUBSTRING error. .P -PCRE2_SUBSTITUTE_UNSET_EMPTY causes unset capturing groups (including unknown +PCRE2_SUBSTITUTE_UNSET_EMPTY causes unset capture groups (including unknown groups when PCRE2_SUBSTITUTE_UNKNOWN_UNSET is set) to be treated as empty strings when inserted as described above. If this option is not set, an attempt to insert an unset group causes the PCRE2_ERROR_UNSET error. This option does @@ -3381,14 +3379,15 @@ terminating a \eQ quoted sequence) reverts to no case forcing. The sequences \eu and \el force the next character (if it is a letter) to upper or lower case, respectively, and then the state automatically reverts to no case forcing. Case forcing applies to all inserted characters, including those from -captured groups and letters within \eQ...\eE quoted sequences. +capture groups and letters within \eQ...\eE quoted sequences. .P Note that case forcing sequences such as \eU...\eE do not nest. For example, the result of processing "\eUaa\eLBB\eEcc\eE" is "AAbbcc"; the final \eE has no effect. .P The second effect of setting PCRE2_SUBSTITUTE_EXTENDED is to add more -flexibility to group substitution. The syntax is similar to that used by Bash: +flexibility to capture group substitution. The syntax is similar to that used +by Bash: .sp ${:-} ${:+:} @@ -3510,7 +3509,7 @@ output and the call to \fBpcre2_substitute()\fP exits, returning the number of matches so far. . . -.SH "DUPLICATE SUBPATTERN NAMES" +.SH "DUPLICATE CAPTURE GROUP NAMES" .rs .sp .nf @@ -3518,13 +3517,14 @@ matches so far. .B " PCRE2_SPTR \fIname\fP, PCRE2_SPTR *\fIfirst\fP, PCRE2_SPTR *\fIlast\fP);" .fi .P -When a pattern is compiled with the PCRE2_DUPNAMES option, names for -subpatterns are not required to be unique. Duplicate names are always allowed -for subpatterns with the same number, created by using the (?| feature. Indeed, -if such subpatterns are named, they are required to use the same names. +When a pattern is compiled with the PCRE2_DUPNAMES option, names for capture +groups are not required to be unique. Duplicate names are always allowed for +groups with the same number, created by using the (?| feature. Indeed, if such +groups are named, they are required to use the same names. .P -Normally, patterns with duplicate names are such that in any one match, only -one of the named subpatterns participates. An example is shown in the +Normally, patterns that use duplicate names are such that in any one match, +only one of each set of identically-named groups participates. An example is +shown in the .\" HREF \fBpcre2pattern\fP .\" @@ -3705,9 +3705,8 @@ the three matched strings are On success, the yield of the function is a number greater than zero, which is the number of matched substrings. The offsets of the substrings are returned in the ovector, and can be extracted by number in the same way as for -\fBpcre2_match()\fP, but the numbers bear no relation to any capturing groups -that may exist in the pattern, because DFA matching does not support group -capture. +\fBpcre2_match()\fP, but the numbers bear no relation to any capture groups +that may exist in the pattern, because DFA matching does not support capturing. .P Calls to the convenience functions that extract substrings by name return the error PCRE2_ERROR_DFA_UFUNC (unsupported function) if used after a @@ -3749,7 +3748,7 @@ a backreference. .sp This return is given if \fBpcre2_dfa_match()\fP encounters a condition item that uses a backreference for the condition, or a test for recursion in a -specific group. These are not supported. +specific capture group. These are not supported. .sp PCRE2_ERROR_DFA_WSSIZE .sp @@ -3758,9 +3757,9 @@ This return is given if \fBpcre2_dfa_match()\fP runs out of space in the .sp PCRE2_ERROR_DFA_RECURSE .sp -When a recursive subpattern is processed, the matching function calls itself -recursively, using private memory for the ovector and \fIworkspace\fP. This -error is given if the internal ovector is not large enough. This should be +When a recursion or subroutine call is processed, the matching function calls +itself recursively, using private memory for the ovector and \fIworkspace\fP. +This error is given if the internal ovector is not large enough. This should be extremely rare, as a vector of size 1000 is used. .sp PCRE2_ERROR_DFA_BADRESTART @@ -3793,6 +3792,6 @@ Cambridge, England. .rs .sp .nf -Last updated: 04 January 2019 +Last updated: 04 February 2019 Copyright (c) 1997-2019 University of Cambridge. .fi diff --git a/doc/pcre2callout.3 b/doc/pcre2callout.3 index 0987758..7a9c0d8 100644 --- a/doc/pcre2callout.3 +++ b/doc/pcre2callout.3 @@ -1,4 +1,4 @@ -.TH PCRE2CALLOUT 3 "17 September 2018" "PCRE2 10.33" +.TH PCRE2CALLOUT 3 "03 February 2019" "PCRE2 10.33" .SH NAME PCRE2 - Perl-compatible regular expressions (revised API) .SH SYNOPSIS @@ -137,7 +137,7 @@ start only after an internal newline or at the beginning of the subject, and branch, automatic anchoring occurs if all branches are anchorable. .P This optimization is disabled, however, if .* is in an atomic group or if there -is a backreference to the capturing group in which it appears. It is also +is a backreference to the capture group in which it appears. It is also disabled if the pattern contains (*PRUNE) or (*SKIP). However, the presence of callouts does not affect it. .P @@ -331,8 +331,8 @@ callout before an assertion such as (?=ab) the length is 3. For an an alternation bar or a closing parenthesis, the length is one, unless a closing parenthesis is followed by a quantifier, in which case its length is included. (This changed in release 10.23. In earlier releases, before an opening -parenthesis the length was that of the entire subpattern, and before an -alternation bar or a closing parenthesis the length was zero.) +parenthesis the length was that of the entire group, and before an alternation +bar or a closing parenthesis the length was zero.) .P The \fIpattern_position\fP and \fInext_item_length\fP fields are intended to help in distinguishing between different automatic callouts, which all have the @@ -452,6 +452,6 @@ Cambridge, England. .rs .sp .nf -Last updated: 17 September 2018 -Copyright (c) 1997-2018 University of Cambridge. +Last updated: 03 February 2019 +Copyright (c) 1997-2019 University of Cambridge. .fi diff --git a/doc/pcre2compat.3 b/doc/pcre2compat.3 index 6e448f6..a2fbf48 100644 --- a/doc/pcre2compat.3 +++ b/doc/pcre2compat.3 @@ -1,4 +1,4 @@ -.TH PCRE2COMPAT 3 "28 July 2018" "PCRE2 10.32" +.TH PCRE2COMPAT 3 "03 February 2019" "PCRE2 10.33" .SH NAME PCRE2 - Perl-compatible regular expressions (revised API) .SH "DIFFERENCES BETWEEN PCRE2 AND PERL" @@ -23,10 +23,9 @@ character is not "a" three times (in principle; PCRE2 optimizes this to run the assertion just once). Perl allows some repeat quantifiers on other assertions, for example, \eb* (but not \eb{3}), but these do not seem to have any use. .P -3. Capturing subpatterns that occur inside negative lookaround assertions are -counted, but their entries in the offsets vector are set only when a negative -assertion is a condition that has a matching branch (that is, the condition is -false). +3. Capture groups that occur inside negative lookaround assertions are counted, +but their entries in the offsets vector are set only when a negative assertion +is a condition that has a matching branch (that is, the condition is false). .P 4. The following Perl escape sequences are not supported: \eF, \el, \eL, \eu, \eU, and \eN when followed by a character name. \eN on its own, matching a @@ -79,13 +78,13 @@ documentation for details. to PCRE2 release 10.23, but from release 10.30 this changed, and backtracking into subroutine calls is now supported, as in Perl. .P -9. If any of the backtracking control verbs are used in a subpattern that is -called as a subroutine (whether or not recursively), their effect is confined -to that subpattern; it does not extend to the surrounding pattern. This is not -always the case in Perl. In particular, if (*THEN) is present in a group that -is called as a subroutine, its action is limited to that group, even if the -group does not contain any | characters. Note that such subpatterns are -processed as anchored at the point where they are tested. +9. If any of the backtracking control verbs are used in a group that is called +as a subroutine (whether or not recursively), their effect is confined to that +group; it does not extend to the surrounding pattern. This is not always the +case in Perl. In particular, if (*THEN) is present in a group that is called as +a subroutine, its action is limited to that group, even if the group does not +contain any | characters. Note that such groups are processed as anchored +at the point where they are tested. .P 10. If a pattern contains more than one backtracking control verb, the first one that is backtracked onto acts. For example, in the pattern @@ -101,21 +100,20 @@ strings when part of a pattern is repeated. For example, matching "aba" against the pattern /^(a(b)?)+$/ in Perl leaves $2 unset, but in PCRE2 it is set to "b". .P -13. PCRE2's handling of duplicate subpattern numbers and duplicate subpattern -names is not as general as Perl's. This is a consequence of the fact the PCRE2 -works internally just with numbers, using an external table to translate -between numbers and names. In particular, a pattern such as (?|(?A)|(?B), -where the two capturing parentheses have the same number but different names, -is not supported, and causes an error at compile time. If it were allowed, it -would not be possible to distinguish which parentheses matched, because both -names map to capturing subpattern number 1. To avoid this confusing situation, -an error is given at compile time. +13. PCRE2's handling of duplicate capture group numbers and names is not as +general as Perl's. This is a consequence of the fact the PCRE2 works internally +just with numbers, using an external table to translate between numbers and +names. In particular, a pattern such as (?|(?A)|(?B), where the two +capture groups have the same number but different names, is not supported, and +causes an error at compile time. If it were allowed, it would not be possible +to distinguish which group matched, because both names map to capture group +number 1. To avoid this confusing situation, an error is given at compile time. .P 14. Perl used to recognize comments in some places that PCRE2 does not, for -example, between the ( and ? at the start of a subpattern. If the /x modifier -is set, Perl allowed white space between ( and ? though the latest Perls give -an error (for a while it was just deprecated). There may still be some cases -where Perl behaves differently. +example, between the ( and ? at the start of a group. If the /x modifier is +set, Perl allowed white space between ( and ? though the latest Perls give an +error (for a while it was just deprecated). There may still be some cases where +Perl behaves differently. .P 15. Perl, when in warning mode, gives warnings for character classes such as [A-\ed] or [a-[:digit:]]. It then treats the hyphens as literals. PCRE2 has no @@ -200,6 +198,6 @@ Cambridge, England. .rs .sp .nf -Last updated: 28 July 2018 -Copyright (c) 1997-2018 University of Cambridge. +Last updated: 03 February 2019 +Copyright (c) 1997-2019 University of Cambridge. .fi diff --git a/doc/pcre2limits.3 b/doc/pcre2limits.3 index 803e97b..9bf3626 100644 --- a/doc/pcre2limits.3 +++ b/doc/pcre2limits.3 @@ -1,4 +1,4 @@ -.TH PCRE2LIMITS 3 "30 March 2017" "PCRE2 10.30" +.TH PCRE2LIMITS 3 "03 February 2019" "PCRE2 10.33" .SH NAME PCRE2 - Perl-compatible regular expressions (revised API) .SH "SIZE AND OTHER LIMITATIONS" @@ -34,16 +34,16 @@ All values in repeating quantifiers must be less than 65536. .P The maximum length of a lookbehind assertion is 65535 characters. .P -There is no limit to the number of parenthesized subpatterns, but there can be -no more than 65535 capturing subpatterns. There is, however, a limit to the -depth of nesting of parenthesized subpatterns of all kinds. This is imposed in -order to limit the amount of system stack used at compile time. The default -limit can be specified when PCRE2 is built; if not, the default is set to 250. -An application can change this limit by calling pcre2_set_parens_nest_limit() -to set the limit in a compile context. +There is no limit to the number of parenthesized groups, but there can be no +more than 65535 capture groups, and there is a limit to the depth of nesting of +parenthesized subpatterns of all kinds. This is imposed in order to limit the +amount of system stack used at compile time. The default limit can be specified +when PCRE2 is built; if not, the default is set to 250. An application can +change this limit by calling pcre2_set_parens_nest_limit() to set the limit in +a compile context. .P -The maximum length of name for a named subpattern is 32 code units, and the -maximum number of named subpatterns is 10000. +The maximum length of name for a named capture group is 32 code units, and the +maximum number of such groups is 10000. .P The maximum length of a name in a (*MARK), (*PRUNE), (*SKIP), or (*THEN) verb is 255 code units for the 8-bit library and 65535 code units for the 16-bit and @@ -67,6 +67,6 @@ Cambridge, England. .rs .sp .nf -Last updated: 30 March 2017 -Copyright (c) 1997-2017 University of Cambridge. +Last updated: 02 February 2019 +Copyright (c) 1997-2019 University of Cambridge. .fi diff --git a/doc/pcre2pattern.3 b/doc/pcre2pattern.3 index 8157f9e..f26117f 100644 --- a/doc/pcre2pattern.3 +++ b/doc/pcre2pattern.3 @@ -1,4 +1,4 @@ -.TH PCRE2PATTERN 3 "27 November 2018" "PCRE2 10.33" +.TH PCRE2PATTERN 3 "04 February 2019" "PCRE2 10.33" .SH NAME PCRE2 - Perl-compatible regular expressions (revised API) .SH "PCRE2 REGULAR EXPRESSION DETAILS" @@ -20,13 +20,13 @@ copious examples. Jeffrey Friedl's "Mastering Regular Expressions", published by O'Reilly, covers regular expressions in great detail. This description of PCRE2's regular expressions is intended as reference material. .P -This document discusses the patterns that are supported by PCRE2 when its main -matching function, \fBpcre2_match()\fP, is used. PCRE2 also has an alternative -matching function, \fBpcre2_dfa_match()\fP, which matches using a different -algorithm that is not Perl-compatible. Some of the features discussed below are -not available when DFA matching is used. The advantages and disadvantages of -the alternative function, and how it differs from the normal function, are -discussed in the +This document discusses the regular expression patterns that are supported by +PCRE2 when its main matching function, \fBpcre2_match()\fP, is used. PCRE2 also +has an alternative matching function, \fBpcre2_dfa_match()\fP, which matches +using a different algorithm that is not Perl-compatible. Some of the features +discussed below are not available when DFA matching is used. The advantages and +disadvantages of the alternative function, and how it differs from the normal +function, are discussed in the .\" HREF \fBpcre2matching\fP .\" @@ -149,8 +149,8 @@ this indirectly restricts the amount of heap memory that is used, but there is also an explicit memory limit that can be set. .P These facilities are provided to catch runaway matches that are provoked by -patterns with huge matching trees (a typical example is a pattern with nested -unlimited repeats applied to a long string that does not match). When one of +patterns with huge matching trees. A common example is a pattern with nested +unlimited repeats applied to a long string that does not match. When one of these limits is reached, \fBpcre2_match()\fP gives an error return. The limits can also be set by items at the start of the pattern of the form .sp @@ -264,10 +264,10 @@ matches a portion of a subject string that is identical to itself. When caseless matching is specified (the PCRE2_CASELESS option), letters are matched independently of case. .P -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 -\fImetacharacters\fP, which do not stand for themselves but instead are -interpreted in some special way. +The power of regular expressions comes from the ability to include wild cards, +character classes, alternatives, and repetitions in the pattern. These are +encoded in the pattern by the use of \fImetacharacters\fP, which do not stand +for themselves but instead are interpreted in some special way. .P There are two different sets of metacharacters: those that are recognized anywhere in the pattern except within square brackets, and those that are @@ -280,14 +280,11 @@ are as follows: . match any character except newline (by default) [ start character class definition | start of alternative branch - ( start subpattern - ) end subpattern - ? extends the meaning of ( - also 0 or 1 quantifier - also quantifier minimizer + ( start group or control verb + ) end group or control verb * 0 or more quantifier - + 1 or more quantifier - also "possessive quantifier" + + 1 or more quantifier; also "possessive quantifier" + ? 0 or 1 quantifier; also quantifier minimizer { start min/max quantifier .sp Part of a pattern that is in square brackets is called a "character class". In @@ -296,9 +293,7 @@ a character class the only metacharacters are: \e general escape character ^ negate the class, but only if the first character - indicates character range -.\" JOIN - [ POSIX character class (only if followed by POSIX - syntax) + [ POSIX character class (if followed by POSIX syntax) ] terminates the character class .sp The following sections describe the use of each of the metacharacters. @@ -308,7 +303,7 @@ The following sections describe the use of each of the metacharacters. .rs .sp The backslash character has several uses. Firstly, if it is followed by a -character that is not a number or a letter, it takes away any special meaning +character that is not a digit or a letter, 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. .P @@ -318,7 +313,7 @@ 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 backslash, you write \e\e. .P -In a UTF mode, only ASCII numbers and letters have any special meaning after a +In a UTF mode, only ASCII digits and letters have any special meaning after a backslash. All other characters (in particular, those whose code points are greater than 127) are treated as literals. .P @@ -328,13 +323,13 @@ outside a character class and the next newline, inclusive, are ignored. An escaping backslash can be used to include a white space or # character as part of the pattern. .P -If you want to remove the special meaning from a sequence of characters, you -can do so by putting them between \eQ and \eE. This is different from Perl in -that $ and @ are handled as literals in \eQ...\eE sequences in PCRE2, whereas -in Perl, $ and @ cause variable interpolation. Also, Perl does "double-quotish -backslash interpolation" on any backslashes between \eQ and \eE which, its -documentation says, "may lead to confusing results". PCRE2 treats a backslash -between \eQ and \eE just like any other character. Note the following examples: +If you want to treat all characters in a sequence as literals, you can do so by +putting them between \eQ and \eE. This is different from Perl in that $ and @ +are handled as literals in \eQ...\eE sequences in PCRE2, whereas in Perl, $ and +@ cause variable interpolation. Also, Perl does "double-quotish backslash +interpolation" on any backslashes between \eQ and \eE which, its documentation +says, "may lead to confusing results". PCRE2 treats a backslash between \eQ and +\eE just like any other character. Note the following examples: .sp Pattern PCRE2 matches Perl matches .sp @@ -362,8 +357,8 @@ A second use of backslash provides a way of encoding non-printing characters in patterns in a visible manner. There is no restriction on the appearance of non-printing characters in a pattern, but when a pattern is being prepared by text editing, it is often easier to use one of the following escape sequences -than the binary character it represents. In an ASCII or Unicode environment, -these escapes are as follows: +instead of the binary character it represents. In an ASCII or Unicode +environment, these escapes are as follows: .sp \ea alarm, that is, the BEL character (hex 07) \ecx "control-x", where x is any printable ASCII character @@ -441,17 +436,17 @@ and Perl has changed over time, causing PCRE2 also to change. .P Outside a character class, PCRE2 reads the digit and any following digits as a decimal number. If the number is less than 10, begins with the digit 8 or 9, or -if there are at least that many previous capturing left parentheses in the -expression, the entire sequence is taken as a \fIbackreference\fP. A -description of how this works is given +if there are at least that many previous capture groups in the expression, the +entire sequence is taken as a \fIbackreference\fP. A description of how this +works is given .\" HTML .\" later, .\" following the discussion of -.\" HTML +.\" HTML .\" -parenthesized subpatterns. +parenthesized groups. .\" Otherwise, up to three octal digits are read to form a character code. .P @@ -463,7 +458,7 @@ for themselves. For example, outside a character class: \e040 is another way of writing an ASCII space .\" JOIN \e40 is the same, provided there are fewer than 40 - previous capturing subpatterns + previous capture groups \e7 is always a backreference .\" JOIN \e11 might be a backreference, or another way of @@ -493,7 +488,9 @@ If the PCRE2_ALT_BSUX option is set, the interpretation of \ex is as just described only when it is followed by two hexadecimal digits. Otherwise, it matches a literal "x" character. In this mode, support for code points greater than 256 is provided by \eu, which must be followed by four hexadecimal digits; -otherwise it matches a literal "u" character. +otherwise it matches a literal "u" character. This syntax makes PCRE2 behave +like ECMAscript (aka JavaScript). Code points greater than 0xFFFF are not +supported. .P Characters whose value is less than 256 can be defined by either of the two syntaxes for \ex (or by \eu in PCRE2_ALT_BSUX mode). There is no difference in @@ -553,9 +550,9 @@ can be coded as \eg{name}. Backreferences are discussed later, .\" following the discussion of -.\" HTML +.\" HTML .\" -parenthesized subpatterns. +parenthesized groups. .\" . . @@ -564,14 +561,14 @@ parenthesized subpatterns. .sp For compatibility with Oniguruma, the non-Perl syntax \eg followed by a name or a number enclosed either in angle brackets or single quotes, is an alternative -syntax for referencing a subpattern as a "subroutine". Details are discussed +syntax for referencing a capture group as a subroutine. Details are discussed .\" HTML .\" later. .\" Note that \eg{...} (Perl syntax) and \eg<...> (Oniguruma syntax) are \fInot\fP synonymous. The former is a backreference; the latter is a -.\" HTML +.\" HTML .\" subroutine .\" @@ -751,21 +748,22 @@ an error. .rs .sp When PCRE2 is built with Unicode support (the default), three additional escape -sequences that match characters with specific properties are available. In -8-bit non-UTF-8 mode, these sequences are of course limited to testing -characters whose code points are less than 256, but they do work in this mode. -In 32-bit non-UTF mode, code points greater than 0x10ffff (the Unicode limit) -may be encountered. These are all treated as being in the Unknown script and -with an unassigned type. The extra escape sequences are: +sequences that match characters with specific properties are available. They +can be used in any mode, though in 8-bit and 16-bit non-UTF modes these +sequences are of course limited to testing characters whose code points are +less than U+0100 and U+10000, respectively. In 32-bit non-UTF mode, code points +greater than 0x10ffff (the Unicode limit) may be encountered. These are all +treated as being in the Unknown script and with an unassigned type. The extra +escape sequences are: .sp \ep{\fIxx\fP} a character with the \fIxx\fP property \eP{\fIxx\fP} a character without the \fIxx\fP property \eX a Unicode extended grapheme cluster .sp -The property names represented by \fIxx\fP above are limited to the Unicode -script names, the general category properties, "Any", which matches any -character (including newline), and some special PCRE2 properties (described -in the +The property names represented by \fIxx\fP above are case-sensitive. There is +support for Unicode script names, Unicode general category properties, "Any", +which matches any character (including newline), and some special PCRE2 +properties (described in the .\" HTML .\" next section). @@ -999,14 +997,16 @@ The special property L& is also supported: it matches a character that has the Lu, Ll, or Lt property, in other words, a letter that is not classified as a modifier or "other". .P -The Cs (Surrogate) property applies only to characters in the range U+D800 to -U+DFFF. Such characters are not valid in Unicode strings and so -cannot be tested by PCRE2, unless UTF validity checking has been turned off -(see the discussion of PCRE2_NO_UTF_CHECK in the +The Cs (Surrogate) property applies only to characters whose code points are in +the range U+D800 to U+DFFF. These characters are no different to any other +character when PCRE2 is not in UTF mode (using the 16-bit or 32-bit library). +However, they are not valid in Unicode strings and so cannot be tested by PCRE2 +in UTF mode, unless UTF validity checking has been turned off (see the +discussion of PCRE2_NO_UTF_CHECK in the .\" HREF \fBpcre2api\fP .\" -page). Perl does not support the Cs property. +page). .P The long synonyms for property names that Perl supports (such as \ep{Letter}) are not supported by PCRE2, nor is it permitted to prefix any of these @@ -1130,7 +1130,7 @@ a lookbehind assertion However, in this case, the part of the subject before the real match does not have to be of fixed length, as lookbehind assertions do. The use of \eK does not interfere with the setting of -.\" HTML +.\" HTML .\" captured substrings. .\" @@ -1161,7 +1161,7 @@ start of the reported match is earlier than where the match started. The final use of backslash is for certain simple assertions. An assertion 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 +groups for more complicated assertions is described .\" HTML .\" below. @@ -1183,12 +1183,12 @@ character. If any other of these assertions appears in a character class, an A word boundary is a position in the subject string where the current character and the previous character do not both match \ew or \eW (i.e. one matches \ew and the other matches \eW), or the start or end of the string if the -first or last character matches \ew, respectively. In a UTF mode, the meanings -of \ew and \eW can be changed by setting the PCRE2_UCP option. When this is -done, it also affects \eb and \eB. Neither PCRE2 nor Perl has a separate "start -of word" or "end of word" metasequence. However, whatever follows \eb normally -determines which it is. For example, the fragment \eba matches "a" at the start -of a word. +first or last character matches \ew, respectively. When PCRE2 is built with +Unicode support, the meanings of \ew and \eW can be changed by setting the +PCRE2_UCP option. When this is done, it also affects \eb and \eB. Neither PCRE2 +nor Perl has a separate "start of word" or "end of word" metasequence. However, +whatever follows \eb normally determines which it is. For example, the fragment +\eba matches "a" at the start of a word. .P The \eA, \eZ, and \ez assertions differ from the traditional circumflex and dollar (described in the next section) in that they only ever match at the very @@ -1380,9 +1380,9 @@ could be used with a UTF-8 string (ignore white space and line breaks): .sp In this example, a group that starts with (?| resets the capturing parentheses numbers in each alternative (see -.\" HTML +.\" HTML .\" -"Duplicate Subpattern Numbers" +"Duplicate Group Numbers" .\" below). The assertions at the start of each branch check the next UTF-8 character for values whose encoding uses 1, 2, 3, or 4 bytes, respectively. The @@ -1624,13 +1624,13 @@ the pattern matches either "gilbert" or "sullivan". Any number of alternatives may appear, and an empty alternative is permitted (matching the empty string). The matching process tries each alternative in turn, from left to right, and the first one -that succeeds is used. If the alternatives are within a subpattern -.\" HTML +that succeeds is used. If the alternatives are within a group +.\" HTML .\" (defined below), .\" "succeeds" means matching the rest of the main pattern as well as the -alternative in the subpattern. +alternative in the group. . . .SH "INTERNAL OPTION SETTING" @@ -1673,16 +1673,16 @@ the same way as the Perl-compatible options by using the characters J and U respectively. However, these are not unset by (?^). .P When one of these option changes occurs at top level (that is, not inside -subpattern parentheses), the change applies to the remainder of the pattern -that follows. An option change within a subpattern (see below for a description -of subpatterns) affects only that part of the subpattern that follows it, so +group parentheses), the change applies to the remainder of the pattern +that follows. An option change within a group (see below for a description +of groups) affects only that part of the group that follows it, so .sp (a(?i)b)c .sp matches abc and aBc and no other strings (assuming PCRE2_CASELESS is not used). By this means, options can be made to have different settings in different parts of the pattern. Any changes made in one alternative do carry on -into subsequent branches within the same subpattern. For example, +into subsequent branches within the same group. For example, .sp (a(?i)b|c) .sp @@ -1692,7 +1692,7 @@ option settings happen at compile time. There would be some very weird behaviour otherwise. .P As a convenient shorthand, if any option settings are required at the start of -a non-capturing subpattern (see the next section), the option letters may +a non-capturing group (see the next section), the option letters may appear between the "?" and the ":". Thus the two patterns .sp (?i:saturday|sunday) @@ -1700,10 +1700,11 @@ appear between the "?" and the ":". Thus the two patterns .sp match exactly the same set of strings. .P -\fBNote:\fP There are other PCRE2-specific options that can be set by the -application when the compiling function is called. The pattern can contain -special leading sequences such as (*CRLF) to override what the application has -set or what has been defaulted. Details are given in the section entitled +\fBNote:\fP There are other PCRE2-specific options, applying to the whole +pattern, which can be set by the application when the compiling function is +called. In addition, the pattern can contain special leading sequences such as +(*CRLF) to override what the application has set or what has been defaulted. +Details are given in the section entitled .\" HTML .\" "Newline sequences" @@ -1715,12 +1716,12 @@ the PCRE2_NEVER_UTF and PCRE2_NEVER_UCP options, which lock out the use of the (*UTF) and (*UCP) sequences. . . -.\" HTML -.SH SUBPATTERNS +.\" HTML +.SH GROUPS .rs .sp -Subpatterns are delimited by parentheses (round brackets), which can be nested. -Turning part of a pattern into a subpattern does two things: +Groups are delimited by parentheses (round brackets), which can be nested. +Turning part of a pattern into a group does two things: .sp 1. It localizes a set of alternatives. For example, the pattern .sp @@ -1729,15 +1730,15 @@ Turning part of a pattern into a subpattern does two things: matches "cataract", "caterpillar", or "cat". Without the parentheses, it would match "cataract", "erpillar" or an empty string. .sp -2. It sets up the subpattern as a capturing subpattern. This means that, when -the whole pattern matches, the portion of the subject string that matched the -subpattern is passed back to the caller, separately from the portion that -matched the whole pattern. (This applies only to the traditional matching -function; the DFA matching function does not support capturing.) +2. It creates a "capture group". This means that, when the whole pattern +matches, the portion of the subject string that matched the group is passed +back to the caller, separately from the portion that matched the whole pattern. +(This applies only to the traditional matching function; the DFA matching +function does not support capturing.) .P Opening parentheses are counted from left to right (starting from 1) to obtain -numbers for the capturing subpatterns. For example, if the string "the red -king" is matched against the pattern +numbers for capture groups. For example, if the string "the red king" is +matched against the pattern .sp the ((red|white) (king|queen)) .sp @@ -1745,38 +1746,37 @@ the captured substrings are "red king", "red", and "king", and are numbered 1, 2, and 3, respectively. .P The fact that plain parentheses fulfil two functions is not always helpful. -There are often times when a grouping subpattern is required without a -capturing requirement. If an opening parenthesis is followed by a question mark -and a colon, the subpattern does not do any capturing, and is not counted when -computing the number of any subsequent capturing subpatterns. For example, if -the string "the white queen" is matched against the pattern +There are often times when grouping is required without capturing. If an +opening parenthesis is followed by a question mark and a colon, the group +does not do any capturing, and is not counted when computing the number of any +subsequent capture groups. For example, if the string "the white queen" +is matched against the pattern .sp the ((?:red|white) (king|queen)) .sp the captured substrings are "white queen" and "queen", and are numbered 1 and -2. The maximum number of capturing subpatterns is 65535. +2. The maximum number of capture groups is 65535. .P As a convenient shorthand, if any option settings are required at the start of -a non-capturing subpattern, the option letters may appear between the "?" and -the ":". Thus the two patterns +a non-capturing group, the option letters may appear between the "?" and the +":". Thus the two patterns .sp (?i:saturday|sunday) (?:(?i)saturday|sunday) .sp match exactly the same set of strings. Because alternative branches are tried -from left to right, and options are not reset until the end of the subpattern -is reached, an option setting in one branch does affect subsequent branches, so +from left to right, and options are not reset until the end of the group is +reached, an option setting in one branch does affect subsequent branches, so the above patterns match "SUNDAY" as well as "Saturday". . . -.\" HTML -.SH "DUPLICATE SUBPATTERN NUMBERS" +.\" HTML +.SH "DUPLICATE GROUP NUMBERS" .rs .sp -Perl 5.10 introduced a feature whereby each alternative in a subpattern uses -the same numbers for its capturing parentheses. Such a subpattern starts with -(?| and is itself a non-capturing subpattern. For example, consider this -pattern: +Perl 5.10 introduced a feature whereby each alternative in a group uses the +same numbers for its capturing parentheses. Such a group starts with (?| and is +itself a non-capturing group. For example, consider this pattern: .sp (?|(Sat)ur|(Sun))day .sp @@ -1786,7 +1786,7 @@ at captured substring number one, whichever alternative matched. This construct is useful when you want to capture part, but not all, of one of a number of alternatives. Inside a (?| group, parentheses are numbered as usual, but the number is reset at the start of each branch. The numbers of any capturing -parentheses that follow the subpattern start after the highest number used in +parentheses that follow the whole group start after the highest number used in any branch. The following example is taken from the Perl documentation. The numbers underneath show in which buffer the captured content will be stored. .sp @@ -1794,13 +1794,12 @@ numbers underneath show in which buffer the captured content will be stored. / ( a ) (?| x ( y ) z | (p (q) r) | (t) u (v) ) ( z ) /x # 1 2 2 3 2 3 4 .sp -A backreference to a numbered subpattern uses the most recent value that is -set for that number by any subpattern. The following pattern matches "abcabc" -or "defdef": +A backreference to a capture group uses the most recent value that is set for +the group. The following pattern matches "abcabc" or "defdef": .sp /(?|(abc)|(def))\e1/ .sp -In contrast, a subroutine call to a numbered subpattern always refers to the +In contrast, a subroutine call to a capture group always refers to the first one in the pattern with the given number. The following pattern matches "abcabc" or "defabc": .sp @@ -1814,29 +1813,35 @@ If a .\" condition test .\" -for a subpattern's having matched refers to a non-unique number, the test is -true if any of the subpatterns of that number have matched. +for a group's having matched refers to a non-unique number, the test is +true if any group with that number has matched. .P An alternative approach to using this "branch reset" feature is to use -duplicate named subpatterns, as described in the next section. +duplicate named groups, as described in the next section. . . -.SH "NAMED SUBPATTERNS" +.SH "NAMED CAPTURE GROUPS" .rs .sp -Identifying capturing parentheses by number is simple, but it can be very hard -to keep track of the numbers in complicated patterns. Furthermore, if an -expression is modified, the numbers may change. To help with this difficulty, -PCRE2 supports the naming of capturing subpatterns. This feature was not added -to Perl until release 5.10. Python had the feature earlier, and PCRE1 -introduced it at release 4.0, using the Python syntax. PCRE2 supports both the -Perl and the Python syntax. +Identifying capture groups by number is simple, but it can be very hard to keep +track of the numbers in complicated patterns. Furthermore, if an expression is +modified, the numbers may change. To help with this difficulty, PCRE2 supports +the naming of capture groups. This feature was not added to Perl until release +5.10. Python had the feature earlier, and PCRE1 introduced it at release 4.0, +using the Python syntax. PCRE2 supports both the Perl and the Python syntax. .P -In PCRE2, a capturing subpattern can be named in one of three ways: -(?...) or (?'name'...) as in Perl, or (?P...) as in Python. Names -consist of up to 32 alphanumeric characters and underscores, but must start -with a non-digit. References to capturing parentheses from other parts of the -pattern, such as +In PCRE2, a capture group can be named in one of three ways: (?...) or +(?'name'...) as in Perl, or (?P...) as in Python. Names may be up to 32 +code units long. When PCRE2_UTF is not set, they may contain only ASCII +alphanumeric characters and underscores, but must start with a non-digit. When +PCRE2_UTF is set, the syntax of group names is extended to allow any Unicode +letter or Unicode decimal digit. In other words, group names must match one of +these patterns: +.sp + ^[_A-Za-z][_A-Za-z0-9]*\ez when PCRE2_UTF is not set + ^[_\ep{L}][_\ep{L}\ep{Nd}]*\ez when PCRE2_UTF is set +.sp +References to capture groups from other parts of the pattern, such as .\" HTML .\" backreferences, @@ -1852,17 +1857,17 @@ conditions, .\" can all be made by name as well as by number. .P -Named capturing parentheses are allocated numbers as well as names, exactly as -if the names were not present. In both PCRE2 and Perl, capturing subpatterns +Named capture groups are allocated numbers as well as names, exactly as +if the names were not present. In both PCRE2 and Perl, capture groups are primarily identified by numbers; any names are just aliases for these numbers. The PCRE2 API provides function calls for extracting the complete name-to-number translation table from a compiled pattern, as well as convenience functions for extracting captured substrings by name. .P -\fBWarning:\fP When more than one subpattern has the same number, as described -in the previous section, a name given to one of them applies to all of them. -Perl allows identically numbered subpatterns to have different names. Consider -this pattern, where there are two capturing subpatterns, both numbered 1: +\fBWarning:\fP When more than one capture group has the same number, as +described in the previous section, a name given to one of them applies to all +of them. Perl allows identically numbered groups to have different names. +Consider this pattern, where there are two capture groups, both numbered 1: .sp (?|(?aa)|(?bb)) .sp @@ -1876,20 +1881,20 @@ pattern: .sp (?|(?aa)|(bb)) .sp -Although the second subpattern number 1 is not explicitly named, the name AA is -still an alias for subpattern 1. Whether the pattern matches "aa" or "bb", a +Although the second group number 1 is not explicitly named, the name AA is +still an alias for any group 1. Whether the pattern matches "aa" or "bb", a reference by name to group AA yields the matched string. .P By default, a name must be unique within a pattern, except that duplicate names -are permitted for subpatterns with the same number, for example: +are permitted for groups with the same number, for example: .sp (?|(?aa)|(?bb)) .sp The duplicate name constraint can be disabled by setting the PCRE2_DUPNAMES option at compile time, or by the use of (?J) within the pattern. Duplicate -names can be useful for patterns where only one instance of the named -parentheses can match. Suppose you want to match the name of a weekday, either -as a 3-letter abbreviation or as the full name, and in both cases you want to +names can be useful for patterns where only one instance of the named capture +group can match. Suppose you want to match the name of a weekday, either as a +3-letter abbreviation or as the full name, and in both cases you want to extract the abbreviation. This pattern (ignoring the line breaks) does the job: .sp (?Mon|Fri|Sun)(?:day)?| @@ -1898,23 +1903,23 @@ extract the abbreviation. This pattern (ignoring the line breaks) does the job: (?Thu)(?:rsday)?| (?Sat)(?:urday)? .sp -There are five capturing substrings, but only one is ever set after a match. -The convenience functions for extracting the data by name returns the substring -for the first (and in this example, the only) subpattern of that name that -matched. This saves searching to find which numbered subpattern it was. (An -alternative way of solving this problem is to use a "branch reset" subpattern, -as described in the previous section.) +There are five capture groups, but only one is ever set after a match. The +convenience functions for extracting the data by name returns the substring for +the first (and in this example, the only) group of that name that matched. This +saves searching to find which numbered group it was. (An alternative way of +solving this problem is to use a "branch reset" group, as described in the +previous section.) .P -If you make a backreference to a non-unique named subpattern from elsewhere in -the pattern, the subpatterns to which the name refers are checked in the order -in which they appear in the overall pattern. The first one that is set is used -for the reference. For example, this pattern matches both "foofoo" and -"barbar" but not "foobar" or "barfoo": +If you make a backreference to a non-unique named group from elsewhere in the +pattern, the groups to which the name refers are checked in the order in which +they appear in the overall pattern. The first one that is set is used for the +reference. For example, this pattern matches both "foofoo" and "barbar" but not +"foobar" or "barfoo": .sp (?:(?foo)|(?bar))\ek .sp .P -If you make a subroutine call to a non-unique named subpattern, the one that +If you make a subroutine call to a non-unique named group, the one that corresponds to the first occurrence of the name is used. In the absence of duplicate numbers this is the one with the lowest number. .P @@ -1925,11 +1930,11 @@ test (see the .\" section about conditions .\" -below), either to check whether a subpattern has matched, or to check for -recursion, all subpatterns with the same name are tested. If the condition is -true for any one of them, the overall condition is true. This is the same -behaviour as testing by number. For further details of the interfaces for -handling named subpatterns, see the +below), either to check whether a capture group has matched, or to check for +recursion, all groups with the same name are tested. If the condition is true +for any one of them, the overall condition is true. This is the same behaviour +as testing by number. For further details of the interfaces for handling named +capture groups, see the .\" HREF \fBpcre2api\fP .\" @@ -1945,18 +1950,18 @@ items: a literal data character the dot metacharacter the \eC escape sequence - the \eX escape sequence the \eR escape sequence + the \eX escape sequence an escape such as \ed or \epL that matches a single character a character class a backreference - a parenthesized subpattern (including most assertions) - a subroutine call to a subpattern (recursive or otherwise) + a parenthesized group (including most assertions) + a subroutine call (recursive or otherwise) .sp The general repetition quantifier specifies a minimum and maximum number of permitted matches, by giving the two numbers in curly brackets (braces), separated by a comma. The numbers must be less than 65536, and the first must -be less than or equal to the second. For example: +be less than or equal to the second. For example, .sp z{2,4} .sp @@ -1984,18 +1989,18 @@ several code units long (and they may be of different lengths). .P The quantifier {0} is permitted, causing the expression to behave as if the previous item and the quantifier were not present. This may be useful for -subpatterns that are referenced as -.\" HTML +capture groups that are referenced as +.\" HTML .\" subroutines .\" from elsewhere in the pattern (but see also the section entitled .\" HTML .\" -"Defining subpatterns for use by reference only" +"Defining capture groups for use by reference only" .\" -below). Items other than subpatterns that have a {0} quantifier are omitted -from the compiled pattern. +below). Except for parenthesized groups, items that have a {0} quantifier are +omitted from the compiled pattern. .P For convenience, the three most common quantifiers have single-character abbreviations: @@ -2004,22 +2009,22 @@ abbreviations: + is equivalent to {1,} ? is equivalent to {0,1} .sp -It is possible to construct infinite loops by following a subpattern that can -match no characters with a quantifier that has no upper limit, for example: +It is possible to construct infinite loops by following a group that can match +no characters with a quantifier that has no upper limit, for example: .sp (a?)* .sp Earlier versions of Perl and PCRE1 used to give an error at compile time for such patterns. However, because there are cases where this can be useful, such -patterns are now accepted, but if any repetition of the subpattern does in fact +patterns are now accepted, but if any repetition of the group does in fact match no characters, the loop is forcibly broken. .P -By default, the quantifiers are "greedy", that is, they match as much as -possible (up to the maximum number of permitted times), without causing the -rest of the pattern to fail. The classic example of where this gives problems -is in trying to match comments in C programs. These appear between /* and */ -and within the comment, individual * and / characters may appear. An attempt to -match C comments by applying the pattern +By default, quantifiers are "greedy", that is, they match as much as possible +(up to the maximum number of permitted times), without causing the rest of the +pattern to fail. The classic example of where this gives problems is in trying +to match comments in C programs. These appear between /* and */ and within the +comment, individual * and / characters may appear. An attempt to match C +comments by applying the pattern .sp /\e*.*\e*/ .sp @@ -2028,10 +2033,9 @@ to the string /* first comment */ not comment /* second comment */ .sp fails, because it matches the entire string owing to the greediness of the .* -item. -.P -If a quantifier is followed by a question mark, it ceases to be greedy, and -instead matches the minimum number of times possible, so the pattern +item. However, if a quantifier is followed by a question mark, it ceases to be +greedy, and instead matches the minimum number of times possible, so the +pattern .sp /\e*.*?\e*/ .sp @@ -2050,7 +2054,7 @@ the quantifiers are not greedy by default, but individual ones can be made greedy by following them with a question mark. In other words, it inverts the default behaviour. .P -When a parenthesized subpattern is quantified with a minimum repeat count that +When a parenthesized group is quantified with a minimum repeat count that is greater than 1 or with a limited maximum, more memory is required for the compiled pattern, in proportion to the size of the minimum or maximum. .P @@ -2085,15 +2089,14 @@ It matches "ab" in the subject "aab". The use of the backtracking control verbs (*PRUNE) and (*SKIP) also disable this optimization, and there is an option, PCRE2_NO_DOTSTAR_ANCHOR, to do so explicitly. .P -When a capturing subpattern is repeated, the value captured is the substring -that matched the final iteration. For example, after +When a capture group is repeated, the value captured is the substring that +matched the final iteration. For example, after .sp (tweedle[dume]{3}\es*)+ .sp has matched "tweedledum tweedledee" the value of the captured substring is -"tweedledee". However, if there are nested capturing subpatterns, the -corresponding captured values may have been set in previous iterations. For -example, after +"tweedledee". However, if there are nested capture groups, the corresponding +captured values may have been set in previous iterations. For example, after .sp (a|(b))+ .sp @@ -2119,7 +2122,7 @@ After matching all 6 digits and then failing to match "foo", the normal action of the matcher is to try again with only 5 digits matching the \ed+ item, and then with 4, and so on, before ultimately failing. "Atomic grouping" (a term taken from Jeffrey Friedl's book) provides the means for specifying -that once a subpattern has matched, it is not to be re-evaluated in this way. +that once a group has matched, it is not to be re-evaluated in this way. .P If we use atomic grouping for the previous example, the matcher gives up immediately on failing to match "foo" the first time. The notation is a kind of @@ -2132,23 +2135,23 @@ be easier to remember: .sp (*atomic:\ed+)foo .sp -This kind of parenthesis "locks up" the part of the pattern it contains once -it has matched, and a failure further into the pattern is prevented from -backtracking into it. Backtracking past it to previous items, however, works as -normal. +This kind of parenthesized group "locks up" the part of the pattern it +contains once it has matched, and a failure further into the pattern is +prevented from backtracking into it. Backtracking past it to previous items, +however, works as normal. .P -An alternative description is that a subpattern of this type matches exactly -the string of characters that an identical standalone pattern would match, if +An alternative description is that a group of this type matches exactly the +string of characters that an identical standalone pattern would match, if anchored at the current point in the subject string. .P -Atomic grouping subpatterns are not capturing subpatterns. Simple cases such as -the above example can be thought of as a maximizing repeat that must swallow -everything it can. So, while both \ed+ and \ed+? are prepared to adjust the -number of digits they match in order to make the rest of the pattern match, -(?>\ed+) can only match an entire sequence of digits. +Atomic groups are not capture groups. Simple cases such as the above example +can be thought of as a maximizing repeat that must swallow everything it can. +So, while both \ed+ and \ed+? are prepared to adjust the number of digits they +match in order to make the rest of the pattern match, (?>\ed+) can only match +an entire sequence of digits. .P Atomic groups in general can of course contain arbitrarily complicated -subpatterns, and can be nested. However, when the subpattern for an atomic +expressions, and can be nested. However, when the contents of an atomic group is just a single repeated item, as in the example above, a simpler notation, called a "possessive quantifier" can be used. This consists of an additional + character following a quantifier. Using this notation, the @@ -2170,8 +2173,8 @@ difference; possessive quantifiers should be slightly faster. The possessive quantifier syntax is an extension to the Perl 5.8 syntax. Jeffrey Friedl originated the idea (and the name) in the first edition of his book. Mike McCloskey liked it, so implemented it when he built Sun's Java -package, and PCRE1 copied it from there. It ultimately found its way into Perl -at release 5.10. +package, and PCRE1 copied it from there. It found its way into Perl at release +5.10. .P PCRE2 has an optimization that automatically "possessifies" certain simple pattern constructs. For example, the sequence A+B is treated as A++B because @@ -2179,10 +2182,9 @@ there is no point in backtracking into a sequence of A's when B must follow. This feature can be disabled by the PCRE2_NO_AUTOPOSSESS option, or starting the pattern with (*NO_AUTO_POSSESS). .P -When a pattern contains an unlimited repeat inside a subpattern that can itself -be repeated an unlimited number of times, the use of an atomic group is the -only way to avoid some failing matches taking a very long time indeed. The -pattern +When a pattern contains an unlimited repeat inside a group that can itself be +repeated an unlimited number of times, the use of an atomic group is the only +way to avoid some failing matches taking a very long time indeed. The pattern .sp (\eD+|<\ed+>)*[!?] .sp @@ -2211,29 +2213,28 @@ sequences of non-digits cannot be broken, and failure happens quickly. .rs .sp Outside a character class, a backslash followed by a digit greater than 0 (and -possibly further digits) is a backreference to a capturing subpattern earlier -(that is, to its left) in the pattern, provided there have been that many -previous capturing left parentheses. +possibly further digits) is a backreference to a capture group earlier (that +is, to its left) in the pattern, provided there have been that many previous +capture groups. .P However, if the decimal number following the backslash is less than 8, it is -always taken as a backreference, and causes an error only if there are not -that many capturing left parentheses in the entire pattern. In other words, the -parentheses that are referenced need not be to the left of the reference for -numbers less than 8. A "forward backreference" of this type can make sense -when a repetition is involved and the subpattern to the right has participated -in an earlier iteration. +always taken as a backreference, and causes an error only if there are not that +many capture groups in the entire pattern. In other words, the group that is +referenced need not be to the left of the reference for numbers less than 8. A +"forward backreference" of this type can make sense when a repetition is +involved and the group to the right has participated in an earlier iteration. .P -It is not possible to have a numerical "forward backreference" to a subpattern -whose number is 8 or more using this syntax because a sequence such as \e50 is +It is not possible to have a numerical "forward backreference" to a group whose +number is 8 or more using this syntax because a sequence such as \e50 is interpreted as a character defined in octal. See the subsection entitled "Non-printing characters" .\" HTML .\" above .\" -for further details of the handling of digits following a backslash. There is -no such problem when named parentheses are used. A backreference to any -subpattern is possible using named parentheses (see below). +for further details of the handling of digits following a backslash. Other +forms of backreferencing do not suffer from this restriction. In particular, +there is no problem when named capture groups are used (see below). .P Another way of avoiding the ambiguity inherent in the use of digits following a backslash is to use the \eg escape sequence. This escape must be followed by a @@ -2250,22 +2251,22 @@ the reference. A signed number is a relative reference. Consider this example: .sp (abc(def)ghi)\eg{-1} .sp -The sequence \eg{-1} is a reference to the most recently started capturing -subpattern before \eg, that is, is it equivalent to \e2 in this example. -Similarly, \eg{-2} would be equivalent to \e1. The use of relative references -can be helpful in long patterns, and also in patterns that are created by -joining together fragments that contain references within themselves. +The sequence \eg{-1} is a reference to the most recently started capture group +before \eg, that is, is it equivalent to \e2 in this example. Similarly, +\eg{-2} would be equivalent to \e1. The use of relative references can be +helpful in long patterns, and also in patterns that are created by joining +together fragments that contain references within themselves. .P -The sequence \eg{+1} is a reference to the next capturing subpattern. This kind -of forward reference can be useful it patterns that repeat. Perl does not -support the use of + in this way. +The sequence \eg{+1} is a reference to the next capture group. This kind of +forward reference can be useful in patterns that repeat. Perl does not support +the use of + in this way. .P -A backreference matches whatever actually matched the capturing subpattern in -the current subject string, rather than anything matching the subpattern -itself (see -.\" HTML +A backreference matches whatever actually most recently matched the capture +group in the current subject string, rather than anything at all that matches +the group (see +.\" HTML .\" -"Subpatterns as subroutines" +"Groups as subroutines" .\" below for a way of doing that). So the pattern .sp @@ -2278,26 +2279,26 @@ backreference, the case of letters is relevant. For example, ((?i)rah)\es+\e1 .sp matches "rah rah" and "RAH RAH", but not "RAH rah", even though the original -capturing subpattern is matched caselessly. +capture group is matched caselessly. .P -There are several different ways of writing backreferences to named -subpatterns. The .NET syntax \ek{name} and the Perl syntax \ek or -\ek'name' are supported, as is the Python syntax (?P=name). Perl 5.10's unified +There are several different ways of writing backreferences to named capture +groups. The .NET syntax \ek{name} and the Perl syntax \ek or \ek'name' +are supported, as is the Python syntax (?P=name). Perl 5.10's unified backreference syntax, in which \eg can be used for both numeric and named -references, is also supported. We could rewrite the above example in any of -the following ways: +references, is also supported. We could rewrite the above example in any of the +following ways: .sp (?(?i)rah)\es+\ek (?'p1'(?i)rah)\es+\ek{p1} (?P(?i)rah)\es+(?P=p1) (?(?i)rah)\es+\eg{p1} .sp -A subpattern that is referenced by name may appear in the pattern before or +A capture group that is referenced by name may appear in the pattern before or after the reference. .P -There may be more than one backreference to the same subpattern. If a -subpattern has not actually been used in a particular match, any backreferences -to it always fail by default. For example, the pattern +There may be more than one backreference to the same group. If a group has not +actually been used in a particular match, backreferences to it always fail by +default. For example, the pattern .sp (a|(bc))\e2 .sp @@ -2305,12 +2306,11 @@ always fails if it starts to match "a" rather than "bc". However, if the PCRE2_MATCH_UNSET_BACKREF option is set at compile time, a backreference to an unset value matches an empty string. .P -Because there may be many capturing parentheses in a pattern, all digits -following a backslash are taken as part of a potential backreference number. -If the pattern continues with a digit character, some delimiter must be used to -terminate the backreference. If the PCRE2_EXTENDED or PCRE2_EXTENDED_MORE -option is set, this can be white space. Otherwise, the \eg{ syntax or an empty -comment (see +Because there may be many capture groups in a pattern, all digits following a +backslash are taken as part of a potential backreference number. If the pattern +continues with a digit character, some delimiter must be used to terminate the +backreference. If the PCRE2_EXTENDED or PCRE2_EXTENDED_MORE option is set, this +can be white space. Otherwise, the \eg{} syntax or an empty comment (see .\" HTML .\" "Comments" @@ -2321,19 +2321,18 @@ below) can be used. .SS "Recursive backreferences" .rs .sp -A backreference that occurs inside the parentheses to which it refers fails -when the subpattern is first used, so, for example, (a\e1) never matches. -However, such references can be useful inside repeated subpatterns. For -example, the pattern +A backreference that occurs inside the group to which it refers fails when the +group is first used, so, for example, (a\e1) never matches. However, such +references can be useful inside repeated groups. For example, the pattern .sp (a|b\e1)+ .sp matches any number of "a"s and also "aba", "ababbaa" etc. At each iteration of -the subpattern, the backreference matches the character string corresponding -to the previous iteration. In order for this to work, the pattern must be such -that the first iteration does not need to match the backreference. This can be -done using alternation, as in the example above, or by a quantifier with a -minimum of zero. +the group, the backreference matches the character string corresponding to the +previous iteration. In order for this to work, the pattern must be such that +the first iteration does not need to match the backreference. This can be done +using alternation, as in the example above, or by a quantifier with a minimum +of zero. .P Backreferences of this type cause the group that they reference to be treated as an @@ -2357,28 +2356,28 @@ coded as \eb, \eB, \eA, \eG, \eZ, \ez, ^ and $ are described above. .\" .P -More complicated assertions are coded as subpatterns. There are two kinds: -those that look ahead of the current position in the subject string, and those -that look behind it, and in each case an assertion may be positive (must match -for the assertion to be true) or negative (must not match for the assertion to -be true). An assertion subpattern is matched in the normal way, and if it is -true, matching continues after it, but with the matching position in the -subject string is was it was before the assertion was processed. +More complicated assertions are coded as parenthesized groups. There are two +kinds: those that look ahead of the current position in the subject string, and +those that look behind it, and in each case an assertion may be positive (must +match for the assertion to be true) or negative (must not match for the +assertion to be true). An assertion group is matched in the normal way, +and if it is true, matching continues after it, but with the matching position +in the subject string is was it was before the assertion was processed. .P A lookaround assertion may also appear as the condition in a .\" HTML .\" -conditional subpattern +conditional group .\" (see below). In this case, the result of matching the assertion determines which branch of the condition is followed. .P -Assertion subpatterns are not capturing subpatterns. If an assertion contains -capturing subpatterns within it, these are counted for the purposes of -numbering the capturing subpatterns in the whole pattern. Within each branch of -an assertion, locally captured substrings may be referenced in the usual way. -For example, a sequence such as (.)\eg{-1} can be used to check that two -adjacent characters are the same. +Assertion groups are not capture groups. If an assertion contains capture +groups within it, these are counted for the purposes of numbering the capture +groups in the whole pattern. Within each branch of an assertion, locally +captured substrings may be referenced in the usual way. For example, a sequence +such as (.)\eg{-1} can be used to check that two adjacent characters are the +same. .P When a branch within an assertion fails to match, any substrings that were captured are discarded (as happens with any pattern branch that fails to @@ -2393,23 +2392,23 @@ the assertion. For a negative assertion, a matching branch means that the assertion is not true. If such an assertion is being used as a condition in a .\" HTML .\" -conditional subpattern +conditional group .\" (see below), captured substrings are retained, because matching continues with the "no" branch of the condition. For other failing negative assertions, control passes to the previous backtracking point, thus discarding any captured strings within the assertion. .P -For compatibility with Perl, most assertion subpatterns may be repeated; though -it makes no sense to assert the same thing several times, the side effect of -capturing parentheses may occasionally be useful. However, an assertion that -forms the condition for a conditional subpattern may not be quantified. In -practice, for other assertions, there only three cases: +For compatibility with Perl, most assertion groups may be repeated; though it +makes no sense to assert the same thing several times, the side effect of +capturing may occasionally be useful. However, an assertion that forms the +condition for a conditional group may not be quantified. In practice, for +other assertions, there only three cases: .sp (1) If the quantifier is {0}, the assertion is never obeyed during matching. -However, it may contain internal capturing parenthesized groups that are called -from elsewhere via the -.\" HTML +However, it may contain internal capture groups that are called from elsewhere +via the +.\" HTML .\" subroutine mechanism. .\" @@ -2436,9 +2435,9 @@ following synonyms: (*positive_lookbehind: or (*plb: is the same as (?<= (*negative_lookbehind: or (*nlb: is the same as (? +.\" HTML .\" "Subroutine" .\" calls (see below) such as (?2) or (?&X) are permitted in lookbehinds, as long -as the subpattern matches a fixed-length string. However, +as the called capture group matches a fixed-length string. However, .\" HTML .\" recursion, @@ -2538,10 +2537,10 @@ is not supported. Perl does not support backreferences in lookbehinds. PCRE2 does support them, but only if certain conditions are met. The PCRE2_MATCH_UNSET_BACKREF option must not be set, there must be no use of (?| in the pattern (it creates -duplicate subpattern numbers), and if the backreference is by name, the name -must be unique. Of course, the referenced subpattern must itself be of fixed -length. The following pattern matches words containing at least two characters -that begin and end with the same character: +duplicate group numbers), and if the backreference is by name, the name +must be unique. Of course, the referenced group must itself match a fixed +length substring. The following pattern matches words containing at least two +characters that begin and end with the same character: .sp \eb(\ew)\ew++(?<=\e1) .P @@ -2669,18 +2668,18 @@ parentheses. .\" (see below) .\" -should not be used within a script run subpattern, because it causes an -immediate exit from the subpattern, bypassing the script run checking. +should not be used within a script run group, because it causes an immediate +exit from the group, bypassing the script run checking. . . .\" HTML -.SH "CONDITIONAL SUBPATTERNS" +.SH "CONDITIONAL GROUPS" .rs .sp -It is possible to cause the matching process to obey a subpattern -conditionally or to choose between two alternative subpatterns, depending on -the result of an assertion, or whether a specific capturing subpattern has -already been matched. The two possible forms of conditional subpattern are: +It is possible to cause the matching process to obey a pattern fragment +conditionally or to choose between two alternative fragments, depending on +the result of an assertion, or whether a specific capture group has +already been matched. The two possible forms of conditional group are: .sp (?(condition)yes-pattern) (?(condition)yes-pattern|no-pattern) @@ -2688,38 +2687,36 @@ already been matched. The two possible forms of conditional subpattern are: If the condition is satisfied, the yes-pattern is used; otherwise the no-pattern (if present) is used. An absent no-pattern is equivalent to an empty string (it always matches). If there are more than two alternatives in the -subpattern, a compile-time error occurs. Each of the two alternatives may -itself contain nested subpatterns of any form, including conditional -subpatterns; the restriction to two alternatives applies only at the level of -the condition. This pattern fragment is an example where the alternatives are -complex: +group, a compile-time error occurs. Each of the two alternatives may itself +contain nested groups of any form, including conditional groups; the +restriction to two alternatives applies only at the level of the condition +itself. This pattern fragment is an example where the alternatives are complex: .sp (?(1) (A|B|C) | (D | (?(2)E|F) | E) ) .sp .P -There are five kinds of condition: references to subpatterns, references to +There are five kinds of condition: references to capture groups, references to recursion, two pseudo-conditions called DEFINE and VERSION, and assertions. . . -.SS "Checking for a used subpattern by number" +.SS "Checking for a used capture group by number" .rs .sp If the text between the parentheses consists of a sequence of digits, the -condition is true if a capturing subpattern of that number has previously -matched. If there is more than one capturing subpattern with the same number -(see the earlier +condition is true if a capture group of that number has previously matched. If +there is more than one capture group with the same number (see the earlier .\" .\" HTML .\" -section about duplicate subpattern numbers), +section about duplicate group numbers), .\" the condition is true if any of them have matched. An alternative notation is -to precede the digits with a plus or minus sign. In this case, the subpattern -number is relative rather than absolute. The most recently opened parentheses -can be referenced by (?(-1), the next most recent by (?(-2), and so on. Inside -loops it can also make sense to refer to subsequent groups. The next -parentheses to be opened can be referenced as (?(+1), and so on. (The value -zero in any of these forms is not used; it provokes a compile-time error.) +to precede the digits with a plus or minus sign. In this case, the group number +is relative rather than absolute. The most recently opened capture group can be +referenced by (?(-1), the next most recent by (?(-2), and so on. Inside loops +it can also make sense to refer to subsequent groups. The next capture group +can be referenced as (?(+1), and so on. (The value zero in any of these forms +is not used; it provokes a compile-time error.) .P Consider the following pattern, which contains non-significant white space to make it more readable (assume the PCRE2_EXTENDED option) and to divide it into @@ -2730,12 +2727,12 @@ three parts for ease of discussion: The first part matches an optional opening parenthesis, and if that character is present, sets it as the first captured substring. The second part matches one or more characters that are not parentheses. The third part is a -conditional subpattern that tests whether or not the first set of parentheses -matched. If they did, that is, if subject started with an opening parenthesis, +conditional group that tests whether or not the first capture group +matched. If it did, that is, if subject started with an opening parenthesis, the condition is true, and so the yes-pattern is executed and a closing parenthesis is required. Otherwise, since no-pattern is not present, the -subpattern matches nothing. In other words, this pattern matches a sequence of -non-parentheses, optionally enclosed in parentheses. +conditional group matches nothing. In other words, this pattern matches a +sequence of non-parentheses, optionally enclosed in parentheses. .P If you were embedding this pattern in a larger one, you could use a relative reference: @@ -2745,21 +2742,20 @@ reference: This makes the fragment independent of the parentheses in the larger pattern. . . -.SS "Checking for a used subpattern by name" +.SS "Checking for a used capture group by name" .rs .sp Perl uses the syntax (?()...) or (?('name')...) to test for a used -subpattern by name. For compatibility with earlier versions of PCRE1, which had -this facility before Perl, the syntax (?(name)...) is also recognized. Note, -however, that undelimited names consisting of the letter R followed by digits -are ambiguous (see the following section). -.P -Rewriting the above example to use a named subpattern gives this: +capture group by name. For compatibility with earlier versions of PCRE1, which +had this facility before Perl, the syntax (?(name)...) is also recognized. +Note, however, that undelimited names consisting of the letter R followed by +digits are ambiguous (see the following section). Rewriting the above example +to use a named group gives this: .sp (? \e( )? [^()]+ (?() \e) ) .sp If the name used in a condition of this kind is a duplicate, the test is -applied to all subpatterns of the same name, and is true if any one of them has +applied to all groups of the same name, and is true if any one of them has matched. . . @@ -2774,22 +2770,22 @@ sections entitled "Recursive patterns" .\" and -.\" HTML +.\" HTML .\" -"Subpatterns as subroutines" +"Groups as subroutines" .\" -below for details of recursion and subpattern calls. +below for details of recursion and subroutine calls. .P -If a condition is the string (R), and there is no subpattern with the name R, -the condition is true if matching is currently in a recursion or subroutine -call to the whole pattern or any subpattern. If digits follow the letter R, and -there is no subpattern with that name, the condition is true if the most recent -call is into a subpattern with the given number, which must exist somewhere in -the overall pattern. This is a contrived example that is equivalent to a+b: +If a condition is the string (R), and there is no capture group with the name +R, the condition is true if matching is currently in a recursion or subroutine +call to the whole pattern or any capture group. If digits follow the letter R, +and there is no group with that name, the condition is true if the most recent +call is into a group with the given number, which must exist somewhere in the +overall pattern. This is a contrived example that is equivalent to a+b: .sp ((?(R1)a+|(?1)b)) .sp -However, in both cases, if there is a subpattern with a matching name, the +However, in both cases, if there is a capture group with a matching name, the condition tests for its being set, as described in the section above, instead of testing for recursion. For example, creating a group with the name R1 by adding (?) to the above pattern completely changes its meaning. @@ -2798,27 +2794,27 @@ If a name preceded by ampersand follows the letter R, for example: .sp (?(R&name)...) .sp -the condition is true if the most recent recursion is into a subpattern of that -name (which must exist within the pattern). +the condition is true if the most recent recursion is into a group of that name +(which must exist within the pattern). .P This condition does not check the entire recursion stack. It tests only the current level. If the name used in a condition of this kind is a duplicate, the -test is applied to all subpatterns of the same name, and is true if any one of +test is applied to all groups of the same name, and is true if any one of them is the most recent recursion. .P At "top level", all these recursion test conditions are false. . . .\" HTML -.SS "Defining subpatterns for use by reference only" +.SS "Defining capture groups for use by reference only" .rs .sp If the condition is the string (DEFINE), the condition is always false, even if there is a group with the name DEFINE. In this case, there may be only one -alternative in the subpattern. It is always skipped if control reaches this -point in the pattern; the idea of DEFINE is that it can be used to define -subroutines that can be referenced from elsewhere. (The use of -.\" HTML +alternative in the rest of the conditional group. It is always skipped if +control reaches this point in the pattern; the idea of DEFINE is that it can be +used to define subroutines that can be referenced from elsewhere. (The use of +.\" HTML .\" subroutines .\" @@ -2858,10 +2854,10 @@ than two digits. .SS "Assertion conditions" .rs .sp -If the condition is not in any of the above formats, it must be an assertion. -This may be a positive or negative lookahead or lookbehind assertion. Consider -this pattern, again containing non-significant white space, and with the two -alternatives on the second line: +If the condition is not in any of the above formats, it must be a parenthesized +assertion. This may be a positive or negative lookahead or lookbehind +assertion. Consider this pattern, again containing non-significant white space, +and with the two alternatives on the second line: .sp (?(?=[^a-z]*[a-z]) \ed{2}-[a-z]{3}-\ed{2} | \ed{2}-\ed{2}-\ed{2} ) @@ -2873,11 +2869,11 @@ subject is matched against the first alternative; otherwise it is matched against the second. This pattern matches strings in one of the two forms dd-aaa-dd or dd-dd-dd, where aaa are letters and dd are digits. .P -When an assertion that is a condition contains capturing subpatterns, any +When an assertion that is a condition contains capture groups, any capturing that occurs in a matching branch is retained afterwards, for both positive and negative assertions, because matching always continues after the assertion, whether it succeeds or fails. (Compare non-conditional assertions, -when captures are retained only for positive assertions that succeed.) +for which captures are retained only for positive assertions that succeed.) . . .\" HTML @@ -2887,7 +2883,7 @@ when captures are retained only for positive assertions that succeed.) There are two ways of including comments in patterns that are processed by PCRE2. In both cases, the start of the comment must not be in a character class, nor in the middle of any other sequence of related characters such as -(?: or a subpattern name or number. The characters that make up a comment play +(?: or a group name or number. The characters that make up a comment play no part in the pattern matching. .P The sequence (?# marks the start of a comment that continues up to the next @@ -2937,13 +2933,13 @@ recursively to the pattern in which it appears. .P Obviously, PCRE2 cannot support the interpolation of Perl code. Instead, it supports special syntax for recursion of the entire pattern, and also for -individual subpattern recursion. After its introduction in PCRE1 and Python, +individual capture group recursion. After its introduction in PCRE1 and Python, this kind of recursion was subsequently introduced into Perl at release 5.10. .P A special item that consists of (? followed by a number greater than zero and a -closing parenthesis is a recursive subroutine call of the subpattern of the -given number, provided that it occurs inside that subpattern. (If not, it is a -.\" HTML +closing parenthesis is a recursive subroutine call of the capture group of the +given number, provided that it occurs inside that group. (If not, it is a +.\" HTML .\" non-recursive subroutine .\" @@ -2976,26 +2972,26 @@ parentheses preceding the recursion. In other words, a negative number counts capturing parentheses leftwards from the point at which it is encountered. .P Be aware however, that if -.\" HTML +.\" HTML .\" -duplicate subpattern numbers +duplicate capture group numbers .\" -are in use, relative references refer to the earliest subpattern with the +are in use, relative references refer to the earliest group with the appropriate number. Consider, for example: .sp (?|(a)|(b)) (c) (?-2) .sp -The first two capturing groups (a) and (b) are both numbered 1, and group (c) +The first two capture groups (a) and (b) are both numbered 1, and group (c) is number 2. When the reference (?-2) is encountered, the second most recently opened parentheses has the number 1, but it is the first such group (the (a) group) to which the recursion refers. This would be the same if an absolute reference (?1) was used. In other words, relative references are just a shorthand for computing a group number. .P -It is also possible to refer to subsequently opened parentheses, by writing +It is also possible to refer to subsequent capture groups, by writing references such as (?+2). However, these cannot be recursive because the reference is not inside the parentheses that are referenced. They are always -.\" HTML +.\" HTML .\" non-recursive subroutine .\" @@ -3007,7 +3003,7 @@ rewrite the above example as follows: .sp (? \e( ( [^()]++ | (?&pn) )* \e) ) .sp -If there is more than one subpattern with the same name, the earliest one is +If there is more than one group with the same name, the earliest one is used. .P The example pattern that we have been looking at contains nested unlimited @@ -3033,9 +3029,9 @@ documentation). If the pattern above is matched against (ab(cd)ef) .sp the value for the inner capturing parentheses (numbered 2) is "ef", which is -the last value taken on at the top level. If a capturing subpattern is not -matched at the top level, its final captured value is unset, even if it was -(temporarily) set at a deeper level during the matching process. +the last value taken on at the top level. If a capture group is not matched at +the top level, its final captured value is unset, even if it was (temporarily) +set at a deeper level during the matching process. .P Do not confuse the (?R) item with the condition (R), which tests for recursion. Consider this pattern, which matches text in angle brackets, allowing for @@ -3044,9 +3040,9 @@ recursing), whereas any characters are permitted at the outer level. .sp < (?: (?(R) \ed++ | [^<>]*+) | (?R)) * > .sp -In this pattern, (?(R) is the start of a conditional subpattern, with two -different alternatives for the recursive and non-recursive cases. The (?R) item -is the actual recursive call. +In this pattern, (?(R) is the start of a conditional group, with two different +alternatives for the recursive and non-recursive cases. The (?R) item is the +actual recursive call. . . .\" HTML @@ -3056,7 +3052,7 @@ is the actual recursive call. Some former differences between PCRE2 and Perl no longer exist. .P Before release 10.30, recursion processing in PCRE2 differed from Perl in that -a recursive subpattern call was always treated as an atomic group. That is, +a recursive subroutine call was always treated as an atomic group. That is, once it had matched some of the subject string, it was never re-entered, even if it contained untried alternatives and there was a subsequent matching failure. (Historical note: PCRE implemented recursion before Perl did.) @@ -3089,7 +3085,7 @@ Perl takes so long that you think it has gone into a loop. .P Another way in which PCRE2 and Perl used to differ in their recursion processing is in the handling of captured values. Formerly in Perl, when a -subpattern was called recursively or as a subpattern (see the next section), it +group was called recursively or as a subroutine (see the next section), it had no access to any values that were captured outside the recursion, whereas in PCRE2 these values can be referenced. Consider this pattern: .sp @@ -3102,17 +3098,16 @@ alternative matches "a" and then recurses. In the recursion, \e1 does now match later versions (I tried 5.024) it now works. . . -.\" HTML -.SH "SUBPATTERNS AS SUBROUTINES" +.\" HTML +.SH "GROUPS AS SUBROUTINES" .rs .sp -If the syntax for a recursive subpattern call (either by number or by -name) is used outside the parentheses to which it refers, it operates a bit -like a subroutine in a programming language. More accurately, PCRE2 treats the -referenced subpattern as an independent subpattern which it tries to match at -the current matching position. The called subpattern may be defined before or -after the reference. A numbered reference can be absolute or relative, as in -these examples: +If the syntax for a recursive group call (either by number or by name) is used +outside the parentheses to which it refers, it operates a bit like a subroutine +in a programming language. More accurately, PCRE2 treats the referenced group +as an independent subpattern which it tries to match at the current matching +position. The called group may be defined before or after the reference. A +numbered reference can be absolute or relative, as in these examples: .sp (...(absolute)...)...(?2)... (...(relative)...)...(?-1)... @@ -3135,21 +3130,21 @@ changed at PCRE2 release 10.30, so backtracking into subroutine calls can now occur. However, any capturing parentheses that are set during the subroutine call revert to their previous values afterwards. .P -Processing options such as case-independence are fixed when a subpattern is +Processing options such as case-independence are fixed when a group is defined, so if it is used as a subroutine, such options cannot be changed for different calls. For example, consider this pattern: .sp (abc)(?i:(?-1)) .sp It matches "abcabc". It does not match "abcABC" because the change of -processing option does not affect the called subpattern. +processing option does not affect the called group. .P The behaviour of .\" HTML .\" backtracking control verbs .\" -in subpatterns when called as subroutines is described in the section entitled +in groups when called as subroutines is described in the section entitled .\" HTML .\" "Backtracking verbs in subroutines" @@ -3163,8 +3158,8 @@ below. .sp For compatibility with Oniguruma, the non-Perl syntax \eg followed by a name or a number enclosed either in angle brackets or single quotes, is an alternative -syntax for referencing a subpattern as a subroutine, possibly recursively. Here -are two of the examples used above, rewritten using this syntax: +syntax for calling a group as a subroutine, possibly recursively. Here are two +of the examples used above, rewritten using this syntax: .sp (? \e( ( (?>[^()]+) | \eg )* \e) ) (sens|respons)e and \eg'1'ibility @@ -3306,7 +3301,7 @@ assertions, and in .\" HTML .\" -subpatterns called as subroutines +capture groups called as subroutines .\" (whether or not recursively) is documented below. . @@ -3347,8 +3342,8 @@ The following verbs act as soon as they are encountered. (*ACCEPT) or (*ACCEPT:NAME) .sp This verb causes the match to end successfully, skipping the remainder of the -pattern. However, when it is inside a subpattern that is called as a -subroutine, only that subpattern is ended successfully. Matching then continues +pattern. However, when it is inside a capture group that is called as a +subroutine, only that group is ended successfully. Matching then continues at the outer level. If (*ACCEPT) in triggered in a positive assertion, the assertion succeeds; in a negative assertion, the assertion fails. .P @@ -3360,9 +3355,8 @@ example: This matches "AB", "AAD", or "ACD"; when it matches "AB", "B" is captured by the outer parentheses. .P -\fBWarning:\fP (*ACCEPT) should not be used within a script run subpattern, -because it causes an immediate exit from the subpattern, bypassing the script -run checking. +\fBWarning:\fP (*ACCEPT) should not be used within a script run group, because +it causes an immediate exit from the group, bypassing the script run checking. .sp (*FAIL) or (*FAIL:NAME) .sp @@ -3602,30 +3596,28 @@ like (*MARK:NAME) in that the name is remembered for passing back to the caller. However, (*SKIP:NAME) searches only for names set with (*MARK), ignoring those set by other backtracking verbs. .P -A subpattern that does not contain a | character is just a part of the -enclosing alternative; it is not a nested alternation with only one -alternative. The effect of (*THEN) extends beyond such a subpattern to the -enclosing alternative. Consider this pattern, where A, B, etc. are complex -pattern fragments that do not contain any | characters at this level: +A group that does not contain a | character is just a part of the enclosing +alternative; it is not a nested alternation with only one alternative. The +effect of (*THEN) extends beyond such a group to the enclosing alternative. +Consider this pattern, where A, B, etc. are complex pattern fragments that do +not contain any | characters at this level: .sp A (B(*THEN)C) | D .sp If A and B are matched, but there is a failure in C, matching does not backtrack into A; instead it moves to the next alternative, that is, D. -However, if the subpattern containing (*THEN) is given an alternative, it +However, if the group containing (*THEN) is given an alternative, it behaves differently: .sp A (B(*THEN)C | (*FAIL)) | D .sp -The effect of (*THEN) is now confined to the inner subpattern. After a failure -in C, matching moves to (*FAIL), which causes the whole subpattern to fail -because there are no more alternatives to try. In this case, matching does now -backtrack into A. +The effect of (*THEN) is now confined to the inner group. After a failure in C, +matching moves to (*FAIL), which causes the whole group to fail because there +are no more alternatives to try. In this case, matching does backtrack into A. .P -Note that a conditional subpattern is not considered as having two -alternatives, because only one is ever used. In other words, the | character in -a conditional subpattern has a different meaning. Ignoring white space, -consider: +Note that a conditional group is not considered as having two alternatives, +because only one is ever used. In other words, the | character in a conditional +group has a different meaning. Ignoring white space, consider: .sp ^.*? (?(?=a) a | b(*THEN)c ) .sp @@ -3633,7 +3625,7 @@ If the subject is "ba", this pattern does not match. Because .*? is ungreedy, it initially matches zero characters. The condition (?=a) then fails, the character "b" is matched, but "c" is not. At this point, matching does not backtrack to .*? as might perhaps be expected from the presence of the | -character. The conditional subpattern is part of the single alternative that +character. The conditional group is part of the single alternative that comprises the whole pattern, and so the match fails. (If there was a backtrack into .*?, allowing it to match "b", the match would succeed.) .P @@ -3690,7 +3682,7 @@ acts. (*FAIL) in any assertion has its normal effect: it forces an immediate backtrack. The behaviour of the other backtracking verbs depends on whether or not the assertion is standalone or acting as the condition in a conditional -subpattern. +group. .P (*ACCEPT) in a standalone positive assertion causes the assertion to succeed without any further processing; captured strings and a mark name (if set) are @@ -3725,25 +3717,24 @@ the assertion to be true, without considering any further alternative branches. .SS "Backtracking verbs in subroutines" .rs .sp -These behaviours occur whether or not the subpattern is called recursively. +These behaviours occur whether or not the group is called recursively. .P -(*ACCEPT) in a subpattern called as a subroutine causes the subroutine match to +(*ACCEPT) in a group called as a subroutine causes the subroutine match to succeed without any further processing. Matching then continues after the subroutine call. Perl documents this behaviour. Perl's treatment of the other verbs in subroutines is different in some cases. .P -(*FAIL) in a subpattern called as a subroutine has its normal effect: it forces +(*FAIL) in a group called as a subroutine has its normal effect: it forces an immediate backtrack. .P (*COMMIT), (*SKIP), and (*PRUNE) cause the subroutine match to fail when -triggered by being backtracked to in a subpattern called as a subroutine. There -is then a backtrack at the outer level. +triggered by being backtracked to in a group called as a subroutine. There is +then a backtrack at the outer level. .P (*THEN), when triggered, skips to the next alternative in the innermost -enclosing group within the subpattern that has alternatives (its normal -behaviour). However, if there is no such group within the subroutine -subpattern, the subroutine match fails and there is a backtrack at the outer -level. +enclosing group that has alternatives (its normal behaviour). However, if there +is no such group within the subroutine's group, the subroutine match fails and +there is a backtrack at the outer level. . . .SH "SEE ALSO" @@ -3767,6 +3758,6 @@ Cambridge, England. .rs .sp .nf -Last updated: 27 November 2018 -Copyright (c) 1997-2018 University of Cambridge. +Last updated: 04 February 2019 +Copyright (c) 1997-2019 University of Cambridge. .fi diff --git a/doc/pcre2perform.3 b/doc/pcre2perform.3 index 91ca22a..040369a 100644 --- a/doc/pcre2perform.3 +++ b/doc/pcre2perform.3 @@ -1,4 +1,4 @@ -.TH PCRE2PERFORM 3 "25 April 2018" "PCRE2 10.32" +.TH PCRE2PERFORM 3 "03 February 2019" "PCRE2 10.33" .SH NAME PCRE2 - Perl-compatible regular expressions (revised API) .SH "PCRE2 PERFORMANCE" @@ -14,9 +14,9 @@ of them. Patterns are compiled by PCRE2 into a reasonably efficient interpretive code, so that most simple patterns do not use much memory for storing the compiled version. However, there is one case where the memory usage of a compiled -pattern can be unexpectedly large. If a parenthesized subpattern has a -quantifier with a minimum greater than 1 and/or a limited maximum, the whole -subpattern is repeated in the compiled code. For example, the pattern +pattern can be unexpectedly large. If a parenthesized group has a quantifier +with a minimum greater than 1 and/or a limited maximum, the whole group is +repeated in the compiled code. For example, the pattern .sp (abc|def){2,4} .sp @@ -239,6 +239,6 @@ Cambridge, England. .rs .sp .nf -Last updated: 25 April 2018 -Copyright (c) 1997-2018 University of Cambridge. +Last updated: 03 February 2019 +Copyright (c) 1997-2019 University of Cambridge. .fi diff --git a/doc/pcre2syntax.3 b/doc/pcre2syntax.3 index 07b7d80..ff1b2b8 100644 --- a/doc/pcre2syntax.3 +++ b/doc/pcre2syntax.3 @@ -1,4 +1,4 @@ -.TH PCRE2SYNTAX 3 "10 October 2018" "PCRE2 10.33" +.TH PCRE2SYNTAX 3 "03 February 2019" "PCRE2 10.33" .SH NAME PCRE2 - Perl-compatible regular expressions (revised API) .SH "PCRE2 REGULAR EXPRESSION SYNTAX SUMMARY" @@ -398,20 +398,24 @@ but some of them use Unicode properties if PCRE2_UCP is set. You can use .SH "CAPTURING" .rs .sp - (...) capturing group - (?...) named capturing group (Perl) - (?'name'...) named capturing group (Perl) - (?P...) named capturing group (Python) - (?:...) non-capturing group - (?|...) non-capturing group; reset group numbers for - capturing groups in each alternative + (...) capture group + (?...) named capture group (Perl) + (?'name'...) named capture group (Perl) + (?P...) named capture group (Python) + (?:...) non-capture group + (?|...) non-capture group; reset group numbers for + capture groups in each alternative +.sp +In non-UTF modes, names may contain underscores and ASCII letters and digits; +in UTF modes, any Unicode letters and Unicode decimal digits are permitted. In +both cases, a name must not start with a digit. . . .SH "ATOMIC GROUPS" .rs .sp - (?>...) atomic, non-capturing group - (*atomic:...) atomic, non-capturing group + (?>...) atomic non-capture group + (*atomic:...) atomic non-capture group . . .SH "COMMENT" @@ -439,7 +443,7 @@ of the group. Unsetting x or xx unsets both. Several options may be set at once, and a mixture of setting and unsetting such as (?i-x) is allowed, but there may be only one hyphen. Setting (but no unsetting) is allowed after (?^ for example -(?^in). An option setting may appear at the start of a non-capturing group, for +(?^in). An option setting may appear at the start of a non-capture group, for example (?i:...). .P The following are recognized only at the very start of a pattern or after one @@ -542,19 +546,19 @@ Each top-level branch of a lookbehind must be of a fixed length. .rs .sp (?R) recurse whole pattern - (?n) call subpattern by absolute number - (?+n) call subpattern by relative number - (?-n) call subpattern by relative number - (?&name) call subpattern by name (Perl) - (?P>name) call subpattern by name (Python) - \eg call subpattern by name (Oniguruma) - \eg'name' call subpattern by name (Oniguruma) - \eg call subpattern by absolute number (Oniguruma) - \eg'n' call subpattern by absolute number (Oniguruma) - \eg<+n> call subpattern by relative number (PCRE2 extension) - \eg'+n' call subpattern by relative number (PCRE2 extension) - \eg<-n> call subpattern by relative number (PCRE2 extension) - \eg'-n' call subpattern by relative number (PCRE2 extension) + (?n) call subroutine by absolute number + (?+n) call subroutine by relative number + (?-n) call subroutine by relative number + (?&name) call subroutine by name (Perl) + (?P>name) call subroutine by name (Python) + \eg call subroutine by name (Oniguruma) + \eg'name' call subroutine by name (Oniguruma) + \eg call subroutine by absolute number (Oniguruma) + \eg'n' call subroutine by absolute number (Oniguruma) + \eg<+n> call subroutine by relative number (PCRE2 extension) + \eg'+n' call subroutine by relative number (PCRE2 extension) + \eg<-n> call subroutine by relative number (PCRE2 extension) + \eg'-n' call subroutine by relative number (PCRE2 extension) . . .SH "CONDITIONAL PATTERNS" @@ -572,7 +576,7 @@ Each top-level branch of a lookbehind must be of a fixed length. (?(R) overall recursion condition (?(Rn) specific numbered group recursion condition (?(R&name) specific named group recursion condition - (?(DEFINE) define subpattern for reference + (?(DEFINE) define groups for reference (?(VERSION[>]=n.m) test PCRE2 version (?(assert) assertion condition .sp @@ -643,6 +647,6 @@ Cambridge, England. .rs .sp .nf -Last updated: 10 October 2018 -Copyright (c) 1997-2018 University of Cambridge. +Last updated: 03 February 2019 +Copyright (c) 1997-2019 University of Cambridge. .fi diff --git a/doc/pcre2test.1 b/doc/pcre2test.1 index df5431a..fdde2ff 100644 --- a/doc/pcre2test.1 +++ b/doc/pcre2test.1 @@ -1,4 +1,4 @@ -.TH PCRE2TEST 1 "12 November 2018" "PCRE 10.33" +.TH PCRE2TEST 1 "03 February 2019" "PCRE 10.33" .SH NAME pcre2test - a program for testing Perl-compatible regular expressions. .SH SYNOPSIS @@ -672,14 +672,14 @@ information is obtained from the \fBpcre2_pattern_info()\fP function. Here are some typical examples: .sp re> /(?i)(^a|^b)/m,info - Capturing subpattern count = 1 + Capture group count = 1 Compile options: multiline Overall options: caseless multiline First code unit at start or follows newline Subject length lower bound = 1 .sp re> /(?i)abc/info - Capturing subpattern count = 0 + Capture group count = 0 Compile options: Overall options: caseless First code unit = 'a' (caseless) @@ -1325,8 +1325,8 @@ current character is CR followed by LF, an advance of two characters occurs. .sp The \fBcopy\fP and \fBget\fP modifiers can be used to test the \fBpcre2_substring_copy_xxx()\fP and \fBpcre2_substring_get_xxx()\fP functions. -They can be given more than once, and each can specify a group name or number, -for example: +They can be given more than once, and each can specify a capture group name or +number, for example: .sp abcd\e=copy=1,copy=3,get=G1 .sp @@ -2056,6 +2056,6 @@ Cambridge, England. .rs .sp .nf -Last updated: 12 November 2018 -Copyright (c) 1997-2018 University of Cambridge. +Last updated: 03 February 2019 +Copyright (c) 1997-2019 University of Cambridge. .fi diff --git a/doc/pcre2test.txt b/doc/pcre2test.txt index a7c8653..dfc5651 100644 --- a/doc/pcre2test.txt +++ b/doc/pcre2test.txt @@ -646,14 +646,14 @@ PATTERN MODIFIERS are some typical examples: re> /(?i)(^a|^b)/m,info - Capturing subpattern count = 1 + Capture group count = 1 Compile options: multiline Overall options: caseless multiline First code unit at start or follows newline Subject length lower bound = 1 re> /(?i)abc/info - Capturing subpattern count = 0 + Capture group count = 0 Compile options: Overall options: caseless First code unit = 'a' (caseless) @@ -1214,8 +1214,8 @@ SUBJECT MODIFIERS The copy and get modifiers can be used to test the pcre2_sub- string_copy_xxx() and pcre2_substring_get_xxx() functions. They can be - given more than once, and each can specify a group name or number, for - example: + given more than once, and each can specify a capture group name or num- + ber, for example: abcd\=copy=1,copy=3,get=G1 @@ -1887,5 +1887,5 @@ AUTHOR REVISION - Last updated: 12 November 2018 - Copyright (c) 1997-2018 University of Cambridge. + Last updated: 03 February 2019 + Copyright (c) 1997-2019 University of Cambridge. diff --git a/doc/pcre2unicode.3 b/doc/pcre2unicode.3 index f1f5810..a34a400 100644 --- a/doc/pcre2unicode.3 +++ b/doc/pcre2unicode.3 @@ -1,4 +1,4 @@ -.TH PCRE2UNICODE 3 "12 October 2018" "PCRE2 10.33" +.TH PCRE2UNICODE 3 "03 February 2019" "PCRE2 10.33" .SH NAME PCRE - Perl-compatible regular expressions (revised API) .SH "UNICODE AND UTF SUPPORT" @@ -27,10 +27,11 @@ case the library will be smaller. .rs .sp When PCRE2 is built with Unicode support, the escape sequences \ep{..}, -\eP{..}, and \eX can be used. The Unicode 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, the Unicode script names such as Arabic or Han, and -the derived properties Any and L&. Full lists are given in the +\eP{..}, and \eX can be used. This is not dependent on the PCRE2_UTF setting. +The Unicode 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, the +Unicode script names such as Arabic or Han, and the derived properties Any and +L&. Full lists are given in the .\" HREF \fBpcre2pattern\fP .\" @@ -62,13 +63,18 @@ individual code units. In UTF modes, the dot metacharacter matches one UTF character instead of a single code unit. .P +In UTF modes, capture group names are not restricted to ASCII, and may contain +any Unicode letters and decimal digits, as well as underscore. +.P The escape sequence \eC can be used to match a single code unit in a UTF mode, but its use can lead to some strange effects because it breaks up multi-unit characters (see the description of \eC in the .\" HREF \fBpcre2pattern\fP .\" -documentation). +documentation). For this reason, there is a build-time option that disables +support for \eC completely. There is also a less draconian compile-time option +for locking out the use of \eC when a pattern is compiled. .P The use of \eC is not supported by the alternative matching function \fBpcre2_dfa_match()\fP when in UTF-8 or UTF-16 mode, that is, when a character @@ -387,6 +393,6 @@ Cambridge, England. .rs .sp .nf -Last updated: 12 October 2018 -Copyright (c) 1997-2018 University of Cambridge. +Last updated: 03 February 2019 +Copyright (c) 1997-2019 University of Cambridge. .fi diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c index eb45210..0c38b5b 100644 --- a/src/pcre2_compile.c +++ b/src/pcre2_compile.c @@ -2194,6 +2194,7 @@ so it is simplest just to return both. Arguments: ptrptr points to the character pointer variable ptrend points to the end of the input string + utf true if the input is UTF-encoded terminator the terminator of a subpattern name must be this offsetptr where to put the offset from the start of the pattern nameptr where to put a pointer to the name in the input @@ -2206,13 +2207,12 @@ Returns: TRUE if a name was read */ static BOOL -read_name(PCRE2_SPTR *ptrptr, PCRE2_SPTR ptrend, uint32_t terminator, +read_name(PCRE2_SPTR *ptrptr, PCRE2_SPTR ptrend, BOOL utf, uint32_t terminator, PCRE2_SIZE *offsetptr, PCRE2_SPTR *nameptr, uint32_t *namelenptr, int *errorcodeptr, compile_block *cb) { PCRE2_SPTR ptr = *ptrptr; BOOL is_group = (*ptr != CHAR_ASTERISK); -uint32_t namelen = 0; if (++ptr >= ptrend) /* No characters in name */ { @@ -2221,35 +2221,74 @@ if (++ptr >= ptrend) /* No characters in name */ goto FAILED; } -/* A group name must not start with a digit. If either of the others start with -a digit it just won't be recognized. */ - -if (is_group && IS_DIGIT(*ptr)) - { - *errorcodeptr = ERR44; - goto FAILED; - } - *nameptr = ptr; *offsetptr = (PCRE2_SIZE)(ptr - cb->start_pattern); -while (ptr < ptrend && MAX_255(*ptr) && (cb->ctypes[*ptr] & ctype_word) != 0) +/* In UTF mode, a group name may contain letters and decimal digits as defined +by Unicode properties, and underscores, but must not start with a digit. */ + +#ifdef SUPPORT_UNICODE +if (utf && is_group) { - ptr++; - namelen++; - if (namelen > MAX_NAME_SIZE) + uint32_t c, type; + + GETCHAR(c, ptr); + type = UCD_CHARTYPE(c); + + if (type == ucp_Nd) { - *errorcodeptr = ERR48; + *errorcodeptr = ERR44; goto FAILED; } + + for(;;) + { + if (type != ucp_Nd && PRIV(ucp_gentype)[type] != ucp_L && + c != CHAR_UNDERSCORE) break; + ptr++; + FORWARDCHAR(ptr); + if (ptr >= ptrend) break; + GETCHAR(c, ptr); + type = UCD_CHARTYPE(c); + } } +else +#else +(void)utf; /* Avoid compiler warning */ +#endif /* SUPPORT_UNICODE */ + +/* Handle non-group names and group names in non-UTF modes. A group name must +not start with a digit. If either of the others start with a digit it just +won't be recognized. */ + + { + if (is_group && IS_DIGIT(*ptr)) + { + *errorcodeptr = ERR44; + goto FAILED; + } + + while (ptr < ptrend && MAX_255(*ptr) && (cb->ctypes[*ptr] & ctype_word) != 0) + { + ptr++; + } + } + +/* Check name length */ + +if (ptr > *nameptr + MAX_NAME_SIZE) + { + *errorcodeptr = ERR48; + goto FAILED; + } +*namelenptr = ptr - *nameptr; /* Subpattern names must not be empty, and their terminator is checked here. (What follows a verb or alpha assertion name is checked separately.) */ if (is_group) { - if (namelen == 0) + if (ptr == *nameptr) { *errorcodeptr = ERR62; /* Subpattern name expected */ goto FAILED; @@ -2262,7 +2301,6 @@ if (is_group) ptr++; } -*namelenptr = namelen; *ptrptr = ptr; return TRUE; @@ -2981,7 +3019,7 @@ while (ptr < ptrend) /* Not a numerical recursion */ - if (!read_name(&ptr, ptrend, terminator, &offset, &name, &namelen, + if (!read_name(&ptr, ptrend, utf, terminator, &offset, &name, &namelen, &errorcode, cb)) goto ESCAPE_FAILED; /* \k and \g when used with braces are back references, whereas \g used @@ -3554,8 +3592,8 @@ while (ptr < ptrend) uint32_t meta; vn = alasnames; - if (!read_name(&ptr, ptrend, 0, &offset, &name, &namelen, &errorcode, - cb)) goto FAILED; + if (!read_name(&ptr, ptrend, utf, 0, &offset, &name, &namelen, + &errorcode, cb)) goto FAILED; if (ptr >= ptrend || *ptr != CHAR_COLON) { errorcode = ERR95; /* Malformed */ @@ -3651,8 +3689,8 @@ while (ptr < ptrend) else { vn = verbnames; - if (!read_name(&ptr, ptrend, 0, &offset, &name, &namelen, &errorcode, - cb)) goto FAILED; + if (!read_name(&ptr, ptrend, utf, 0, &offset, &name, &namelen, + &errorcode, cb)) goto FAILED; if (ptr >= ptrend || (*ptr != CHAR_COLON && *ptr != CHAR_RIGHT_PARENTHESIS)) { @@ -3907,7 +3945,7 @@ while (ptr < ptrend) errorcode = ERR41; goto FAILED; } - if (!read_name(&ptr, ptrend, CHAR_RIGHT_PARENTHESIS, &offset, &name, + if (!read_name(&ptr, ptrend, utf, CHAR_RIGHT_PARENTHESIS, &offset, &name, &namelen, &errorcode, cb)) goto FAILED; *parsed_pattern++ = META_BACKREF_BYNAME; *parsed_pattern++ = namelen; @@ -3967,7 +4005,7 @@ while (ptr < ptrend) case CHAR_AMPERSAND: RECURSE_BY_NAME: - if (!read_name(&ptr, ptrend, CHAR_RIGHT_PARENTHESIS, &offset, &name, + if (!read_name(&ptr, ptrend, utf, CHAR_RIGHT_PARENTHESIS, &offset, &name, &namelen, &errorcode, cb)) goto FAILED; *parsed_pattern++ = META_RECURSE_BYNAME; *parsed_pattern++ = namelen; @@ -4215,7 +4253,7 @@ while (ptr < ptrend) terminator = CHAR_RIGHT_PARENTHESIS; ptr--; /* Point to char before name */ } - if (!read_name(&ptr, ptrend, terminator, &offset, &name, &namelen, + if (!read_name(&ptr, ptrend, utf, terminator, &offset, &name, &namelen, &errorcode, cb)) goto FAILED; /* Handle (?(R&name) */ @@ -4349,7 +4387,7 @@ while (ptr < ptrend) terminator = CHAR_APOSTROPHE; /* Terminator */ DEFINE_NAME: - if (!read_name(&ptr, ptrend, terminator, &offset, &name, &namelen, + if (!read_name(&ptr, ptrend, utf, terminator, &offset, &name, &namelen, &errorcode, cb)) goto FAILED; /* We have a name for this capturing group. It is also assigned a number, diff --git a/src/pcre2_error.c b/src/pcre2_error.c index 4c8127c..349351d 100644 --- a/src/pcre2_error.c +++ b/src/pcre2_error.c @@ -95,7 +95,7 @@ static const unsigned char compile_error_texts[] = /* 25 */ "lookbehind assertion is not fixed length\0" "a relative value of zero is not allowed\0" - "conditional group contains more than two branches\0" + "conditional subpattern contains more than two branches\0" "assertion expected after (?( or (?(?C)\0" "digit expected after (?+ or (?-\0" /* 30 */ @@ -113,21 +113,21 @@ static const unsigned char compile_error_texts[] = /* 40 */ "invalid escape sequence in (*VERB) name\0" "unrecognized character after (?P\0" - "syntax error in subpattern name (missing terminator)\0" + "syntax error in subpattern name (missing terminator?)\0" "two named subpatterns have the same name (PCRE2_DUPNAMES not set)\0" - "group name must start with a non-digit\0" + "subpattern name must start with a non-digit\0" /* 45 */ "this version of PCRE2 does not have support for \\P, \\p, or \\X\0" "malformed \\P or \\p sequence\0" "unknown property name after \\P or \\p\0" - "subpattern name is too long (maximum " XSTRING(MAX_NAME_SIZE) " characters)\0" + "subpattern name is too long (maximum " XSTRING(MAX_NAME_SIZE) " code units)\0" "too many named subpatterns (maximum " XSTRING(MAX_NAME_COUNT) ")\0" /* 50 */ "invalid range in character class\0" "octal value is greater than \\377 in 8-bit non-UTF-8 mode\0" "internal error: overran compiling workspace\0" "internal error: previously-checked referenced subpattern not found\0" - "DEFINE group contains more than one branch\0" + "DEFINE subpattern contains more than one branch\0" /* 55 */ "missing opening brace after \\o\0" "internal error: unknown newline setting\0" @@ -137,7 +137,7 @@ static const unsigned char compile_error_texts[] = "obsolete error (should not occur)\0" /* Was the above */ /* 60 */ "(*VERB) not recognized or malformed\0" - "group number is too big\0" + "subpattern number is too big\0" "subpattern name expected\0" "internal error: parsed pattern overflow\0" "non-octal character in \\o{} (closing brace missing?)\0" diff --git a/src/pcre2test.c b/src/pcre2test.c index 40b4a6f..462a254 100644 --- a/src/pcre2test.c +++ b/src/pcre2test.c @@ -169,7 +169,7 @@ commented out the original, but kept it around just in case. */ /* void vms_setsymbol( char *, char *, int ); Original code from [1]. */ #endif -/* VC and older compilers don't support %td or %zu, and even some that claim to +/* VC and older compilers don't support %td or %zu, and even some that claim to be C99 don't support it (hence DISABLE_PERCENT_ZT). */ #if defined(_MSC_VER) || !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L || defined(DISABLE_PERCENT_ZT) @@ -539,7 +539,7 @@ typedef struct patctl { /* Structure for pattern modifiers. */ uint32_t jitstack; /* Must be in same position as datctl */ uint8_t replacement[REPLACE_MODSIZE]; /* So must this */ uint32_t substitute_skip; /* Must be in same position as patctl */ - uint32_t substitute_stop; /* Must be in same position as patctl */ + uint32_t substitute_stop; /* Must be in same position as patctl */ uint32_t jit; uint32_t stackguard_test; uint32_t tables_id; @@ -561,7 +561,7 @@ typedef struct datctl { /* Structure for data line modifiers. */ uint32_t jitstack; /* Must be in same position as patctl */ uint8_t replacement[REPLACE_MODSIZE]; /* So must this */ uint32_t substitute_skip; /* Must be in same position as patctl */ - uint32_t substitute_stop; /* Must be in same position as patctl */ + uint32_t substitute_stop; /* Must be in same position as patctl */ uint32_t startend[2]; uint32_t cerror[2]; uint32_t cfail[2]; @@ -3049,13 +3049,14 @@ return yield; -#ifdef SUPPORT_PCRE2_8 /************************************************* * 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. +and encodes it as a UTF-8 character in 0 to 6 bytes. It is needed even when the +8-bit library is not supported, to generate UTF-8 output for non-ASCII +characters. Arguments: cvalue the character value @@ -3081,7 +3082,6 @@ for (j = i; j > 0; j--) *utf8bytes = utf8_table2[i] | cvalue; return i + 1; } -#endif /* SUPPORT_PCRE2_8 */ @@ -4374,6 +4374,7 @@ static int show_pattern_info(void) { uint32_t compile_options, overall_options, extra_options; +BOOL utf = (FLD(compiled_code, overall_options) & PCRE2_UTF) != 0; if ((pat_patctl.control & (CTL_BINCODE|CTL_FULLBINCODE)) != 0) { @@ -4463,7 +4464,7 @@ if ((pat_patctl.control & CTL_INFO) != 0) != 0) return PR_ABEND; - fprintf(outfile, "Capturing subpattern count = %d\n", capture_count); + fprintf(outfile, "Capture group count = %d\n", capture_count); if (backrefmax > 0) fprintf(outfile, "Max back reference = %d\n", backrefmax); @@ -4482,14 +4483,60 @@ if ((pat_patctl.control & CTL_INFO) != 0) if (namecount > 0) { - fprintf(outfile, "Named capturing subpatterns:\n"); + fprintf(outfile, "Named capture groups:\n"); for (; namecount > 0; namecount--) { int imm2_size = test_mode == PCRE8_MODE ? 2 : 1; uint32_t length = (uint32_t)STRLEN(nametable + imm2_size); fprintf(outfile, " "); - PCHARSV(nametable, imm2_size, length, FALSE, outfile); + + /* In UTF mode the name may be a UTF string containing non-ASCII + letters and digits. We must output it as a UTF-8 string. In non-UTF mode, + use the normal string printing functions, which use escapes for all + non-ASCII characters. */ + + if (utf) + { +#ifdef SUPPORT_PCRE2_32 + if (test_mode == PCRE32_MODE) + { + PCRE2_SPTR32 nameptr = (PCRE2_SPTR32)nametable + imm2_size; + while (*nameptr != 0) + { + uint8_t u8buff[6]; + int len = ord2utf8(*nameptr++, u8buff); + fprintf(outfile, "%.*s", len, u8buff); + } + } +#endif +#ifdef SUPPORT_PCRE2_16 + if (test_mode == PCRE16_MODE) + { + PCRE2_SPTR16 nameptr = (PCRE2_SPTR16)nametable + imm2_size; + while (*nameptr != 0) + { + int len; + uint8_t u8buff[6]; + uint32_t c = *nameptr++ & 0xffff; + if (c >= 0xD800 && c < 0xDC00) + c = ((c & 0x3ff) << 10) + (*nameptr++ & 0x3ff) + 0x10000; + len = ord2utf8(c, u8buff); + fprintf(outfile, "%.*s", len, u8buff); + } + } +#endif +#ifdef SUPPORT_PCRE2_8 + if (test_mode == PCRE8_MODE) + fprintf(outfile, "%s", (PCRE2_SPTR8)nametable + imm2_size); +#endif + } + else /* Not UTF mode */ + { + PCHARSV(nametable, imm2_size, length, FALSE, outfile); + } + while (length++ < nameentrysize - imm2_size) putc(' ', outfile); + #ifdef SUPPORT_PCRE2_32 if (test_mode == PCRE32_MODE) fprintf(outfile, "%3d\n", (int)(((PCRE2_SPTR32)nametable)[0])); @@ -4503,6 +4550,7 @@ if ((pat_patctl.control & CTL_INFO) != 0) fprintf(outfile, "%3d\n", (int)( ((((PCRE2_SPTR8)nametable)[0]) << 8) | ((PCRE2_SPTR8)nametable)[1])); #endif + nametable = (void*)((PCRE2_SPTR8)nametable + nameentrysize * code_unit_size); } } @@ -5971,30 +6019,30 @@ BOOL utf = (FLD(compiled_code, overall_options) & PCRE2_UTF) != 0; (void)data_ptr; /* Not used */ fprintf(outfile, "%2d(%d) Old %" SIZ_FORM " %" SIZ_FORM " \"", - scb->subscount, scb->oveccount, + scb->subscount, scb->oveccount, SIZ_CAST scb->ovector[0], SIZ_CAST scb->ovector[1]); -PCHARSV(scb->input, scb->ovector[0], scb->ovector[1] - scb->ovector[0], +PCHARSV(scb->input, scb->ovector[0], scb->ovector[1] - scb->ovector[0], utf, outfile); fprintf(outfile, "\" New %" SIZ_FORM " %" SIZ_FORM " \"", SIZ_CAST scb->output_offsets[0], SIZ_CAST scb->output_offsets[1]); -PCHARSV(scb->output, scb->output_offsets[0], +PCHARSV(scb->output, scb->output_offsets[0], scb->output_offsets[1] - scb->output_offsets[0], utf, outfile); -if (scb->subscount == dat_datctl.substitute_stop) +if (scb->subscount == dat_datctl.substitute_stop) { yield = -1; - fprintf(outfile, " STOPPED"); - } -else if (scb->subscount == dat_datctl.substitute_skip) + fprintf(outfile, " STOPPED"); + } +else if (scb->subscount == dat_datctl.substitute_skip) { yield = +1; - fprintf(outfile, " SKIPPED"); - } + fprintf(outfile, " SKIPPED"); + } -fprintf(outfile, "\"\n"); +fprintf(outfile, "\"\n"); return yield; } @@ -6867,11 +6915,11 @@ arg_ulen = ulen; /* Value to use in match arg */ if (p[-1] != 0 && !decode_modifiers(p, CTX_DAT, NULL, &dat_datctl)) return PR_OK; - -/* Setting substitute_{skip,fail} implies a substitute callout. */ + +/* Setting substitute_{skip,fail} implies a substitute callout. */ if (dat_datctl.substitute_skip != 0 || dat_datctl.substitute_stop != 0) - dat_datctl.control2 |= CTL2_SUBSTITUTE_CALLOUT; + dat_datctl.control2 |= CTL2_SUBSTITUTE_CALLOUT; /* Check for mutually exclusive modifiers. At present, these are all in the first control word. */ @@ -8129,7 +8177,7 @@ if (arg != NULL && arg[0] != CHAR_MINUS) break; } -/* For VMS, return the value by setting a symbol, for certain values only. This +/* For VMS, return the value by setting a symbol, for certain values only. This is contributed code which the PCRE2 developers have no means of testing. */ #ifdef __VMS diff --git a/testdata/testinput10 b/testdata/testinput10 index 0e19681..50e489f 100644 --- a/testdata/testinput10 +++ b/testdata/testinput10 @@ -480,5 +480,13 @@ /(?<=abc)(|def)/g,utf,replace=<$0>,substitute_callout 123abcáyzabcdef789abcሴqr + +# Check name length with non-ASCII characters + +/(?'ABáC678901234567890123456789012'...)/utf + +/(?'ABáC6789012345678901234567890123'...)/utf + +/(?'ABZC6789012345678901234567890123'...)/utf # End of testinput10 diff --git a/testdata/testinput4 b/testdata/testinput4 index e67dfed..cccab0e 100644 --- a/testdata/testinput4 +++ b/testdata/testinput4 @@ -2457,4 +2457,27 @@ # ------- +# Test group names containing non-ASCII letters and digits + +/(?'ABáC'...)\g{ABáC}/utf + abcabcdefg + +/(?'XʰABC'...)/utf + xyzpq + +/(?'XאABC'...)/utf + 12345 + +/(?'XᾈABC'...)/utf + %^&*(... + +/(?'𐨐ABC'...)/utf + abcde + +/^(?'אABC'...)(?&אABC)(?P=אABC)/utf + 123123123456 + +/^(?'אABC'...)(?&אABC)/utf + 123123123456 + # End of testinput4 diff --git a/testdata/testinput5 b/testdata/testinput5 index c57ebeb..3e7701e 100644 --- a/testdata/testinput5 +++ b/testdata/testinput5 @@ -2149,4 +2149,19 @@ # ------- +# Test reference and errors in non-ASCII characters in group names + +/(?'𑠅ABC'...)/I,utf + abcde\=copy=𑠅ABC + +# Bad ones + +/(?'AB၌C'...)\g{AB၌C}/utf + +/(?'٠ABC'...)/utf + +/(?'²ABC'...)/utf + +/(?'X²ABC'...)/utf + # End of testinput5 diff --git a/testdata/testoutput10 b/testdata/testoutput10 index 97757de..724b8bc 100644 --- a/testdata/testoutput10 +++ b/testdata/testoutput10 @@ -248,7 +248,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xc4 Last code unit = \x80 @@ -261,7 +261,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xe1 Last code unit = \x80 @@ -274,7 +274,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xf0 Last code unit = \x80 @@ -287,7 +287,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xf4 Last code unit = \x80 @@ -300,7 +300,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xf4 Last code unit = \xbf @@ -313,7 +313,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xc3 Last code unit = \xbf @@ -326,7 +326,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xc4 Last code unit = \x80 @@ -339,7 +339,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xc2 Last code unit = \x80 @@ -352,7 +352,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xc3 Last code unit = \xbf @@ -365,7 +365,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xed Last code unit = \xb4 @@ -380,7 +380,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xe6 Last code unit = \x9e @@ -395,7 +395,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xc2 Last code unit = \x80 @@ -408,7 +408,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xc2 Last code unit = \x84 @@ -421,7 +421,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xc4 Last code unit = \x84 @@ -434,7 +434,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xe0 Last code unit = \xa1 @@ -447,7 +447,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xf0 Last code unit = \xab @@ -460,7 +460,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \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 @@ -495,7 +495,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xc4 Last code unit = \x80 @@ -514,7 +514,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf Starting code units: x \xc4 Subject length lower bound = 1 @@ -531,7 +531,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf Starting code units: a x \xc4 Subject length lower bound = 1 @@ -548,7 +548,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf Starting code units: a x \xc4 Subject length lower bound = 1 @@ -566,7 +566,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf Starting code units: x \xc4 Subject length lower bound = 1 @@ -578,7 +578,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xc4 Last code unit = \x80 @@ -592,7 +592,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'a' Last code unit = \x80 @@ -606,7 +606,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'a' Last code unit = \x81 @@ -619,7 +619,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 /[\x{100}]/IB,utf @@ -629,7 +629,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xc4 Last code unit = \x80 @@ -648,7 +648,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xc3 Last code unit = \xbf @@ -663,7 +663,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Subject length lower bound = 1 @@ -678,14 +678,14 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf First code unit = \xc4 Last code unit = 'z' Subject length lower bound = 7 /\777/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xc7 Last code unit = \xbf @@ -703,7 +703,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xc4 Last code unit = \x80 @@ -717,7 +717,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xc4 Last code unit = 'X' @@ -761,7 +761,7 @@ No match 0: \x{1234} /(*CRLF)(*UTF)(*BSR_UNICODE)a\Rb/I -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: utf \R matches any Unicode newline @@ -771,7 +771,7 @@ Last code unit = 'b' Subject length lower bound = 3 /\h/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x09 \x20 \xc2 \xe1 \xe2 \xe3 Subject length lower bound = 1 @@ -795,7 +795,7 @@ Subject length lower bound = 1 0: \x{3000} /\v/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x0a \x0b \x0c \x0d \xc2 \xe2 Subject length lower bound = 1 @@ -813,7 +813,7 @@ Subject length lower bound = 1 0: \x{2028} /\h*A/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x09 \x20 A \xc2 \xe1 \xe2 \xe3 Last code unit = 'A' @@ -822,21 +822,21 @@ Subject length lower bound = 1 0: A /\v+A/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x0a \x0b \x0c \x0d \xc2 \xe2 Last code unit = 'A' Subject length lower bound = 2 /\s?xxx\s/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 x Last code unit = 'x' Subject length lower bound = 4 /\sxxx\s/I,utf,tables=2 -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 \xc2 Last code unit = 'x' @@ -847,7 +847,7 @@ Subject length lower bound = 5 0: \x{a0}xxx\x{85} /\S \S/I,utf,tables=2 -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a \x1b \x1c \x1d \x1e @@ -883,25 +883,25 @@ Error -36 (bad UTF-8 offset) No match /\x{1234}+/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: \xe1 Subject length lower bound = 1 /\x{1234}+?/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: \xe1 Subject length lower bound = 1 /\x{1234}++/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: \xe1 Subject length lower bound = 1 /\x{1234}{2}/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: \xe1 Subject length lower bound = 2 @@ -913,7 +913,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Subject length lower bound = 1 @@ -925,14 +925,14 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'X' Last code unit = \x80 Subject length lower bound = 2 /\R/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x0a \x0b \x0c \x0d \xc2 \xe2 Subject length lower bound = 1 @@ -944,7 +944,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xc7 Last code unit = \xbf @@ -1105,7 +1105,7 @@ Failed: error 174 at offset 0: using UTF is disabled by the application Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf First code unit = 'A' (caseless) Subject length lower bound = 5 @@ -1117,7 +1117,7 @@ Subject length lower bound = 5 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'A' Last code unit = \xb0 @@ -1130,7 +1130,7 @@ Subject length lower bound = 5 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'A' Last code unit = \xb0 @@ -1143,14 +1143,14 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf First code unit = 'A' (caseless) Last code unit = 'B' (caseless) Subject length lower bound = 3 /\x{401}\x{420}\x{421}\x{422}\x{423}\x{424}\x{425}\x{426}\x{427}\x{428}\x{429}\x{42a}\x{42b}\x{42c}\x{42d}\x{42e}\x{42f}/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: \xd0 \xd1 Subject length lower bound = 17 @@ -1176,17 +1176,17 @@ Subject length lower bound = 17 ------------------------------------------------------------------ /\h/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x09 \x20 \xa0 Subject length lower bound = 1 /\v/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x0a \x0b \x0c \x0d \x85 Subject length lower bound = 1 /\R/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x0a \x0b \x0c \x0d \x85 Subject length lower bound = 1 @@ -1199,7 +1199,7 @@ Subject length lower bound = 1 ------------------------------------------------------------------ /\x{212a}+/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: K k \xe2 Subject length lower bound = 1 @@ -1207,7 +1207,7 @@ Subject length lower bound = 1 0: KKkk\x{212a} /s+/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: S s \xc5 Subject length lower bound = 1 @@ -1222,7 +1222,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: A \xc4 Last code unit = 'A' @@ -1239,7 +1239,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: 0 1 2 3 4 5 6 7 8 9 \xc4 Subject length lower bound = 1 @@ -1251,7 +1251,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: Z \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 @@ -1273,7 +1273,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: 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 @@ -1289,7 +1289,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: - ] a d z \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 \xd8 \xd9 \xda \xdb @@ -1314,7 +1314,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf Starting code units: a b \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 @@ -1332,7 +1332,7 @@ Subject length lower bound = 7 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 \xc4 Subject length lower bound = 1 @@ -1345,7 +1345,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: 0 1 2 3 4 5 6 7 8 9 \xc4 Subject length lower bound = 1 @@ -1358,7 +1358,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: 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 @@ -1373,7 +1373,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \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 @@ -1395,7 +1395,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a \x1b \x1c \x1d \x1e @@ -1416,7 +1416,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \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 @@ -1435,7 +1435,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: \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 @@ -1462,7 +1462,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: Z z { | } ~ \x7f \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 @@ -1503,7 +1503,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: Z z { | } ~ \x7f \xc2 \xc3 \xc4 \xc5 \xc6 \xc7 \xc8 \xc9 \xca \xcb \xcc \xcd \xce \xcf \xd0 \xd1 \xd2 \xd3 \xd4 \xd5 \xd6 \xd7 @@ -1520,7 +1520,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: \xce \xcf Last code unit = 'B' (caseless) @@ -1531,7 +1531,7 @@ Subject length lower bound = 2 Failed: error -3: UTF-8 error: 1 byte missing at end /(?<=(a)(?-1))x/I,utf -Capturing subpattern count = 1 +Capture group count = 1 Max lookbehind = 2 Options: utf First code unit = 'x' @@ -1579,7 +1579,7 @@ Failed: error 176 at offset 259: name is too long in (*MARK), (*PRUNE), (*SKIP), # but subjects containing them must not be UTF-checked. /\x{d800}/I,utf,allow_surrogate_escapes -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Extra options: allow_surrogate_escapes First code unit = \xed @@ -1602,7 +1602,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: utf Overall options: anchored utf Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a @@ -1635,5 +1635,14 @@ No match 3(2) Old 13 16 "def" New 17 22 "" 4(2) Old 22 22 "" New 28 30 "<>" 4: 123abc<>\x{e1}yzabc<>789abc<>\x{1234}qr + +# Check name length with non-ASCII characters + +/(?'ABáC678901234567890123456789012'...)/utf + +/(?'ABáC6789012345678901234567890123'...)/utf +Failed: error 148 at offset 36: subpattern name is too long (maximum 32 code units) + +/(?'ABZC6789012345678901234567890123'...)/utf # End of testinput10 diff --git a/testdata/testoutput11-16 b/testdata/testoutput11-16 index e22581d..78bf7fb 100644 --- a/testdata/testoutput11-16 +++ b/testdata/testoutput11-16 @@ -13,11 +13,11 @@ Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 /\x{100}/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = \x{100} Subject length lower bound = 1 @@ -215,7 +215,7 @@ Subject length lower bound = 1 (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* # optional trailing comment /Ix -Capturing subpattern count = 0 +Capture group count = 0 Contains explicit CR or LF match Options: extended Starting code units: \x09 \x20 ! " # $ % & ' ( * + - / 0 1 2 3 4 5 6 7 8 @@ -260,7 +260,7 @@ Subject length lower bound = 3 ------------------------------------------------------------------ /\h+/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x09 \x20 \xa0 \xff Subject length lower bound = 1 \x{1681}\x{200b}\x{1680}\x{2000}\x{202f}\x{3000} @@ -275,7 +275,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x09 \x20 \xa0 \xff Subject length lower bound = 1 \x{1681}\x{200b}\x{1680}\x{2000}\x{202f}\x{3000} @@ -284,7 +284,7 @@ Subject length lower bound = 1 0: \x{200a}\xa0\x{2000} /\H+/I -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 \x{1680}\x{180e}\x{167f}\x{1681}\x{180d}\x{180f} 0: \x{167f}\x{1681}\x{180d}\x{180f} @@ -306,7 +306,7 @@ Subject length lower bound = 1 0: \x9f\xa1\x{2fff}\x{3001} /\v+/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x0a \x0b \x0c \x0d \x85 \xff Subject length lower bound = 1 \x{2027}\x{2030}\x{2028}\x{2029} @@ -321,7 +321,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x0a \x0b \x0c \x0d \x85 \xff Subject length lower bound = 1 \x{2027}\x{2030}\x{2028}\x{2029} @@ -330,7 +330,7 @@ Subject length lower bound = 1 0: \x85\x0a\x0b\x0c\x0d /\V+/I -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 \x{2028}\x{2029}\x{2027}\x{2030} 0: \x{2027}\x{2030} @@ -344,7 +344,7 @@ Subject length lower bound = 1 0: \x09\x0e\x84\x86 /\R+/I,bsr=unicode -Capturing subpattern count = 0 +Capture group count = 0 \R matches any Unicode newline Starting code units: \x0a \x0b \x0c \x0d \x85 \xff Subject length lower bound = 1 @@ -354,7 +354,7 @@ Subject length lower bound = 1 0: \x85\x0a\x0b\x0c\x0d /\x{d800}\x{d7ff}\x{dc00}\x{dc00}\x{dcff}\x{dd00}/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = \x{d800} Last code unit = \x{dd00} Subject length lower bound = 6 @@ -600,7 +600,7 @@ Failed: error 134 at offset 9: character code point value in \x{} or \o{} is too Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0a \x0b \x0c \x0d \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a \x1b \x1c \x1d \x1e \x1f ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 @@ -624,7 +624,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \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 : ; < = > diff --git a/testdata/testoutput11-32 b/testdata/testoutput11-32 index d8a909f..4b00384 100644 --- a/testdata/testoutput11-32 +++ b/testdata/testoutput11-32 @@ -13,11 +13,11 @@ Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 /\x{100}/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = \x{100} Subject length lower bound = 1 @@ -215,7 +215,7 @@ Subject length lower bound = 1 (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* # optional trailing comment /Ix -Capturing subpattern count = 0 +Capture group count = 0 Contains explicit CR or LF match Options: extended Starting code units: \x09 \x20 ! " # $ % & ' ( * + - / 0 1 2 3 4 5 6 7 8 @@ -260,7 +260,7 @@ Subject length lower bound = 3 ------------------------------------------------------------------ /\h+/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x09 \x20 \xa0 \xff Subject length lower bound = 1 \x{1681}\x{200b}\x{1680}\x{2000}\x{202f}\x{3000} @@ -275,7 +275,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x09 \x20 \xa0 \xff Subject length lower bound = 1 \x{1681}\x{200b}\x{1680}\x{2000}\x{202f}\x{3000} @@ -284,7 +284,7 @@ Subject length lower bound = 1 0: \x{200a}\xa0\x{2000} /\H+/I -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 \x{1680}\x{180e}\x{167f}\x{1681}\x{180d}\x{180f} 0: \x{167f}\x{1681}\x{180d}\x{180f} @@ -306,7 +306,7 @@ Subject length lower bound = 1 0: \x9f\xa1\x{2fff}\x{3001} /\v+/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x0a \x0b \x0c \x0d \x85 \xff Subject length lower bound = 1 \x{2027}\x{2030}\x{2028}\x{2029} @@ -321,7 +321,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x0a \x0b \x0c \x0d \x85 \xff Subject length lower bound = 1 \x{2027}\x{2030}\x{2028}\x{2029} @@ -330,7 +330,7 @@ Subject length lower bound = 1 0: \x85\x0a\x0b\x0c\x0d /\V+/I -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 \x{2028}\x{2029}\x{2027}\x{2030} 0: \x{2027}\x{2030} @@ -344,7 +344,7 @@ Subject length lower bound = 1 0: \x09\x0e\x84\x86 /\R+/I,bsr=unicode -Capturing subpattern count = 0 +Capture group count = 0 \R matches any Unicode newline Starting code units: \x0a \x0b \x0c \x0d \x85 \xff Subject length lower bound = 1 @@ -354,7 +354,7 @@ Subject length lower bound = 1 0: \x85\x0a\x0b\x0c\x0d /\x{d800}\x{d7ff}\x{dc00}\x{dc00}\x{dcff}\x{dd00}/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = \x{d800} Last code unit = \x{dd00} Subject length lower bound = 6 @@ -558,19 +558,19 @@ Failed: error 134 at offset 12: character code point value in \x{} or \o{} is to Failed: error 134 at offset 14: character code point value in \x{} or \o{} is too large /\x{7fffffff}\x{7fffffff}/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = \x{7fffffff} Last code unit = \x{7fffffff} Subject length lower bound = 2 /\x{80000000}\x{80000000}/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = \x{80000000} Last code unit = \x{80000000} Subject length lower bound = 2 /\x{ffffffff}\x{ffffffff}/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = \x{ffffffff} Last code unit = \x{ffffffff} Subject length lower bound = 2 @@ -588,7 +588,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless First code unit = \x{400000} Last code unit = \x{800000} @@ -603,7 +603,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0a \x0b \x0c \x0d \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a \x1b \x1c \x1d \x1e \x1f ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 @@ -627,7 +627,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \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 : ; < = > diff --git a/testdata/testoutput12-16 b/testdata/testoutput12-16 index a5b5b75..09151b4 100644 --- a/testdata/testoutput12-16 +++ b/testdata/testoutput12-16 @@ -18,7 +18,7 @@ Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{ffff} Subject length lower bound = 1 @@ -30,7 +30,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{d800} Last code unit = \x{dc00} @@ -43,7 +43,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{100} Subject length lower bound = 1 @@ -55,7 +55,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{1000} Subject length lower bound = 1 @@ -67,7 +67,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{d800} Last code unit = \x{dc00} @@ -80,7 +80,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{dbc0} Last code unit = \x{dc00} @@ -93,7 +93,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{dbff} Last code unit = \x{dfff} @@ -106,7 +106,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xff Subject length lower bound = 1 @@ -118,7 +118,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{100} Subject length lower bound = 1 @@ -130,7 +130,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x80 Subject length lower bound = 1 @@ -142,7 +142,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xff Subject length lower bound = 1 @@ -154,7 +154,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{d55c} Last code unit = \x{c5b4} @@ -169,7 +169,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{65e5} Last code unit = \x{8a9e} @@ -184,7 +184,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x80 Subject length lower bound = 1 @@ -196,7 +196,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x84 Subject length lower bound = 1 @@ -208,7 +208,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{104} Subject length lower bound = 1 @@ -220,7 +220,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{861} Subject length lower bound = 1 @@ -232,7 +232,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{d844} Last code unit = \x{deab} @@ -245,7 +245,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \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 @@ -281,7 +281,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{100} Last code unit = \x{100} @@ -300,7 +300,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf Starting code units: x \xff Subject length lower bound = 1 @@ -317,7 +317,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf Starting code units: a x \xff Subject length lower bound = 1 @@ -334,7 +334,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf Starting code units: a x \xff Subject length lower bound = 1 @@ -352,7 +352,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf Starting code units: x \xff Subject length lower bound = 1 @@ -364,7 +364,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{100} Subject length lower bound = 1 @@ -377,7 +377,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'a' Last code unit = \x{100} @@ -391,7 +391,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'a' Last code unit = \x{101} @@ -404,7 +404,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 /[\x{100}]/IB,utf @@ -414,7 +414,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{100} Subject length lower bound = 1 @@ -432,7 +432,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xff Subject length lower bound = 1 @@ -446,7 +446,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Subject length lower bound = 1 @@ -461,14 +461,14 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf First code unit = \x{100} Last code unit = 'z' Subject length lower bound = 7 /\777/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{1ff} Subject length lower bound = 1 @@ -485,7 +485,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{100} Last code unit = \x{200} @@ -499,7 +499,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{100} Last code unit = 'X' @@ -547,7 +547,7 @@ Failed: error -24: UTF-16 error: missing low surrogate at end at offset 2 0: \x{11234} /(*UTF)\x{11234}/I -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: utf First code unit = \x{d804} @@ -565,7 +565,7 @@ Failed: error 160 at offset 5: (*VERB) not recognized or malformed abcd\x{11234}pqr /(*CRLF)(*UTF16)(*BSR_UNICODE)a\Rb/I -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: utf \R matches any Unicode newline @@ -578,7 +578,7 @@ Subject length lower bound = 3 Failed: error 160 at offset 14: (*VERB) not recognized or malformed /\h/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x09 \x20 \xa0 \xff Subject length lower bound = 1 @@ -602,7 +602,7 @@ Subject length lower bound = 1 0: \x{3000} /\v/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x0a \x0b \x0c \x0d \x85 \xff Subject length lower bound = 1 @@ -620,7 +620,7 @@ Subject length lower bound = 1 0: \x{2028} /\h*A/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x09 \x20 A \xa0 \xff Last code unit = 'A' @@ -631,7 +631,7 @@ Subject length lower bound = 1 0: \x{2000}A /\R*A/I,bsr=unicode,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf \R matches any Unicode newline Starting code units: \x0a \x0b \x0c \x0d A \x85 \xff @@ -643,21 +643,21 @@ Subject length lower bound = 1 0: \x{2028}A /\v+A/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x0a \x0b \x0c \x0d \x85 \xff Last code unit = 'A' Subject length lower bound = 2 /\s?xxx\s/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 x Last code unit = 'x' Subject length lower bound = 4 /\sxxx\s/I,utf,tables=2 -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 \x85 \xa0 Last code unit = 'x' @@ -668,7 +668,7 @@ Subject length lower bound = 5 0: \x{a0}xxx\x{85} /\S \S/I,utf,tables=2 -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a \x1b \x1c \x1d \x1e @@ -708,25 +708,25 @@ Failed: error -33: bad offset value Failed: error -33: bad offset value /\x{1234}+/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf First code unit = \x{1234} Subject length lower bound = 1 /\x{1234}+?/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf First code unit = \x{1234} Subject length lower bound = 1 /\x{1234}++/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf First code unit = \x{1234} Subject length lower bound = 1 /\x{1234}{2}/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf First code unit = \x{1234} Last code unit = \x{1234} @@ -739,7 +739,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Subject length lower bound = 1 @@ -751,14 +751,14 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'X' Last code unit = \x{200} Subject length lower bound = 2 /\R/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x0a \x0b \x0c \x0d \x85 \xff Subject length lower bound = 1 @@ -936,7 +936,7 @@ Failed: error 174 at offset 0: using UTF is disabled by the application Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf First code unit = 'A' (caseless) Last code unit = \x{1fb0} (caseless) @@ -949,7 +949,7 @@ Subject length lower bound = 5 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'A' Last code unit = \x{1fb0} @@ -962,7 +962,7 @@ Subject length lower bound = 5 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'A' Last code unit = \x{1fb0} @@ -975,14 +975,14 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf First code unit = 'A' (caseless) Last code unit = \x{1fb0} (caseless) Subject length lower bound = 3 /\x{401}\x{420}\x{421}\x{422}\x{423}\x{424}\x{425}\x{426}\x{427}\x{428}\x{429}\x{42a}\x{42b}\x{42c}\x{42d}\x{42e}\x{42f}/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf First code unit = \x{401} (caseless) Last code unit = \x{42f} (caseless) @@ -1017,7 +1017,7 @@ Subject length lower bound = 17 ------------------------------------------------------------------ /\x{212a}+/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: K k \xff Subject length lower bound = 1 @@ -1025,7 +1025,7 @@ Subject length lower bound = 1 0: KKkk\x{212a} /s+/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: S s \xff Subject length lower bound = 1 @@ -1048,7 +1048,7 @@ Failed: error 134 at offset 10: character code point value in \x{} or \o{} is to Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: A \xff Last code unit = 'A' @@ -1065,7 +1065,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: 0 1 2 3 4 5 6 7 8 9 \xff Subject length lower bound = 1 @@ -1077,7 +1077,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: Z \xff Subject length lower bound = 1 @@ -1095,7 +1095,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: z { | } ~ \x7f \x80 \x81 \x82 \x83 \x84 \x85 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90 \x91 \x92 \x93 \x94 \x95 \x96 @@ -1115,7 +1115,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: - ] a d z \xff Subject length lower bound = 1 @@ -1136,7 +1136,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf Starting code units: a b \xff Last code unit = 'z' @@ -1150,7 +1150,7 @@ Subject length lower bound = 7 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 \xff Subject length lower bound = 1 @@ -1163,7 +1163,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: 0 1 2 3 4 5 6 7 8 9 \xff Subject length lower bound = 1 @@ -1176,7 +1176,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: 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 @@ -1191,7 +1191,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \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 @@ -1217,7 +1217,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a \x1b \x1c \x1d \x1e @@ -1243,7 +1243,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \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 @@ -1266,7 +1266,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: \xff Subject length lower bound = 1 @@ -1289,7 +1289,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: Z z { | } ~ \x7f \x80 \x81 \x82 \x83 \x84 \x85 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90 \x91 \x92 \x93 \x94 \x95 @@ -1335,7 +1335,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: Z z { | } ~ \x7f \x80 \x81 \x82 \x83 \x84 \x85 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90 \x91 \x92 \x93 \x94 \x95 @@ -1357,7 +1357,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: \xff Last code unit = 'B' (caseless) @@ -1443,7 +1443,7 @@ Failed: error 191 at offset 0: PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES is not allowe Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: utf Overall options: anchored utf Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a diff --git a/testdata/testoutput12-32 b/testdata/testoutput12-32 index ac51be9..ea70896 100644 --- a/testdata/testoutput12-32 +++ b/testdata/testoutput12-32 @@ -18,7 +18,7 @@ Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{ffff} Subject length lower bound = 1 @@ -30,7 +30,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{10000} Subject length lower bound = 1 @@ -42,7 +42,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{100} Subject length lower bound = 1 @@ -54,7 +54,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{1000} Subject length lower bound = 1 @@ -66,7 +66,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{10000} Subject length lower bound = 1 @@ -78,7 +78,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{100000} Subject length lower bound = 1 @@ -90,7 +90,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{10ffff} Subject length lower bound = 1 @@ -102,7 +102,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xff Subject length lower bound = 1 @@ -114,7 +114,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{100} Subject length lower bound = 1 @@ -126,7 +126,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x80 Subject length lower bound = 1 @@ -138,7 +138,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xff Subject length lower bound = 1 @@ -150,7 +150,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{d55c} Last code unit = \x{c5b4} @@ -165,7 +165,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{65e5} Last code unit = \x{8a9e} @@ -180,7 +180,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x80 Subject length lower bound = 1 @@ -192,7 +192,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x84 Subject length lower bound = 1 @@ -204,7 +204,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{104} Subject length lower bound = 1 @@ -216,7 +216,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{861} Subject length lower bound = 1 @@ -228,7 +228,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{212ab} Subject length lower bound = 1 @@ -240,7 +240,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \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 @@ -276,7 +276,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{100} Last code unit = \x{100} @@ -295,7 +295,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf Starting code units: x \xff Subject length lower bound = 1 @@ -312,7 +312,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf Starting code units: a x \xff Subject length lower bound = 1 @@ -329,7 +329,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf Starting code units: a x \xff Subject length lower bound = 1 @@ -347,7 +347,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf Starting code units: x \xff Subject length lower bound = 1 @@ -359,7 +359,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{100} Subject length lower bound = 1 @@ -372,7 +372,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'a' Last code unit = \x{100} @@ -386,7 +386,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'a' Last code unit = \x{101} @@ -399,7 +399,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 /[\x{100}]/IB,utf @@ -409,7 +409,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{100} Subject length lower bound = 1 @@ -427,7 +427,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xff Subject length lower bound = 1 @@ -441,7 +441,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Subject length lower bound = 1 @@ -456,14 +456,14 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf First code unit = \x{100} Last code unit = 'z' Subject length lower bound = 7 /\777/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{1ff} Subject length lower bound = 1 @@ -480,7 +480,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{100} Last code unit = \x{200} @@ -494,7 +494,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{100} Last code unit = 'X' @@ -542,7 +542,7 @@ Failed: error 160 at offset 7: (*VERB) not recognized or malformed abcd\x{11234}pqr /(*UTF)\x{11234}/I -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: utf First code unit = \x{11234} @@ -562,7 +562,7 @@ Failed: error 160 at offset 5: (*VERB) not recognized or malformed Failed: error 160 at offset 14: (*VERB) not recognized or malformed /(*CRLF)(*UTF32)(*BSR_UNICODE)a\Rb/I -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: utf \R matches any Unicode newline @@ -572,7 +572,7 @@ Last code unit = 'b' Subject length lower bound = 3 /\h/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x09 \x20 \xa0 \xff Subject length lower bound = 1 @@ -596,7 +596,7 @@ Subject length lower bound = 1 0: \x{3000} /\v/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x0a \x0b \x0c \x0d \x85 \xff Subject length lower bound = 1 @@ -614,7 +614,7 @@ Subject length lower bound = 1 0: \x{2028} /\h*A/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x09 \x20 A \xa0 \xff Last code unit = 'A' @@ -625,7 +625,7 @@ Subject length lower bound = 1 0: \x{2000}A /\R*A/I,bsr=unicode,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf \R matches any Unicode newline Starting code units: \x0a \x0b \x0c \x0d A \x85 \xff @@ -637,21 +637,21 @@ Subject length lower bound = 1 0: \x{2028}A /\v+A/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x0a \x0b \x0c \x0d \x85 \xff Last code unit = 'A' Subject length lower bound = 2 /\s?xxx\s/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 x Last code unit = 'x' Subject length lower bound = 4 /\sxxx\s/I,utf,tables=2 -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 \x85 \xa0 Last code unit = 'x' @@ -662,7 +662,7 @@ Subject length lower bound = 5 0: \x{a0}xxx\x{85} /\S \S/I,utf,tables=2 -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a \x1b \x1c \x1d \x1e @@ -702,25 +702,25 @@ Failed: error -33: bad offset value Failed: error -33: bad offset value /\x{1234}+/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf First code unit = \x{1234} Subject length lower bound = 1 /\x{1234}+?/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf First code unit = \x{1234} Subject length lower bound = 1 /\x{1234}++/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf First code unit = \x{1234} Subject length lower bound = 1 /\x{1234}{2}/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf First code unit = \x{1234} Last code unit = \x{1234} @@ -733,7 +733,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Subject length lower bound = 1 @@ -745,14 +745,14 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'X' Last code unit = \x{200} Subject length lower bound = 2 /\R/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x0a \x0b \x0c \x0d \x85 \xff Subject length lower bound = 1 @@ -930,7 +930,7 @@ Failed: error 174 at offset 0: using UTF is disabled by the application Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf First code unit = 'A' (caseless) Last code unit = \x{1fb0} (caseless) @@ -943,7 +943,7 @@ Subject length lower bound = 5 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'A' Last code unit = \x{1fb0} @@ -956,7 +956,7 @@ Subject length lower bound = 5 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'A' Last code unit = \x{1fb0} @@ -969,14 +969,14 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf First code unit = 'A' (caseless) Last code unit = \x{1fb0} (caseless) Subject length lower bound = 3 /\x{401}\x{420}\x{421}\x{422}\x{423}\x{424}\x{425}\x{426}\x{427}\x{428}\x{429}\x{42a}\x{42b}\x{42c}\x{42d}\x{42e}\x{42f}/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf First code unit = \x{401} (caseless) Last code unit = \x{42f} (caseless) @@ -1011,7 +1011,7 @@ Subject length lower bound = 17 ------------------------------------------------------------------ /\x{212a}+/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: K k \xff Subject length lower bound = 1 @@ -1019,7 +1019,7 @@ Subject length lower bound = 1 0: KKkk\x{212a} /s+/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: S s \xff Subject length lower bound = 1 @@ -1042,7 +1042,7 @@ Failed: error 134 at offset 10: character code point value in \x{} or \o{} is to Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: A \xff Last code unit = 'A' @@ -1059,7 +1059,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: 0 1 2 3 4 5 6 7 8 9 \xff Subject length lower bound = 1 @@ -1071,7 +1071,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: Z \xff Subject length lower bound = 1 @@ -1089,7 +1089,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: z { | } ~ \x7f \x80 \x81 \x82 \x83 \x84 \x85 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90 \x91 \x92 \x93 \x94 \x95 \x96 @@ -1109,7 +1109,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: - ] a d z \xff Subject length lower bound = 1 @@ -1130,7 +1130,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf Starting code units: a b \xff Last code unit = 'z' @@ -1144,7 +1144,7 @@ Subject length lower bound = 7 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 \xff Subject length lower bound = 1 @@ -1157,7 +1157,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: 0 1 2 3 4 5 6 7 8 9 \xff Subject length lower bound = 1 @@ -1170,7 +1170,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: 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 @@ -1185,7 +1185,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \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 @@ -1211,7 +1211,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a \x1b \x1c \x1d \x1e @@ -1237,7 +1237,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Starting code units: \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 @@ -1260,7 +1260,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: \xff Subject length lower bound = 1 @@ -1283,7 +1283,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: Z z { | } ~ \x7f \x80 \x81 \x82 \x83 \x84 \x85 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90 \x91 \x92 \x93 \x94 \x95 @@ -1329,7 +1329,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: Z z { | } ~ \x7f \x80 \x81 \x82 \x83 \x84 \x85 \x86 \x87 \x88 \x89 \x8a \x8b \x8c \x8d \x8e \x8f \x90 \x91 \x92 \x93 \x94 \x95 @@ -1351,7 +1351,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Starting code units: \xff Last code unit = 'B' (caseless) @@ -1418,7 +1418,7 @@ No match # errors in 16-bit mode. /\x{d800}/I,utf,allow_surrogate_escapes -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Extra options: allow_surrogate_escapes First code unit = \x{d800} @@ -1440,7 +1440,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: utf Overall options: anchored utf Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a diff --git a/testdata/testoutput15 b/testdata/testoutput15 index d09e781..d312765 100644 --- a/testdata/testoutput15 +++ b/testdata/testoutput15 @@ -7,7 +7,7 @@ # (2) Other tests that must not be run with JIT. /(a+)*zz/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a z Last code unit = 'z' Subject length lower bound = 2 @@ -24,7 +24,7 @@ Minimum depth limit = 30 No match !((?:\s|//.*\\n|/[*](?:\\n|.)*?[*]/)*)!I -Capturing subpattern count = 1 +Capture group count = 1 May match empty string Subject length lower bound = 0 /* this is a C style comment */\=find_limits @@ -117,7 +117,7 @@ Failed: error 160 at offset 17: (*VERB) not recognized or malformed Failed: error 160 at offset 24: (*VERB) not recognized or malformed /(*LIMIT_DEPTH=4294967280)abc/I -Capturing subpattern count = 0 +Capture group count = 0 Depth limit = 4294967280 First code unit = 'a' Last code unit = 'c' @@ -137,7 +137,7 @@ Failed: error -47: match limit exceeded Failed: error -53: matching depth limit exceeded /(*LIMIT_MATCH=3000)(a+)*zz/I -Capturing subpattern count = 1 +Capture group count = 1 Match limit = 3000 Starting code units: a z Last code unit = 'z' @@ -150,7 +150,7 @@ Failed: error -47: match limit exceeded Failed: error -47: match limit exceeded /(*LIMIT_MATCH=60000)(*LIMIT_MATCH=3000)(a+)*zz/I -Capturing subpattern count = 1 +Capture group count = 1 Match limit = 3000 Starting code units: a z Last code unit = 'z' @@ -160,7 +160,7 @@ Subject length lower bound = 2 Failed: error -47: match limit exceeded /(*LIMIT_MATCH=60000)(a+)*zz/I -Capturing subpattern count = 1 +Capture group count = 1 Match limit = 60000 Starting code units: a z Last code unit = 'z' @@ -173,7 +173,7 @@ No match Failed: error -47: match limit exceeded /(*LIMIT_DEPTH=10)(a+)*zz/I -Capturing subpattern count = 1 +Capture group count = 1 Depth limit = 10 Starting code units: a z Last code unit = 'z' @@ -186,7 +186,7 @@ Failed: error -53: matching depth limit exceeded Failed: error -53: matching depth limit exceeded /(*LIMIT_DEPTH=10)(*LIMIT_DEPTH=1000)(a+)*zz/I -Capturing subpattern count = 1 +Capture group count = 1 Depth limit = 1000 Starting code units: a z Last code unit = 'z' @@ -196,7 +196,7 @@ Subject length lower bound = 2 No match /(*LIMIT_DEPTH=1000)(a+)*zz/I -Capturing subpattern count = 1 +Capture group count = 1 Depth limit = 1000 Starting code units: a z Last code unit = 'z' @@ -269,14 +269,14 @@ Failed: error -52: nested recursion at the same subject position # when JIT is used. /(?R)/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Subject length lower bound = 0 abcd Failed: error -52: nested recursion at the same subject position /(a|(?R))/I -Capturing subpattern count = 1 +Capture group count = 1 May match empty string Subject length lower bound = 0 abcd @@ -286,7 +286,7 @@ Subject length lower bound = 0 Failed: error -52: nested recursion at the same subject position /(ab|(bc|(de|(?R))))/I -Capturing subpattern count = 3 +Capture group count = 3 May match empty string Subject length lower bound = 0 abcd @@ -296,7 +296,7 @@ Subject length lower bound = 0 Failed: error -52: nested recursion at the same subject position /(ab|(bc|(de|(?1))))/I -Capturing subpattern count = 3 +Capture group count = 3 May match empty string Subject length lower bound = 0 abcd @@ -306,7 +306,7 @@ Subject length lower bound = 0 Failed: error -52: nested recursion at the same subject position /x(ab|(bc|(de|(?1)x)x)x)/I -Capturing subpattern count = 3 +Capture group count = 3 First code unit = 'x' Subject length lower bound = 3 xab123 @@ -352,7 +352,7 @@ Failed: error -52: nested recursion at the same subject position Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Subject length lower bound = 1 abcd Failed: error -52: nested recursion at the same subject position @@ -367,7 +367,7 @@ Failed: error -52: nested recursion at the same subject position Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: no_auto_possess Starting code units: 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 @@ -390,7 +390,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: no_auto_possess Starting code units: 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 diff --git a/testdata/testoutput16 b/testdata/testoutput16 index 616567b..78d43bd 100644 --- a/testdata/testoutput16 +++ b/testdata/testoutput16 @@ -3,14 +3,14 @@ # are different without JIT. /abc/I,jit,jitverify -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'c' Subject length lower bound = 3 JIT support is not available in this version of PCRE2 /a*/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Subject length lower bound = 0 diff --git a/testdata/testoutput17 b/testdata/testoutput17 index f5d751a..b66cfa3 100644 --- a/testdata/testoutput17 +++ b/testdata/testoutput17 @@ -6,7 +6,7 @@ # JIT does not support this pattern (callout at start of condition). /(?(?C1)(?=a)a)/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Subject length lower bound = 0 JIT compilation was not successful (no more memory) @@ -14,7 +14,7 @@ JIT compilation was not successful (no more memory) # The following pattern cannot be compiled by JIT. /b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*b*/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Subject length lower bound = 0 JIT compilation was not successful (no more memory) @@ -26,7 +26,7 @@ JIT compilation was not successful (no more memory) Failed: error -46: JIT stack limit reached /abcd/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'd' Subject length lower bound = 4 @@ -38,7 +38,7 @@ JIT compilation was successful No match (JIT) /(*NO_JIT)abcd/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'd' Subject length lower bound = 4 @@ -174,7 +174,7 @@ Partial match: ab (JIT) No match (JIT) /abcd/I,jit=2 -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'd' Subject length lower bound = 4 @@ -192,7 +192,7 @@ No match, mark = m (JIT) # Limits tests that give different output with JIT. /(a+)*zz/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a z Last code unit = 'z' Subject length lower bound = 2 @@ -207,7 +207,7 @@ Minimum match limit = 16383 No match (JIT) !((?:\s|//.*\\n|/[*](?:\\n|.)*?[*]/)*)!I -Capturing subpattern count = 1 +Capture group count = 1 May match empty string Subject length lower bound = 0 JIT compilation was successful @@ -294,7 +294,7 @@ No match (JIT) Failed: error -47: match limit exceeded /(*LIMIT_MATCH=3000)(a+)*zz/I -Capturing subpattern count = 1 +Capture group count = 1 Match limit = 3000 Starting code units: a z Last code unit = 'z' @@ -308,7 +308,7 @@ Failed: error -47: match limit exceeded Failed: error -47: match limit exceeded /(*LIMIT_MATCH=60000)(*LIMIT_MATCH=3000)(a+)*zz/I -Capturing subpattern count = 1 +Capture group count = 1 Match limit = 3000 Starting code units: a z Last code unit = 'z' @@ -319,7 +319,7 @@ JIT compilation was successful Failed: error -47: match limit exceeded /(*LIMIT_MATCH=60000)(a+)*zz/I -Capturing subpattern count = 1 +Capture group count = 1 Match limit = 60000 Starting code units: a z Last code unit = 'z' @@ -371,7 +371,7 @@ No match /^abc\Kdef/info,push ** Applies only to compile when pattern is stacked with 'push': jitverify -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored First code unit = 'a' @@ -383,7 +383,7 @@ JIT compilation was successful /^abc\Kdef/info,push ** Applies only to compile when pattern is stacked with 'push': jitverify -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored First code unit = 'a' @@ -423,7 +423,7 @@ JIT compilation was successful # when JIT is used. /(?R)/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Subject length lower bound = 0 JIT compilation was successful @@ -431,7 +431,7 @@ JIT compilation was successful Failed: error -46: JIT stack limit reached /(a|(?R))/I -Capturing subpattern count = 1 +Capture group count = 1 May match empty string Subject length lower bound = 0 JIT compilation was successful @@ -442,7 +442,7 @@ JIT compilation was successful Failed: error -46: JIT stack limit reached /(ab|(bc|(de|(?R))))/I -Capturing subpattern count = 3 +Capture group count = 3 May match empty string Subject length lower bound = 0 JIT compilation was successful @@ -453,7 +453,7 @@ JIT compilation was successful Failed: error -46: JIT stack limit reached /(ab|(bc|(de|(?1))))/I -Capturing subpattern count = 3 +Capture group count = 3 May match empty string Subject length lower bound = 0 JIT compilation was successful @@ -464,7 +464,7 @@ JIT compilation was successful Failed: error -46: JIT stack limit reached /x(ab|(bc|(de|(?1)x)x)x)/I -Capturing subpattern count = 3 +Capture group count = 3 First code unit = 'x' Subject length lower bound = 3 JIT compilation was successful @@ -511,7 +511,7 @@ Failed: error -46: JIT stack limit reached Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Subject length lower bound = 1 JIT compilation was successful abcd diff --git a/testdata/testoutput2 b/testdata/testoutput2 index ecc5d21..6628457 100644 --- a/testdata/testoutput2 +++ b/testdata/testoutput2 @@ -47,12 +47,12 @@ 0: DE /(a)b|/I -Capturing subpattern count = 1 +Capture group count = 1 May match empty string Subject length lower bound = 0 /abc/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'c' Subject length lower bound = 3 @@ -69,7 +69,7 @@ No match No match /^abc/I -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored First code unit = 'a' @@ -85,30 +85,30 @@ No match No match /a+bc/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'c' Subject length lower bound = 3 /a*bc/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: a b Last code unit = 'c' Subject length lower bound = 2 /a{3}bc/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'c' Subject length lower bound = 5 /(abc|a+z)/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Subject length lower bound = 2 /^abc$/I -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored First code unit = 'a' @@ -159,19 +159,19 @@ Failed: error 118 at offset 7: missing ) after (?# comment Failed: error 111 at offset 2: unrecognized character after (? or (?- /.*b/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit at start or follows newline Last code unit = 'b' Subject length lower bound = 1 /.*?b/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit at start or follows newline Last code unit = 'b' Subject length lower bound = 1 /cat|dog|elephant/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: c d e Subject length lower bound = 3 this sentence eventually mentions a cat @@ -180,7 +180,7 @@ Subject length lower bound = 3 0: elephant /cat|dog|elephant/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: c d e Subject length lower bound = 3 this sentence eventually mentions a cat @@ -189,7 +189,7 @@ Subject length lower bound = 3 0: elephant /cat|dog|elephant/Ii -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless Starting code units: C D E c d e Subject length lower bound = 3 @@ -199,12 +199,12 @@ Subject length lower bound = 3 0: elephant /a|[bcd]/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: a b c d Subject length lower bound = 1 /(a|[^\dZ])/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: \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 ! " # $ % & ' ( ) * + , - . / : ; < = > @@ -222,7 +222,7 @@ Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a Subject length lower bound = 1 /(a|b)*[\s]/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 a b Subject length lower bound = 1 @@ -233,7 +233,7 @@ Failed: error 115 at offset 4: reference to non-existent subpattern Failed: error 109 at offset 4: quantifier does not follow a repeatable item /(a)(b)(c)\2/I -Capturing subpattern count = 3 +Capture group count = 3 Max back reference = 2 First code unit = 'a' Last code unit = 'c' @@ -267,7 +267,7 @@ Matched, but too many substrings 3: c /(a)bc|(a)(b)\2/I -Capturing subpattern count = 3 +Capture group count = 3 Max back reference = 2 First code unit = 'a' Subject length lower bound = 3 @@ -312,7 +312,7 @@ Matched, but too many substrings 3: b /abc$/I,dollar_endonly -Capturing subpattern count = 0 +Capture group count = 0 Options: dollar_endonly First code unit = 'a' Last code unit = 'c' @@ -329,7 +329,7 @@ No match Failed: error 115 at offset 16: reference to non-existent subpattern /the quick brown fox/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 't' Last code unit = 'x' Subject length lower bound = 19 @@ -339,7 +339,7 @@ Subject length lower bound = 19 0: the quick brown fox /the quick brown fox/I,anchored -Capturing subpattern count = 0 +Capture group count = 0 Options: anchored First code unit = 't' Subject length lower bound = 19 @@ -353,7 +353,7 @@ No match Failed: error 111 at offset 4: unrecognized character after (? or (?- /^abc|def/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: a d Subject length lower bound = 3 abcdef @@ -362,7 +362,7 @@ Subject length lower bound = 3 0: def /.*((abc)$|(def))/I -Capturing subpattern count = 3 +Capture group count = 3 First code unit at start or follows newline Subject length lower bound = 3 defabc @@ -382,7 +382,7 @@ Failed: error 122 at offset 0: unmatched closing parenthesis Failed: error 106 at offset 4: missing terminating ] for character class /[^aeiou ]{3,}/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \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 ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 @@ -402,7 +402,7 @@ Subject length lower bound = 3 0: -pr /<.*>/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = '<' Last code unit = '>' Subject length lower bound = 2 @@ -410,7 +410,7 @@ Subject length lower bound = 2 0: ghi /<.*?>/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = '<' Last code unit = '>' Subject length lower bound = 2 @@ -418,7 +418,7 @@ Subject length lower bound = 2 0: /<.*>/I,ungreedy -Capturing subpattern count = 0 +Capture group count = 0 Options: ungreedy First code unit = '<' Last code unit = '>' @@ -427,7 +427,7 @@ Subject length lower bound = 2 0: /(?U)<.*>/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = '<' Last code unit = '>' Subject length lower bound = 2 @@ -435,7 +435,7 @@ Subject length lower bound = 2 0: /<.*?>/I,ungreedy -Capturing subpattern count = 0 +Capture group count = 0 Options: ungreedy First code unit = '<' Last code unit = '>' @@ -444,7 +444,7 @@ Subject length lower bound = 2 0: ghi /={3,}/I,ungreedy -Capturing subpattern count = 0 +Capture group count = 0 Options: ungreedy First code unit = '=' Last code unit = '=' @@ -453,7 +453,7 @@ Subject length lower bound = 3 0: === /(?U)={3,}?/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = '=' Last code unit = '=' Subject length lower bound = 3 @@ -461,7 +461,7 @@ Subject length lower bound = 3 0: ======== /(? Overall options: anchored First code unit = '1' Subject length lower bound = 4 /(^b|(?i)^d)/I -Capturing subpattern count = 1 +Capture group count = 1 Compile options: Overall options: anchored Starting code units: D b d Subject length lower bound = 1 /(?s).*/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Compile options: Overall options: anchored Subject length lower bound = 0 /[abcd]/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: a b c d Subject length lower bound = 1 /(?i)[abcd]/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: A B C D a b c d Subject length lower bound = 1 /(?m)[xy]|(b|c)/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: b c x y Subject length lower bound = 1 /(^a|^b)/Im -Capturing subpattern count = 1 +Capture group count = 1 Options: multiline First code unit at start or follows newline Subject length lower bound = 1 /(?i)(^a|^b)/Im -Capturing subpattern count = 1 +Capture group count = 1 Options: multiline First code unit at start or follows newline Subject length lower bound = 1 /(a)(?(1)a|b|c)/ -Failed: error 127 at offset 3: conditional group contains more than two branches +Failed: error 127 at offset 3: conditional subpattern contains more than two branches /(?(?=a)a|b|c)/ -Failed: error 127 at offset 0: conditional group contains more than two branches +Failed: error 127 at offset 0: conditional subpattern contains more than two branches /(?(1a)/ Failed: error 124 at offset 4: missing closing parenthesis for condition @@ -565,14 +565,14 @@ Failed: error 115 at offset 3: reference to non-existent subpattern Failed: error 128 at offset 2: assertion expected after (?( or (?(?C) /((?s)blah)\s+\1/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 First code unit = 'b' Last code unit = 'h' Subject length lower bound = 9 /((?i)blah)\s+\1/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 First code unit = 'b' (caseless) Last code unit = 'h' (caseless) @@ -587,17 +587,17 @@ Subject length lower bound = 9 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'b' (caseless) Subject length lower bound = 1 /(a*b|(?i:c*(?-i)d))/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: C a b c d Subject length lower bound = 1 /a$/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Subject length lower bound = 1 a @@ -611,7 +611,7 @@ No match No match /a$/Im -Capturing subpattern count = 0 +Capture group count = 0 Options: multiline First code unit = 'a' Subject length lower bound = 1 @@ -626,7 +626,7 @@ Subject length lower bound = 1 No match /\Aabc/Im -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 1 Compile options: multiline Overall options: anchored multiline @@ -634,14 +634,14 @@ First code unit = 'a' Subject length lower bound = 3 /^abc/Im -Capturing subpattern count = 0 +Capture group count = 0 Options: multiline First code unit at start or follows newline Last code unit = 'c' Subject length lower bound = 3 /^((a+)(?U)([ab]+)(?-U)([bc]+)(\w*))/I -Capturing subpattern count = 5 +Capture group count = 5 Compile options: Overall options: anchored First code unit = 'a' @@ -655,25 +655,25 @@ Subject length lower bound = 3 5: def /(?<=foo)[ab]/I -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 3 Starting code units: a b Subject length lower bound = 1 /(?^abc)/Im -Capturing subpattern count = 0 +Capture group count = 0 Options: multiline First code unit at start or follows newline Last code unit = 'c' @@ -733,7 +733,7 @@ Failed: error 125 at offset 0: lookbehind assertion is not fixed length /The next three are in testinput2 because they have variable length branches/ /(?<=bullock|donkey)-cart/I -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 7 First code unit = '-' Last code unit = 't' @@ -749,13 +749,13 @@ No match No match /(?<=ab(?i)x|y|z)/I -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 3 May match empty string Subject length lower bound = 0 /(?>.*)(?<=(abcd)|(xyz))/I -Capturing subpattern count = 2 +Capture group count = 2 Max lookbehind = 4 May match empty string Subject length lower bound = 0 @@ -768,7 +768,7 @@ Subject length lower bound = 0 2: xyz /(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ/I -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 4 First code unit = 'Z' Last code unit = 'Z' @@ -796,7 +796,7 @@ No match No match /(? Overall options: anchored @@ -949,7 +949,7 @@ Failed: error 101 at offset 4: \ at end of pattern Failed: error 101 at offset 4: \ at end of pattern /(a)bc(d)/I -Capturing subpattern count = 2 +Capture group count = 2 First code unit = 'a' Last code unit = 'd' Subject length lower bound = 4 @@ -969,7 +969,7 @@ Subject length lower bound = 4 Copy substring 5 failed (-49): unknown substring /(.{20})/I -Capturing subpattern count = 1 +Capture group count = 1 Subject length lower bound = 20 abcdefghijklmnopqrstuvwxyz 0: abcdefghijklmnopqrst @@ -984,7 +984,7 @@ Subject length lower bound = 20 1G abcdefghijklmnopqrst (20) /(.{15})/I -Capturing subpattern count = 1 +Capture group count = 1 Subject length lower bound = 15 abcdefghijklmnopqrstuvwxyz 0: abcdefghijklmno @@ -996,7 +996,7 @@ Subject length lower bound = 15 1G abcdefghijklmno (15) /(.{16})/I -Capturing subpattern count = 1 +Capture group count = 1 Subject length lower bound = 16 abcdefghijklmnopqrstuvwxyz 0: abcdefghijklmnop @@ -1010,7 +1010,7 @@ Subject length lower bound = 16 1L abcdefghijklmnop /^(a|(bc))de(f)/I -Capturing subpattern count = 3 +Capture group count = 3 Compile options: Overall options: anchored Starting code units: a b @@ -1049,7 +1049,7 @@ Get substring 4 failed (-49): unknown substring 0C adef (4) /^abc\00def/I -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored First code unit = 'a' @@ -1062,7 +1062,7 @@ Subject length lower bound = 7 /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/I -Capturing subpattern count = 8 +Capture group count = 8 Contains explicit CR or LF match First code unit = 'w' Last code unit = 'd' @@ -1076,7 +1076,7 @@ Subject length lower bound = 14 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 First code unit at start or follows newline Last code unit = 'X' Subject length lower bound = 1 @@ -1089,7 +1089,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: dotall Overall options: anchored dotall Last code unit = 'X' @@ -1108,7 +1108,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 First code unit at start or follows newline Subject length lower bound = 1 @@ -1125,7 +1125,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Compile options: dotall Overall options: anchored dotall Subject length lower bound = 1 @@ -1143,7 +1143,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Compile options: Overall options: anchored Subject length lower bound = 1 @@ -1161,13 +1161,13 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Subject length lower bound = 1 /\Biss\B/I,aftertext -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 1 First code unit = 'i' Last code unit = 's' @@ -1177,7 +1177,7 @@ Subject length lower bound = 3 0+ issippi /iss/I,aftertext,altglobal -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'i' Last code unit = 's' Subject length lower bound = 3 @@ -1188,7 +1188,7 @@ Subject length lower bound = 3 0+ ippi /\Biss\B/I,aftertext,altglobal -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 1 First code unit = 'i' Last code unit = 's' @@ -1198,7 +1198,7 @@ Subject length lower bound = 3 0+ issippi /\Biss\B/Ig,aftertext -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 1 First code unit = 'i' Last code unit = 's' @@ -1213,7 +1213,7 @@ Subject length lower bound = 3 No match /(?<=[Ms])iss/Ig,aftertext -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 1 First code unit = 'i' Last code unit = 's' @@ -1225,7 +1225,7 @@ Subject length lower bound = 3 0+ ippi /(?<=[Ms])iss/I,aftertext,altglobal -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 1 First code unit = 'i' Last code unit = 's' @@ -1235,7 +1235,7 @@ Subject length lower bound = 3 0+ issippi /^iss/Ig,aftertext -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored First code unit = 'i' @@ -1245,7 +1245,7 @@ Subject length lower bound = 3 0+ issippi /.*iss/Ig,aftertext -Capturing subpattern count = 0 +Capture group count = 0 First code unit at start or follows newline Last code unit = 's' Subject length lower bound = 3 @@ -1256,7 +1256,7 @@ Subject length lower bound = 3 0+ pqr /.i./Ig,aftertext -Capturing subpattern count = 0 +Capture group count = 0 Last code unit = 'i' Subject length lower bound = 3 Mississippi @@ -1285,7 +1285,7 @@ Subject length lower bound = 3 0+ souri river /^.is/Ig,aftertext -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Subject length lower bound = 3 @@ -1294,7 +1294,7 @@ Subject length lower bound = 3 0+ sissippi /^ab\n/Ig,aftertext -Capturing subpattern count = 0 +Capture group count = 0 Contains explicit CR or LF match Compile options: Overall options: anchored @@ -1305,7 +1305,7 @@ Subject length lower bound = 3 0+ ab\x0acd /^ab\n/Igm,aftertext -Capturing subpattern count = 0 +Capture group count = 0 Contains explicit CR or LF match Options: multiline First code unit at start or follows newline @@ -1329,238 +1329,238 @@ Subject length lower bound = 3 0+ xyz /abc/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'c' Subject length lower bound = 3 /abc|bac/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: a b Last code unit = 'c' Subject length lower bound = 3 /(abc|bac)/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a b Last code unit = 'c' Subject length lower bound = 3 /(abc|(c|dc))/I -Capturing subpattern count = 2 +Capture group count = 2 Starting code units: a c d Last code unit = 'c' Subject length lower bound = 1 /(abc|(d|de)c)/I -Capturing subpattern count = 2 +Capture group count = 2 Starting code units: a d Last code unit = 'c' Subject length lower bound = 2 /a*/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Subject length lower bound = 0 /a+/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Subject length lower bound = 1 /(baa|a+)/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a b Last code unit = 'a' Subject length lower bound = 1 /a{0,3}/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Subject length lower bound = 0 /baa{3,}/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'b' Last code unit = 'a' Subject length lower bound = 5 /"([^\\"]+|\\.)*"/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit = '"' Last code unit = '"' Subject length lower bound = 2 /(abc|ab[cd])/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Subject length lower bound = 3 /(a|.)/I -Capturing subpattern count = 1 +Capture group count = 1 Subject length lower bound = 1 /a|ba|\w/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: 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 Subject length lower bound = 1 /abc(?=pqr)/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'r' Subject length lower bound = 3 /...(?<=abc)/I -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 3 Subject length lower bound = 3 /abc(?!pqr)/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'c' Subject length lower bound = 3 /ab./I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'b' Subject length lower bound = 3 /ab[xyz]/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'b' Subject length lower bound = 3 /abc*/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'b' Subject length lower bound = 2 /ab.c*/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'b' Subject length lower bound = 3 /a.c*/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Subject length lower bound = 2 /.c*/I -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 /ac*/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Subject length lower bound = 1 /(a.c*|b.c*)/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a b Subject length lower bound = 2 /a.c*|aba/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Subject length lower bound = 2 /.+a/I -Capturing subpattern count = 0 +Capture group count = 0 Last code unit = 'a' Subject length lower bound = 2 /(?=abcda)a.*/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'a' Subject length lower bound = 1 /(?=a)a.*/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Subject length lower bound = 1 /a(b)*/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Subject length lower bound = 1 /a\d*/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Subject length lower bound = 1 /ab\d*/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'b' Subject length lower bound = 2 /a(\d)*/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Subject length lower bound = 1 /abcde{0,0}/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'd' Subject length lower bound = 4 /ab\d+/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'b' Subject length lower bound = 3 /a(?(1)b)(.)/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 First code unit = 'a' Subject length lower bound = 2 /a(?(1)bag|big)(.)/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 First code unit = 'a' Last code unit = 'g' Subject length lower bound = 5 /a(?(1)bag|big)*(.)/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 First code unit = 'a' Subject length lower bound = 2 /a(?(1)bag|big)+(.)/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 First code unit = 'a' Last code unit = 'g' Subject length lower bound = 5 /a(?(1)b..|b..)(.)/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 First code unit = 'a' Last code unit = 'b' Subject length lower bound = 5 /ab\d{0}e/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'e' Subject length lower bound = 3 /a?b?/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Subject length lower bound = 0 a @@ -1576,7 +1576,7 @@ Subject length lower bound = 0 No match /|-/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Subject length lower bound = 0 abcd @@ -1590,7 +1590,7 @@ Subject length lower bound = 0 No match /^.?abcd/I -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Last code unit = 'd' @@ -1604,7 +1604,7 @@ Subject length lower bound = 4 )* # Zero or more contents \) # Closing ) /Ix -Capturing subpattern count = 0 +Capture group count = 0 Options: extended First code unit = '(' Last code unit = ')' @@ -1632,7 +1632,7 @@ No match No match /\( ( (?>[^()]+) | (?R) )* \) /Igx -Capturing subpattern count = 1 +Capture group count = 1 Options: extended First code unit = '(' Last code unit = ')' @@ -1647,7 +1647,7 @@ Subject length lower bound = 2 1: z /\( (?: (?>[^()]+) | (?R) ) \) /Ix -Capturing subpattern count = 0 +Capture group count = 0 Options: extended First code unit = '(' Last code unit = ')' @@ -1665,7 +1665,7 @@ Subject length lower bound = 3 No match /\( (?: (?>[^()]+) | (?R) )? \) /Ix -Capturing subpattern count = 0 +Capture group count = 0 Options: extended First code unit = '(' Last code unit = ')' @@ -1676,7 +1676,7 @@ Subject length lower bound = 2 0: (fsh) /\( ( (?>[^()]+) | (?R) )* \) /Ix -Capturing subpattern count = 1 +Capture group count = 1 Options: extended First code unit = '(' Last code unit = ')' @@ -1686,7 +1686,7 @@ Subject length lower bound = 2 1: cd /\( ( ( (?>[^()]+) | (?R) )* ) \) /Ix -Capturing subpattern count = 2 +Capture group count = 2 Options: extended First code unit = '(' Last code unit = ')' @@ -1697,7 +1697,7 @@ Subject length lower bound = 2 2: cd /\( (123)? ( ( (?>[^()]+) | (?R) )* ) \) /Ix -Capturing subpattern count = 3 +Capture group count = 3 Options: extended First code unit = '(' Last code unit = ')' @@ -1714,7 +1714,7 @@ Subject length lower bound = 2 3: cd /\( ( (123)? ( (?>[^()]+) | (?R) )* ) \) /Ix -Capturing subpattern count = 3 +Capture group count = 3 Options: extended First code unit = '(' Last code unit = ')' @@ -1731,7 +1731,7 @@ Subject length lower bound = 2 3: cd /\( (((((((((( ( (?>[^()]+) | (?R) )* )))))))))) \) /Ix -Capturing subpattern count = 11 +Capture group count = 11 Options: extended First code unit = '(' Last code unit = ')' @@ -1751,7 +1751,7 @@ Subject length lower bound = 2 11: cd /\( ( ( (?>[^()<>]+) | ((?>[^()]+)) | (?R) )* ) \) /Ix -Capturing subpattern count = 3 +Capture group count = 3 Options: extended First code unit = '(' Last code unit = ')' @@ -1762,7 +1762,7 @@ Subject length lower bound = 2 2: 123 /\( ( ( (?>[^()]+) | ((?R)) )* ) \) /Ix -Capturing subpattern count = 3 +Capture group count = 3 Options: extended First code unit = '(' Last code unit = ')' @@ -1786,7 +1786,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: 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 @@ -1801,7 +1801,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a @@ -1826,7 +1826,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: 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 @@ -1841,7 +1841,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a @@ -1860,7 +1860,7 @@ Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a Subject length lower bound = 1 /[_[:alpha:]]/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: 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 Subject length lower bound = 1 @@ -1873,7 +1873,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a @@ -1892,7 +1892,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: \x80 \x81 \x82 \x83 \x84 \x85 \x86 \x87 \x88 \x89 \x8a @@ -1914,7 +1914,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: \x09 \x20 @@ -1928,7 +1928,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0a \x0b @@ -1948,7 +1948,7 @@ Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0a \x0b Subject length lower bound = 1 /[\n\x0b\x0c\x0d[:blank:]]/I -Capturing subpattern count = 0 +Capture group count = 0 Contains explicit CR or LF match Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 Subject length lower bound = 1 @@ -1961,7 +1961,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a @@ -1977,7 +1977,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: 0 1 2 3 4 5 6 7 8 9 @@ -1991,7 +1991,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : @@ -2007,7 +2007,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: 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 @@ -2021,7 +2021,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: \x20 ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 @@ -2037,7 +2037,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ @@ -2052,7 +2052,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 @@ -2066,7 +2066,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: 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 @@ -2080,7 +2080,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f @@ -2094,7 +2094,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: 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 @@ -2109,7 +2109,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: \x20 ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 @@ -2134,7 +2134,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 \x0a @@ -2161,7 +2161,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0a \x0b @@ -2187,7 +2187,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: % 0 1 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 Subject length lower bound = 1 @@ -2202,7 +2202,7 @@ Failed: error 113 at offset 1: POSIX collating elements are not supported Failed: error 130 at offset 3: unknown POSIX class name /[[:upper:]]/Ii -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless Starting code units: 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 @@ -2213,7 +2213,7 @@ Subject length lower bound = 1 0: a /[[:lower:]]/Ii -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless Starting code units: 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 @@ -2224,7 +2224,7 @@ Subject length lower bound = 1 0: a /((?-i)[[:lower:]])[[:lower:]]/Ii -Capturing subpattern count = 1 +Capture group count = 1 Options: caseless Starting code units: 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 Subject length lower bound = 2 @@ -2249,7 +2249,7 @@ Failed: error 115 at offset 5: reference to non-existent subpattern # This one's here because of the large output vector needed /(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\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)/I -Capturing subpattern count = 271 +Capture group count = 271 Max back reference = 270 Starting code units: 0 1 2 3 4 5 6 7 8 9 Subject length lower bound = 0 @@ -2530,7 +2530,7 @@ Subject length lower bound = 0 # This one's here because Perl does this differently and PCRE2 can't at present /(main(O)?)+/I -Capturing subpattern count = 2 +Capture group count = 2 First code unit = 'm' Last code unit = 'n' Subject length lower bound = 4 @@ -2545,7 +2545,7 @@ Subject length lower bound = 4 # These are all cases where Perl does it differently (nested captures) /^(a(b)?)+$/I -Capturing subpattern count = 2 +Capture group count = 2 Compile options: Overall options: anchored First code unit = 'a' @@ -2556,7 +2556,7 @@ Subject length lower bound = 1 2: b /^(aa(bb)?)+$/I -Capturing subpattern count = 2 +Capture group count = 2 Compile options: Overall options: anchored First code unit = 'a' @@ -2567,7 +2567,7 @@ Subject length lower bound = 2 2: bb /^(aa|aa(bb))+$/I -Capturing subpattern count = 2 +Capture group count = 2 Compile options: Overall options: anchored First code unit = 'a' @@ -2578,7 +2578,7 @@ Subject length lower bound = 2 2: bb /^(aa(bb)??)+$/I -Capturing subpattern count = 2 +Capture group count = 2 Compile options: Overall options: anchored First code unit = 'a' @@ -2589,7 +2589,7 @@ Subject length lower bound = 2 2: bb /^(?:aa(bb)?)+$/I -Capturing subpattern count = 1 +Capture group count = 1 Compile options: Overall options: anchored First code unit = 'a' @@ -2599,7 +2599,7 @@ Subject length lower bound = 2 1: bb /^(aa(b(b))?)+$/I -Capturing subpattern count = 3 +Capture group count = 3 Compile options: Overall options: anchored First code unit = 'a' @@ -2611,7 +2611,7 @@ Subject length lower bound = 2 3: b /^(?:aa(b(b))?)+$/I -Capturing subpattern count = 2 +Capture group count = 2 Compile options: Overall options: anchored First code unit = 'a' @@ -2622,7 +2622,7 @@ Subject length lower bound = 2 2: b /^(?:aa(b(?:b))?)+$/I -Capturing subpattern count = 1 +Capture group count = 1 Compile options: Overall options: anchored First code unit = 'a' @@ -2632,7 +2632,7 @@ Subject length lower bound = 2 1: bb /^(?:aa(bb(?:b))?)+$/I -Capturing subpattern count = 1 +Capture group count = 1 Compile options: Overall options: anchored First code unit = 'a' @@ -2642,7 +2642,7 @@ Subject length lower bound = 2 1: bbb /^(?:aa(b(?:bb))?)+$/I -Capturing subpattern count = 1 +Capture group count = 1 Compile options: Overall options: anchored First code unit = 'a' @@ -2652,7 +2652,7 @@ Subject length lower bound = 2 1: bbb /^(?:aa(?:b(b))?)+$/I -Capturing subpattern count = 1 +Capture group count = 1 Compile options: Overall options: anchored First code unit = 'a' @@ -2662,7 +2662,7 @@ Subject length lower bound = 2 1: b /^(?:aa(?:b(bb))?)+$/I -Capturing subpattern count = 1 +Capture group count = 1 Compile options: Overall options: anchored First code unit = 'a' @@ -2672,7 +2672,7 @@ Subject length lower bound = 2 1: bb /^(aa(b(bb))?)+$/I -Capturing subpattern count = 3 +Capture group count = 3 Compile options: Overall options: anchored First code unit = 'a' @@ -2684,7 +2684,7 @@ Subject length lower bound = 2 3: bb /^(aa(bb(bb))?)+$/I -Capturing subpattern count = 3 +Capture group count = 3 Compile options: Overall options: anchored First code unit = 'a' @@ -2703,7 +2703,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Options: extended Subject length lower bound = 0 @@ -2715,7 +2715,7 @@ Subject length lower bound = 0 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: extended First code unit = 'a' Subject length lower bound = 1 @@ -2727,7 +2727,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 Subject length lower bound = 1 @@ -2738,7 +2738,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a \x1b \x1c \x1d \x1e \x1f ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C @@ -2763,7 +2763,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'b' (caseless) Subject length lower bound = 2 @@ -2785,7 +2785,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Last code unit = 'b' (caseless) Subject length lower bound = 2 @@ -2806,7 +2806,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: extended First code unit = 'a' (caseless) Last code unit = 'c' (caseless) @@ -2820,7 +2820,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: extended First code unit = 'a' (caseless) Last code unit = 'c' (caseless) @@ -2833,7 +2833,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 First code unit = '1' Last code unit = '0' Subject length lower bound = 300 @@ -2845,7 +2845,7 @@ Subject length lower bound = 300 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 First code unit = '1' Last code unit = '0' Subject length lower bound = 300 @@ -2856,7 +2856,7 @@ Subject length lower bound = 300 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Subject length lower bound = 0 \ @@ -2869,7 +2869,7 @@ Subject length lower bound = 0 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'x' Subject length lower bound = 1 @@ -2880,7 +2880,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 First code unit = ' ' Subject length lower bound = 1 @@ -2891,7 +2891,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Subject length lower bound = 1 abc @@ -2908,7 +2908,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'b' Subject length lower bound = 2 @@ -2922,7 +2922,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'c' Subject length lower bound = 3 @@ -2935,7 +2935,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: 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 Subject length lower bound = 1 @@ -2950,7 +2950,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Subject length lower bound = 0 @@ -2961,7 +2961,7 @@ Subject length lower bound = 0 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'x' Subject length lower bound = 1 @@ -3011,12 +3011,12 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 May match empty string Subject length lower bound = 0 /^(\w++|\s++)*$/I -Capturing subpattern count = 1 +Capture group count = 1 May match empty string Compile options: Overall options: anchored @@ -3029,7 +3029,7 @@ Subject length lower bound = 0 No match /(\d++)(\w)/I -Capturing subpattern count = 2 +Capture group count = 2 Starting code units: 0 1 2 3 4 5 6 7 8 9 Subject length lower bound = 2 12345a @@ -3041,7 +3041,7 @@ Subject length lower bound = 2 No match /a++b/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'b' Subject length lower bound = 2 @@ -3049,7 +3049,7 @@ Subject length lower bound = 2 0: aaab /(a++b)/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Last code unit = 'b' Subject length lower bound = 2 @@ -3058,7 +3058,7 @@ Subject length lower bound = 2 1: aaab /(a++)b/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Last code unit = 'b' Subject length lower bound = 2 @@ -3067,7 +3067,7 @@ Subject length lower bound = 2 1: aaa /([^()]++|\([^()]*\))+/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: \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 @@ -3088,7 +3088,7 @@ Subject length lower bound = 1 1: x /\(([^()]++|\([^()]+\))+\)/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit = '(' Last code unit = ')' Subject length lower bound = 3 @@ -3123,7 +3123,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Last code unit = 'c' Subject length lower bound = 3 @@ -3149,7 +3149,7 @@ Failed: error 109 at offset 7: quantifier does not follow a repeatable item Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'x' Last code unit = 'b' Subject length lower bound = 3 @@ -3165,7 +3165,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'x' Last code unit = 'b' Subject length lower bound = 3 @@ -3193,7 +3193,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 5 +Capture group count = 5 Compile options: Overall options: anchored First code unit = 'a' @@ -3209,7 +3209,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored First code unit = 'x' @@ -3228,7 +3228,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Compile options: Overall options: anchored First code unit = 'x' @@ -3282,7 +3282,7 @@ Failed: error 106 at offset 10: missing terminating ] for character class Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 Subject length lower bound = 1 @@ -3293,7 +3293,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 Subject length lower bound = 1 @@ -3304,12 +3304,12 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 a b c d e Subject length lower bound = 1 /< (?: (?(R) \d++ | [^<>]*+) | (?R)) * >/Ix -Capturing subpattern count = 0 +Capture group count = 0 Options: extended First code unit = '<' Last code unit = '>' @@ -3338,7 +3338,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 1 First code unit = '8' Last code unit = 'X' @@ -3352,43 +3352,43 @@ Subject length lower bound = 409 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 1 First code unit = '$' Last code unit = 'X' Subject length lower bound = 404 /(.*)\d+\1/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Subject length lower bound = 1 /(.*)\d+/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit at start or follows newline Subject length lower bound = 1 /(.*)\d+\1/Is -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Options: dotall Subject length lower bound = 1 /(.*)\d+/Is -Capturing subpattern count = 1 +Capture group count = 1 Compile options: dotall Overall options: anchored dotall Subject length lower bound = 1 /(.*(xyz))\d+\2/I -Capturing subpattern count = 2 +Capture group count = 2 Max back reference = 2 First code unit at start or follows newline Last code unit = 'z' Subject length lower bound = 7 /((.*))\d+\1/I -Capturing subpattern count = 2 +Capture group count = 2 Max back reference = 1 Subject length lower bound = 1 abc123bc @@ -3397,143 +3397,143 @@ Subject length lower bound = 1 2: bc /a[b]/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'b' Subject length lower bound = 2 /(?=a).*/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string First code unit = 'a' Subject length lower bound = 0 /(?=abc).xyz/Ii -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless First code unit = 'a' (caseless) Last code unit = 'z' (caseless) Subject length lower bound = 4 /(?=abc)(?i).xyz/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'z' (caseless) Subject length lower bound = 4 /(?=a)(?=b)/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string First code unit = 'a' Subject length lower bound = 0 /(?=.)a/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Subject length lower bound = 1 /((?=abcda)a)/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Last code unit = 'a' Subject length lower bound = 1 /((?=abcda)ab)/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Last code unit = 'b' Subject length lower bound = 2 /()a/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Subject length lower bound = 1 /(?:(?=.)|(? Overall options: anchored First code unit = 'a' Subject length lower bound = 3 /(?C)a|b/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: a b Subject length lower bound = 1 /a|(b)(?C)/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a b Subject length lower bound = 1 b @@ -3894,7 +3894,7 @@ Subject length lower bound = 1 1: b /x(ab|(bc|(de|(?R))))/I -Capturing subpattern count = 3 +Capture group count = 3 First code unit = 'x' Subject length lower bound = 3 xab @@ -3924,7 +3924,7 @@ Subject length lower bound = 3 No match /^([^()]|\((?1)*\))*$/I -Capturing subpattern count = 1 +Capture group count = 1 May match empty string Compile options: Overall options: anchored @@ -3943,7 +3943,7 @@ Subject length lower bound = 0 No match /^>abc>([^()]|\((?1)*\))* Overall options: anchored First code unit = '>' @@ -3970,7 +3970,7 @@ Subject length lower bound = 10 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Last code unit = 'b' Subject length lower bound = 2 @@ -3988,13 +3988,13 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Last code unit = 'b' Subject length lower bound = 2 /^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/I -Capturing subpattern count = 2 +Capture group count = 2 Compile options: Overall options: anchored Starting code units: ( - 0 1 2 3 4 5 6 7 8 9 @@ -4014,7 +4014,7 @@ Subject length lower bound = 1 No match /^(x(y|(?1){2})z)/I -Capturing subpattern count = 2 +Capture group count = 2 Compile options: Overall options: anchored First code unit = 'x' @@ -4034,7 +4034,7 @@ No match No match /((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))/Ix -Capturing subpattern count = 2 +Capture group count = 2 Options: extended First code unit = '<' Last code unit = '>' @@ -4074,7 +4074,7 @@ Failed: error 115 at offset 3: reference to non-existent subpattern Failed: error 114 at offset 10: missing closing parenthesis /^(abc)def(?1)/I -Capturing subpattern count = 1 +Capture group count = 1 Compile options: Overall options: anchored First code unit = 'a' @@ -4084,7 +4084,7 @@ Subject length lower bound = 9 1: abc /^(a|b|c)=(?1)+/I -Capturing subpattern count = 1 +Capture group count = 1 Compile options: Overall options: anchored Starting code units: a b c @@ -4100,7 +4100,7 @@ Subject length lower bound = 2 1: a /^(a|b|c)=((?1))+/I -Capturing subpattern count = 2 +Capture group count = 2 Compile options: Overall options: anchored Starting code units: a b c @@ -4134,8 +4134,8 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 2 -Named capturing subpatterns: +Capture group count = 2 +Named capture groups: longername2 2 name1 1 First code unit = 'a' @@ -4168,8 +4168,8 @@ Subject length lower bound = 4 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 3 -Named capturing subpatterns: +Capture group count = 3 +Named capture groups: a 3 c 1 d 2 @@ -4193,18 +4193,18 @@ Subject length lower bound = 4 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 -Named capturing subpatterns: +Named capture groups: a 1 First code unit = 'a' Last code unit = 'd' Subject length lower bound = 10 /^\W*(?:(?P(?P.)\W*(?P>one)\W*(?P=two)|)|(?P(?P.)\W*(?P>three)\W*(?P=four)|\W*.\W*))\W*$/Ii -Capturing subpattern count = 4 +Capture group count = 4 Max back reference = 4 -Named capturing subpatterns: +Named capture groups: four 4 one 1 three 3 @@ -4240,7 +4240,7 @@ Subject length lower bound = 0 No match /((?(R)a|b))\1(?1)?/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Subject length lower bound = 2 bb @@ -4251,21 +4251,21 @@ Subject length lower bound = 2 1: b /(.*)a/Is -Capturing subpattern count = 1 +Capture group count = 1 Compile options: dotall Overall options: anchored dotall Last code unit = 'a' Subject length lower bound = 1 /(.*)a\1/Is -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Options: dotall Last code unit = 'a' Subject length lower bound = 1 /(.*)a(b)\2/Is -Capturing subpattern count = 2 +Capture group count = 2 Max back reference = 2 Compile options: dotall Overall options: anchored dotall @@ -4273,35 +4273,35 @@ Last code unit = 'b' Subject length lower bound = 3 /((.*)a|(.*)b)z/Is -Capturing subpattern count = 3 +Capture group count = 3 Compile options: dotall Overall options: anchored dotall Last code unit = 'z' Subject length lower bound = 2 /((.*)a|(.*)b)z\1/Is -Capturing subpattern count = 3 +Capture group count = 3 Max back reference = 1 Options: dotall Last code unit = 'z' Subject length lower bound = 3 /((.*)a|(.*)b)z\2/Is -Capturing subpattern count = 3 +Capture group count = 3 Max back reference = 2 Options: dotall Last code unit = 'z' Subject length lower bound = 2 /((.*)a|(.*)b)z\3/Is -Capturing subpattern count = 3 +Capture group count = 3 Max back reference = 3 Options: dotall Last code unit = 'z' Subject length lower bound = 2 /((.*)a|^(.*)b)z\3/Is -Capturing subpattern count = 3 +Capture group count = 3 Max back reference = 3 Compile options: dotall Overall options: anchored dotall @@ -4309,21 +4309,21 @@ Last code unit = 'z' Subject length lower bound = 2 /(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/Is -Capturing subpattern count = 31 +Capture group count = 31 May match empty string Compile options: dotall Overall options: anchored dotall Subject length lower bound = 0 /(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/Is -Capturing subpattern count = 31 +Capture group count = 31 Max back reference = 31 May match empty string Options: dotall Subject length lower bound = 0 /(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/Is -Capturing subpattern count = 32 +Capture group count = 32 Max back reference = 32 May match empty string Options: dotall @@ -4341,7 +4341,7 @@ Subject length lower bound = 0 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: no_auto_capture First code unit = 'a' Last code unit = 'c' @@ -4361,8 +4361,8 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 -Named capturing subpatterns: +Capture group count = 1 +Named capture groups: one 1 Options: no_auto_capture First code unit = 'a' @@ -4384,8 +4384,8 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 -Named capturing subpatterns: +Capture group count = 1 +Named capture groups: named 1 Options: no_auto_capture First code unit = 'a' @@ -4393,7 +4393,7 @@ Last code unit = 'c' Subject length lower bound = 3 /(aaa(?C1)bbb|ab)/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Last code unit = 'b' Subject length lower bound = 2 @@ -4421,8 +4421,8 @@ Callout data = -1 No match /ab(?Pcd)ef(?Pgh)/I -Capturing subpattern count = 2 -Named capturing subpatterns: +Capture group count = 2 +Named capture groups: one 1 two 2 First code unit = 'a' @@ -4461,8 +4461,8 @@ Copy substring 'three' failed (-49): unknown substring Ket End ------------------------------------------------------------------ -Capturing subpattern count = 2 -Named capturing subpatterns: +Capture group count = 2 +Named capture groups: Tes 1 Test 2 May match empty string @@ -4478,16 +4478,16 @@ Subject length lower bound = 0 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 2 -Named capturing subpatterns: +Capture group count = 2 +Named capture groups: Tes 2 Test 1 May match empty string Subject length lower bound = 0 /(?Pzz)(?Paa)/I -Capturing subpattern count = 2 -Named capturing subpatterns: +Capture group count = 2 +Named capture groups: A 2 Z 1 First code unit = 'z' @@ -4511,8 +4511,8 @@ Failed: error 143 at offset 16: two named subpatterns have the same name (PCRE2_ Failed: error 143 at offset 31: two named subpatterns have the same name (PCRE2_DUPNAMES not set) "\[((?P\d+)(,(?P>elem))*)\]"I -Capturing subpattern count = 3 -Named capturing subpatterns: +Capture group count = 3 +Named capture groups: elem 2 First code unit = '[' Last code unit = ']' @@ -4527,8 +4527,8 @@ Subject length lower bound = 3 No match "\[((?P\d+)(,(?P>elem))*)?\]"I -Capturing subpattern count = 3 -Named capturing subpatterns: +Capture group count = 3 +Named capture groups: elem 2 First code unit = '[' Last code unit = ']' @@ -4556,7 +4556,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 2 +Capture group count = 2 May match empty string Subject length lower bound = 0 @@ -4575,7 +4575,7 @@ Subject length lower bound = 0 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 2 +Capture group count = 2 May match empty string Subject length lower bound = 0 @@ -4605,7 +4605,7 @@ Subject length lower bound = 0 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 2 +Capture group count = 2 May match empty string Subject length lower bound = 0 @@ -4638,7 +4638,7 @@ Subject length lower bound = 0 ------------------------------------------------------------------ /((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/Ii -Capturing subpattern count = 3 +Capture group count = 3 Options: caseless Last code unit = 'g' (caseless) Subject length lower bound = 8 @@ -4647,7 +4647,7 @@ Subject length lower bound = 8 1: Baby Bjorn Active Carrier - With free SHIPPING!! /((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/Ii -Capturing subpattern count = 3 +Capture group count = 3 Options: caseless Last code unit = 'g' (caseless) Subject length lower bound = 8 @@ -4664,7 +4664,7 @@ Subject length lower bound = 8 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Last code unit = 'b' Subject length lower bound = 1 @@ -4682,7 +4682,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Last code unit = 'c' Subject length lower bound = 1 @@ -4697,7 +4697,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'f' Subject length lower bound = 6 @@ -4719,7 +4719,7 @@ Subject length lower bound = 6 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: auto_callout First code unit = 'a' Last code unit = 'e' @@ -4754,7 +4754,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: auto_callout Starting code units: a b Last code unit = 'b' @@ -4797,7 +4797,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: auto_callout Starting code units: a b Last code unit = 'b' @@ -4840,7 +4840,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: auto_callout First code unit = 'a' Last code unit = 'b' @@ -4897,7 +4897,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: auto_callout Starting code units: a d Last code unit = 'x' @@ -4971,7 +4971,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: auto_callout Starting code units: a d Last code unit = 'x' @@ -5019,7 +5019,7 @@ Subject length lower bound = 4 No match /(ab|cd){3,4}/I,auto_callout -Capturing subpattern count = 1 +Capture group count = 1 Options: auto_callout Starting code units: a c Subject length lower bound = 6 @@ -5111,7 +5111,7 @@ Subject length lower bound = 6 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: auto_callout Starting code units: a b x Subject length lower bound = 2 @@ -5161,7 +5161,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: auto_callout Starting code units: a b x Subject length lower bound = 2 @@ -5262,7 +5262,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: auto_callout Starting code units: a b x Last code unit = '3' @@ -5294,7 +5294,7 @@ Subject length lower bound = 11 1: aac /\b.*/I -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 1 May match empty string Subject length lower bound = 0 @@ -5302,7 +5302,7 @@ Subject length lower bound = 0 0: cd /\b.*/Is -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 1 May match empty string Options: dotall @@ -5311,14 +5311,14 @@ Subject length lower bound = 0 0: cd /(?!.bcd).*/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Subject length lower bound = 0 Xbcd12345 0: bcd12345 /abcde/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'e' Subject length lower bound = 5 @@ -5337,7 +5337,7 @@ Partial match: abc No match "^(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/(20)?\d\d$"I -Capturing subpattern count = 3 +Capture group count = 3 Compile options: Overall options: anchored Starting code units: 0 1 2 3 4 5 6 7 8 9 @@ -5393,31 +5393,31 @@ No match No match /0{0,2}ABC/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: 0 A Last code unit = 'C' Subject length lower bound = 3 /\d{3,}ABC/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: 0 1 2 3 4 5 6 7 8 9 Last code unit = 'C' Subject length lower bound = 6 /\d*ABC/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: 0 1 2 3 4 5 6 7 8 9 A Last code unit = 'C' Subject length lower bound = 3 /[abc]+DE/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: a b c Last code unit = 'E' Subject length lower bound = 3 /[abc]?123/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: 1 a b c Last code unit = '3' Subject length lower bound = 3 @@ -5435,7 +5435,7 @@ Partial match: c12 0: c123 /^(?:\d){3,5}X/I -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: 0 1 2 3 4 5 6 7 8 9 @@ -5462,7 +5462,7 @@ No match No match "<(\w+)/?>(.)*"Igms -Capturing subpattern count = 3 +Capture group count = 3 Max back reference = 1 Options: dotall multiline First code unit = '<' @@ -5475,7 +5475,7 @@ Subject length lower bound = 7 3: seite /line\nbreak/I -Capturing subpattern count = 0 +Capture group count = 0 Contains explicit CR or LF match First code unit = 'l' Last code unit = 'k' @@ -5486,7 +5486,7 @@ Subject length lower bound = 10 0: line\x0abreak /line\nbreak/I,firstline -Capturing subpattern count = 0 +Capture group count = 0 Contains explicit CR or LF match Options: firstline First code unit = 'l' @@ -5499,7 +5499,7 @@ Subject length lower bound = 10 No match /line\nbreak/Im,firstline -Capturing subpattern count = 0 +Capture group count = 0 Contains explicit CR or LF match Options: firstline multiline First code unit = 'l' @@ -5512,7 +5512,7 @@ Subject length lower bound = 10 No match /(?i)(?-i)AbCd/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'A' Last code unit = 'd' Subject length lower bound = 4 @@ -5532,7 +5532,7 @@ Failed: error 105 at offset 9: number too big in {} quantifier Failed: error 105 at offset 11: number too big in {} quantifier "(?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"I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 First code unit = 'a' (caseless) Last code unit = 'B' @@ -5542,9 +5542,9 @@ Subject length lower bound = 15 1: k "(?Pa)(?Pb)(?Pc)(?Pd)(?Pe)(?Pf)(?Pg)(?Ph)(?Pi)(?Pj)(?Pk)(?Pl)A\11B"I -Capturing subpattern count = 12 +Capture group count = 12 Max back reference = 11 -Named capturing subpatterns: +Named capture groups: n0 1 n1 2 n10 11 @@ -5576,7 +5576,7 @@ Subject length lower bound = 15 12: l "(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)A\11B"I -Capturing subpattern count = 12 +Capture group count = 12 Max back reference = 11 First code unit = 'a' Last code unit = 'B' @@ -5597,8 +5597,8 @@ Subject length lower bound = 15 12: l "(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)(?Pa)"I -Capturing subpattern count = 101 -Named capturing subpatterns: +Capture group count = 101 +Named capture groups: name0 1 name1 2 name10 11 @@ -5722,7 +5722,7 @@ Matched, but too many substrings 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)"I -Capturing subpattern count = 101 +Capture group count = 101 First code unit = 'a' Last code unit = 'a' Subject length lower bound = 101 @@ -5745,7 +5745,7 @@ Matched, but too many substrings 14: a /[^()]*(?:\((?R)\)[^()]*)*/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Subject length lower bound = 0 (this(and)that @@ -5756,7 +5756,7 @@ Subject length lower bound = 0 0: (this(and)that)stuff /[^()]*(?:\((?>(?R))\)[^()]*)*/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Subject length lower bound = 0 (this(and)that @@ -5765,7 +5765,7 @@ Subject length lower bound = 0 0: (this(and)that) /[^()]*(?:\((?R)\))*[^()]*/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Subject length lower bound = 0 (this(and)that @@ -5774,7 +5774,7 @@ Subject length lower bound = 0 0: (this(and)that) /(?:\((?R)\))*[^()]*/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Subject length lower bound = 0 (this(and)that @@ -5785,7 +5785,7 @@ Subject length lower bound = 0 0: ((this)) /(?:\((?R)\))|[^()]*/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Subject length lower bound = 0 (this(and)that @@ -5798,7 +5798,7 @@ Subject length lower bound = 0 0: ((this)) /\x{0000ff}/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = \xff Subject length lower bound = 1 @@ -5806,8 +5806,8 @@ Subject length lower bound = 1 Failed: error 143 at offset 18: two named subpatterns have the same name (PCRE2_DUPNAMES not set) /^((?Pa1)|(?Pa2)b)/I,dupnames -Capturing subpattern count = 3 -Named capturing subpatterns: +Capture group count = 3 +Named capture groups: A 2 A 3 Compile options: dupnames @@ -5834,8 +5834,8 @@ Copy substring 'Z' failed (-49): unknown substring C a1 (2) A (non-unique) /(?|(?)(?)(?)|(?)(?)(?))/I,dupnames -Capturing subpattern count = 3 -Named capturing subpatterns: +Capture group count = 3 +Named capture groups: a 1 a 3 b 2 @@ -5844,8 +5844,8 @@ Options: dupnames Subject length lower bound = 0 /^(?Pa)(?Pb)/I,dupnames -Capturing subpattern count = 2 -Named capturing subpatterns: +Capture group count = 2 +Named capture groups: A 1 A 2 Compile options: dupnames @@ -5859,8 +5859,8 @@ Subject length lower bound = 2 C a (1) A (non-unique) /^(?Pa)(?Pb)|cd/I,dupnames -Capturing subpattern count = 2 -Named capturing subpatterns: +Capture group count = 2 +Named capture groups: A 1 A 2 Options: dupnames @@ -5876,8 +5876,8 @@ Subject length lower bound = 2 Copy substring 'A' failed (-55): requested value is not set /^(?Pa)(?Pb)|cd(?Pef)(?Pgh)/I,dupnames -Capturing subpattern count = 4 -Named capturing subpatterns: +Capture group count = 4 +Named capture groups: A 1 A 2 A 3 @@ -5894,8 +5894,8 @@ Subject length lower bound = 2 C ef (2) A (non-unique) /^((?Pa1)|(?Pa2)b)/I,dupnames -Capturing subpattern count = 3 -Named capturing subpatterns: +Capture group count = 3 +Named capture groups: A 2 A 3 Compile options: dupnames @@ -5922,8 +5922,8 @@ Get substring 'Z' failed (-49): unknown substring G a1 (2) A (non-unique) /^(?Pa)(?Pb)/I,dupnames -Capturing subpattern count = 2 -Named capturing subpatterns: +Capture group count = 2 +Named capture groups: A 1 A 2 Compile options: dupnames @@ -5937,8 +5937,8 @@ Subject length lower bound = 2 G a (1) A (non-unique) /^(?Pa)(?Pb)|cd/I,dupnames -Capturing subpattern count = 2 -Named capturing subpatterns: +Capture group count = 2 +Named capture groups: A 1 A 2 Options: dupnames @@ -5954,8 +5954,8 @@ Subject length lower bound = 2 Get substring 'A' failed (-55): requested value is not set /^(?Pa)(?Pb)|cd(?Pef)(?Pgh)/I,dupnames -Capturing subpattern count = 4 -Named capturing subpatterns: +Capture group count = 4 +Named capture groups: A 1 A 2 A 3 @@ -5972,8 +5972,8 @@ Subject length lower bound = 2 G ef (2) A (non-unique) /(?J)^((?Pa1)|(?Pa2)b)/I -Capturing subpattern count = 3 -Named capturing subpatterns: +Capture group count = 3 +Named capture groups: A 2 A 3 Compile options: @@ -6001,8 +6001,8 @@ Failed: error 143 at offset 38: two named subpatterns have the same name (PCRE2_ # a random value. /^(?Pa) (?J:(?Pb)(?Pc)) (?Pd)/I -Capturing subpattern count = 4 -Named capturing subpatterns: +Capture group count = 4 +Named capture groups: A 1 B 2 B 3 @@ -6023,9 +6023,9 @@ Subject length lower bound = 6 C d (1) C (group 4) /^(?Pa)?(?(A)a|b)/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 -Named capturing subpatterns: +Named capture groups: A 1 Compile options: Overall options: anchored @@ -6040,9 +6040,9 @@ Subject length lower bound = 1 No match /(?:(?(ZZ)a|b)(?PX))+/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 -Named capturing subpatterns: +Named capture groups: ZZ 1 Last code unit = 'X' Subject length lower bound = 2 @@ -6057,9 +6057,9 @@ Failed: error 124 at offset 7: missing closing parenthesis for condition Failed: error 115 at offset 6: reference to non-existent subpattern /(?:(?(ZZ)a|b)(?(ZZ)a|b)(?PX))+/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 -Named capturing subpatterns: +Named capture groups: ZZ 1 Last code unit = 'X' Subject length lower bound = 3 @@ -6068,9 +6068,9 @@ Subject length lower bound = 3 1: X /(?:(?(ZZ)a|\(b\))\\(?PX))+/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 -Named capturing subpatterns: +Named capture groups: ZZ 1 Last code unit = 'X' Subject length lower bound = 3 @@ -6079,12 +6079,12 @@ Subject length lower bound = 3 1: X /(?PX|Y))+/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 -Named capturing subpatterns: +Named capture groups: A 1 Subject length lower bound = 2 bXXaYYaY @@ -6095,9 +6095,9 @@ Subject length lower bound = 2 1: X /()()()()()()()()()(?:(?(A)(?P=A)a|b)(?PX|Y))+/I -Capturing subpattern count = 10 +Capture group count = 10 Max back reference = 10 -Named capturing subpatterns: +Named capture groups: A 10 Subject length lower bound = 2 bXXaYYaY @@ -6114,7 +6114,7 @@ Subject length lower bound = 2 10: Y /\s*,\s*/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x09 \x0a \x0b \x0c \x0d \x20 , Last code unit = ',' Subject length lower bound = 1 @@ -6124,7 +6124,7 @@ Subject length lower bound = 1 0: \x0c,\x0d /^abc/Im,newline=lf -Capturing subpattern count = 0 +Capture group count = 0 Options: multiline Forced newline is LF First code unit at start or follows newline @@ -6147,7 +6147,7 @@ No match No match /^abc/Im,newline=crlf -Capturing subpattern count = 0 +Capture group count = 0 Options: multiline Forced newline is CRLF First code unit at start or follows newline @@ -6162,7 +6162,7 @@ No match No match /^abc/Im,newline=cr -Capturing subpattern count = 0 +Capture group count = 0 Options: multiline Forced newline is CR First code unit at start or follows newline @@ -6180,7 +6180,7 @@ No match ** Invalid value in 'newline=bad' /.*/I,newline=lf -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Forced newline is LF First code unit at start or follows newline @@ -6193,7 +6193,7 @@ Subject length lower bound = 0 0: abc\x0d /.*/I,newline=cr -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Forced newline is CR First code unit at start or follows newline @@ -6206,7 +6206,7 @@ Subject length lower bound = 0 0: abc /.*/I,newline=crlf -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Forced newline is CRLF First code unit at start or follows newline @@ -6219,7 +6219,7 @@ Subject length lower bound = 0 0: abc /\w+(.)(.)?def/Is -Capturing subpattern count = 2 +Capture group count = 2 Options: dotall Starting code units: 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 @@ -6237,8 +6237,8 @@ Subject length lower bound = 5 2: \x0a /(?P25[0-5]|2[0-4]\d|[01]?\d?\d)(?:\.(?P>B)){3}/I -Capturing subpattern count = 1 -Named capturing subpatterns: +Capture group count = 1 +Named capture groups: B 1 Starting code units: 0 1 2 3 4 5 6 7 8 9 Last code unit = '.' @@ -6250,7 +6250,7 @@ Subject length lower bound = 7 ()()()()()()()()()()()()()()()()()()()() ()()()()()()()()()()()()()()()()()()()() (.(.))/Ix -Capturing subpattern count = 102 +Capture group count = 102 Options: extended Subject length lower bound = 2 XY\=ovector=133 @@ -6359,42 +6359,42 @@ Subject length lower bound = 2 102: Y /(a*b|(?i:c*(?-i)d))/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: C a b c d Subject length lower bound = 1 /()[ab]xyz/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a b Last code unit = 'z' Subject length lower bound = 4 /(|)[ab]xyz/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a b Last code unit = 'z' Subject length lower bound = 4 /(|c)[ab]xyz/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a b c Last code unit = 'z' Subject length lower bound = 4 /(|c?)[ab]xyz/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a b c Last code unit = 'z' Subject length lower bound = 4 /(d?|c?)[ab]xyz/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a b c d Last code unit = 'z' Subject length lower bound = 4 /(d?|c)[ab]xyz/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a b c d Last code unit = 'z' Subject length lower bound = 4 @@ -6409,7 +6409,7 @@ Subject length lower bound = 4 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: a b @@ -6426,7 +6426,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: a b @@ -6443,7 +6443,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Starting code units: a b @@ -6460,7 +6460,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored First code unit = 'a' @@ -6482,7 +6482,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: caseless Overall options: anchored caseless Starting code units: A a @@ -6494,22 +6494,22 @@ Subject length lower bound = 2 0: aaaa5 /(a*|b*)[cd]/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a b c d Subject length lower bound = 1 /(a+|b*)[cd]/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a b c d Subject length lower bound = 1 /(a*|b+)[cd]/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a b c d Subject length lower bound = 1 /(a+|b+)[cd]/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a b Subject length lower bound = 2 @@ -6521,7 +6521,7 @@ Subject length lower bound = 2 )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ))) /Ix -Capturing subpattern count = 203 +Capture group count = 203 Options: extended First code unit = 'a' Subject length lower bound = 1 @@ -7138,8 +7138,8 @@ Matched, but too many substrings ------------------------------------------------------------------ /(?Px)(?Py)/I -Capturing subpattern count = 2 -Named capturing subpatterns: +Capture group count = 2 +Named capture groups: abc 1 xyz 2 First code unit = 'x' @@ -7153,8 +7153,8 @@ Subject length lower bound = 2 C y (1) xyz (group 2) /(?x)(?'xyz'y)/I -Capturing subpattern count = 2 -Named capturing subpatterns: +Capture group count = 2 +Named capture groups: abc 1 xyz 2 First code unit = 'x' @@ -7168,10 +7168,10 @@ Subject length lower bound = 2 C y (1) xyz (group 2) /(?x)(?'xyz>y)/I -Failed: error 142 at offset 15: syntax error in subpattern name (missing terminator) +Failed: error 142 at offset 15: syntax error in subpattern name (missing terminator?) /(?P'abc'x)(?Py)/I Failed: error 141 at offset 3: unrecognized character after (?P @@ -7364,9 +7364,9 @@ No match ------------------------------------------------------------------ /^\W*(?:(?(?.)\W*(?&one)\W*\k|)|(?(?.)\W*(?&three)\W*\k'four'|\W*.\W*))\W*$/Ii -Capturing subpattern count = 4 +Capture group count = 4 Max back reference = 4 -Named capturing subpatterns: +Named capture groups: four 4 one 1 three 3 @@ -7402,7 +7402,7 @@ Subject length lower bound = 0 No match /(?=(\w+))\1:/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Starting code units: 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 @@ -7413,9 +7413,9 @@ Subject length lower bound = 2 1: abcd /(?=(?'abc'\w+))\k:/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 -Named capturing subpatterns: +Named capture groups: abc 1 Starting code units: 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 @@ -7450,7 +7450,7 @@ No match No match /(?(P)/I -Capturing subpattern count = 1 -Named capturing subpatterns: +Capture group count = 1 +Named capture groups: abc 1 Last code unit = 'P' Subject length lower bound = 3 @@ -7631,8 +7631,8 @@ Subject length lower bound = 3 1: P /(?1)X(?P)/I -Capturing subpattern count = 1 -Named capturing subpatterns: +Capture group count = 1 +Named capture groups: abc 1 Last code unit = 'P' Subject length lower bound = 3 @@ -7933,7 +7933,7 @@ Failed: error 115 at offset 6: reference to non-existent subpattern No match /\g{A/ -Failed: error 142 at offset 4: syntax error in subpattern name (missing terminator) +Failed: error 142 at offset 4: syntax error in subpattern name (missing terminator?) /(?|(abc)|(xyz))/B ------------------------------------------------------------------ @@ -8390,10 +8390,10 @@ No match Failed: error 166 at offset 7: (*MARK) must have an argument /(?i:A{1,}\6666666666)/ -Failed: error 161 at offset 19: group number is too big +Failed: error 161 at offset 19: subpattern number is too big /\g6666666666/ -Failed: error 161 at offset 7: group number is too big +Failed: error 161 at offset 7: subpattern number is too big /[\g6666666666]/B ------------------------------------------------------------------ @@ -8524,7 +8524,7 @@ No match No match /a\Rb/I,bsr=anycrlf -Capturing subpattern count = 0 +Capture group count = 0 \R matches CR, LF, or CRLF First code unit = 'a' Last code unit = 'b' @@ -8542,7 +8542,7 @@ No match No match /a\Rb/I,bsr=unicode -Capturing subpattern count = 0 +Capture group count = 0 \R matches any Unicode newline First code unit = 'a' Last code unit = 'b' @@ -8559,7 +8559,7 @@ Subject length lower bound = 3 0: a\x0bb /a\R?b/I,bsr=anycrlf -Capturing subpattern count = 0 +Capture group count = 0 \R matches CR, LF, or CRLF First code unit = 'a' Last code unit = 'b' @@ -8577,7 +8577,7 @@ No match No match /a\R?b/I,bsr=unicode -Capturing subpattern count = 0 +Capture group count = 0 \R matches any Unicode newline First code unit = 'a' Last code unit = 'b' @@ -8594,7 +8594,7 @@ Subject length lower bound = 2 0: a\x0bb /a\R{2,4}b/I,bsr=anycrlf -Capturing subpattern count = 0 +Capture group count = 0 \R matches CR, LF, or CRLF First code unit = 'a' Last code unit = 'b' @@ -8612,7 +8612,7 @@ No match No match /a\R{2,4}b/I,bsr=unicode -Capturing subpattern count = 0 +Capture group count = 0 \R matches any Unicode newline First code unit = 'a' Last code unit = 'b' @@ -8632,7 +8632,7 @@ Subject length lower bound = 4 No match /(*BSR_ANYCRLF)a\Rb/I -Capturing subpattern count = 0 +Capture group count = 0 \R matches CR, LF, or CRLF First code unit = 'a' Last code unit = 'b' @@ -8643,7 +8643,7 @@ Subject length lower bound = 3 0: a\x0db /(*BSR_UNICODE)a\Rb/I -Capturing subpattern count = 0 +Capture group count = 0 \R matches any Unicode newline First code unit = 'a' Last code unit = 'b' @@ -8652,7 +8652,7 @@ Subject length lower bound = 3 0: a\x85b /(*BSR_ANYCRLF)(*CRLF)a\Rb/I -Capturing subpattern count = 0 +Capture group count = 0 \R matches CR, LF, or CRLF Forced newline is CRLF First code unit = 'a' @@ -8664,7 +8664,7 @@ Subject length lower bound = 3 0: a\x0db /(*CRLF)(*BSR_UNICODE)a\Rb/I -Capturing subpattern count = 0 +Capture group count = 0 \R matches any Unicode newline Forced newline is CRLF First code unit = 'a' @@ -8674,7 +8674,7 @@ Subject length lower bound = 3 0: a\x85b /(*CRLF)(*BSR_ANYCRLF)(*CR)ab/I -Capturing subpattern count = 0 +Capture group count = 0 \R matches CR, LF, or CRLF Forced newline is CR First code unit = 'a' @@ -8893,12 +8893,12 @@ No match Failed: error 109 at offset 8: quantifier does not follow a repeatable item /(abc|pqr|123){0}[xyz]/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: x y z Subject length lower bound = 1 /(?(?=.*b)b|^)/I,auto_callout -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Options: auto_callout Subject length lower bound = 0 @@ -8938,11 +8938,11 @@ Subject length lower bound = 0 0: b /(?(?=b).*b|^d)/I -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 /(?(?=.*b).*b|^d)/I -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 /xyz/auto_callout @@ -9680,48 +9680,48 @@ Failed: error 115 at offset 8: reference to non-existent subpattern Failed: error 125 at offset 0: lookbehind assertion is not fixed length /(a|bc)\1/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Starting code units: a b Subject length lower bound = 2 /(a|bc)\1{2,3}/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Starting code units: a b Subject length lower bound = 3 /(a|bc)(?1)/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a b Subject length lower bound = 2 /(a|b\1)(a|b\1)/I -Capturing subpattern count = 2 +Capture group count = 2 Max back reference = 1 Starting code units: a b Subject length lower bound = 2 /(a|b\1){2}/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Starting code units: a b Subject length lower bound = 2 /(a|bbbb\1)(a|bbbb\1)/I -Capturing subpattern count = 2 +Capture group count = 2 Max back reference = 1 Starting code units: a b Subject length lower bound = 2 /(a|bbbb\1){2}/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Starting code units: a b Subject length lower bound = 2 /^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]/I -Capturing subpattern count = 1 +Capture group count = 1 Compile options: Overall options: anchored First code unit = 'F' @@ -9729,31 +9729,31 @@ Last code unit = ':' Subject length lower bound = 22 /]{0,})>]{0,})>([\d]{0,}\.)(.*)((
    ([\w\W\s\d][^<>]{0,})|[\s]{0,}))<\/a><\/TD>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><\/TR>/Iis -Capturing subpattern count = 11 +Capture group count = 11 Options: caseless dotall First code unit = '<' Last code unit = '>' Subject length lower bound = 47 "(?>.*/)foo"I -Capturing subpattern count = 0 +Capture group count = 0 Last code unit = 'o' Subject length lower bound = 4 /(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /Ix -Capturing subpattern count = 0 +Capture group count = 0 Options: extended Last code unit = '-' Subject length lower bound = 8 /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/Ii -Capturing subpattern count = 1 +Capture group count = 1 Options: caseless Starting code units: A B C a b c Subject length lower bound = 1 /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: c d Last code unit = 'b' Subject length lower bound = 41 @@ -9763,7 +9763,7 @@ Subject length lower bound = 41 (?(1) (.*?)\1 | ([^\s]+)) # if quote found, match up to next matching # quote, otherwise match up to next space /Iisx -Capturing subpattern count = 3 +Capture group count = 3 Max back reference = 1 Options: caseless dotall extended First code unit = '<' @@ -9779,7 +9779,7 @@ Subject length lower bound = 9 [0-9a-f]{1,4} $ # final hex number at end of string (?(1)|.) # check that there was an empty component /Iix -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Compile options: caseless extended Overall options: anchored caseless extended @@ -9787,8 +9787,8 @@ Last code unit = ':' Subject length lower bound = 2 /(?|(?
    A)|(?B))/I -Capturing subpattern count = 1 -Named capturing subpatterns: +Capture group count = 1 +Named capture groups: a 1 Starting code units: A B Subject length lower bound = 1 @@ -9807,9 +9807,9 @@ Failed: error 165 at offset 16: different names for subpatterns of the same numb /(?:a(? (?')|(?")) | b(? (?')|(?")) ) (?('quote')[a-z]+|[0-9]+)/Ix,dupnames -Capturing subpattern count = 6 +Capture group count = 6 Max back reference = 4 -Named capturing subpatterns: +Named capture groups: apostrophe 2 apostrophe 5 quote 1 @@ -9869,9 +9869,9 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 4 +Capture group count = 4 Max back reference = 4 -Named capturing subpatterns: +Named capture groups: D 4 D 1 Compile options: dupnames extended @@ -9917,9 +9917,9 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 4 +Capture group count = 4 Max back reference = 4 -Named capturing subpatterns: +Named capture groups: A 1 A 4 Options: dupnames extended @@ -9979,7 +9979,7 @@ Partial match: abcde 3: a /(\3)(\1)(a)/I,alt_bsux,allow_empty_class,match_unset_backref,dupnames -Capturing subpattern count = 3 +Capture group count = 3 Max back reference = 3 Options: alt_bsux allow_empty_class dupnames match_unset_backref Last code unit = 'a' @@ -9991,7 +9991,7 @@ Subject length lower bound = 1 3: a /(\3)(\1)(a)/I -Capturing subpattern count = 3 +Capture group count = 3 Max back reference = 3 Last code unit = 'a' Subject length lower bound = 3 @@ -10000,8 +10000,8 @@ Subject length lower bound = 3 No match /i(?(DEFINE)(?a))/I -Capturing subpattern count = 1 -Named capturing subpatterns: +Capture group count = 1 +Named capture groups: s 1 First code unit = 'i' Subject length lower bound = 1 @@ -10009,7 +10009,7 @@ Subject length lower bound = 1 0: i /()i(?(1)a)/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 First code unit = 'i' Subject length lower bound = 1 @@ -10507,7 +10507,7 @@ Failed: error 168 at offset 3: \c must be followed by a printable ASCII characte ------------------------------------------------------------------ /(?P(?P=abn)(?(?P=axn)xxx)/B Failed: error 115 at offset 12: reference to non-existent subpattern @@ -10619,13 +10619,13 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Last code unit = '4' Subject length lower bound = 5 /([abc])++1234/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a b c Last code unit = '4' Subject length lower bound = 5 @@ -10634,149 +10634,149 @@ Subject length lower bound = 5 Failed: error 125 at offset 0: lookbehind assertion is not fixed length /(^ab)/I -Capturing subpattern count = 1 +Capture group count = 1 Compile options: Overall options: anchored First code unit = 'a' Subject length lower bound = 2 /(^ab)++/I -Capturing subpattern count = 1 +Capture group count = 1 Compile options: Overall options: anchored First code unit = 'a' Subject length lower bound = 2 /(^ab|^)+/I -Capturing subpattern count = 1 +Capture group count = 1 May match empty string Compile options: Overall options: anchored Subject length lower bound = 0 /(^ab|^)++/I -Capturing subpattern count = 1 +Capture group count = 1 May match empty string Compile options: Overall options: anchored Subject length lower bound = 0 /(?:^ab)/I -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored First code unit = 'a' Subject length lower bound = 2 /(?:^ab)++/I -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored First code unit = 'a' Subject length lower bound = 2 /(?:^ab|^)+/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Compile options: Overall options: anchored Subject length lower bound = 0 /(?:^ab|^)++/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Compile options: Overall options: anchored Subject length lower bound = 0 /(.*ab)/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit at start or follows newline Last code unit = 'b' Subject length lower bound = 2 /(.*ab)++/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit at start or follows newline Last code unit = 'b' Subject length lower bound = 2 /(.*ab|.*)+/I -Capturing subpattern count = 1 +Capture group count = 1 May match empty string First code unit at start or follows newline Subject length lower bound = 0 /(.*ab|.*)++/I -Capturing subpattern count = 1 +Capture group count = 1 May match empty string First code unit at start or follows newline Subject length lower bound = 0 /(?:.*ab)/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit at start or follows newline Last code unit = 'b' Subject length lower bound = 2 /(?:.*ab)++/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit at start or follows newline Last code unit = 'b' Subject length lower bound = 2 /(?:.*ab|.*)+/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string First code unit at start or follows newline Subject length lower bound = 0 /(?:.*ab|.*)++/I -Capturing subpattern count = 0 +Capture group count = 0 May match empty string First code unit at start or follows newline Subject length lower bound = 0 /(?=a)[bcd]/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Subject length lower bound = 1 /((?=a))[bcd]/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Subject length lower bound = 1 /((?=a))+[bcd]/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Subject length lower bound = 1 /((?=a))++[bcd]/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Subject length lower bound = 1 /(?=a+)[bcd]/Ii -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless First code unit = 'a' (caseless) Subject length lower bound = 1 /(?=a+?)[bcd]/Ii -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless First code unit = 'a' (caseless) Subject length lower bound = 1 /(?=a++)[bcd]/Ii -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless First code unit = 'a' (caseless) Subject length lower bound = 1 /(?=a{3})[bcd]/Ii -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless First code unit = 'a' (caseless) Last code unit = 'a' (caseless) @@ -10922,22 +10922,22 @@ Matched, but too many substrings 3: b /(?(DEFINE)(a(?2)|b)(b(?1)|a))(?:(?1)|(?2))/I -Capturing subpattern count = 2 +Capture group count = 2 May match empty string Subject length lower bound = 0 /(a(?2)|b)(b(?1)|a)(?:(?1)|(?2))/I -Capturing subpattern count = 2 +Capture group count = 2 Starting code units: a b Subject length lower bound = 3 /(a(?2)|b)(b(?1)|a)(?1)(?2)/I -Capturing subpattern count = 2 +Capture group count = 2 Starting code units: a b Subject length lower bound = 4 /(abc)(?1)/I -Capturing subpattern count = 1 +Capture group count = 1 First code unit = 'a' Last code unit = 'c' Subject length lower bound = 6 @@ -11206,20 +11206,20 @@ Latest Mark: B No match /\btype\b\W*?\btext\b\W*?\bjavascript\b/I -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 1 First code unit = 't' Last code unit = 't' Subject length lower bound = 18 /\btype\b\W*?\btext\b\W*?\bjavascript\b|\burl\b\W*?\bshell:|.*?a)(?<=ba)/I -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 2 Last code unit = 'a' Subject length lower bound = 1 /(?:.*?a)(?<=ba)/I -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 2 First code unit at start or follows newline Last code unit = 'a' Subject length lower bound = 1 /.*?a(*PRUNE)b/I -Capturing subpattern count = 0 +Capture group count = 0 Last code unit = 'b' Subject length lower bound = 2 /.*?a(*PRUNE)b/Is -Capturing subpattern count = 0 +Capture group count = 0 Options: dotall Last code unit = 'b' Subject length lower bound = 2 /^a(*PRUNE)b/Is -Capturing subpattern count = 0 +Capture group count = 0 Compile options: dotall Overall options: anchored dotall First code unit = 'a' Subject length lower bound = 2 /.*?a(*SKIP)b/I -Capturing subpattern count = 0 +Capture group count = 0 Last code unit = 'b' Subject length lower bound = 2 /(?>.*?a)b/Is -Capturing subpattern count = 0 +Capture group count = 0 Options: dotall Last code unit = 'b' Subject length lower bound = 2 /(?>.*?a)b/I -Capturing subpattern count = 0 +Capture group count = 0 Last code unit = 'b' Subject length lower bound = 2 /(?>^a)b/Is -Capturing subpattern count = 0 +Capture group count = 0 Compile options: dotall Overall options: anchored dotall First code unit = 'a' Subject length lower bound = 2 /(?>.*?)(?<=(abcd)|(wxyz))/I -Capturing subpattern count = 2 +Capture group count = 2 Max lookbehind = 4 May match empty string Subject length lower bound = 0 /(?>.*)(?<=(abcd)|(wxyz))/I -Capturing subpattern count = 2 +Capture group count = 2 Max lookbehind = 4 May match empty string Subject length lower bound = 0 "(?>.*)foo"I -Capturing subpattern count = 0 +Capture group count = 0 Last code unit = 'o' Subject length lower bound = 3 "(?>.*?)foo"I -Capturing subpattern count = 0 +Capture group count = 0 Last code unit = 'o' Subject length lower bound = 3 /(?>^abc)/Im -Capturing subpattern count = 0 +Capture group count = 0 Options: multiline First code unit at start or follows newline Last code unit = 'c' Subject length lower bound = 3 /(?>.*abc)/Im -Capturing subpattern count = 0 +Capture group count = 0 Options: multiline Last code unit = 'c' Subject length lower bound = 3 /(?:.*abc)/Im -Capturing subpattern count = 0 +Capture group count = 0 Options: multiline First code unit at start or follows newline Last code unit = 'c' @@ -12057,8 +12057,8 @@ No match 0: ba /(?|(?f)|(?b))/I,dupnames -Capturing subpattern count = 1 -Named capturing subpatterns: +Capture group count = 1 +Named capture groups: n 1 Options: dupnames Starting code units: b f @@ -12079,9 +12079,9 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 3 +Capture group count = 3 Max back reference = 2 -Named capturing subpatterns: +Named capture groups: a 1 a 2 Options: dupnames @@ -13124,7 +13124,7 @@ Subject length lower bound = 5 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: a b c d Last code unit = 'd' Subject length lower bound = 1 @@ -13137,7 +13137,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: a b c Last code unit = 'd' Subject length lower bound = 2 @@ -13150,7 +13150,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: a b c d Last code unit = 'd' Subject length lower bound = 1 @@ -13163,7 +13163,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: a b c Last code unit = 'd' Subject length lower bound = 5 @@ -13176,7 +13176,7 @@ Subject length lower bound = 5 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: a b c d Last code unit = 'd' Subject length lower bound = 1 @@ -13254,40 +13254,40 @@ Failed: error 108 at offset 3: range out of order in character class Failed: error 150 at offset 5: invalid range in character class /(?<0abc>xx)/ -Failed: error 144 at offset 3: group name must start with a non-digit +Failed: error 144 at offset 3: subpattern name must start with a non-digit /(?&1abc)xx(?<1abc>y)/ -Failed: error 144 at offset 3: group name must start with a non-digit +Failed: error 144 at offset 3: subpattern name must start with a non-digit /(?xx)/ -Failed: error 142 at offset 5: syntax error in subpattern name (missing terminator) +Failed: error 142 at offset 5: syntax error in subpattern name (missing terminator?) /(?'0abc'xx)/ -Failed: error 144 at offset 3: group name must start with a non-digit +Failed: error 144 at offset 3: subpattern name must start with a non-digit /(?P<0abc>xx)/ -Failed: error 144 at offset 4: group name must start with a non-digit +Failed: error 144 at offset 4: subpattern name must start with a non-digit /\k<5ghj>/ -Failed: error 144 at offset 3: group name must start with a non-digit +Failed: error 144 at offset 3: subpattern name must start with a non-digit /\k'5ghj'/ -Failed: error 144 at offset 3: group name must start with a non-digit +Failed: error 144 at offset 3: subpattern name must start with a non-digit /\k{2fgh}/ -Failed: error 144 at offset 3: group name must start with a non-digit +Failed: error 144 at offset 3: subpattern name must start with a non-digit /(?P=8yuki)/ -Failed: error 144 at offset 4: group name must start with a non-digit +Failed: error 144 at offset 4: subpattern name must start with a non-digit /\g{4df}/ Failed: error 157 at offset 2: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number /(?&1abc)xx(?<1abc>y)/ -Failed: error 144 at offset 3: group name must start with a non-digit +Failed: error 144 at offset 3: subpattern name must start with a non-digit /(?P>1abc)xx(?<1abc>y)/ -Failed: error 144 at offset 4: group name must start with a non-digit +Failed: error 144 at offset 4: subpattern name must start with a non-digit /\g'3gh'/ Failed: error 157 at offset 2: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number @@ -13296,16 +13296,16 @@ Failed: error 157 at offset 2: \g is not followed by a braced, angle-bracketed, Failed: error 157 at offset 2: \g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number /(?(<4gh>)abc)/ -Failed: error 144 at offset 4: group name must start with a non-digit +Failed: error 144 at offset 4: subpattern name must start with a non-digit /(?('4gh')abc)/ -Failed: error 144 at offset 4: group name must start with a non-digit +Failed: error 144 at offset 4: subpattern name must start with a non-digit /(?(4gh)abc)/ Failed: error 124 at offset 4: missing closing parenthesis for condition /(?(R&6yh)abc)/ -Failed: error 144 at offset 5: group name must start with a non-digit +Failed: error 144 at offset 5: subpattern name must start with a non-digit /(((a\2)|(a*)\g<-1>))*a?/B ------------------------------------------------------------------ @@ -13487,7 +13487,7 @@ No match 0+ dab /(?(VERSION>=10.0)yes|no)/I -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 2 yesno 0: yes @@ -13506,7 +13506,7 @@ Subject length lower bound = 2 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Subject length lower bound = 0 yesno @@ -13514,7 +13514,7 @@ Subject length lower bound = 0 0+ yesno /(?(VERSION=8)yes|no){3}/I -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 6 yesnononoyes 0: nonono @@ -13523,9 +13523,9 @@ Subject length lower bound = 6 No match /(?:(?abc)|xyz)(?(VERSION)yes|no)/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 -Named capturing subpatterns: +Named capture groups: VERSION 1 Starting code units: a x Subject length lower bound = 5 @@ -13553,18 +13553,18 @@ Failed: error 179 at offset 16: syntax error or number too big in (?(VERSION con Failed: error 179 at offset 16: syntax error or number too big in (?(VERSION condition /abcd/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'a' Last code unit = 'd' Subject length lower bound = 4 /abcd/I,no_start_optimize -Capturing subpattern count = 0 +Capture group count = 0 Options: no_start_optimize Subject length lower bound = 0 /(|ab)*?d/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a d Last code unit = 'd' Subject length lower bound = 1 @@ -13575,7 +13575,7 @@ Subject length lower bound = 1 0: d /(|ab)*?d/I,no_start_optimize -Capturing subpattern count = 1 +Capture group count = 1 Options: no_start_optimize Subject length lower bound = 0 abd @@ -13839,21 +13839,21 @@ Copy substring 1 failed (-2): partial match get substring list failed (-2): partial match /^abc/info -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored First code unit = 'a' Subject length lower bound = 3 /^abc/info,no_dotstar_anchor -Capturing subpattern count = 0 +Capture group count = 0 Compile options: no_dotstar_anchor Overall options: anchored no_dotstar_anchor First code unit = 'a' Subject length lower bound = 3 /.*\d/info,auto_callout -Capturing subpattern count = 0 +Capture group count = 0 Options: auto_callout First code unit at start or follows newline Subject length lower bound = 1 @@ -13868,7 +13868,7 @@ Subject length lower bound = 1 No match /.*\d/info,no_dotstar_anchor,auto_callout -Capturing subpattern count = 0 +Capture group count = 0 Options: auto_callout no_dotstar_anchor Subject length lower bound = 1 \= Expect no match @@ -13889,18 +13889,18 @@ Subject length lower bound = 1 No match /.*\d/dotall,info -Capturing subpattern count = 0 +Capture group count = 0 Compile options: dotall Overall options: anchored dotall Subject length lower bound = 1 /.*\d/dotall,no_dotstar_anchor,info -Capturing subpattern count = 0 +Capture group count = 0 Options: dotall no_dotstar_anchor Subject length lower bound = 1 /(*NO_DOTSTAR_ANCHOR)(?s).*\d/info -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: no_dotstar_anchor Subject length lower bound = 1 @@ -14323,7 +14323,7 @@ Failed: error 125 at offset 1: lookbehind assertion is not fixed length 0+ /((?2){73}(?2))((?1))/info -Capturing subpattern count = 2 +Capture group count = 2 May match empty string Subject length lower bound = 0 @@ -14383,8 +14383,8 @@ Failed: error 115 at offset 2: reference to non-existent subpattern /(?x:((?'a')) # comment (with parentheses) and | vertical (?-x:#not a comment (?'b')) # this is a comment () (?'c')) # not a comment (?'d')/info -Capturing subpattern count = 5 -Named capturing subpatterns: +Capture group count = 5 +Named capture groups: a 2 b 3 c 4 @@ -14394,8 +14394,8 @@ Last code unit = ' ' Subject length lower bound = 32 /(?|(?'a')(2)(?'b')|(?'a')(?'a')(3))/I,dupnames -Capturing subpattern count = 3 -Named capturing subpatterns: +Capture group count = 3 +Named capture groups: a 1 a 2 b 3 @@ -14482,7 +14482,7 @@ Failed: error 162 at offset 4: subpattern name expected "(?J:(?|(?'R')(\k'R')|((?'R'))))" /(?<=|(\,\$(?73591620449005828816)\xa8.{7}){6}\x09)/ -Failed: error 161 at offset 17: group number is too big +Failed: error 161 at offset 17: subpattern number is too big /^(?:(?(1)x|)+)+$()/B ------------------------------------------------------------------ @@ -14533,8 +14533,8 @@ Failed: error 162 at offset 10: subpattern name expected Failed: error 162 at offset 14: subpattern name expected /((?x)(?#))#(?'abc')/I -Capturing subpattern count = 2 -Named capturing subpatterns: +Capture group count = 2 +Named capture groups: abc 2 First code unit = '#' Subject length lower bound = 1 @@ -14543,8 +14543,8 @@ Subject length lower bound = 1 Failed: error 162 at offset 9: subpattern name expected /[[:\\](?'abc')[a:]/I -Capturing subpattern count = 1 -Named capturing subpatterns: +Capture group count = 1 +Named capture groups: abc 1 Starting code units: : [ \ Subject length lower bound = 2 @@ -14578,16 +14578,16 @@ Failed: error 158 at offset 3: (?R (recursive pattern call) must be followed by Failed: error 162 at offset 16: subpattern name expected /(?(?C{\Q})(?!(?'abc')))/I -Capturing subpattern count = 1 -Named capturing subpatterns: +Capture group count = 1 +Named capture groups: abc 1 May match empty string Subject length lower bound = 0 /(?1){3918}(((((0(\k'R'))))(?J)(?'R'(?'R'\3){99})))/I -Capturing subpattern count = 8 +Capture group count = 8 Max back reference = 8 -Named capturing subpatterns: +Named capture groups: R 7 R 8 Duplicate name status changes @@ -14595,33 +14595,33 @@ Last code unit = '0' Subject length lower bound = 65535 /(?|(aaa)|(b))\g{1}/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Starting code units: a b Subject length lower bound = 0 /(?|(aaa)|(b))(?1)/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a b Subject length lower bound = 4 /(?|(aaa)|(b))/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a b Subject length lower bound = 1 /(?|(?'a'aaa)|(?'a'b))\k'a'/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 -Named capturing subpatterns: +Named capture groups: a 1 Starting code units: a b Subject length lower bound = 0 /(?|(?'a'aaa)|(?'a'b))(?'a'cccc)\k'a'/I,dupnames -Capturing subpattern count = 2 +Capture group count = 2 Max back reference = 2 -Named capturing subpatterns: +Named capture groups: a 1 a 2 Options: dupnames @@ -14673,10 +14673,10 @@ No match 0: ab /(?(8000000000/ -Failed: error 161 at offset 8: group number is too big +Failed: error 161 at offset 8: subpattern number is too big /((?(R8000000000)))/ -Failed: error 161 at offset 9: group number is too big +Failed: error 161 at offset 9: subpattern number is too big /0(?0)|(1)(*THEN)(*SKIP:0)(*FAIL)/ \= Expect no match @@ -14684,7 +14684,7 @@ Failed: error 161 at offset 9: group number is too big No match /(?(1)()\983040\2)/ -Failed: error 161 at offset 14: group number is too big +Failed: error 161 at offset 14: subpattern number is too big /(*LIMIT_MATCH=)abc/ Failed: error 160 at offset 14: (*VERB) not recognized or malformed @@ -14883,7 +14883,7 @@ Failed: error -55 at offset 3 in replacement: requested value is not set 1: AAbbaa..AAbBaa /^(o(\1{72}{\"{\\{00000059079}\d*){74}}){19}/I -Capturing subpattern count = 2 +Capture group count = 2 Max back reference = 1 Compile options: Overall options: anchored @@ -14892,10 +14892,10 @@ Last code unit = '}' Subject length lower bound = 65535 /((p(?'K/ -Failed: error 142 at offset 7: syntax error in subpattern name (missing terminator) +Failed: error 142 at offset 7: syntax error in subpattern name (missing terminator?) /((p(?'K/no_auto_capture -Failed: error 142 at offset 7: syntax error in subpattern name (missing terminator) +Failed: error 142 at offset 7: syntax error in subpattern name (missing terminator?) /abc/replace=A$3123456789Z abc @@ -14905,7 +14905,7 @@ Failed: error -49 at offset 3 in replacement: unknown substring Failed: error 187 at offset 0: lookbehind assertion is too long /(?a)(?b)\g{b}\g{a}\g{a}\g{a}\g{a}(?xx)(?zz)/I,dupnames -Capturing subpattern count = 4 +Capture group count = 4 Max back reference = 4 -Named capturing subpatterns: +Named capture groups: a 1 a 3 b 2 @@ -15816,14 +15816,14 @@ No match # the start of a branch. /(?(DEFINE)(a))^bc/I -Capturing subpattern count = 1 +Capture group count = 1 Compile options: Overall options: anchored First code unit = 'b' Subject length lower bound = 2 /(a){0}.*bc/sI -Capturing subpattern count = 1 +Capture group count = 1 Compile options: dotall Overall options: anchored dotall Last code unit = 'c' @@ -15833,7 +15833,7 @@ Subject length lower bound = 2 # no alternative branch. /(?(VERSION>=999)yes)^bc/I -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored Subject length lower bound = 2 @@ -15841,12 +15841,12 @@ Subject length lower bound = 2 # This should not be anchored. /(?(VERSION>=999)yes|no)^bc/I -Capturing subpattern count = 0 +Capture group count = 0 Last code unit = 'c' Subject length lower bound = 4 /(*LIMIT_HEAP=0)xxx/I -Capturing subpattern count = 0 +Capture group count = 0 Heap limit = 0 First code unit = 'x' Last code unit = 'x' @@ -16122,7 +16122,7 @@ Failed: error -37: callout error code Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: extended_more Starting code units: a b c Subject length lower bound = 1 @@ -16134,7 +16134,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: extended extended_more Starting code units: a b c Subject length lower bound = 1 @@ -16218,7 +16218,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Extra options: bad_escape_is_literal First code unit = 'N' Last code unit = 'c' @@ -16324,7 +16324,7 @@ Failed: error 192 at offset 0: invalid option bits with PCRE2_LITERAL 0: (*CR)abc /cat|dog/I,match_word -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 1 Extra options: match_word Starting code units: c d @@ -16340,7 +16340,7 @@ No match No match /(cat)|dog/I,match_line,literal -Capturing subpattern count = 0 +Capture group count = 0 Compile options: literal Overall options: anchored literal Extra options: match_line @@ -16408,7 +16408,7 @@ Failed: error 150 at offset 3: invalid range in character class # Perl gets the second of these wrong, giving no match. "(?<=(a))\1?b"I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Max lookbehind = 1 Last code unit = 'b' @@ -16421,7 +16421,7 @@ Subject length lower bound = 1 1: a "(?=(a))\1?b"I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 First code unit = 'a' Last code unit = 'b' @@ -16650,21 +16650,21 @@ Failed: error 194 at offset 3: invalid hyphen in option setting Failed: error 194 at offset 5: invalid hyphen in option setting /(?(?=^))b/I -Capturing subpattern count = 0 +Capture group count = 0 Last code unit = 'b' Subject length lower bound = 1 abc 0: b /(?(?=^)|)b/I -Capturing subpattern count = 0 +Capture group count = 0 First code unit = 'b' Subject length lower bound = 1 abc 0: b /(?(?=^)|^)b/I -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored First code unit = 'b' @@ -16676,7 +16676,7 @@ Subject length lower bound = 1 No match /(?(1)^|^())/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Compile options: @@ -16684,13 +16684,13 @@ Overall options: anchored Subject length lower bound = 0 /(?(1)^())b/I -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Last code unit = 'b' Subject length lower bound = 1 /(?(1)^())+b/I,aftertext -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Last code unit = 'b' Subject length lower bound = 1 @@ -16699,7 +16699,7 @@ Subject length lower bound = 1 0+ c /(?(1)^()|^)+b/I,aftertext -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Compile options: Overall options: anchored @@ -16713,7 +16713,7 @@ Subject length lower bound = 1 No match /(?(1)^()|^)*b/I,aftertext -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 First code unit = 'b' Subject length lower bound = 1 @@ -16728,7 +16728,7 @@ Subject length lower bound = 1 0+ c /(?(1)^())+b/I,aftertext -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Last code unit = 'b' Subject length lower bound = 1 @@ -16737,7 +16737,7 @@ Subject length lower bound = 1 0+ c /(?(1)^a()|^a)+b/I,aftertext -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Compile options: Overall options: anchored @@ -16752,7 +16752,7 @@ Subject length lower bound = 2 No match /(?(1)^|^(a))+b/I,aftertext -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Compile options: Overall options: anchored @@ -16767,7 +16767,7 @@ Subject length lower bound = 1 No match /(?(1)^a()|^a)*b/I,aftertext -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 Last code unit = 'b' Subject length lower bound = 1 @@ -16894,21 +16894,21 @@ Failed: error 128 at offset 14: assertion expected after (?( or (?(?C) 0: foobar /(*:XX)^abc/I -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored First code unit = 'a' Subject length lower bound = 3 /(*COMMIT:XX)^abc/I -Capturing subpattern count = 0 +Capture group count = 0 Compile options: Overall options: anchored First code unit = 'a' Subject length lower bound = 3 /(*ACCEPT:XX)^abc/I -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 0 # End of testinput2 diff --git a/testdata/testoutput20 b/testdata/testoutput20 index d6265fd..5ce720f 100644 --- a/testdata/testoutput20 +++ b/testdata/testoutput20 @@ -32,9 +32,9 @@ #load testsaved2 #pop info -Capturing subpattern count = 2 +Capture group count = 2 Max back reference = 2 -Named capturing subpatterns: +Named capture groups: n 1 n 2 Options: dupnames @@ -66,8 +66,8 @@ No match, mark = A 4: A #pop info -Capturing subpattern count = 4 -Named capturing subpatterns: +Capture group count = 4 +Named capture groups: ADDR 2 ADDRESS_PAT 4 NAME 1 diff --git a/testdata/testoutput21 b/testdata/testoutput21 index cba1326..fbd7400 100644 --- a/testdata/testoutput21 +++ b/testdata/testoutput21 @@ -79,7 +79,7 @@ Failed: error 183 at offset 4: using \C is disabled by the application /ab\Cde/info -Capturing subpattern count = 0 +Capture group count = 0 Contains \C First code unit = 'a' Last code unit = 'e' diff --git a/testdata/testoutput22-16 b/testdata/testoutput22-16 index df29e14..4b6008c 100644 --- a/testdata/testoutput22-16 +++ b/testdata/testoutput22-16 @@ -4,7 +4,7 @@ # in some widths and not in others. /ab\Cde/utf,info -Capturing subpattern count = 0 +Capture group count = 0 Contains \C Options: utf First code unit = 'a' diff --git a/testdata/testoutput22-32 b/testdata/testoutput22-32 index f0b7984..e96696a 100644 --- a/testdata/testoutput22-32 +++ b/testdata/testoutput22-32 @@ -4,7 +4,7 @@ # in some widths and not in others. /ab\Cde/utf,info -Capturing subpattern count = 0 +Capture group count = 0 Contains \C Options: utf First code unit = 'a' diff --git a/testdata/testoutput22-8 b/testdata/testoutput22-8 index 0a04aa8..5dd167e 100644 --- a/testdata/testoutput22-8 +++ b/testdata/testoutput22-8 @@ -4,7 +4,7 @@ # in some widths and not in others. /ab\Cde/utf,info -Capturing subpattern count = 0 +Capture group count = 0 Contains \C Options: utf First code unit = 'a' diff --git a/testdata/testoutput3 b/testdata/testoutput3 index d9e8c5c..801966a 100644 --- a/testdata/testoutput3 +++ b/testdata/testoutput3 @@ -78,13 +78,13 @@ No match 0: cole /\w/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: 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 Subject length lower bound = 1 /\w/I,locale=fr_FR -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: 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 @@ -153,7 +153,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: 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 diff --git a/testdata/testoutput3A b/testdata/testoutput3A index 9b00be8..d7a223a 100644 --- a/testdata/testoutput3A +++ b/testdata/testoutput3A @@ -78,13 +78,13 @@ No match 0: cole /\w/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: 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 Subject length lower bound = 1 /\w/I,locale=fr_FR -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: 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 @@ -153,7 +153,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: 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 diff --git a/testdata/testoutput3B b/testdata/testoutput3B index b30fc5f..b18d441 100644 --- a/testdata/testoutput3B +++ b/testdata/testoutput3B @@ -78,13 +78,13 @@ No match 0: cole /\w/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: 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 Subject length lower bound = 1 /\w/I,locale=fr_FR -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: 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 @@ -153,7 +153,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: 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 diff --git a/testdata/testoutput4 b/testdata/testoutput4 index 1199885..84b8b9e 100644 --- a/testdata/testoutput4 +++ b/testdata/testoutput4 @@ -3975,4 +3975,41 @@ No match # ------- +# Test group names containing non-ASCII letters and digits + +/(?'ABáC'...)\g{ABáC}/utf + abcabcdefg + 0: abcabc + 1: abc + +/(?'XʰABC'...)/utf + xyzpq + 0: xyz + 1: xyz + +/(?'XאABC'...)/utf + 12345 + 0: 123 + 1: 123 + +/(?'XᾈABC'...)/utf + %^&*(... + 0: %^& + 1: %^& + +/(?'𐨐ABC'...)/utf + abcde + 0: abc + 1: abc + +/^(?'אABC'...)(?&אABC)(?P=אABC)/utf + 123123123456 + 0: 123123123 + 1: 123 + +/^(?'אABC'...)(?&אABC)/utf + 123123123456 + 0: 123123 + 1: 123 + # End of testinput4 diff --git a/testdata/testoutput5 b/testdata/testoutput5 index 9fcebf3..d2f9352 100644 --- a/testdata/testoutput5 +++ b/testdata/testoutput5 @@ -147,7 +147,7 @@ Failed: error 173 at offset 9: disallowed Unicode code point (>= 0xd800 && <= 0x Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'A' Last code unit = '.' @@ -164,7 +164,7 @@ Subject length lower bound = 4 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Last code unit = 'X' Subject length lower bound = 4 @@ -179,7 +179,7 @@ Subject length lower bound = 4 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Subject length lower bound = 3 \x{212ab}\x{212ab}\x{212ab}\x{861} @@ -193,7 +193,7 @@ Subject length lower bound = 3 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: utf Overall options: anchored utf Starting code units: a b @@ -238,7 +238,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Options: utf Subject length lower bound = 0 @@ -251,7 +251,7 @@ Subject length lower bound = 0 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'a' Subject length lower bound = 1 @@ -264,7 +264,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'a' Last code unit = 'b' @@ -291,7 +291,7 @@ No match Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 First code unit = \xff Subject length lower bound = 1 >\xff< @@ -304,7 +304,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 /[Ä-Ü]/utf @@ -343,7 +343,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Options: utf Last code unit = 'z' Subject length lower bound = 7 @@ -363,7 +363,7 @@ Subject length lower bound = 7 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 2 +Capture group count = 2 May match empty string Options: utf Subject length lower bound = 0 @@ -394,7 +394,7 @@ Subject length lower bound = 0 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 2 +Capture group count = 2 May match empty string Options: utf Subject length lower bound = 0 @@ -414,7 +414,7 @@ Subject length lower bound = 0 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 2 +Capture group count = 2 May match empty string Options: utf Subject length lower bound = 0 @@ -445,7 +445,7 @@ Subject length lower bound = 0 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 2 +Capture group count = 2 May match empty string Options: utf Subject length lower bound = 0 @@ -471,7 +471,7 @@ Subject length lower bound = 0 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Compile options: no_start_optimize utf Overall options: anchored no_start_optimize utf Subject length lower bound = 0 @@ -713,7 +713,7 @@ No match 0: \x{1ec5} /a\Rb/I,bsr=anycrlf,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf \R matches CR, LF, or CRLF First code unit = 'a' @@ -732,7 +732,7 @@ No match No match /a\Rb/I,bsr=unicode,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf \R matches any Unicode newline First code unit = 'a' @@ -750,7 +750,7 @@ Subject length lower bound = 3 0: a\x{0b}b /a\R?b/I,bsr=anycrlf,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf \R matches CR, LF, or CRLF First code unit = 'a' @@ -769,7 +769,7 @@ No match No match /a\R?b/I,bsr=unicode,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf \R matches any Unicode newline First code unit = 'a' @@ -1408,22 +1408,22 @@ Failed: error 168 at offset 3: \c must be followed by a printable ASCII characte 2: \x{0d} /[^\x{1234}]+/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Subject length lower bound = 1 /[^\x{1234}]+?/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Subject length lower bound = 1 /[^\x{1234}]++/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Subject length lower bound = 1 /[^\x{1234}]{2}/Ii,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf Subject length lower bound = 2 @@ -1703,7 +1703,7 @@ Partial match: \x{0d}\x{0d} ------------------------------------------------------------------ /(?<=\x{1234}\x{1234})\bxy/I,utf -Capturing subpattern count = 0 +Capture group count = 0 Max lookbehind = 2 Options: utf First code unit = 'x' @@ -1768,7 +1768,7 @@ Failed: error 173 at offset 6: disallowed Unicode code point (>= 0xd800 && <= 0x Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 /[\p{^L}]/IB @@ -1778,7 +1778,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 /[\P{L}]/IB @@ -1788,7 +1788,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 /[\P{^L}]/IB @@ -1798,7 +1798,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 /[abc\p{L}\x{0660}]/IB,utf @@ -1808,7 +1808,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Subject length lower bound = 1 @@ -1819,7 +1819,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Subject length lower bound = 1 1234 @@ -1832,7 +1832,7 @@ Subject length lower bound = 1 Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf Subject length lower bound = 1 1234 @@ -2998,7 +2998,7 @@ Partial match: AA Ket End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless utf First code unit = 'A' (caseless) Last code unit = 'B' (caseless) @@ -3914,7 +3914,7 @@ No match ------------------------------------------------------------------ /^s?c/Iim,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: caseless multiline utf First code unit at start or follows newline Last code unit = 'c' (caseless) @@ -4889,4 +4889,31 @@ MK: ABC # ------- +# Test reference and errors in non-ASCII characters in group names + +/(?'𑠅ABC'...)/I,utf +Capture group count = 1 +Named capture groups: + 𑠅ABC 1 +Options: utf +Subject length lower bound = 3 + abcde\=copy=𑠅ABC + 0: abc + 1: abc + C abc (3) 𑠅ABC (group 1) + +# Bad ones + +/(?'AB၌C'...)\g{AB၌C}/utf +Failed: error 142 at offset 5: syntax error in subpattern name (missing terminator?) + +/(?'٠ABC'...)/utf +Failed: error 144 at offset 3: subpattern name must start with a non-digit + +/(?'²ABC'...)/utf +Failed: error 162 at offset 3: subpattern name expected + +/(?'X²ABC'...)/utf +Failed: error 142 at offset 4: syntax error in subpattern name (missing terminator?) + # End of testinput5 diff --git a/testdata/testoutput6 b/testdata/testoutput6 index 042ca42..3ef10b4 100644 --- a/testdata/testoutput6 +++ b/testdata/testoutput6 @@ -5978,7 +5978,7 @@ Partial match: 123 0: Content-Type:xxxyyyz /^abc/Im,newline=lf -Capturing subpattern count = 0 +Capture group count = 0 Options: multiline Forced newline is LF First code unit at start or follows newline @@ -6001,7 +6001,7 @@ No match No match /^abc/Im,newline=crlf -Capturing subpattern count = 0 +Capture group count = 0 Options: multiline Forced newline is CRLF First code unit at start or follows newline @@ -6016,7 +6016,7 @@ No match No match /^abc/Im,newline=cr -Capturing subpattern count = 0 +Capture group count = 0 Options: multiline Forced newline is CR First code unit at start or follows newline @@ -6031,7 +6031,7 @@ No match No match /.*/I,newline=lf -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Forced newline is LF First code unit at start or follows newline @@ -6044,7 +6044,7 @@ Subject length lower bound = 0 0: abc\x0d /.*/I,newline=cr -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Forced newline is CR First code unit at start or follows newline @@ -6057,7 +6057,7 @@ Subject length lower bound = 0 0: abc /.*/I,newline=crlf -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Forced newline is CRLF First code unit at start or follows newline @@ -6070,7 +6070,7 @@ Subject length lower bound = 0 0: abc /\w+(.)(.)?def/Is -Capturing subpattern count = 2 +Capture group count = 2 Options: dotall Starting code units: 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 @@ -6447,7 +6447,7 @@ No match 0: \x0aA /a\Rb/I,bsr=anycrlf -Capturing subpattern count = 0 +Capture group count = 0 \R matches CR, LF, or CRLF First code unit = 'a' Last code unit = 'b' @@ -6465,7 +6465,7 @@ No match No match /a\Rb/I,bsr=unicode -Capturing subpattern count = 0 +Capture group count = 0 \R matches any Unicode newline First code unit = 'a' Last code unit = 'b' @@ -6482,7 +6482,7 @@ Subject length lower bound = 3 0: a\x0bb /a\R?b/I,bsr=anycrlf -Capturing subpattern count = 0 +Capture group count = 0 \R matches CR, LF, or CRLF First code unit = 'a' Last code unit = 'b' @@ -6500,7 +6500,7 @@ No match No match /a\R?b/I,bsr=unicode -Capturing subpattern count = 0 +Capture group count = 0 \R matches any Unicode newline First code unit = 'a' Last code unit = 'b' @@ -6517,7 +6517,7 @@ Subject length lower bound = 2 0: a\x0bb /a\R{2,4}b/I,bsr=anycrlf -Capturing subpattern count = 0 +Capture group count = 0 \R matches CR, LF, or CRLF First code unit = 'a' Last code unit = 'b' @@ -6535,7 +6535,7 @@ No match No match /a\R{2,4}b/I,bsr=unicode -Capturing subpattern count = 0 +Capture group count = 0 \R matches any Unicode newline First code unit = 'a' Last code unit = 'b' @@ -6831,7 +6831,7 @@ Partial match: +ab 0+ CBA /(abc|def|xyz)/I -Capturing subpattern count = 1 +Capture group count = 1 Starting code units: a d x Subject length lower bound = 3 terhjk;abcdaadsfe @@ -6843,7 +6843,7 @@ Subject length lower bound = 3 No match /(abc|def|xyz)/I,no_start_optimize -Capturing subpattern count = 1 +Capture group count = 1 Options: no_start_optimize Subject length lower bound = 0 terhjk;abcdaadsfe diff --git a/testdata/testoutput7 b/testdata/testoutput7 index f804185..004186e 100644 --- a/testdata/testoutput7 +++ b/testdata/testoutput7 @@ -1030,7 +1030,7 @@ No match No match /a\Rb/I,bsr=anycrlf,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf \R matches CR, LF, or CRLF First code unit = 'a' @@ -1049,7 +1049,7 @@ No match No match /a\Rb/I,bsr=unicode,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf \R matches any Unicode newline First code unit = 'a' @@ -1067,7 +1067,7 @@ Subject length lower bound = 3 0: a\x{0b}b /a\R?b/I,bsr=anycrlf,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf \R matches CR, LF, or CRLF First code unit = 'a' @@ -1086,7 +1086,7 @@ No match No match /a\R?b/I,bsr=unicode,utf -Capturing subpattern count = 0 +Capture group count = 0 Options: utf \R matches any Unicode newline First code unit = 'a' diff --git a/testdata/testoutput8-16-2 b/testdata/testoutput8-16-2 index 47c9e56..5706e60 100644 --- a/testdata/testoutput8-16-2 +++ b/testdata/testoutput8-16-2 @@ -67,7 +67,7 @@ Memory allocation (code space): 10 2 2 Ket 4 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Options: extended Subject length lower bound = 0 @@ -80,7 +80,7 @@ Memory allocation (code space): 14 4 4 Ket 6 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: extended First code unit = 'a' Subject length lower bound = 1 @@ -376,7 +376,7 @@ Memory allocation (code space): 26 10 10 Ket 12 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'A' Last code unit = '.' @@ -390,7 +390,7 @@ Memory allocation (code space): 22 8 8 Ket 10 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{d55c} Last code unit = \x{c5b4} @@ -404,7 +404,7 @@ Memory allocation (code space): 22 8 8 Ket 10 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{65e5} Last code unit = \x{8a9e} @@ -904,7 +904,7 @@ Failed: error 186 at offset 12820: regular expression is too complicated 79 79 Ket 81 End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Subject length lower bound = 0 @@ -938,7 +938,7 @@ Subject length lower bound = 0 43 43 Ket 45 End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Subject length lower bound = 0 @@ -1011,7 +1011,7 @@ No match 133 133 Ket 135 End ------------------------------------------------------------------ -Capturing subpattern count = 10 +Capture group count = 10 May match empty string Subject length lower bound = 0 diff --git a/testdata/testoutput8-16-3 b/testdata/testoutput8-16-3 index 722b0e1..bd80a23 100644 --- a/testdata/testoutput8-16-3 +++ b/testdata/testoutput8-16-3 @@ -67,7 +67,7 @@ Memory allocation (code space): 14 3 3 Ket 6 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Options: extended Subject length lower bound = 0 @@ -80,7 +80,7 @@ Memory allocation (code space): 18 5 5 Ket 8 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: extended First code unit = 'a' Subject length lower bound = 1 @@ -376,7 +376,7 @@ Memory allocation (code space): 30 11 11 Ket 14 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'A' Last code unit = '.' @@ -390,7 +390,7 @@ Memory allocation (code space): 26 9 9 Ket 12 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{d55c} Last code unit = \x{c5b4} @@ -404,7 +404,7 @@ Memory allocation (code space): 26 9 9 Ket 12 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{65e5} Last code unit = \x{8a9e} @@ -903,7 +903,7 @@ Failed: error 186 at offset 12820: regular expression is too complicated 110 110 Ket 113 End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Subject length lower bound = 0 @@ -937,7 +937,7 @@ Subject length lower bound = 0 58 58 Ket 61 End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Subject length lower bound = 0 @@ -1010,7 +1010,7 @@ No match 194 194 Ket 197 End ------------------------------------------------------------------ -Capturing subpattern count = 10 +Capture group count = 10 May match empty string Subject length lower bound = 0 diff --git a/testdata/testoutput8-16-4 b/testdata/testoutput8-16-4 index 722b0e1..bd80a23 100644 --- a/testdata/testoutput8-16-4 +++ b/testdata/testoutput8-16-4 @@ -67,7 +67,7 @@ Memory allocation (code space): 14 3 3 Ket 6 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Options: extended Subject length lower bound = 0 @@ -80,7 +80,7 @@ Memory allocation (code space): 18 5 5 Ket 8 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: extended First code unit = 'a' Subject length lower bound = 1 @@ -376,7 +376,7 @@ Memory allocation (code space): 30 11 11 Ket 14 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'A' Last code unit = '.' @@ -390,7 +390,7 @@ Memory allocation (code space): 26 9 9 Ket 12 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{d55c} Last code unit = \x{c5b4} @@ -404,7 +404,7 @@ Memory allocation (code space): 26 9 9 Ket 12 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{65e5} Last code unit = \x{8a9e} @@ -903,7 +903,7 @@ Failed: error 186 at offset 12820: regular expression is too complicated 110 110 Ket 113 End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Subject length lower bound = 0 @@ -937,7 +937,7 @@ Subject length lower bound = 0 58 58 Ket 61 End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Subject length lower bound = 0 @@ -1010,7 +1010,7 @@ No match 194 194 Ket 197 End ------------------------------------------------------------------ -Capturing subpattern count = 10 +Capture group count = 10 May match empty string Subject length lower bound = 0 diff --git a/testdata/testoutput8-32-2 b/testdata/testoutput8-32-2 index 30667a3..a86ef9a 100644 --- a/testdata/testoutput8-32-2 +++ b/testdata/testoutput8-32-2 @@ -67,7 +67,7 @@ Memory allocation (code space): 20 2 2 Ket 4 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Options: extended Subject length lower bound = 0 @@ -80,7 +80,7 @@ Memory allocation (code space): 28 4 4 Ket 6 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: extended First code unit = 'a' Subject length lower bound = 1 @@ -376,7 +376,7 @@ Memory allocation (code space): 52 10 10 Ket 12 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'A' Last code unit = '.' @@ -390,7 +390,7 @@ Memory allocation (code space): 44 8 8 Ket 10 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{d55c} Last code unit = \x{c5b4} @@ -404,7 +404,7 @@ Memory allocation (code space): 44 8 8 Ket 10 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{65e5} Last code unit = \x{8a9e} @@ -903,7 +903,7 @@ Failed: error 186 at offset 12820: regular expression is too complicated 79 79 Ket 81 End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Subject length lower bound = 0 @@ -937,7 +937,7 @@ Subject length lower bound = 0 43 43 Ket 45 End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Subject length lower bound = 0 @@ -1010,7 +1010,7 @@ No match 133 133 Ket 135 End ------------------------------------------------------------------ -Capturing subpattern count = 10 +Capture group count = 10 May match empty string Subject length lower bound = 0 diff --git a/testdata/testoutput8-32-3 b/testdata/testoutput8-32-3 index 30667a3..a86ef9a 100644 --- a/testdata/testoutput8-32-3 +++ b/testdata/testoutput8-32-3 @@ -67,7 +67,7 @@ Memory allocation (code space): 20 2 2 Ket 4 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Options: extended Subject length lower bound = 0 @@ -80,7 +80,7 @@ Memory allocation (code space): 28 4 4 Ket 6 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: extended First code unit = 'a' Subject length lower bound = 1 @@ -376,7 +376,7 @@ Memory allocation (code space): 52 10 10 Ket 12 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'A' Last code unit = '.' @@ -390,7 +390,7 @@ Memory allocation (code space): 44 8 8 Ket 10 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{d55c} Last code unit = \x{c5b4} @@ -404,7 +404,7 @@ Memory allocation (code space): 44 8 8 Ket 10 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{65e5} Last code unit = \x{8a9e} @@ -903,7 +903,7 @@ Failed: error 186 at offset 12820: regular expression is too complicated 79 79 Ket 81 End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Subject length lower bound = 0 @@ -937,7 +937,7 @@ Subject length lower bound = 0 43 43 Ket 45 End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Subject length lower bound = 0 @@ -1010,7 +1010,7 @@ No match 133 133 Ket 135 End ------------------------------------------------------------------ -Capturing subpattern count = 10 +Capture group count = 10 May match empty string Subject length lower bound = 0 diff --git a/testdata/testoutput8-32-4 b/testdata/testoutput8-32-4 index 30667a3..a86ef9a 100644 --- a/testdata/testoutput8-32-4 +++ b/testdata/testoutput8-32-4 @@ -67,7 +67,7 @@ Memory allocation (code space): 20 2 2 Ket 4 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Options: extended Subject length lower bound = 0 @@ -80,7 +80,7 @@ Memory allocation (code space): 28 4 4 Ket 6 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: extended First code unit = 'a' Subject length lower bound = 1 @@ -376,7 +376,7 @@ Memory allocation (code space): 52 10 10 Ket 12 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'A' Last code unit = '.' @@ -390,7 +390,7 @@ Memory allocation (code space): 44 8 8 Ket 10 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{d55c} Last code unit = \x{c5b4} @@ -404,7 +404,7 @@ Memory allocation (code space): 44 8 8 Ket 10 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \x{65e5} Last code unit = \x{8a9e} @@ -903,7 +903,7 @@ Failed: error 186 at offset 12820: regular expression is too complicated 79 79 Ket 81 End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Subject length lower bound = 0 @@ -937,7 +937,7 @@ Subject length lower bound = 0 43 43 Ket 45 End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Subject length lower bound = 0 @@ -1010,7 +1010,7 @@ No match 133 133 Ket 135 End ------------------------------------------------------------------ -Capturing subpattern count = 10 +Capture group count = 10 May match empty string Subject length lower bound = 0 diff --git a/testdata/testoutput8-8-2 b/testdata/testoutput8-8-2 index 4b03356..33fd6e3 100644 --- a/testdata/testoutput8-8-2 +++ b/testdata/testoutput8-8-2 @@ -67,7 +67,7 @@ Memory allocation (code space): 7 3 3 Ket 6 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Options: extended Subject length lower bound = 0 @@ -80,7 +80,7 @@ Memory allocation (code space): 9 5 5 Ket 8 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: extended First code unit = 'a' Subject length lower bound = 1 @@ -376,7 +376,7 @@ Memory allocation (code space): 18 14 14 Ket 17 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'A' Last code unit = '.' @@ -390,7 +390,7 @@ Memory allocation (code space): 19 15 15 Ket 18 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xed Last code unit = \xb4 @@ -404,7 +404,7 @@ Memory allocation (code space): 19 15 15 Ket 18 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xe6 Last code unit = \x9e @@ -904,7 +904,7 @@ Failed: error 186 at offset 12820: regular expression is too complicated 119 119 Ket 122 End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Subject length lower bound = 0 @@ -938,7 +938,7 @@ Subject length lower bound = 0 61 61 Ket 64 End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Subject length lower bound = 0 @@ -1011,7 +1011,7 @@ No match 205 205 Ket 208 End ------------------------------------------------------------------ -Capturing subpattern count = 10 +Capture group count = 10 May match empty string Subject length lower bound = 0 diff --git a/testdata/testoutput8-8-3 b/testdata/testoutput8-8-3 index 3d33c77..59c6925 100644 --- a/testdata/testoutput8-8-3 +++ b/testdata/testoutput8-8-3 @@ -67,7 +67,7 @@ Memory allocation (code space): 9 4 4 Ket 8 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Options: extended Subject length lower bound = 0 @@ -80,7 +80,7 @@ Memory allocation (code space): 11 6 6 Ket 10 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: extended First code unit = 'a' Subject length lower bound = 1 @@ -376,7 +376,7 @@ Memory allocation (code space): 20 15 15 Ket 19 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'A' Last code unit = '.' @@ -390,7 +390,7 @@ Memory allocation (code space): 21 16 16 Ket 20 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xed Last code unit = \xb4 @@ -404,7 +404,7 @@ Memory allocation (code space): 21 16 16 Ket 20 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xe6 Last code unit = \x9e @@ -903,7 +903,7 @@ Failed: error 186 at offset 12820: regular expression is too complicated 150 150 Ket 154 End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Subject length lower bound = 0 @@ -937,7 +937,7 @@ Subject length lower bound = 0 76 76 Ket 80 End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Subject length lower bound = 0 @@ -1010,7 +1010,7 @@ No match 266 266 Ket 270 End ------------------------------------------------------------------ -Capturing subpattern count = 10 +Capture group count = 10 May match empty string Subject length lower bound = 0 diff --git a/testdata/testoutput8-8-4 b/testdata/testoutput8-8-4 index db04971..9480865 100644 --- a/testdata/testoutput8-8-4 +++ b/testdata/testoutput8-8-4 @@ -67,7 +67,7 @@ Memory allocation (code space): 11 5 5 Ket 10 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 May match empty string Options: extended Subject length lower bound = 0 @@ -80,7 +80,7 @@ Memory allocation (code space): 13 7 7 Ket 12 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: extended First code unit = 'a' Subject length lower bound = 1 @@ -376,7 +376,7 @@ Memory allocation (code space): 22 16 16 Ket 21 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = 'A' Last code unit = '.' @@ -390,7 +390,7 @@ Memory allocation (code space): 23 17 17 Ket 22 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xed Last code unit = \xb4 @@ -404,7 +404,7 @@ Memory allocation (code space): 23 17 17 Ket 22 End ------------------------------------------------------------------ -Capturing subpattern count = 0 +Capture group count = 0 Options: utf First code unit = \xe6 Last code unit = \x9e @@ -903,7 +903,7 @@ Failed: error 186 at offset 12820: regular expression is too complicated 181 181 Ket 186 End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Subject length lower bound = 0 @@ -937,7 +937,7 @@ Subject length lower bound = 0 91 91 Ket 96 End ------------------------------------------------------------------ -Capturing subpattern count = 1 +Capture group count = 1 Max back reference = 1 May match empty string Subject length lower bound = 0 @@ -1010,7 +1010,7 @@ No match 327 327 Ket 332 End ------------------------------------------------------------------ -Capturing subpattern count = 10 +Capture group count = 10 May match empty string Subject length lower bound = 0 diff --git a/testdata/testoutput9 b/testdata/testoutput9 index 6b014e5..f98f276 100644 --- a/testdata/testoutput9 +++ b/testdata/testoutput9 @@ -215,7 +215,7 @@ Failed: error 134 at offset 6: character code point value in \x{} or \o{} is too (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )* \) )* # optional trailing comment /Ix -Capturing subpattern count = 0 +Capture group count = 0 Contains explicit CR or LF match Options: extended Starting code units: \x09 \x20 ! " # $ % & ' ( * + - / 0 1 2 3 4 5 6 7 8 @@ -224,25 +224,25 @@ Starting code units: \x09 \x20 ! " # $ % & ' ( * + - / 0 1 2 3 4 5 6 7 8 Subject length lower bound = 3 /\h/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x09 \x20 \xa0 Subject length lower bound = 1 /\H/I -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 /\v/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x0a \x0b \x0c \x0d \x85 Subject length lower bound = 1 /\V/I -Capturing subpattern count = 0 +Capture group count = 0 Subject length lower bound = 1 /\R/I -Capturing subpattern count = 0 +Capture group count = 0 Starting code units: \x0a \x0b \x0c \x0d \x85 Subject length lower bound = 1