Professional Documents
Culture Documents
Python Code
Python Code
def extract_date(text):
date_regex = r"[0-9]{1,2}[-,/](JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC|
Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|jan|feb|mar|apr|may|jun|jul|aug|
sep|oct|nov|dec){1,2}[-,/][0-9]{2,4}" # Define the regular expression for matching
the date
match = re.search(date_regex, text) # Search for the date in the text
if match:
date = match.group()
return date
else:
return "No date found"