Regular expressions

Michael Torrie torriem at gmail.com
Mon Nov 2 23:38:04 EST 2015


On 11/02/2015 09:23 PM, rurpy--- via Python-list wrote:
>> My completely unsolicited advice is that regular expressions shouldn't be
>> very high on the list of things to learn.  They are very useful, and very
>> tricky and prone many problems that can and should be learned to be
>> resolved with much simpler methods.  If you really want to learn regular
>> expressions, that's great but the problem you posed is not one for which
>> they are the best solution.  Remember simpler is better than complex.
> 
> Regular expressions should be learned by every programmer or by anyone
> who wants to use computers as a tool.  They are a fundamental part of
> computer science and are used in all sorts of matching and searching 
> from compilers down to your work-a-day text editor.
> 
> Not knowing how to use them is like an auto mechanic not knowing how to 
> use a socket wrench.

Not quite.  Core language concepts like ifs, loops, functions,
variables, slicing, etc are the socket wrenches of the programmer's
toolbox.  Regexs are like an electric impact socket wrench.  You can do
the same work without it, but in many cases it's slower. But you have to
learn the other hand tools first in order to really use the electric
driver properly (understanding torques, direction of threads, etc), lest
you wonder why you're breaking off so many bolts with the torque of the
impact drive.





More information about the Python-list mailing list