nitely / nim-regex

Pure Nim regex engine. Guarantees linear time matching
https://nitely.github.io/nim-regex/
MIT License
227 stars 20 forks source link

findAll fix #13 #63

Closed nitely closed 4 years ago

nitely commented 4 years ago

Fixes #13 Fixes #29 (except for the last example)

This is a hack not a hack, since find needs this anyway (to keep the same behaviour as re/nre). A better fix would not call find in findAll repeatedly, it'd implement the matchImpl as an iterator. Also, that change would enable data stream input for findAll (issue #14). However, that's a more involved change as it'd require to prune the capture tree after some threshold (i.e: the first X nodes are no longer useful when the first parallel/submatch state boundaries are > X) of N KiB, and discard overlapping submatch states after a match.

^ update: the above is simpler now that there is no multi capture support, and no capture tree. The better fix was implemented a while ago, and overlapping submatch states are discarded.

timotheecour commented 4 years ago

seems to cause regression https://github.com/nitely/nim-regex/issues/64