# Example from https://docs.python.org/3/howto/regex.html import re p = re.compile('ab*') p.match(input1)