This may or may not be part of the same bug, but regml(N) gives the N'th non-empty group rather than the N'th group.

Code:
//noop $regex(test regml,/(test)\s(a\s)?(regml)/) | echo -a Number of groups captured: $regml(0) - Group 1: $regml(1) - Group 2: $regml(2) - Group 3: $regml(3)


results in

Code:
Number of groups captured: 2 - Group 1: test - Group 2: regml - Group 3:


when it should be

Code:
Number of groups captured: 3 - Group 1: test - Group 2: - Group 3: regml