Closed kaushalmodi closed 4 years ago
as mentioned in https://github.com/nim-lang/Nim/issues/9306#issue-369016855 what nre does here seems correct, and what nim-regex should do
Using nre:
import nre
echo replace("bar", re"^", "foo")
echo replace("foo", re"$", "bar")
echo replace("foo", re"", "-")
produces:
foobar
foobar
-f-o-o-
I think this a duplicate of https://github.com/nitely/nim-regex/issues/13. I'll try to fix it (again) this weekend soon. IIRC, it's not as easy as implementing the nre version of this function, there is some issue in how empty matches are handled.
Thank you!!
See https://github.com/nim-lang/Nim/issues/9306.
produces: