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

Support binary input #108

Closed nitely closed 9 months ago

nitely commented 2 years ago

Add support to match on binary input. The -u flag is not enough because the input is iterated as Runes. The Regex object should contain a binary_mode flag so the input is treated as binary data in all the APIs.

The regex pattern supports \x{007F} and \u007F to match raw bytes so we don't need to treat it as binary. Throw an error if a unicode char is found, as it won't ever match the input. It must generate the nodes to match ASCII.