‘How to learn regular expression in Python?’ - a very common question from the beginners or Python newbies. Well… if you can use regular expression in Perl or PHP, then it’s not very different in Python.
And if you are completely new to regular expression and want to learn it, then you can follow the following guideline:
[Update on Oct 30, 2010]: I think you should start with this video on regular expression .
At first, you should be to read Regular Expression HowTo by A.M. Kuchling. Read it carefully and read it at least twice :)
So… now you have finished reading Regular Expression How To and still not very confident. Don’t worry. It’s time to dive into regular expression. Just go through Chapter 7 Regular Expressions of Dive Into Python. Don’t forget to code each and every example. There are some nice case studies. Those will help (it was really helpful in my case).
And now it’s time for you to check details about the re module from python doc.
By this time you should be a good player of regular expressions and can use it to solve practical problems.
Still want to be a master? Then you should read this: Mastering Regular Expressions (I haven’t read it yet though ;)