25 nov. 2020 kl. 22.39 skrev Stefan Kangas : > I personally worry about the performance here. Since we use regexps > heavily all over, it is not clear (to me) that 10 % overall performance > drop with subexpressions is worth it to work correctly in these rare > edge-cases. I suppose we do have to fix the bug here, but is it > feasible to solve this in a way that has less performance impact? We can't really let it remain buggy, especially as the consequence can be an error or silently wrong results. Also remember that one man's edge case is another's reasonable use. However, unlike Boris we can eat our cake and have it! The attached patch performs the match-data translation in a C function, which obviously is much faster and indeed speeds up replace-regexp-in-string in all cases (as long as there is any match at all). The new primitive is a bit ad-hoc, but does one well-defined thing and isn't intended for use by the general public anyway.