May 21st, 2004, 09:20 AM
There is a tutorial at http://www.amk.ca/python/howto/regex/
The book 'Text Processing in Python' by David Mertz has a chapter on regular expressions. You can find a web copy of the book at http://gnosis.cx/TPiP/
In answer to your second question:
>>> import re
>>> s = " What a nice day guys. hello it's me Omega "
>>> match = re.search(r'hello(.*)', s)
" it's me Omega "
The regular expression "hello(.*)" will match the "hello", then assign all the text after it to a group, which can then be extracted from the match object.
Dave - The Developers' Coach
Last edited by DevCoach : May 21st, 2004 at 09:23 AM.