This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
t/re/re_tests: Skip ASCII-centric test for EBCDIC
[perl5.git] / t / re / re_tests
index c41d529..6805441 100644 (file)
@@ -5,7 +5,7 @@
 # could not go in this file, and were farmed out to other .t's, where they
 # remain
 #
-# pat  string  y/n/etc expr    expected-expr   skip-reason
+# pat  string  y/n/etc expr    expected-expr   skip-reason     comment
 __END__
 abc    abc     y       $&      abc
 abc    abc     y       $-[0]   0
@@ -134,6 +134,16 @@ a[^]b]c    adc     y       $&      adc
 \By\b  xy      y       -       -
 \by\B  yz      y       -       -
 \By\B  xyz     y       -       -
+\b             n       -       -
+\b{gcb}                n       -       -
+\b{lb}         n       -       -
+\b{sb}         n       -       -
+\b{wb}         n       -       -
+\B             y       -       -
+\B{gcb}                y       -       -
+\B{lb}         y       -       -
+\B{sb}         y       -       -
+\B{wb}         y       -       -
 \w     a       y       -       -
 \w     -       n       -       -
 \W     a       n       -       -
@@ -255,6 +265,7 @@ a[bcd]+dcdcde       adcdcde n       -       -
 ((a)(b)c)(d)   abcd    y       $-[4]   3
 ((a)(b)c)(d)   abcd    y       $+[4]   4
 [a-zA-Z_][a-zA-Z0-9_]* alpha   y       $&      alpha
+[_A-Z] }       n       -       -               # This could match on EBCDIC if A-Z not excluding things in middle
 ^a(bc+|b[eh])g|.h$     abh     y       $&-$1   bh-
 (bc+d$|ef*g.|h?i(j|k)) effgz   y       $&-$1-$2        effgz-effgz-
 (bc+d$|ef*g.|h?i(j|k)) ij      y       $&-$1-$2        ij-ij-j
@@ -476,12 +487,19 @@ a(?:b|(c|e){1,2}?|d)+?(.) ace     y       $1$2    ce
 (((a{2}){2})+) aaaaaaaaaa      y       $1      aaaaaaaa
 (?:(f)(o)(o)|(b)(a)(r))*       foobar  y       $1:$2:$3:$4:$5:$6       f:o:o:b:a:r
 (?<=a)b        ab      y       $&      b
+(?<=af?)b      ab      y       $&      b
 (?<=a)b        cb      n       -       -
+(?<=a(?:fo)?)b cb      n       -       -
 (?<=a)b        b       n       -       -
+(?<=a(?:foo)?)b        b       n       -       -
 (?<!c)b        ab      y       $&      b
+(?<!c(?:foob)?)b       ab      y       $&      b
 (?<!c)b        cb      n       -       -
+(?<!c(?:fooba)?)b      cb      n       -       -
 (?<!c)b        b       y       -       -
+(?<!c(?:foobar)?)b     b       y       -       -
 (?<!c)b        b       y       $&      b
+(?<!c(?:foobarb)?)b    b       y       $&      b
 (?<%)b -       c       -       Group name must start with a non-digit word character
 (?:..)*a       aba     y       $&      aba
 (?:..)*?a      aba     y       $&      a
