I use Python 3.8.6 with regular expression to find an English month+year combination in a string. Therefor I use the following code:
import re
regMonthPatternEn = 'an(?:uary)?|eb(?:ruary)?|march?|apr(?:il)?|may|jun(?:e)?|jul(?:y)?|aug(?:usst)?|sep(?:tember)?|oct(?:ober)?|(nov|dec)(?:ember)'
regYearPattern = '.*([1-3][0-9]{3})'
text = 'january 2018'
resultMonthEn = re.match(regMonthPatternEn,text)
resultYear = re.match(regYearPattern,text.lower())
print(text)
print(workExperiencePeriodYearList)
if (resultMonthEn and resultYear):
print('Match')
I expect that is will return "Match" in the console as output. But it returns nothing. Can you please help me to solve this problem?