In this example,
I read the file to content. we need to replace the string ‘20180827235833’ with ‘20180827_235833’
Code is in python3
content_str = content.decode('utf-8')
dates=re.findall(r'20\d{12}',content_str)
for d in dates:
content_str= content_str.replace(d,d[:8] + '_' + d[8:])
content = content_str.encode('utf-8')