Nested Backreferences #xe5 tests greediness

Hello,
The last stage of the backreferences extension (#xe5) has a case that test greediness:

echo -n "abc-def is abc-def, not efg, abc, or def" | ./your_program.sh -E "(([abc]+)-([def]+)) is \1, not ([^xyz]+), \2, or \3"

([^xyz]+) matches the rest of the string efg.... To pass the test, you need to take into account greediness and backtracking. This behavior is never tested before. I think this is not a good way to introduce it and would be better in a separated extension.

Thanks @Gamma120 for highlighting this! I’ve shared your feedback with our team, and added an internal +1 for your vote on a new extension.

In the meantime, feel free to personally vote on a new extension.

1 Like