# This stops me getting screenfulls of syntax errors every time I accidentally
-# run this file via a shell glob. Format of this file is given in regexp.t
-# Can't use \N{VALID NAME TEST} here because need 'use charnames'; but can use
-# \N{U+valid} here.
+# run this file via a shell glob. The full format of this file is given
+# in regexp.t
+# Prior to the implementation of autoloading of \N{}, tests that used \N{name}
+# 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
__END__
abc abc y $& abc
abc abc y $-[0] 0
a[b-d] aac y $& ac
a[-b] a- y $& a-
a[b-] a- y $& a-
-a[b-a] - c - Invalid [] range \"b-a\"
+a[b-a] - c - Invalid [] range
a[]b - c - Unmatched [
a[ - c - Unmatched [
a] a] y $& a]
()ef def y $&-$1 ef-
()ef def y $-[0] 1
()ef def y $+[0] 3
+()\x{100}\x{1000} d\x{100}\x{1000} y $+[0] 3
()ef def y $-[1] 1
()ef def y $+[1] 1
*a - c - Quantifier follows nothing
'a[b-d]'i AAC y $& AC
'a[-b]'i A- y $& A-
'a[b-]'i A- y $& A-
-'a[b-a]'i - c - Invalid [] range \"b-a\"
+'a[b-a]'i - c - Invalid [] range
'a[]b'i - c - Unmatched [
'a['i - c - Unmatched [
'a]'i A] y $& A]
(?<!c)b cb n - -
(?<!c)b b y - -
(?<!c)b b y $& b
-(?<%)b - c - Sequence (?<%...) not recognized
+(?<%)b - c - Group name must start with a non-digit word character
(?:..)*a aba y $& aba
(?:..)*?a aba y $& a
^(?:b|a(?=(.)))*\1 abc y $& ab
'(ab)\d\1'i ab4Ab y $1 ab
foo\w*\d{4}baz foobar1234baz y $& foobar1234baz
a(?{})b cabd y $& ab
-a(?{)b - c - Sequence (?{...}) not terminated or not {}-balanced
-a(?{{})b - c - Sequence (?{...}) not terminated or not {}-balanced
+a(?{f()+ - c - Missing right curly or square bracket
+a(?{{1}+ - c - Missing right curly or square bracket
a(?{}})b - c -
-a(?{"{"})b - c - Sequence (?{...}) not terminated or not {}-balanced
+a(?{"{"})b ab y - -
a(?{"\{"})b cabd y $& ab
-a(?{"{"}})b - c - Unmatched right curly bracket
+a(?{"{"}})b - c - Sequence (?{...}) not terminated with ')'
a(?{$::bl="\{"}).b caxbd y $::bl {
x(~~)*(?:(?:F)?)? x~~ y - -
^a(?#xxx){3}c aaac y $& aaac
^(\(+)?blah(?(1)(\)))$ blah y ($2) ()
^(\(+)?blah(?(1)(\)))$ blah) n - -
^(\(+)?blah(?(1)(\)))$ (blah n - -
-(?(1?)a|b) a c - Switch condition not recognized
-(?(1)a|b|c) a c - Switch (?(condition)... contains too many branches
+(?(1?)a|b) - c - Switch condition not recognized
+(?(1)a|b|c) - c - Switch (?(condition)... contains too many branches
(?(?{0})a|b) a n - -
(?(?{0})b|a) a y $& a
(?(?{1})b|a) a n - -
(?(?!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:
^[^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 :[
[a[:xyz: - c - Unmatched [
[a[:xyz:] - c - POSIX class [:xyz:] unknown
[a[:]b[:c] abc y $& abc
-([a[:xyz:]b]+) pbaq c - POSIX class [:xyz:] unknown
-[a[:]b[:c] abc y $& abc
+([a[:xyz:]b]+) - c - POSIX class [:xyz:] unknown
([[:alpha:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd
([[:alnum:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy
([[:ascii:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy__-- ${nulnul}
([[:upper:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 AB
([[:xdigit:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01
([[:^alpha:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 01
-([[:^alnum:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 __-- ${nulnul}${ffff}
+((?a)[[:^alnum:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 __-- ${nulnul}${ffff}
([[:^ascii:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ${ffff}
([[:^cntrl:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy__--
([[:^digit:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd
([[:^lower:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 AB
-([[:^print:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ${nulnul}${ffff}
+((?a)[[:^print:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ${nulnul}${ffff}
([[:^punct:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy
([[:^space:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy__--
-([[:^word:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 -- ${nulnul}${ffff}
+((?a)[[:^word:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 -- ${nulnul}${ffff}
([[:^upper:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 cd01
([[:^xdigit:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 Xy__-- ${nulnul}${ffff}
[[:foo:]] - c - POSIX class [:foo:] unknown
(?>(a+))b aaab y $1 aaa
((?>[^()]+)|\([^()]*\))+ ((abc(ade)ufh()()x y $& abc(ade)ufh()()x
(?<=x+)y - c - Variable length lookbehind not implemented
-a{37,17} - c - Can't do {n,m} with n > m
-a{37,0} - c - Can't do {n,m} with n > m
+((def){37,17})?ABC ABC y $& ABC
\Z a\nb\n y $-[0] 3
\z a\nb\n y $-[0] 4
$ a\nb\n y $-[0] 3
'abb\Z'm b\nca n - -
'abb\z'm b\nca n - -
'abb$'m b\nca n - -
+'\Aa$'m a\n\n y $& a
(^|x)(c) ca y $2 c
a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz x n - -
a(?{$a=2;$b=3;($b)=$a})b yabz y $b 2
.[X](.+)+[X][X] bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa n - -
.[X][X](.+)+[X] bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa n - -
tt+$ xxxtt y - -
-([a-\d]+) za-9z y $1 a-9
-([\d-z]+) a0-za y $1 0-z
-([\d-\s]+) a0- z y $1 0-
-([a-[:digit:]]+) za-9z y $1 a-9
-([[:digit:]-z]+) =0-z= y $1 0-z
-([[:digit:]-[:alpha:]]+) =0-z= y $1 0-z
+([a-\d]+) za-9z Sy $1 a-9
+([a-\d]+) - sc - False [] range
+([\d-z]+) a0-za Sy $1 0-z
+([\d-z]+) - sc $1 False [] range
+([\d-\s]+) a0- z Sy $1 0-
+([\d-\s]+) - sc $1 False [] range
+([a-[:digit:]]+) za-9z Sy $1 a-9
+([a-[:digit:]]+) - sc - False [] range
+([[:digit:]-z]+) =0-z= Sy $1 0-z
+([[:digit:]-z]+) - sc c False [] range
+([[:digit:]-[:alpha:]]+) =0-z= Sy $1 0-z
+([[:digit:]-[:alpha:]]+) - sc - False [] range
\GX.*X aaaXbX n - -
(\d+\.\d+) 3.1415926 y $1 3.1415926
(\ba.{0,10}br) have a web browser y $1 a web br
^([^,]{0,3},){3,}d aaa,b,c,d y $1 c,
^([^,]{0,3},){0,3}d aaa,b,c,d y $1 c,
(?i) y - -
+(?a:((?u)\w)\W) \xC0\xC0 y $& \xC0\xC0
'(?!\A)x'm a\nxb\n y - -
^(a(b)?)+$ aba y -$1-$2- -a--
^(aa(bb)?)+$ aabbaa y -$1-$2- -aa--
^.{2,3}?((?:b|a|r)+?)\1\z foobarbar y $1 bar
^(?:f|o|b){2,3}?((?:b|a|r)+?)\1\z foobarbar y $1 bar
.*a(?!(b|cd)*e).*f ......abef n - - # [perl #23030]
-x(?# x c - Sequence (?#... not terminated
-:x(?#: x c - Sequence (?#... not terminated
+x(?# - c - Sequence (?#... not terminated
+:x(?#: - c - Sequence (?#... not terminated
(WORDS|WORD)S WORDS y $1 WORD
(X.|WORDS|X.|WORD)S WORDS y $1 WORD
(WORDS|WORLD|WORD)S WORDS y $1 WORD
((?2)*)([fF]o+) fooFoFoo y $1-$2 fooFo-Foo
(<(?:[^<>]+|(?R))*>) <<><<<><>>>> y $1 <<><<<><>>>>
(?<n>foo|bar|baz) snofooewa y $1 foo
-(?<n>foo|bar|baz) snofooewa y $+{n} foo
-(?<n>foo|bar|baz)(?<m>[ew]+) snofooewa y $+{n} foo
-(?<n>foo|bar|baz)(?<m>[ew]+) snofooewa y $+{m} ew
-(?<n>foo)|(?<n>bar)|(?<n>baz) snofooewa y $+{n} foo
-(?<n>foo)(??{ $+{n} }) snofooefoofoowaa y $+{n} 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
+(?<n>foo|bar|baz)(?<m>[ew]+) snofooewa yM $+{m} ew miniperl cannot load Tie::Hash::NamedCapture
+(?<n>foo)|(?<n>bar)|(?<n>baz) snofooewa yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
+(?<n>foo)(??{ $+{n} }) snofooefoofoowaa yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
(?P<n>foo|bar|baz) snofooewa y $1 foo
-(?P<n>foo|bar|baz) snofooewa y $+{n} foo
-(?P<n>foo|bar|baz)(?P<m>[ew]+) snofooewa y $+{n} foo
-(?P<n>foo|bar|baz)(?P<m>[ew]+) snofooewa y $+{m} ew
-(?P<n>foo)|(?P<n>bar)|(?P<n>baz) snofooewa y $+{n} foo
-(?P<n>foo)(??{ $+{n} }) snofooefoofoowaa y $+{n} foo
-(?P<=n>foo|bar|baz) snofooewa c - Sequence (?P<=...) not recognized
-(?P<!n>foo|bar|baz) snofooewa c - Sequence (?P<!...) not recognized
-(?PX<n>foo|bar|baz) snofooewa c - Sequence (?PX<...) not recognized
+(?P<n>foo|bar|baz) snofooewa yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
+(?P<n>foo|bar|baz)(?P<m>[ew]+) snofooewa yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
+(?P<n>foo|bar|baz)(?P<m>[ew]+) snofooewa yM $+{m} ew miniperl cannot load Tie::Hash::NamedCapture
+(?P<n>foo)|(?P<n>bar)|(?P<n>baz) snofooewa yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
+(?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
/(?'n'foo|bar|baz)/ snofooewa y $1 foo
-/(?'n'foo|bar|baz)/ snofooewa y $+{n} foo
-/(?'n'foo|bar|baz)(?'m'[ew]+)/ snofooewa y $+{n} foo
-/(?'n'foo|bar|baz)(?'m'[ew]+)/ snofooewa y $+{m} ew
-/(?'n'foo)|(?'n'bar)|(?<n>baz)/ snobazewa y $+{n} baz
-/(?'n'foo)(??{ $+{n} })/ snofooefoofoowaa y $+{n} 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
+/(?'n'foo|bar|baz)(?'m'[ew]+)/ snofooewa yM $+{m} ew miniperl cannot load Tie::Hash::NamedCapture
+/(?'n'foo)|(?'n'bar)|(?<n>baz)/ snobazewa yM $+{n} baz miniperl cannot load Tie::Hash::NamedCapture
+/(?'n'foo)(??{ $+{n} })/ snofooefoofoowaa yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
/(?'n'foo)\k<n>/ ..foofoo.. y $1 foo
-/(?'n'foo)\k<n>/ ..foofoo.. y $+{n} foo
+/(?'n'foo)\k<n>/ ..foofoo.. yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
/(?<n>foo)\k'n'/ ..foofoo.. y $1 foo
-/(?<n>foo)\k'n'/ ..foofoo.. y $+{n} foo
-/(?:(?<n>foo)|(?<n>bar))\k<n>/ ..barbar.. y $+{n} bar
-/^(?'main'<(?:[^<>]+|(?&crap)|(?&main))*>)(?'empty')(?'crap'!>!>!>)$/ <<!>!>!>><>>!>!>!> y $+{main} <<!>!>!>><>>
+/(?<n>foo)\k'n'/ ..foofoo.. yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
+/(?:(?<n>foo)|(?<n>bar))\k<n>/ ..barbar.. yM $+{n} bar miniperl cannot load Tie::Hash::NamedCapture
+/^(?'main'<(?:[^<>]+|(?&crap)|(?&main))*>)(?'empty')(?'crap'!>!>!>)$/ <<!>!>!>><>>!>!>!> yM $+{main} <<!>!>!>><>> miniperl cannot load Tie::Hash::NamedCapture
/^(?'main'<(?:[^<>]+|(?&main))*>)$/ <<><<<><>>>> y $1 <<><<<><>>>>
-/(?'first'(?&second)*)(?'second'[fF]o+)/ fooFoFoo y $+{first}-$+{second} fooFo-Foo
-(?<A>foo)?(?(<A>)bar|nada) foobar y $+{A} foo
+/(?'first'(?&second)*)(?'second'[fF]o+)/ fooFoFoo yM $+{first}-$+{second} fooFo-Foo miniperl cannot load Tie::Hash::NamedCapture
+(?<A>foo)?(?(<A>)bar|nada) foobar yM $+{A} foo miniperl cannot load Tie::Hash::NamedCapture
(?<A>foo)?(?(<A>)bar|nada) foo-barnada y $& nada
(?<A>foo)?(?(1)bar|nada) foo-barnada y $& nada
(?<A>foo(?(R)bar))?(?1) foofoobar y $1 foo
# \k<n> preceded by a literal
/(?'n'foo) \k<n>/ ..foo foo.. y $1 foo
-/(?'n'foo) \k<n>/ ..foo foo.. y $+{n} foo
+/(?'n'foo) \k<n>/ ..foo foo.. yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
/(?<n>foo) \k'n'/ ..foo foo.. y $1 foo
-/(?<n>foo) \k'n'/ ..foo foo.. y $+{n} foo
-/(?'a1'foo) \k'a1'/ ..foo foo.. y $+{a1} foo
-/(?<a1>foo) \k<a1>/ ..foo foo.. y $+{a1} foo
-/(?'_'foo) \k'_'/ ..foo foo.. y $+{_} foo
-/(?<_>foo) \k<_>/ ..foo foo.. y $+{_} foo
-/(?'_0_'foo) \k'_0_'/ ..foo foo.. y $+{_0_} foo
-/(?<_0_>foo) \k<_0_>/ ..foo foo.. y $+{_0_} foo
-/(?'0'foo) bar/ ..foo bar.. c - Sequence (?'
-/(?<0>foo) bar/ ..foo bar.. c - Sequence (?<
-/(?'12'foo) bar/ ..foo bar.. c - Sequence (?'
-/(?<12>foo) bar/ ..foo bar.. c - Sequence (?<
-/(?'1a'foo) bar/ ..foo bar.. c - Sequence (?'
-/(?<1a>foo) bar/ ..foo bar.. c - Sequence (?<
-/(?''foo) bar/ ..foo bar.. c - Sequence (?''
-/(?<>foo) bar/ ..foo bar.. c - Sequence (?<>
-/foo \k'n'/ foo foo c - Reference to nonexistent named group
-/foo \k<n>/ foo foo c - Reference to nonexistent named group
-/foo \k'a1'/ foo foo c - Reference to nonexistent named group
-/foo \k<a1>/ foo foo c - Reference to nonexistent named group
-/foo \k'_'/ foo foo c - Reference to nonexistent named group
-/foo \k<_>/ foo foo c - Reference to nonexistent named group
-/foo \k'_0_'/ foo foo c - Reference to nonexistent named group
-/foo \k<_0_>/ foo foo c - Reference to nonexistent named group
-/foo \k'0'/ foo foo c - Sequence \\k'
-/foo \k<0>/ foo foo c - Sequence \\k<
-/foo \k'12'/ foo foo c - Sequence \\k'
-/foo \k<12>/ foo foo c - Sequence \\k<
-/foo \k'1a'/ foo foo c - Sequence \\k'
-/foo \k<1a>/ foo foo c - Sequence \\k<
-/foo \k''/ foo foo c - Sequence \\k'
-/foo \k<>/ foo foo c - Sequence \\k<
+/(?<n>foo) \k'n'/ ..foo foo.. yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
+/(?'a1'foo) \k'a1'/ ..foo foo.. yM $+{a1} foo miniperl cannot load Tie::Hash::NamedCapture
+/(?<a1>foo) \k<a1>/ ..foo foo.. yM $+{a1} foo miniperl cannot load Tie::Hash::NamedCapture
+/(?'_'foo) \k'_'/ ..foo foo.. yM $+{_} foo miniperl cannot load Tie::Hash::NamedCapture
+/(?<_>foo) \k<_>/ ..foo foo.. yM $+{_} foo miniperl cannot load Tie::Hash::NamedCapture
+/(?'_0_'foo) \k'_0_'/ ..foo foo.. yM $+{_0_} foo miniperl cannot load Tie::Hash::NamedCapture
+/(?<_0_>foo) \k<_0_>/ ..foo foo.. yM $+{_0_} foo miniperl cannot load Tie::Hash::NamedCapture
+/(?'0'foo) bar/ - c - Group name must start with a non-digit word character
+/(?<0>foo) bar/ - c - Group name must start with a non-digit word character
+/(?'12'foo) bar/ - c - Group name must start with a non-digit word character
+/(?<12>foo) bar/ - c - Group name must start with a non-digit word character
+/(?'1a'foo) bar/ - c - Group name must start with a non-digit word character
+/(?<1a>foo) bar/ - c - Group name must start with a non-digit word character
+/(?''foo) bar/ - c - Group name must start with a non-digit word character
+/(?<>foo) bar/ - c - Group name must start with a non-digit word character
+/foo \k'n'/ - c - Reference to nonexistent named group
+/foo \k<n>/ - c - Reference to nonexistent named group
+/foo \k'a1'/ - c - Reference to nonexistent named group
+/foo \k<a1>/ - c - Reference to nonexistent named group
+/foo \k'_'/ - c - Reference to nonexistent named group
+/foo \k<_>/ - c - Reference to nonexistent named group
+/foo \k'_0_'/ - c - Reference to nonexistent named group
+/foo \k<_0_>/ - c - Reference to nonexistent named group
+/foo \k'0'/ - c - Group name must start with a non-digit word character
+/foo \k<0>/ - c - Group name must start with a non-digit word character
+/foo \k'12'/ - c - Group name must start with a non-digit word character
+/foo \k<12>/ - c - Group name must start with a non-digit word character
+/foo \k'1a'/ - c - Group name must start with a non-digit word character
+/foo \k<1a>/ - c - Group name must start with a non-digit word character
+/foo \k''/ - c - Group name must start with a non-digit word character
+/foo \k<>/ - c - Group name must start with a non-digit word character
/(?<as>as) (\w+) \k<as> (\w+)/ as easy as pie y $1-$2-$3 as-easy-pie
# \g{...} with a name as the argument
/(?'n'foo) \g{n}/ ..foo foo.. y $1 foo
-/(?'n'foo) \g{n}/ ..foo foo.. y $+{n} foo
+/(?'n'foo) \g{n}/ ..foo foo.. yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
/(?<n>foo) \g{n}/ ..foo foo.. y $1 foo
-/(?<n>foo) \g{n}/ ..foo foo.. y $+{n} foo
+/(?<n>foo) \g{n}/ ..foo foo.. yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
/(?<as>as) (\w+) \g{as} (\w+)/ as easy as pie y $1-$2-$3 as-easy-pie
# Python style named capture buffer stuff
/(?P<n>foo)(?P=n)/ ..foofoo.. y $1 foo
-/(?P<n>foo)(?P=n)/ ..foofoo.. y $+{n} foo
-/(?:(?P<n>foo)|(?P<n>bar))(?P=n)/ ..barbar.. y $+{n} bar
+/(?P<n>foo)(?P=n)/ ..foofoo.. yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
+/(?:(?P<n>foo)|(?P<n>bar))(?P=n)/ ..barbar.. yM $+{n} bar miniperl cannot load Tie::Hash::NamedCapture
/^(?P<PAL>(?P<CHAR>.)((?P>PAL)|.?)(?P=CHAR))$/ madamimadam y $& madamimadam
/^(?P<PAL>(?P<CHAR>.)((?P>PAL)|.?)(?P=CHAR))$/ madamiamadam n - -
/(?P<n>foo) (?P=n)/ ..foo foo.. y $1 foo
-/(?P<n>foo) (?P=n)/ ..foo foo.. y $+{n} foo
+/(?P<n>foo) (?P=n)/ ..foo foo.. yM $+{n} foo miniperl cannot load Tie::Hash::NamedCapture
/(?P<as>as) (\w+) (?P=as) (\w+)/ as easy as pie y $1-$2-$3 as-easy-pie
#check that non identifiers as names are treated as the appropriate lookaround
(?|(?|(a)|(b))|(?|(c)|(d))) d y $1 d
(.)(?|(.)(.)x|(.)d)(.) abcde y $1-$2-$3-$4-$5- b-c--e--
(\N)(?|(\N)(\N)x|(\N)d)(\N) abcde y $1-$2-$3-$4-$5- b-c--e--
-(?|(?<foo>x)) x y $+{foo} x
-(?|(?<foo>x)|(?<bar>y)) x y $+{foo} x
-(?|(?<bar>y)|(?<foo>x)) x y $+{foo} x
-(?<bar>)(?|(?<foo>x)) x y $+{foo} x
+(?|(?<foo>x)) x yM $+{foo} x miniperl cannot load Tie::Hash::NamedCapture
+(?|(?<foo>x)|(?<bar>y)) x yM $+{foo} x miniperl cannot load Tie::Hash::NamedCapture
+(?|(?<bar>y)|(?<foo>x)) x yM $+{foo} x miniperl cannot load Tie::Hash::NamedCapture
+(?<bar>)(?|(?<foo>x)) x yM $+{foo} x miniperl cannot load Tie::Hash::NamedCapture
+# Used to crash, because the last branch was ignored when the parens
+# were counted:
+(?|(b)|()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(a)) a y $& a
#Bug #41492
(?(DEFINE)(?<A>(?&B)+)(?<B>a))(?&A) a y $& a
/\N{U+41}\x{c1}/i a\x{e1} y $& a\x{e1}
/[\N{U+41}\x{c1}]/i \x{e1} y $& \x{e1}
-[\s][\S] \x{a0}\x{a0} nT - - # Unicode complements should not match same character
+[\s][\S] \x{a0}\x{a0} n - - # Unicode complements should not match same character
# was generating malformed utf8
'[\x{100}\xff]'i \x{ff} y $& \x{ff}
# and bypasses the lexer.
/\N{U+}/ - c - Invalid hexadecimal number
# Below currently gives a misleading message
-/[\N{U+}]/ - c - Unmatched
+/[\N{U+}]/ - Sc - Unmatched
+/[\N{U+}]/ - sc - Syntax error in (?[...])
/abc\N{def/ - c - Missing right brace
/\N{U+4AG3}/ - c - Illegal hexadecimal digit
/[\N{U+4AG3}]/ - c - Illegal hexadecimal digit
# 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`\" more clearly written simply as \"\\ \"
-\c1 - c - \"\\c1\" more clearly written simply as \"q\"
+\c` - c - \"\\c`\" is more clearly written simply as \"\\ \"
+\c1 - c - \"\\c1\" is more clearly written simply as \"q\"
\cA \001 y $& \1
\400 \x{100} y $& \x{100}
[a\o{400}] \x{100} y $& \x{100}
[a\o{1000}] \x{200} y $& \x{200}
+# The below were inserting a NULL
+\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
+
# The below was inserting a NULL into the character class.
-[\8\9] \000 n - -
-[\8\9] 8 y $& 8
-[\8\9] 9 y $& 9
+[\8\9] \000 Sn - -
+[\8\9] - sc $& Unrecognized escape \\8 in character class
+[\8\9] 8 Sy $& 8
+[\8\9] 9 Sy $& 9
# Verify that reads 1-3 octal digits, and that \_ works in char class
-[\0] \000 y $& \000
-[\07] \007 y $& \007
-[\07] 7\000 n - -
+[\0] \000 Sy $& \000
+[\0] - sc - Need exactly 3 octal digits
+[\07] \007 Sy $& \007
+[\07] - sc - Need exactly 3 octal digits
+[\07] 7\000 Sn - -
+[\07] - sc - Need exactly 3 octal digits
[\006] \006 y $& \006
[\006] 6\000 n - -
[\0005] \0005 y $& \000
[\0005] 5\000 y $& 5
[\_] _ y $& _
+# RT #79152
+(q1|.)*(q2|.)*(x(a|bc)*y){2,} xayxay y $& xayxay
+(q1|.)*(q2|.)*(x(a|bc)*y){2,3} xayxay y $& xayxay
+(q1|z)*(q2|z)*z{15}-.*?(x(a|bc)*y){2,3}Z zzzzzzzzzzzzzzzz-xayxayxayxayZ y $& zzzzzzzzzzzzzzzz-xayxayxayxayZ
+
(?:(?:)foo|bar|zot|rt78356) foo y $& foo
+/\xe0\pL/i \xc0a y $& \xc0a
+
+# RT #85528
+(?{})[\x{100}] \x{100} y $& \x{100}
+
+# RT #85964
+^m?(\S)(.*)\1$ aba y $1 a
+^m?(\S)(.*)\1$ \tb\t n - -
+^m?(\s)(.*)\1$ \tb\t y $1 \t
+^m?(\s)(.*)\1$ aba n - -
+^m?(\W)(.*)\1$ :b: y $1 :
+^m?(\W)(.*)\1$ aba n - -
+^m?(\w)(.*)\1$ aba y $1 a
+^m?(\w)(.*)\1$ :b: n - -
+^m?(\D)(.*)\1$ aba y $1 a
+^m?(\D)(.*)\1$ 5b5 n - -
+^m?(\d)(.*)\1$ 5b5 y $1 5
+^m?(\d)(.*)\1$ aba n - -
+
+# 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 - -
+/s/aia S y $& S
+/(?aia:s)/ \x{17F} n - -
+/(?aia:s)/ S y $& S
+
+# Normally 1E9E generates a multi-char fold, but not in inverted class;
+# See [perl #89750]. This makes sure that the simple fold gets generated
+# in that case, to DF.
+/[^\x{1E9E}]/i \x{DF} Sn - -
+
+# RT #96354
+/^.*\d\H/ X1 n - -
+/^.*\d\V/ X1 n - -
+
+# \p{L_} was being misinterpreted as \p{L}. L_ matches cased letters, which
+# the ideograph below isn't, whereas it does match L
+/^\p{L_}/ \x{3400} n - -
+/^\p{L}/ \x{3400} y $& \x{3400}
+
+# RT #89774
+/[s\xDF]a/ui ssa Sy $& ssa
+/[s\xDF]a/ui sa y $& sa
+
+# RT #99928
+/^\R\x0A$/ \x0D\x0A n - -
+
+/ff/i \x{FB00}\x{FB01} y $& \x{FB00}
+/ff/i \x{FB01}\x{FB00} y $& \x{FB00}
+/fi/i \x{FB01}\x{FB00} y $& \x{FB01}
+/fi/i \x{FB00}\x{FB01} y $& \x{FB01}
+#
+# Make sure we don't see code blocks where there aren't, and vice-versa
+(?#( (?{1+)a a y - -
+'a# (?{1+'x a y - -
+ab[(?{1] ab1 y - -
+ab[(?{1\](?{2] ab2 y - -
+ab(?{"["})cd abcd y - -
+ab(??{"[x]"})cd abxcd y - -
+ab\[(??{1})c ab[1c y - -
+ab\\[(??{1;})]c ab\\;c y - -
+ab\\\[(??{1})c ab\\[1c y - -
+ab[c\](??{"]d abcd y - -
+ab[c\\](??{"[x]"})d ab\\xd y - -
+ab[c\\\](??{"x"})]{3}d ab\\](d y - -
+
+# These test that doesn't cut-off matching too soon in the string for
+# multi-char folds
+/ffiffl/i abcdef\x{FB03}\x{FB04} y $& \x{FB03}\x{FB04}
+/\xdf\xdf/ui abcdefssss y $& ssss
+
+/st/i \x{DF}\x{FB05} y $& \x{FB05}
+/ssst/i \x{DF}\x{FB05} y $& \x{DF}\x{FB05}
+
+# [perl #101970]
+/[[:lower:]]/i \x{100} y $& \x{100}
+/[[:upper:]]/i \x{101} y $& \x{101}
+
+# Was matching 'ss' only and failing the entire match, not seeing the
+# alternative that would succeed
+/s\xDF/ui \xDFs y $& \xDFs
+/sst/ui s\N{LATIN SMALL LIGATURE ST} y $& s\N{LATIN SMALL LIGATURE ST}
+/sst/ui s\N{LATIN SMALL LIGATURE LONG S T} y $& s\N{LATIN SMALL LIGATURE LONG S T}
+
+# /i properties shouldn't match more than the property itself
+/[[:ascii:]]/i \N{KELVIN SIGN} n - -
+
+# [[:lower:]]/i and [[:upper:]]/i should match what \p{Lower} and \p{Upper} do.
+# which is \p{Cased}, not \p{Alpha},
+/[[:lower:]]/i \N{U+3400} n - -
+/[[:upper:]]/i \N{U+01BB} n - -
+
+# [perl #110648]
+[^\p{Alphabetic}] \x{100} n - -
+
+# [perl #111400]. Tests the first Y/N boundary above 255 for each of these.
+/[[:alnum:]]/ \x{2c1} y - -
+/[[:alnum:]]/ \x{2c2} n - -
+/[[:alpha:]]/ \x{2c1} y - -
+/[[:alpha:]]/ \x{2c2} n - -
+/[[:graph:]]/ \x{377} y - -
+/[[:graph:]]/ \x{378} n - -
+/[[:lower:]]/ \x{100} n - -
+/[[:lower:]]/ \x{101} y - -
+/[[:lower:]]/ \x{102} n - -
+/[[:print:]]/ \x{377} y - -
+/[[:print:]]/ \x{378} n - -
+/[[:punct:]]/ \x{37D} n - -
+/[[:punct:]]/ \x{37E} y - -
+/[[:punct:]]/ \x{388} n - -
+/[[:upper:]]/ \x{100} y - -
+/[[:upper:]]/ \x{101} n - -
+/[[:word:]]/ \x{2c1} y - -
+/[[:word:]]/ \x{2c2} n - -
+
+# [perl #113400]
+/syntax OK\s+\z/si t/bin/good.pl syntax OK\n y - -
+
+/^(.*?)\s*\|\s*(?:\/\s*|)'(.+)'$/ text|'sec' y <$1><$2> <text><sec>
+/^(foo|)bar$/ bar y <$&> <bar>
+/^(foo||baz)bar$/ bar y <$&> <bar>
+/^(foo||baz)bar$/ bazbar y <$1> <baz>
+/^(foo||baz)bar$/ foobar y <$1> <foo>
+
+/^(?:foo|)bar$/ bar y <$&> <bar>
+/^(?:foo||baz)bar$/ bar y <$&> <bar>
+/^(?:foo||baz)bar$/ bazbar y <$&> <bazbar>
+/^(?:foo||baz)bar$/ foobar y <$&> <foobar>
+
+/^(?i:foo|)bar$/ bar y <$&> <bar>
+/^(?i:foo||baz)bar$/ bar y <$&> <bar>
+/^(?i:foo||baz)bar$/ bazbar y <$&> <bazbar>
+/^(?i:foo||baz)bar$/ foobar y <$&> <foobar>
+
+# $^N, $+ on backtrackracking
+# BRANCH
+^(.)(?:(..)|B)[CX] ABCDE y $^N-$+ A-A -
+# TRIE
+^(.)(?:BC(.)|B)[CX] ABCDE y $^N-$+ A-A -
+# CURLYX
+^(.)(?:(.)+)*[BX] ABCDE y $^N-$+ A-A -
+# CURLYM
+^(.)(BC)* ABCDE y $^N-$+ BC-BC -
+^(.)(BC)*[BX] ABCDE y $^N-$+ A-A -
+# CURLYN
+^(.)(B)*.[DX] ABCDE y $^N-$+ B-B -
+^(.)(B)*.[CX] ABCDE y $^N-$+ A-A -
+
+# using 'return' in code blocks
+^(A)(?{"xyz"})B$ AB y $1-$^R A-xyz -
+^(A)(?{return "xyz"})B$ AB y $1-$^R A-xyz -
+^(A)((??{"xyz"}))$ Axyz y $1-$2 A-xyz -
+^(A)((??{return "xyz"}))$ Axyz y $1-$2 A-xyz -
+^(A)((?(?{1})abc|xyz))$ Aabc y $1-$2 A-abc -
+^(A)((?(?{0})abc|xyz))$ Axyz y $1-$2 A-xyz -
+^(A)((?(?{return 1})abc|xyz))$ Aabc y $1-$2 A-abc -
+^(A)((?(?{return 0})abc|xyz))$ Axyz y $1-$2 A-xyz -
+
+# pattern modifier flags should propagate into returned (??{}) pattern
+# p,d,l not tested
+
+/^(a)((??{"b"}))$/i AB y $1-$2 A-B -
+/^(A)((??{'B$'}))(\nC)$/m AB\nC y $1-$2-$3 A-B-\nC -
+/^(A)((??{'.'}))(B)$/s A\nB y $1-$2-$3 A-\n-B -
+/^(A) ((??{' .'}))(B)$/x A B y $1-$2-$3 A- -B -
+/^((??{'\d'}))$/a \x{660} n - -
+/^(??{"s"})$/i \x{17F} y - -
+/^(??{"s"})$/ia \x{17F} y - -
+/^(??{"s"})$/iaa \x{17F} n - -
+/^(??{'\w'})$/u \x{AA} y - -
+
+# #113670 ensure any captures to the right are invalidated when CURLY
+# and CURLYM backtrack
+
+^(?:(X)?(\d)|(X)?(\d\d))$ X12 y $1-$2-$3-$4 --X-12
+^(?:(XX)?(\d)|(XX)?(\d\d))$ XX12 y $1-$2-$3-$4 --XX-12
+
+# rt 113770
+\A(?>\[(?:(?:)(?:R){1}|T|V?|A)\])\z [A] y $& [A]
+# rt 114068
+/( [^z] $ [^z]+)/xm aa\nbb\ncc\n y $1 a\nbb\ncc\n
+
+# [perl #114220]
+/[\h]/ \x{A0} y $& \xA0
+/[\H]/ \x{BF} y $& \xBF
+/[\H]/ \x{A0} n - -
+/[\H]/ \x{A1} y $& \xA1
+
+[^\n]+ \nb y $& b
+[^\n]+ a\n y $& a
+
+# /a has no effect on properties
+(?a:\p{Any}) \x{100} y $& \x{100}
+(?aa:\p{Any}) \x{100} y $& \x{100}
+
+\w \x{200C} y $& \x{200C}
+\W \x{200C} n - -
+\w \x{200D} y $& \x{200D}
+\W \x{200D} n - -
+
+/^(?d:\xdf|_)*_/i \x{17f}\x{17f}_ y $& \x{17f}\x{17f}_
+#
+# check that @-, @+ count chars, not bytes; especially if beginning of
+# string is not copied
+
+(\x{100}) \x{2000}\x{2000}\x{2000}\x{100} y $-[0]:$-[1]:$+[0]:$+[1] 3:3:4:4
+
+^\R{2}$ \r\n\r\n y $& \r\n\r\n
+
+/^\D{11}/a \x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF} n - -
+/^\S{11}/a \x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF} n - -
+/^\W{11}/a \x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF}\x{10FFFF} n - -
+
+# [ perl #114272]
+\Vn \xFFn/ y $& \xFFn
+
+/(?l:a?\w)/ b y $& b
+m?^xy\?$? xy? y $& xy?
+
+# 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
# vim: softtabstop=0 noexpandtab
+/[#]/ 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