Maybe you want r'\b'.  From 'pydoc sre':
    \b       Matches the empty string, but only at the start or end of a word.


import re
r = re.compile( r'\btest\b' )
print r.findall("testy")
print r.findall(" testy ")
print r.findall(" test ")
print r.findall("test")

Attachment: pgps8PNW4uDgh.pgp
Description: PGP signature

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to