Great article, good topic. If you’re an expert, there’s no reason not to add regexes to your bag of tricks. The key is to understand not only what happens logically, but also the runtime consequences. For example, take PCRE2, an ubiquitously available library. In this flavor of extended regex, you can use greedy matching (i.e., \d++). Used right, along with other constructs, you can judiciously avoid backtracking by the regex state machine and make your regexes fast and lean. I would advise not to be afraid of them, but like swords, to respect them and understand how to work with them. So it is often with powerful things. :)
Since I would not consider myself as an expert, I would not do it :)
I would still vote against if there is any more readable alternative. Strive for readability/maintainability and only optimize for speed if it’s necessary.
Of course! Makes sense.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.