Andrew Dunstan <and...@dunslane.net> writes: > I'm a bit worried about how you'll keep track of back-ref numbering > since back-refs only count capturing groups, and you're silently turning > a capturing group into a non-capturing group.
They're already numbered at this point, and we aren't changing the numbers of the capturing groups that remain live. There will be unused entries in the regmatch_t array at runtime (corresponding to the zapped groups), but that doesn't cost anything worth mentioning. Now that you mention it, I am not sure whether there are any regression test cases that specifically cover still being able to match \2 when the first capture group went away. Probably should add more cases... regards, tom lane