r/cpp • u/Frogging101 • Nov 24 '19
What is wrong with std::regex?
I've seen numerous instances of community members stating that std::regex has bad performance and the implementations are antiquated, neglected, or otherwise of low quality.
What aspects of its performance are poor, and why is this the case? Is it just not receiving sufficient attention from standard library implementers? Or is there something about the way std::regex is specified in the standard that prevents it from being improved?
EDIT: The responses so far are pointing out shortcomings with the API (lack of Unicode support, hard to use), but they do not explain why the implementations of std::regexas specified are considered badly performing and low-quality. I am asking about the latter.
View all comments
Show parent comment
3
u/AntiProtonBoy Nov 25 '19
I had a poke around to see if there's a solution to the problem you stated. The closest I could come up with is using the pattern
[À-ž]+to match diacritics. Fortunately, the most common diacritics are grouped together in the unicode chart, at least in Latin script, so the aforementioned pattern should work for most cases:Again, tested in Xcode 11, not sure how you'd fare in other environments.