diff options
-rw-r--r-- | regcomp.c | 7 | ||||
-rw-r--r-- | t/op/re_tests | 5 |
2 files changed, 12 insertions, 0 deletions
@@ -6138,6 +6138,13 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth) /* Pick up the branches, linking them together. */ parse_start = RExC_parse; /* MJD */ br = regbranch(pRExC_state, &flags, 1,depth+1); + + if (freeze_paren) { + if (RExC_npar > after_freeze) + after_freeze = RExC_npar; + RExC_npar = freeze_paren; + } + /* branch_len = (paren != 0); */ if (br == NULL) diff --git a/t/op/re_tests b/t/op/re_tests index 0c04840117..89934fd494 100644 --- a/t/op/re_tests +++ b/t/op/re_tests @@ -1311,6 +1311,11 @@ X(\w+)(?=\s)|X(\w+) Xab y [$1-$2] [-ab] (?|(?|(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 + #Bug #41492 (?(DEFINE)(?<A>(?&B)+)(?<B>a))(?&A) a y $& a (?(DEFINE)(?<A>(?&B)+)(?<B>a))(?&A) aa y $& aa |