http://docs.python.org/2/library/re.html
But to read and know all and practice immediately, this is really hard. In this article, I will share you some powerful regular expression tools.
Kodos:
Kodos is a free, opensource software, cross platform. With this software, we can try regular expression with many options, new version of it support replace and generates to sample codes.
Pythonregex
Homepage: http://www.pythonregex.com/
Like Kodos but it generates code more details and measure runtime like this:
>>> regex = re.compile("(?P<key>\w*?)=(?P<value>\w*?)\s|$")
>>> r = regex.search(string)
>>> r
<_sre.SRE_Match object at 0x53bb4f400b615b08>
>>> regex.match(string)
<_sre.SRE_Match object at 0x53bb4f400b615880>
# List the groups found
>>> r.groups()
(u'color', u'fsck')
# List the named dictionary objects found
>>> r.groupdict()
{u'key': u'color', u'value': u'fsck'}
# Run findall
>>> regex.findall(string)
[(u'color', u'fsck'), (u'animal', u'aasvogel'), (u'vegetable', u'rutabaga'), (u'', u'')]
# Run timeit test
>>> setup = ur"import re; regex =re.compile("(?P<key>\w*?)=(?P<value>\w*?)\s|$");string="" ...
>>> t = timeit.Timer('regex.search(string)',setup)
>>> t.timeit(10000)
0.0131378173828