([a-c]*)\1 abcabc y $1 abc
\1 - c - Reference to nonexistent group
\2 - c - Reference to nonexistent group
+\g1 - c - Reference to nonexistent group
+\g-1 - c - Reference to nonexistent or unclosed group
+\g{1} - c - Reference to nonexistent group
+\g{-1} - c - Reference to nonexistent or unclosed group
+\g0 - c - Reference to invalid group 0
+\g-0 - c - Reference to invalid group 0
+\g{0} - c - Reference to invalid group 0
+\g{-0} - c - Reference to invalid group 0
(a)|\1 a y - -
(a)|\1 x n - -
(a)|\2 - c - Reference to nonexistent group
((\3|b)\2(a)x)+ aaxabxbaxbbx n - -
((\3|b)\2(a)x)+ aaaxabaxbaaxbbax y $&-$1-$2-$3 bbax-bbax-b-a
((\3|b)\2(a)){2,} bbaababbabaaaaabbaaaabba y $&-$1-$2-$3 bbaaaabba-bba-b-a
+#Bug #3589 - up to perl-5.6.0 matches incorrectly, from 5.6.1 not anymore
+^((.)?a\2)+$ babadad n - -
(a)|(b) b y $-[0] 0
(a)|(b) b y $+[0] 1
(a)|(b) b y x$-[1] x
a(?{"{"})b - c - Sequence (?{...}) not terminated or not {}-balanced
a(?{"\{"})b cabd y $& ab
a(?{"{"}})b - c - Unmatched right curly bracket
-a(?{$bl="\{"}).b caxbd y $bl {
+a(?{$::bl="\{"}).b caxbd y $::bl {
x(~~)*(?:(?:F)?)? x~~ y - -
^a(?#xxx){3}c aaac y $& aaac
'^a (?#xxx) (?#yyy) {3}c'x aaac y $& aaac
^(??{q(.+)})\x{100} \x{100}\x{100} y $& \x{100}\x{100}
^(??{q(.)})\x{100} \x{100}\x{100} y $& \x{100}\x{100}
^(??{chr 0x100})\xbb \x{100}\x{bb} y $& \x{100}\x{bb}
-\x{100}?(??{""})xxx xxx y $& xxx
^(.)(??{"(.)(.)"})(.)$ abcd y $1-$2 a-d
^(.)(??{"(bz+|.)(.)"})(.)$ abcd y $1-$2 a-d
^(.)((??{"(.)(cz+)"})|.) abcd y $1-$2 a-b
(?<=bar>ABC)foo bar>ABCfoo y $& foo
(?<!bar>ABC)foo bar>ABCfoo n - -
(?<bar>)foo bar>ABCfoo y $& foo
-(?<bar>ABC)foo bar>ABCfoo y $& ABCfoo
\ No newline at end of file
+(?<bar>ABC)foo bar>ABCfoo y $& ABCfoo
+
+(?<=abcd(?<=(aaaabcd))) ..aaaabcd.. y $1 aaaabcd
+(?=xy(?<=(aaxy))) ..aaxy.. y $1 aaxy
+
+X(\w+)(?=\s)|X(\w+) Xab y [$1-$2] [-ab]
+
+#check that branch reset works ok.
+(?|a(.)b|d(.(o).)d|i(.)(.)j)(.) d!o!da y $1-$2-$3 !o!-o-a
+(?|a(.)b|d(.(o).)d|i(.)(.)j)(.) aabc y $1-$2-$3 a--c
+(?|a(.)b|d(.(o).)d|i(.)(.)j)(.) ixyjp y $1-$2-$3 x-y-p
+(?|(?|(a)|(b))|(?|(c)|(d))) a y $1 a
+(?|(?|(a)|(b))|(?|(c)|(d))) b y $1 b
+(?|(?|(a)|(b))|(?|(c)|(d))) c y $1 c
+(?|(?|(a)|(b))|(?|(c)|(d))) d y $1 d
+(.)(?|(.)(.)x|(.)d)(.) abcde y $1-$2-$3-$4-$5- b-c--e--
+#Bug #41492
+(?(DEFINE)(?<A>(?&B)+)(?<B>a))(?&A) a y $& a
+(?(DEFINE)(?<A>(?&B)+)(?<B>a))(?&A) aa y $& aa
+\x{100}?(??{""})xxx xxx y $& xxx
+
+foo(\R)bar foo\r\nbar y $1 \r\n
+foo(\R)bar foo\nbar y $1 \n
+foo(\R)bar foo\rbar y $1 \r
+
+foo(\R+)bar foo\r\n\x{85}\r\n\nbar y $1 \r\n\x{85}\r\n\n
+(\V+)(\R) foo\r\n\x{85}\r\n\nbar y $1-$2 foo-\r\n
+(\R+)(\V) foo\r\n\x{85}\r\n\nbar y $1-$2 \r\n\x{85}\r\n\n-b
+foo(\R)bar foo\x{85}bar y $1 \x{85}
+(\V)(\R) foo\x{85}bar y $1-$2 o-\x{85}
+(\R)(\V) foo\x{85}bar y $1-$2 \x{85}-b
+foo(\R)bar foo\r\nbar y $1 \r\n
+(\V)(\R) foo\r\nbar y $1-$2 o-\r\n
+(\R)(\V) foo\r\nbar y $1-$2 \r\n-b
+foo(\R)bar foo\r\nbar y $1 \r\n
+(\V)(\R) foo\r\nbar y $1-$2 o-\r\n
+(\R)(\V) foo\r\nbar y $1-$2 \r\n-b
+foo(\R)bar foo\rbar y $1 \r
+(\V)(\R) foo\rbar y $1-$2 o-\r
+(\R)(\V) foo\rbar y $1-$2 \r-b
+
+foo(\v+)bar foo\r\n\x{85}\r\n\nbar y $1 \r\n\x{85}\r\n\n
+(\V+)(\v) foo\r\n\x{85}\r\n\nbar y $1-$2 foo-\r
+(\v+)(\V) foo\r\n\x{85}\r\n\nbar y $1-$2 \r\n\x{85}\r\n\n-b
+foo(\v)bar foo\x{85}bar y $1 \x{85}
+(\V)(\v) foo\x{85}bar y $1-$2 o-\x{85}
+(\v)(\V) foo\x{85}bar y $1-$2 \x{85}-b
+foo(\v)bar foo\rbar y $1 \r
+(\V)(\v) foo\rbar y $1-$2 o-\r
+(\v)(\V) foo\rbar y $1-$2 \r-b
+
+
+foo(\h+)bar foo\t\x{A0}bar y $1 \t\x{A0}
+(\H+)(\h) foo\t\x{A0}bar y $1-$2 foo-\t
+(\h+)(\H) foo\t\x{A0}bar y $1-$2 \t\x{A0}-b
+foo(\h)bar foo\x{A0}bar y $1 \x{A0}
+(\H)(\h) foo\x{A0}bar y $1-$2 o-\x{A0}
+(\h)(\H) foo\x{A0}bar y $1-$2 \x{A0}-b
+foo(\h)bar foo\tbar y $1 \t
+(\H)(\h) foo\tbar y $1-$2 o-\t
+(\h)(\H) foo\tbar y $1-$2 \t-b
+
+.*\z foo\n y - -
+^(?:(\d)x)?\d$ 1 y ${\(defined($1)?1:0)} 0
+.*?(?:(\w)|(\w))x abx y $1-$2 b-