@@ -538,6 +556,7 @@ foo\w*\d{4}baz      foobar1234baz   y       $&      foobar1234baz
 a(?{})b        cabd    y       $&      ab
 a(?{f()+       -       c       -       Missing right curly or square bracket
 a(?{{1}+       -       c       -       Missing right curly or square bracket
+ (?{(^{})      -       c       -       syntax error
 a(?{}})b       -       c       -       
 a(?{"{"})b     ab      y       -       -
 a(?{"\{"})b    cabd    y       $&      ab
@@ -547,7 +566,10 @@ x(~~)*(?:(?:F)?)?  x~~     y       -       -
 ^a(?#xxx){3}c  aaac    y       $&      aaac
 '^a (?#xxx) (?#yyy) {3}c'x     aaac    y       $&      aaac
 (?<![cd])b     dbcb    n       -       -
+(?<![cd]e{0,254})b     dbcb    n       -       -
 (?<![cd])[ab]  dbaacb  y       $&      a
+(?<![cd]{1,2})[ab]     dbaacb  y       $&      a
+#Why does this fail.  I think it's confusing (?<![cd]{1,3})[ab]        dbaacb  y       $&      a
 (?<!(c|d))b    dbcb    n       -       -
 (?<!(c|d))[ab] dbaacb  y       $&      a
 (?<!cd)[ab]    cdaccb  y       $&      b
@@ -592,6 +614,10 @@ x(~~)*(?:(?:F)?)?  x~~     y       -       -
 (?(?!a)b|a)    a       y       $&      a
 (?(?=a)b|a)    a       n       -       -
 (?(?=a)a|b)    a       y       $&      a
+(?(?!\x{100})\x{100}|b)        \x{100} n       -       -
+(?(?!\x{100})b|\x{100})        \x{100} y       $&      \x{100}
+(?(?=\x{100})b|\x{100})        \x{100} n       -       -
+(?(?=\x{100})\x{100}|b)        \x{100} y       $&      \x{100}
 (?=(a+?))(\1ab)        aaab    y       $2      aab
 ^(?=(a+?))\1ab aaab    n       -       -
 (\w+:)+        one:    y       $1      one:
@@ -609,6 +635,8 @@ $(?<=^(a))  a       y       $1      a
 ^[^bcd]*(c+)   aexycd  y       $1      c
 (?{$a=2})a*aa(?{local$a=$a+1})k*c(?{$b=$a})    yaaxxaaaacd     y       $b      3
 (?{$a=2})(a(?{local$a=$a+1}))*aak*c(?{$b=$a})  yaaxxaaaacd     y       $b      4
+# [perl #117917]
+^(a(?{ "x" =~ m{x}})b)(??{ $1 })       abab    y       $&      abab
 (>a+)ab        aaab    n       -       -
 (?>a+)b        aaab    y       -       -
 ([[:]+)        a:[b]:  y       $1      :[
@@ -621,7 +649,7 @@ $(?<=^(a))  a       y       $1      a
 ([[:alpha:]]+) ABcd01Xy__--  ${nulnul}${ffff}  y       $1      ABcd
 ([[:alnum:]]+) ABcd01Xy__--  ${nulnul}${ffff}  y       $1      ABcd01Xy
 ([[:ascii:]]+) ABcd01Xy__--  ${nulnul}${ffff}  y       $1      ABcd01Xy__--  ${nulnul}
-([[:cntrl:]]+) ABcd01Xy__--  ${nulnul}${ffff}  y       $1      ${nulnul}
+([[:cntrl:]]+) ABcd01Xy__--  ${nulnul}${ffff}  ya      $1      ${nulnul}       ff is a control on EBCDIC (non-POSIX-BC), so this fails under /u rules
 ([[:digit:]]+) ABcd01Xy__--  ${nulnul}${ffff}  y       $1      01
 ([[:graph:]]+) ABcd01Xy__--  ${nulnul}${ffff}  y       $1      ABcd01Xy__--
 ([[:lower:]]+) ABcd01Xy__--  ${nulnul}${ffff}  y       $1      cd
@@ -634,6 +662,7 @@ $(?<=^(a))  a       y       $1      a
 ([[:^alpha:]]+)        ABcd01Xy__--  ${nulnul}${ffff}  y       $1      01
 ((?a)[[:^alnum:]]+)    ABcd01Xy__--  ${nulnul}${ffff}  y       $1      __--  ${nulnul}${ffff}
 ([[:^ascii:]]+)        ABcd01Xy__--  ${nulnul}${ffff}  y       $1      ${ffff}
+([:[:^ascii:]]+)       ABcd01Xy__--  ${nulnul}${ffff}  y       $1      ${ffff} RT #120799
 ([[:^cntrl:]]+)        ABcd01Xy__--  ${nulnul}${ffff}  y       $1      ABcd01Xy__--  
 ([[:^digit:]]+)        ABcd01Xy__--  ${nulnul}${ffff}  y       $1      ABcd
 ([[:^lower:]]+)        ABcd01Xy__--  ${nulnul}${ffff}  y       $1      AB
@@ -645,10 +674,11 @@ $(?<=^(a))        a       y       $1      a
 ([[:^xdigit:]]+)       ABcd01Xy__--  ${nulnul}${ffff}  y       $1      Xy__--  ${nulnul}${ffff}
 [[:foo:]]      -       c       -       POSIX class [:foo:] unknown
 [[:^foo:]]     -       c       -       POSIX class [:^foo:] unknown
+'[[:^cntrl:]]+'u       a\x80   y       $&      a       \x80 was matching on EBCDIC platforms
 ((?>a+)b)      aaab    y       $1      aaab
 (?>(a+))b      aaab    y       $1      aaa
 ((?>[^()]+)|\([^()]*\))+       ((abc(ade)ufh()()x      y       $&      abc(ade)ufh()()x
-(?<=x+)y       -       c       -       Variable length lookbehind not implemented
+(?<=x+)y       -       c       -       Lookbehind longer than 255 not implemented
 ((def){37,17})?ABC     ABC     y       $&      ABC
 \Z     a\nb\n  y       $-[0]   3
 \z     a\nb\n  y       $-[0]   4
@@ -937,12 +967,12 @@ tt+$      xxxtt   y       -       -
 (abc)?(abc)+   abc     y       $1:$2   :abc    -
 'b\s^'m        a\nb\n  n       -       -
 \ba    a       y       -       -
-^(a(??{"(?!)"})|(a)(?{1}))b    ab      y       $2      a       # [ID 20010811.006]
-ab(?i)cd       AbCd    n       -       -       # [ID 20010809.023]
+^(a(??{"(?!)"})|(a)(?{1}))b    ab      y       $2      a       # [ID 20010811.006 (#7512)]
+ab(?i)cd       AbCd    n       -       -       # [ID 20010809.023 (#7503)]
 ab(?i)cd       abCd    y       -       -
 (A|B)*(?(1)(CD)|(CD))  CD      y       $2-$3   -CD
 (A|B)*(?(1)(CD)|(CD))  ABCD    y       $2-$3   CD-
-(A|B)*?(?(1)(CD)|(CD)) CD      y       $2-$3   -CD     # [ID 20010803.016]
+(A|B)*?(?(1)(CD)|(CD)) CD      y       $2-$3   -CD     # [ID 20010803.016 (#7438)]
 (A|B)*?(?(1)(CD)|(CD)) ABCD    y       $2-$3   CD-
 '^(o)(?!.*\1)'i        Oo      n       -       -
 (.*)\d+\1      abc12bc y       $1      bc
@@ -1049,6 +1079,7 @@ X(?:ABCF[cC]x*|ABCD|ABCF):(?:DIT|DID|DIM) XABCFCxxxxxxxxxx:DIM    y       $&      XABCFCxxxxxx
 (?=foo)        foo     y       pos     0
 (?=foo)        XfooY   y       pos     1
 .*(?=foo)      XfooY   y       pos     1
+(?=.*P)P       aP      y       pos     2
 (?<=foo)       foo     y       pos     3
 (?<=foo)       XfooY   y       pos     4
 .*(?<=foo)     foo     y       pos     3
@@ -1090,7 +1121,7 @@ X(?<=foo.)[YZ]    ..XfooXY..      y       pos     8
 (?P<n>foo)(??{ $+{n} })        snofooefoofoowaa        yM      $+{n}   foo     miniperl cannot load Tie::Hash::NamedCapture
 (?P<=n>foo|bar|baz)    -       c       -       Group name must start with a non-digit word character
 (?P<!n>foo|bar|baz)    -       c       -       Group name must start with a non-digit word character
-(?PX<n>foo|bar|baz)    -       c       -       Sequence (?PX<...) not recognized
+(?PX<n>foo|bar|baz)    -       c       -       Sequence (?PX...) not recognized
 /(?'n'foo|bar|baz)/    snofooewa       y       $1      foo
 /(?'n'foo|bar|baz)/    snofooewa       yM      $+{n}   foo     miniperl cannot load Tie::Hash::NamedCapture
 /(?'n'foo|bar|baz)(?'m'[ew]+)/ snofooewa       yM      $+{n}   foo     miniperl cannot load Tie::Hash::NamedCapture
@@ -1122,11 +1153,18 @@ X(?<=foo.)[YZ]  ..XfooXY..      y       pos     8
 /(a)+((?1))(fox)/      aafox   y       $1-$2-$3        a-a-fox
 /(a){1,100}((?1))(fox)/        aafox   y       $1-$2-$3        a-a-fox
 /(a){0,100}((?1))(fox)/        aafox   y       $1-$2-$3        a-a-fox
+/(a)??((?1))(fox)/     aafox   y       $1-$2-$3        a-a-fox
+/(a)*?((?1))(fox)/     aafox   y       $1-$2-$3        a-a-fox
+/(a)+?((?1))(fox)/     aafox   y       $1-$2-$3        a-a-fox
+/(a){1,100}?((?1))(fox)/       aafox   y       $1-$2-$3        a-a-fox
+/(a){0,100}?((?1))(fox)/       aafox   y       $1-$2-$3        a-a-fox
 /(ab)?((?1))(fox)/     ababfox y       $1-$2-$3        ab-ab-fox
 /(ab)*((?1))(fox)/     ababfox y       $1-$2-$3        ab-ab-fox
 /(ab)+((?1))(fox)/     ababfox y       $1-$2-$3        ab-ab-fox
 /(ab){1,100}((?1))(fox)/       ababfox y       $1-$2-$3        ab-ab-fox
 /(ab){0,100}((?1))(fox)/       ababfox y       $1-$2-$3        ab-ab-fox
+foo(?0)?bar    phoofoofoobarbarbarr    y       $&      foofoobarbar
+foo(?R)?bar    phoofoofoobarbarbarr    y       $&      foofoobarbar
 # possessive captures
 a++a   aaaaa   n       -       -
 a*+a   aaaaa   n       -       -
@@ -1321,6 +1359,7 @@ a*(*F)    aaaab   n       -       -
 
 (?<=abcd(?<=(aaaabcd)))        ..aaaabcd..     y       $1      aaaabcd
 (?=xy(?<=(aaxy)))      ..aaxy..        y       $1      aaxy
+(?=xy(?<=(aaxyz?)))    ..aaxy..        y       $1      aaxy
 
 X(\w+)(?=\s)|X(\w+)    Xab     y       [$1-$2] [-ab]
 
@@ -1416,9 +1455,12 @@ foo(\h)bar       foo\tbar        y       $1      \t
 /[a\N{U+0100}]/        \x{100} y       $&      \x{100}
 /[a\N{U+0100}]/        a       y       $&      a
 
-# Verify that \N{U+...} forces Unicode semantics
+# Verify that \N{U+...} forces Unicode rules
 /\N{U+41}\x{c1}/i      a\x{e1} y       $&      a\x{e1}
+'\N{U+41}\x{c1}'i      a\x{e1} y       $&      a\x{e1}
 /[\N{U+41}\x{c1}]/i    \x{e1}  y       $&      \x{e1}
+'[\N{U+41}\x{c1}]'i    \x{e1}  y       $&      \x{e1}
+'\N{U+41}'     A       y       $&      A               # Even for single quoted patterns
 
 [\s][\S]       \x{a0}\x{a0}    n       -       -       # Unicode complements should not match same character
 
@@ -1429,8 +1471,8 @@ foo(\h)bar        foo\tbar        y       $1      \t
 
 # Verify that \ escapes the { after \N, and causes \N to match non-newline
 abc\N\{U+BEEF} abc\n{UBEEF}    n               
-abc\N\{U+BEEF} abc.{UBEEF}     y       $&      abc.{UBEEF}
-[abc\N\{U+BEEF}]       -       c       -       \\N in a character class must be a named character
+abc\N\{U+BEEF\}        abc.{UBEEF}     y       $&      abc.{UBEEF}
+[abc\N\{U+BEEF\}]      -       c       -       \\N in a character class must be a named character
 
 # Verify that \N can be trailing and causes \N to match non-newline
 abc\N  abcd    y       $&      abcd
@@ -1439,12 +1481,10 @@ abc\N   abc\n   n
 # Verify get errors.  For these, we need // or else puts it in single quotes,
 # and bypasses the lexer.
 /\N{U+}/       -       c       -       Invalid hexadecimal number
-# Below currently gives a misleading message
-/[\N{U+}]/     -       Sc      -       Unmatched
-/[\N{U+}]/     -       sc      -       Syntax error in (?[...])
+/[\N{U+}]/     -       c       -       Invalid hexadecimal number
 /abc\N{def/    -       c       -       Missing right brace
-/\N{U+4AG3}/   -       c       -       Illegal hexadecimal digit
-/[\N{U+4AG3}]/ -       c       -       Illegal hexadecimal digit
+/\N{U+4AG3}/   -       c       -       Invalid hexadecimal number
+/[\N{U+4AG3}]/ -       c       -       Invalid hexadecimal number
 
 # And verify that in single quotes which bypasses the lexer, the regex compiler
 # figures it out.
@@ -1452,23 +1492,44 @@ abc\N   abc\n   n
 [\N{U+}]       -       c       -       Invalid hexadecimal number
 \N{U+4AG3}     -       c       -       Invalid hexadecimal number
 [\N{U+4AG3}]   -       c       -       Invalid hexadecimal number
-abc\N{def      -       c       -       \\N{NAME} must be resolved by the lexer
+abc\N{def}     -       c       -       Unknown charname 'def' in regex
+abc\N{U+4AG3   -       c       -       Missing right brace on \\N{}
+abc\N{def      -       c       -       Missing right brace on \\N{}
+abc\N{ -       c       -       Missing right brace on \\N{}
 
 # Verify that under /x that still cant have space before left brace
 /abc\N {U+41}/x        -       c       -       Missing braces
 /abc\N {SPACE}/x       -       c       -       Missing braces
 
-# Verifies catches hex errors, and doesn't expose our . notation to the outside
-/\N{U+0xBEEF}/ -       c       -       Illegal hexadecimal digit
-/\N{U+BEEF.BEAD}/      -       c       -       Illegal hexadecimal digit
+# Verifies catches hex errors
+/\N{U+0xBEEF}/ -       c       -       Invalid hexadecimal number
+\N{U+0xBEEF}   -       c       -       Invalid hexadecimal number
+# Used to be an error, but not any more:
+/\N{U+BEEF.BEAD}/      -       c       -       
 
 # Verify works in single quotish context; regex compiler delivers slightly different msg
 # \N{U+BEEF.BEAD} succeeds here, because can't completely hide it from the outside.
 \N{U+0xBEEF}   -       c       -       Invalid hexadecimal number
-\c`    -       c       -       \"\\c`\" is more clearly written simply as \"\\ \"
-\c1    -       c       -       \"\\c1\" is more clearly written simply as \"q\"
-\cA    \001    y       $&      \1
-
+\c`    -       ac      -       \"\\c`\" is more clearly written simply as \"\\ \"
+\c1    -       ac      -       \"\\c1\" is more clearly written simply as \"q\"
+\c@    \0      y       $&      \0
+\cA    \001    y       $&      \001
+\cB    \002    y       $&      \002
+\cC    \003    y       $&      \003
+\cI    \011    y       $&      \011
+\cJ    \012    y       $&      \012
+\cR    \022    y       $&      \022
+\cS    \023    y       $&      \023
+\cX    \030    y       $&      \030
+\cY    \031    y       $&      \031
+\cZ    \032    y       $&      \032
+\c[    \033    y       $&      \033
+\c\X   \034X   y       $&      \034X
+\c]    \035    y       $&      \035
+\c^    \036    y       $&      \036
+\c_    \037    y       $&      \037
+\c?    \177    ay      $&      \177
+\c?    \x9F    ey      $&      \x9F            \c? is APC on EBCDIC
 \400   \x{100} y       $&      \x{100}
 \600   \x{180} y       $&      \x{180}
 \777   \x{1FF} y       $&      \x{1FF}
@@ -1483,10 +1544,50 @@ abc\N{def       -       c       -       \\N{NAME} must be resolved by the lexer
 [a\o{1000}]    \x{200} y       $&      \x{200}
 
 # The below were inserting a NULL
-\87    87      y       $&      87
-a\87   a87     y       $&      a87
-a\97   a97     y       $&      a97
-
+\87    87      c       -       Reference to nonexistent group in regex
+a\87   a87     c       -       Reference to nonexistent group in regex
+a\97   a97     c       -       Reference to nonexistent group in regex
+
+# avoid problems with 32-bit signed integer overflow
+
+(.)\g2147483648}       x       c       -       Reference to nonexistent group in regex
+(.)\g2147483649}       x       c       -       Reference to nonexistent group in regex
+(.)\g2147483650}       x       c       -       Reference to nonexistent group in regex
+(.)\g4294967296}       x       c       -       Reference to nonexistent group in regex
+(.)\g4294967297}       x       c       -       Reference to nonexistent group in regex
+(.)\g4294967298}       x       c       -       Reference to nonexistent group in regex
+a(.)\g2147483648}      x       c       -       Reference to nonexistent group in regex
+a(.)\g2147483649}      x       c       -       Reference to nonexistent group in regex
+a(.)\g2147483650}      x       c       -       Reference to nonexistent group in regex
+a(.)\g4294967296}      x       c       -       Reference to nonexistent group in regex
+a(.)\g4294967297}      x       c       -       Reference to nonexistent group in regex
+a(.)\g4294967298}      x       c       -       Reference to nonexistent group in regex
+
+(.)\g{2147483648}      x       c       -       Reference to nonexistent group in regex
+(.)\g{2147483649}      x       c       -       Reference to nonexistent group in regex
+(.)\g{2147483650}      x       c       -       Reference to nonexistent group in regex
+(.)\g{4294967296}      x       c       -       Reference to nonexistent group in regex
+(.)\g{4294967297}      x       c       -       Reference to nonexistent group in regex
+(.)\g{4294967298}      x       c       -       Reference to nonexistent group in regex
+a(.)\g{2147483648}     x       c       -       Reference to nonexistent group in regex
+a(.)\g{2147483649}     x       c       -       Reference to nonexistent group in regex
+a(.)\g{2147483650}     x       c       -       Reference to nonexistent group in regex
+a(.)\g{4294967296}     x       c       -       Reference to nonexistent group in regex
+a(.)\g{4294967297}     x       c       -       Reference to nonexistent group in regex
+a(.)\g{4294967298}     x       c       -       Reference to nonexistent group in regex
+
+(.)\2147483648 b\o{214}7483648 ya      $1      b       \d not converted to native; \o{} is
+(.)\2147483649 b\o{214}7483649 ya      $1      b       \d not converted to native; \o{} is
+(.)\2147483650 b\o{214}7483650 ya      $1      b       \d not converted to native; \o{} is
+(.)\4294967296 b\o{42}94967296 ya      $1      b       \d not converted to native; \o{} is
+(.)\4294967297 b\o{42}94967297 ya      $1      b       \d not converted to native; \o{} is
+(.)\4294967298 b\o{42}94967298 ya      $1      b       \d not converted to native; \o{} is
+a(.)\2147483648        ab\o{214}7483648        ya      $1      b       \d not converted to native; \o{} is
+a(.)\2147483649        ab\o{214}7483649        ya      $1      b       \d not converted to native; \o{} is
+a(.)\2147483650        ab\o{214}7483650        ya      $1      b       \d not converted to native; \o{} is
+a(.)\4294967296        ab\o{42}94967296        ya      $1      b       \d not converted to native; \o{} is
+a(.)\4294967297        ab\o{42}94967297        ya      $1      b       \d not converted to native; \o{} is
+a(.)\4294967298        ab\o{42}94967298        ya      $1      b       \d not converted to native; \o{} is
 
 # The below was inserting a NULL into the character class.
 [\8\9] \000    Sn      -       -
@@ -1532,6 +1633,8 @@ a\97      a97     y       $&      a97
 ^m?(\d)(.*)\1$ 5b5     y       $1      5
 ^m?(\d)(.*)\1$ aba     n       -       -
 
+^_?[^\W_0-9]\w\z       \xAA\x{100}     y       $&      \xAA\x{100}             [perl #127537]
+
 # 17F is 'Long s';  This makes sure the a's in /aa can be separate
 /s/ai  \x{17F} y       $&      \x{17F}
 /s/aia \x{17F} n       -       -
@@ -1671,6 +1774,12 @@ ab[c\\\](??{"x"})]{3}d   ab\\](d y       -       -
 ^(A)((?(?{return 1})abc|xyz))$ Aabc    y       $1-$2   A-abc   -
 ^(A)((?(?{return 0})abc|xyz))$ Axyz    y       $1-$2   A-xyz   -
 
+# using 'return' in code blocks with additional scopes to pop
+^(A)(?{ { 1; return "xyz"} })B$        AB      y       $1-$^R  A-xyz   -
+^(A)((??{ { 1; return "xyz" } }))$     Axyz    y       $1-$2   A-xyz   -
+^(A)((?(?{ { 1; return 1 } })abc|xyz))$        Aabc    y       $1-$2   A-abc   -
+^(A)((?(?{ { 1; return 0 } })abc|xyz))$        Axyz    y       $1-$2   A-xyz   -
+
 # pattern modifier flags should propagate into returned (??{}) pattern
 # p,d,l not tested
 
@@ -1729,7 +1838,185 @@ ab[c\\\](??{"x"})]{3}d  ab\\](d y       -       -
 # [ perl #114272]
 \Vn    \xFFn/  y       $&      \xFFn
 
+# These mostly exercize various paths in the optimizer
 /(?l:a?\w)/    b       y       $&      b
+/(?l:a?\D)/    b       y       $&      b
+^_?[^\S_0-9]\w*\z      \t      y       $&      \t
 m?^xy\?$?      xy?     y       $&      xy?
-
+a?\X   a\x{100}        y       $&      a\x{100}
+a?\R   a\n     y       $&      a\n
+^a?\N$ a\n     y       $&      a
+\N?a   \na     y       $&      a
+/\s?\s/l       \t      y       $&      \t
+/\s?\d/l       3       y       $&      3
+/\s?\S/l       A       y       $&      A
+
+# check we have the right utf8ness as we switch back and forth between
+# patterns
+^(\x{100}|a)(??{ qr/.?\xF7/d}) a_\xF7  y       -       -
+
+# [perl #118375]
+/(a|(bc)){0,0}?xyz/    xyz     y       $&      xyz
+/( a | ( bc ) ) {0,0} ? xyz/x  xyz     y       $&      xyz
+
+/(a|(bc)){0,0}+xyz/    xyz     y       $&      xyz
+/( a | ( bc ) ) {0,0} + xyz/x  xyz     y       $&      xyz
+
+(A(*PRUNE)B|A(*PRUNE)C)        AC      n       -       -
+(A(*PRUNE)B|A(*PRUNE)D|A(*PRUNE)C)     AC      n       -       -
+(A(*PRUNE)B|A(*PRUNE)C|A(*PRUNE)D)     AC      n       -       -
+((A(*PRUNE)B|A(*PRUNE)C))      AC      n       -       -
+((A(*PRUNE)B|A(*PRUNE)D|A(*PRUNE)C))   AC      n       -       -
+((A(*PRUNE)B|A(*PRUNE)C|A(*PRUNE)D))   AC      n       -       -
+
+A+?(*THEN)BC   AAABC   y       $&      ABC
+A+?(*PRUNE)BC  AAABC   y       $&      ABC
+A+(*THEN)BC    AAABC   y       $&      AAABC
+A+(*PRUNE)BC   AAABC   y       $&      AAABC
+A+?(*THEN)BC(?{})      AAABC   y       $&      ABC
+A+?(*PRUNE)BC(?{})     AAABC   y       $&      ABC
+A+(*THEN)BC(?{})       AAABC   y       $&      AAABC
+A+(*PRUNE)BC(?{})      AAABC   y       $&      AAABC
+/[#]/  a#b     y       $&      #
+/[#]b/ a#b     y       $&      #b
+/[#]/x a#b     y       $&      #
+/[#]b/x        a#b     y       $&      #b
+/[#](?{})/x    a#b     y       $&      #
+/[#](??{'b'})/x        a#b     y       $&      #b
+/(?#)(?{})b/   a#b     y       $&      b
+/(?#)(??{'b'})/        a#b     y       $&      b
+/[(?#](?{})b/  a#b     y       $&      #b
+/[(?#](??{'b'})/       a#b     y       $&      #b
+/(?#)(?{})b/x  a#b     y       $&      b
+/(?#)(??{'b'})/x       a#b     y       $&      b
+
+# RT #119069: PCRE regression test: no segfault
+^(?=(a)){0}b(?1)       back    y       $&      ba
+# RT #119071: PCRE regression test: No warning of infinite regression
+(?:(a(*SKIP)b)){0}(?:(?1)|ac)  x       n       -       -
+# RT #119073: PCRE regression test: {0} => NOTHING optimization
+(?1)(?:(b)){0} b       y       $&      b
+# RT #120041
+^A*\z          y       $&      
+/\N* /x        ab      y       $&      ab               # Under /x was ignoring the '*'
+/\N (?#comment) * /x   ab      y       $&      ab      # likewise
+
+# RT #120600: Variable length lookbehind is not variable
+(?<W>a)(?<BB>(?=(?&W))(?<=(?&W)))(?&BB)        aa      y       $&      a       # test repeated recursive patterns
+
+# This group is from RT #121144
+/^\S+=/d       \x{3a3}=\x{3a0} y       $&      \x{3a3}=
+/^\S+=/u       \x{3a3}=\x{3a0} y       $&      \x{3a3}=
+
+# utf8 cache length panics
+\x{100}[xy]\x{100}{2}  \x{100}y\x{100}\x{100}  y       $&      \x{100}y\x{100}\x{100}
+\x{100}a{2,3}  \x{100}aaa      y       $&      \x{100}aaa
+^x?abc?de      abcde   y       $&      abcde
+
+'(?-m:^abc)'m  abcde   y       $&      abc
+'(?-m:^abc)'m  x\nabcde        n       -       -
+
+# RT #121248 - segfault
+/^[+]([^(]+)$/mi       li      n       -       -
+
+# RT #121299 - Inconsistent behavior with backreferences nested inside subpattern references
+/(.)((o)\1)(?2)/       fofof   y       $2      of
+/(.)(?2)((\1)(?4)(\1))/        fffffff y       $1      f
+/(.)(?2)((.)(?4)(\1))/ foffoff y       $2      off
+/^(.\2?)(.)(?1)$/      abcb    y       $2      b
+/^(.\1?)(?1)$/ aba     y       $1      a
+/^ (\3(?2)\3)? ((.)) (?1) $/x  aaba    y       $2      a
+/^ (a|\3(?1)\2|(?2)) ((b|c)(?4)?) (?1) (d(?1)) $/x     abbcdcabbda     y       $2      b
+
+# RT #121321 - perl 5.19.10 infinite loops on backrefs > number of capture buffers (npar) where npar>9
+/(a)\2/        a\2     c       -       Reference to nonexistent group in regex
+/(a)(b)\3/     ab\3    c       -       Reference to nonexistent group in regex
+/(a)(b)(c)\4/  abc\4   c       -       Reference to nonexistent group in regex
+/(a)(b)(c)(d)\5/       abcd\5  c       -       Reference to nonexistent group in regex
+/(a)(b)(c)(d)(e)\6/    abcde\6 c       -       Reference to nonexistent group in regex
+/(a)(b)(c)(d)(e)(f)\7/ abcdef\7        c       -       Reference to nonexistent group in regex
+/(a)(b)(c)(d)(e)(f)(g)(h)(i)\10/       abcdefghi\10    y       $&      abcdefghi\10
+/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)\11/    abcdefghij\11   y       $&      abcdefghij\11
+/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12/ abcdefghijk\12  y       $&      abcdefghijk\12
+/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\13\14/   abcdefghijk\12\13\14    y       $&      abcdefghijk\12\13\14
+
+\d<(.*?)>      a<>     n       -       -
+[bcd].{2,3}aaaa        XbXaaaaa        y       -       -
+[bcd].{2,3}aaaa        Xb\x{100}aaaaa  y       -       -
+'\Awibble\z'm  wibble  y       -       -
+/(alias|status)es$/i   Statuses        y       $1      Status          # [perl #121778]
+/( (?&solution) | % ) \Z (?(DEFINE) (?<solution>7\%\ solution) )/x     7% solution     y       $1      7% solution             # [perl #122890]
+(.)(?{$~=$^N}) \x{100} y       $~      \x{100}         # [perl #123135]
+
+/[a-z]/i       \N{KELVIN SIGN} y       $&      \N{KELVIN SIGN}
+/[A-Z]/ia      \N{KELVIN SIGN} y       $&      \N{KELVIN SIGN}
+/[A-Z]/iaa     \N{KELVIN SIGN} n       -       -
+/[A-Z]/i       \N{LATIN SMALL LETTER LONG S}   y       $&      \N{LATIN SMALL LETTER LONG S}
+
+# RT #123840: these used to hang in re_intuit_start
+/w\zxy?\z/i    \x{100}a\x{80}a n       -       -
+/w\z\R\z/i     \x{100}a\x{80}a n       -       -
+
+/(a+){1}+a/    aaa     n       -       -               # [perl #125825]
+
+^((?(?=x)xb|ya)z)      xbz     y       $1      xbz
+^((?(?=x)xb|ya)z)      yaz     y       $1      yaz
+^((?(?!y)xb|ya)z)      xbz     y       $1      xbz
+^((?(?!y)xb|ya)z)      yaz     y       $1      yaz
+^((?(?!)xb|ya)z)       xbz     n       -       -
+^((?(?!)xb|ya)z)       yaz     y       $1      yaz             # [perl-126222]
+
+foo(*ACCEPT:foo)       foo     y       $::REGMARK      foo
+(foo(*ACCEPT:foo))     foo     y       $::REGMARK      foo
+A(*FAIL:foo)[BC]       A       n       $::REGERROR     foo
+
+\N(?#comment){SPACE}   A       c       -       Missing braces on \\N{}
+ab(?#Comment){2}c      abbc    y       $&      abbc
+\p A   A       c       -       Character following \\p must be '{' or a single-character Unicode property name         # [perl #126187
+\P:A   A       c       -       Character following \\P must be '{' or a single-character Unicode property name
+\p^    A       c       -       Character following \\p must be '{' or a single-character Unicode property name
+\PU    A       c       -       Can't find Unicode property definition \"U\"
+
+(?i    -       c       -       Sequence (?... not terminated
+(?a-x  -       c       -       Sequence (?... not terminated
+.{1}?? -       c       -       Nested quantifiers
+.{1}?+ -       c       -       Nested quantifiers
+(?:.||)(?|)000000000@  000000000@      y       $&      000000000@              #  [perl #126405]
+aa$|a(?R)a|a   aaa     y       $&      aaa             # [perl 128420] recursive matches
+(?:\1|a)([bcd])\1(?:(?R)|e)\1  abbaccaddedcb   y       $&      abbaccaddedcb           # [perl 128420] recursive match with backreferences
+AB\s+\x{100}   AB \x{100}X     y       -       -
+\b\z0*\x{100}  .\x{100}        n       -       -       # [perl #129350] crashed in intuit_start
+(.*?(a(a)|i(i))n)      riiaan  y       $2-$3-$4-$1     aa-a--riiaan            #  Jump trie capture buffer issue [perl #129897]
+(^(?:(\d)x)?\d$)       1       y       [$1-$2] [1-]            #  make sure that we reset capture buffers properly (from regtry)
+(X{2,}[-X]{1,4}){3,}X{2,}      XXX-XXX-XXX--   n       -       -       # [perl #130307]
+
+/[a b]/x       \N{SPACE}       yS      $&                      # Note a space char here
+/[a b]/xx      \N{SPACE}       n       -       -
+/[a\ b]/xx     \N{SPACE}       y       $&                      # Note a space char here
+/[ ^ a b ]/xx  a       n       -       -
+/[ ^ a b ]/xx  b       n       -       -
+/[ ^ a b ]/xx  A       y       $&      A
+/(?x:[a b])/xx \N{SPACE}       yS      $&              # Note a space char here
+/(?xx:[a b])/x \N{SPACE}       n       -       -
+/(?x)[a b]/xx  \N{SPACE}       yS      $&              # Note a space char here
+/(?xx)[a b]/x  \N{SPACE}       n       -       -
+/(?-x:[a b])/xx        \N{SPACE}       yS      $&              # Note a space char here
+^a?bcd\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff     ABCDEFGHIJKLMNOPQRSTUVWXYZ      n       -       -       # [perl #132187] for valgrind's benefit
+^Xaaa?Xaa      aaa\x{400000}   n       -       -       # [perl #132552] for valgrind's benefit
+([[:ascii:]]+)\x81     a\x80b\x81      y       $&      b\x81
+[[:^ascii:]]+b \x80a\x81b      y       $&      \x81b
+[[:^ascii:]]+b \x80a\x81\x{100}b       y       $&      \x81\x{100}b
+/\A\x80+\z/    \x80\x80\x80\x80\x80\x80\x80\x80\x80    y       $&      \x80\x80\x80\x80\x80\x80\x80\x80\x80            # [perl #132900]
+^(\d+)*?4X$    1234X   y       $1      123     # perl #131648
+(?il)\x{100}|\x{100}|\x{FE}    \xFE    y       $&      \xFE
+\A([\x00-\x7F]+)(.*)\z \007\011\012    y       $&      \007\011\012    # [perl #133311]
+(?:(?^:(?{1}))[^0-9])  :       y       $&      :       # [perl #133348]
+/[\xdf-/i      -       ca      -       Invalid [] range        # [perl #133620] likely only fails under valgrind
+/[\x59-/i      -       ce      -       Unmatched [     # [perl #133620] likely only fails under valgrind
+/\1a(b)/       bab     n       -       -               # This compiles but fails to match as \1 is not set when parsed.
+/(?iu)(?<=\xdf)hbase/  sshbase y       $&      hbase
+/\x{30c3}?[\x{30a2}\x{30a4}\x{30a6}\x{30a8}\x{30aa}-\x{30e2}\x{30e4}\x{30e6}\x{30e8}-\x{30f4}](?:[\x{30e3}\x{30e5}\x{30e7}\x{30a1}\x{30a3}\x{30a5}\x{30a7}\x{30a9}])?\x{30fc}?\x{30f3}?/       \x{30de}\x{30fc}\x{30af}\x{30b5}\x{30fc}\x{30d3}\x{30b9}        y       $&      \x{30de}\x{30fc}        # part of [perl #133942
+/[\x{3041}-\x{3093}]+/ \x{6f22}\x{5b57}\x{3001}\x{30ab}\x{30bf}\x{30ab}\x{30ca}\x{3001}\x{3072}\x{3089}\x{304c}\x{306a}\x{306e}\x{5165}\x{3063}\x{305f}String  y       $&      \x{3072}\x{3089}\x{304c}\x{306a}\x{306e}        # [perl #133978]
+
+# Keep these lines at the end of the file
 # vim: softtabstop=0 noexpandtab