My programme:
import pandas as pd
import re
df = pd.read_csv('path of csv file')
corpus = []
for i in range(0,df.shape[0]):
x = df.iloc[i]['OrderTime']
if re.search(r'\d{2}/\d{2}/\d{4}',x): ### for mm/dd/yyyy
y= re.findall(r'\d{2}/\d{2}/\d{4}',x)
corpus.append(y)
elif re.search(r'\d{1}/\d{1}/\d{4}',x): ### for m/d/yyyy
y= re.findall(r'\d{1}/\d{1}/\d{4}',x)
corpus.append(y)
elif re.search(r'\d{1}/\d{2}\d{4}',x): ### for m/dd/yyyy
y= re.findall(r'\d{1}/\d{2}/\d{4}',x)
corpus.append(y)
elif re.search(r'\d{2}/\d{1}\d{4}',x): ### for mm/d/yyyy
y= re.findall(r'\d{2}/\d{1}/\d{4}',x)
corpus.append(y)
else: ### empty cells or says nan
y=["00/00/0000"]
corpus.append(y)
print(corpus)
My programme consits of coloumn that consits of string that contains date and time but I am not getting the actual result. I need the regex for m/dd/yyyy and mm/d/yyyy.