You are on page 1of 1

import re

import datatable as dt

dt_name = "DescData"
column = "Line_Description"

# Define the regular expression for matching the date


date_regex = r"[0-9]{2}\-.*\-[0-9]{2}"

dt = dt.fread(dt_name)
for row in dt[:,column]:
text = row[0]
# Search for the date in the text
match = re.search(date_regex, text)
# If a match is found, extract the date
if match:
date = match.group()
print("Date:", date)
else:
print("No date found in the text")

[0-9]{1,2}[\/-].{3}[\/-][0-9]{2,4}

[0-9]{1-2}\-.*\-[0-9]{2-4}
[0-9]{1}\-.*\-[0-9]{2}
[0-9]{1}\/[0-9]{1}\/[0-9]{4}

You might also like