Hacker News new | ask | show | jobs
by poleguy 1491 days ago
99 times out of 100 when I think I might need a regular expression, I find it far better to code the search in python directly rather than using the regular expression engine at all. It's far easier to understand and you can run a regular debugger on it and use regular comments. In the 100'th case, I'll code most of the expression in straight python and a very small piece using the regular expression engine.

By straight python I mean things like 'for', 'split', 'startswith', 'find', and regular character indexing.

So for me this post is a solution to a problem that I just avoid.