Hacker News new | past | comments | ask | show | jobs | submit login

I'm not familiar with the AoC problem. You might be able to. But RegexSet doesn't give you match offsets.

You can drop down to regex-automata, which does let you do multi-regex search and it will tell you which patterns match[1]. The docs have an example of a simple lexer[2]. But... that will only give you non-overlapping matches.

You can drop down to an even lower level of abstraction and get multi-pattern overlapping matches[3], but it's awkward. The comment there explains that I had initially tried to provide a higher level API for it, but was unsure of what the semantics should be. Getting the starting position in particular is a bit of a wrinkle.

[1]: https://docs.rs/regex-automata/latest/regex_automata/meta/in...

[2]: https://docs.rs/regex-automata/latest/regex_automata/meta/st...

[3]: https://github.com/rust-lang/regex/blob/837fd85e79fac2a4ea64...




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: