nitely / nim-regex

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

Support split with captures #8

Closed nitely closed 6 years ago

nitely commented 6 years ago

Apparently this is a useful feature:

assert "a,b".split(re"(,)") == @["a", ",", "b"]
hendrikgit commented 6 years ago

Hello, that is a coincidence. I was just about to write you a mail asking if this was possible when I saw this. I'm trying to make docopt work with your nim-regex and found that this is indeed my main problem. If you are adding this feature I'll wait with further workarounds. Thank you :)

nitely commented 6 years ago

I check nim's IRC logs from time to time :smile: . docopt used to have a split_incl function [0] when it used re instead of nre, so you use that as a workaround if you need it right now.

[0] https://github.com/docopt/docopt.nim/commit/0aaf814d3c884f83d7d0b232192a4e9dba9a73d2#diff-fb2b8a1303af4bbea06de1907212a8b4L26