Here's my REG_STARTEND patch, mostly copied from the original tre[1] implementation. It's only lightly tested. [1] https://github.com/laurikari/tre/