(original) (raw)

import re r = re.compile(r'(a?)+?y') res = r.match('z') assert not res