from typing import Pattern, Match import re my_pattern = re.compile("[abc]*") # type: Pattern[str] my_match = re.match(my_pattern, "abbcab") # type: Match[str] print(my_match)