I am using the following code to identify years in my text.
import re
match = re.match(r'.*([1-2][0-9]{3})', text)
print(match.group(1))
However, this also accepts years such as 2999, 2078 that are still not valid.
Therefore, I would like to know how to identify years till recent in Python (i.e up to 2018).