2018-05-07 21:56 GMT+02:00 Neil Girdhar email@example.com:
Regular expressions are not just "an order of magnitude better"—they're asymptotically faster. See https://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm for a non-regular-expression algorithm.
[Jacco wrote, capitalized important words] regular expressions would probably be AT LEAST an order of magnitude better in speed, if it's a bottleneck to you. But pure python implementation for this is a lot easier than it would be for the current string.count().
But I think my point stands that that's what you need to do if speed is an issue, and python code is fine when it isn't.
Also, intersting read. Thanks.