Open fwgreen opened 4 months ago
This is wanted! We've had a few PRs in the past but none of them were completed
I took a quick look at this at it seems that there are native regex replace functions that should work for both JS and Erlang.
The String.prototype.replace() or String.prototype.replaceAll() methods should work here. They both require that regexes have the global flag set and the external compile_regex
method does that by default already.
The re:replace/4 method should do the trick. It will likely require specifying the global option though to make sure it replaces all occurrences.
This seems to be the most recent PR that tried to tackle this feature request.
Should this be closed since https://github.com/gleam-lang/stdlib/pull/638 was merged?
My own naive implementation seems a bit slow with larger strings:
I'm hoping the target runtimes have something faster.