When using nested capture groups, the position of the parent capture group is not correct. Use backtrack search (when index = -1).