Re: [PATCH] regex: fix backreference matching

2021-07-05 Thread Dmitry V. Levin
On Tue, Jun 29, 2021 at 11:51:13AM +0300, Egor Ignatov wrote: > Well, then I have a few questions about matching and capturing > groups. > > 1. "ab" -> "^(a*)*(.)" > So, from your test case I can assume that: > regs[0] = (0, 2] > regs[1] = (0, 1] > regs[2] = (1, 2] > > But if we add backref at th

Re: [PATCH] regex: fix backreference matching

2021-06-29 Thread Egor Ignatov
Well, then I have a few questions about matching and capturing groups. 1. "ab" -> "^(a*)*(.)" So, from your test case I can assume that: regs[0] = (0, 2] regs[1] = (0, 1] regs[2] = (1, 2] But if we add backref at the end: 2. "ab" -> "^(a*)*(.)\1" check_matching matches the whole string "ab", thi

Re: [PATCH] regex: fix backreference matching

2021-06-16 Thread Dmitry V. Levin
On Wed, Jun 16, 2021 at 12:46:15PM +0300, Egor Ignatov wrote: > This fixes a bug described in 70b673eb7. [...] > - { "^(a*)*(.)", "ab", REG_EXTENDED, 3, { { 0, 2 }, { 0, 1 }, { 1, 2 } } }, > + { "^(a*)*(.)", "ab", REG_EXTENDED, 3, { { 0, 2 }, { 1, 1 }, { 1, 2 } } }, Sorry, but how this could be

[PATCH] regex: fix backreference matching

2021-06-16 Thread Egor Ignatov
This fixes a bug described in 70b673eb7. * lib/regexec.c (set_regs): Revert pop condition changed in the commit mentioned above. (proceed_next_node): Always proceed on OP_BACK_REF to the next node if naccepted is 0. (update_regs): Fix optional sub expression boundaries matching. * tests/test-regex