http://docs.python.org/py3k/library/re.html "Note that patterns which start with positive lookbehind assertions will never match at the beginning of the string being searched; you will most likely want to use the search() function rather than the match() function:" >>> re.match(r'(?<=^)abc', 'abc').group() 'abc' >>> re.match(r'(?<=\b)abc', 'abc').group() 'abc' >>> re.match(r'(?<=\A)abc', 'abc').group() 'abc' >>> re.match(r'(?<=\A)abc', 'abc', re.DEBUG).group() assert -1 at at_beginning_string literal 97 literal 98 literal 99 'abc' >>> in some cases match() can match
Technically you are correct, however using zero-width classes inside a lookbehind doesn't make much sense, because the result would be equivalent even without lookbehind. I replaced 'never' with 'not', because usually it will not match, except in these corner cases that can IMHO be ignored.