Simple regular expression

python_enthu srhegde at gmail.com
Fri Jun 27 10:00:52 EDT 2008


I am trying this.. what is wrong in this..

IDLE 1.2.2
>>> import re
>>> a="my name is fname lname"
>>> p=re.compile('name')
>>> m=p.match (a)
>>> print p.match(a)
None


findall() seems to work

>>> print p.findall(a)
['name', 'name', 'name']



More information about the Python-list mailing list