I just finished answering a question in #python because someone tried to match using ... well.. match() but did not realize that match() is actually startswith() for regexps. I suggest: re.compile('blah').atstartof(string) re.compile('blah').atendof(string) But it will never happen.