Python Regular Expression Date Formate
Trying to write a RE to recognize date format mm/dd in Python reg = '((1[0-2])|(0?[1-9]))/((1[0-9])|(2[0-9])|(3[0-1])|(0?[0-9]))' match = re.findall(reg, text, re.IGNORECASE) print
Solution 1:
dont't use re.findall
. use re.match
:
reg = "((0?[1-9])|(1[0-2]))/((1[0-9])|(2[0-9])|(3[0-1])|(0?[0-9]))"match = re.match(reg, text, re.IGNORECASE)
printmatch.group()
Post a Comment for "Python Regular Expression Date Formate"