Jeff Epler wrote: > 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") That works great. Thanks for the tip!