Python:
Write a RegEx that can check if a string is in a specific date format; For example dateString = '15 November 2009'
BECAUSE OF THE IDENTATION PROBLEM WHILE SUBMITTING THE CODE, SO THAT IAM ALSO GIVING YOU THE SCREENSHOT OF THE CODE SO THAT YOU CAN REFER IT :
PYTHON CODE :
import re
date = input("Enter the date : ") # read the date
result = re.search(r'\d{2} \D+ \d{4}', date) # regular
expression
if result != None: # if matches
print("Date matches")
else:
print("Date does not matches")
OUTPUT :
Get Answers For Free
Most questions answered within 1 hours.