remove trait implementation of `std::str::pattern::Pattern`
BurntSushi opened this issue · 1 comments
While the Pattern trait sat unchanged for years, it seems that recently, some breaking changes have been landing to it:
And truthfully, I don't like the idea of regex compilation depending on unstable features and thus being apt to break arbitrarily. In the most recent case, it seems like it just broke due to an API oversight. And since it's an unstable API, not a lot of attention is paid to quality control on these APIs.
My sense is that there are a number of folks using this trait implementation for one reason or another. In particular, when a breakage does occur, it seems to get reported very quickly. So I wanted to file this issue to hear from folks relying on this. Why are you using unstable APIs instead of just using a Regex directly?
Regex::replace is unsightly when chaining replaces, especially with regular strings, e.g.
haystack.replace(re_a, rep)
.replace("regular string", rep)
.replace(re_b, rep)becomes
re_b.replace(re_a.replace(haystack, rep).replace("regular string", rep), rep)