-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
replace has problems with empty strings #394
Labels
Comments
This is probably a dupe of #393, but we can leave this open until a fix confirms. |
Lapin0t
added a commit
to Lapin0t/regex
that referenced
this issue
Aug 20, 2017
Lapin0t
added a commit
to Lapin0t/regex
that referenced
this issue
Oct 15, 2017
bors
added a commit
that referenced
this issue
Nov 9, 2017
Fix `Regex::replacen` when replacing an empty match. Fixes #393, #394. There was some logic error when deciding to return `Cow::Borrowed` vs `Cow::Owned` in the fast-path. I took the same solution as the slow-path, ie use `peekable` on the iterator. I'm not sure this is the most efficient way (maybe just add `mut did_replace = false` and set it to true in the loop), but it does the job.
ethanpailes
pushed a commit
to ethanpailes/regex
that referenced
this issue
Nov 29, 2017
Fixed by #395 |
ethanpailes
pushed a commit
to ethanpailes/regex
that referenced
this issue
Dec 8, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seems like a replace has problems processing empty strings. example:
That fails. however:
That one passes.
Thanks to lapinot I've workaround here:
The text was updated successfully, but these errors were encountered: