Re:The Fall Of Perl, The Web's Most Promising Language
by maxerickson on Monday February 24, 2014 @08:57AM
(#7290714)
It's more a matter of different design taste than it is an optimization.
(I don't think it is controversial that Python has a relatively simple language definition/grammar/etc; regex as language syntax would expand all of that quite a bit)
Being able to use Regex easily is a plus in my book. Yes they are lower than some dedicated string search or some state machine ad-hoc implementation, but you can document Regexes and they pack a lot of punch.
If a Regex is causing a concern in term of performance, then it may be time to review that code and optimise it, otherwise why even bother?
When people talk about Regex being bad and they say you can often use string manipulation instead they only talk about the most trivial uses of Regex.
As soon as you go beyond that, using a Regex is almost always going to be cleaner than spewing lines of codes and building state machines to achieve the same functionality.