If you just want the dates just split:
s="""TRAVEL_DELAY_01072015
TRAVEL_DELAY_01_07_2015
TRAVEL_DELAY_2015/01/04
TRAVEL_DELAY_2015-01-04"""
for line in s.splitlines():
date = line.split("_",2)[-1]
01072015
01_07_2015
2015/01/04
2015-01-04
Or str.replace, there is no need for a regex:
for line in s.splitlines():
date = line.replace("TRAVEL_DELAY_","")
print(date)
01072015
01_07_2015
2015/01/04
2015-01-04
If you were actually trying to parse the dates you could use dateutil and fix the strings:
from dateutil import parser
for line in s.splitlines():
date = line.replace("TRAVEL_DELAY_","")
if any(ch in date for ch in ("/","-","_")):
print(parser.parse(date.replace("_","-")))
else:
date = "{}-{}-{}".format(date[:2],date[2:4],date[4:])
print(parser.parse(date))
2015-01-07 00:00:00
2015-01-07 00:00:00
2015-01-04 00:00:00
2015-01-04 00:00:00
If the digits are only in the date and you want actually want the string not the date:
s="""TRAVEL_DELAY_01072015
TRAVEL_DELAY_01_07_2015
TRAVEL_DELAY_2015/01/04
Travel_Delay_Data_2015/01/04
TRAVEL_DELAY_2015-01-04"""
for line in s.splitlines():
ind = next(ind for ind, ele in enumerate(line) if ele.isdigit())
s = line[:ind-1]
print(s)
TRAVEL_DELAY
TRAVEL_DELAY
TRAVEL_DELAY
Travel_Delay_Data
TRAVEL_DELAY