I’m trying to scour a csv with timecodes and subtitles, and change the timecode format.
For instance:
timecode_in, timecode_out, text
01:09:37.12,01:09:40.11,and we felt very close to them.
I need to replace all of the periods in the timecode with colons. But I need to filter it so it won’t change the periods in the text.
I’m thinking there should be a way to say: “Where a period has a number on each side, replace it with a colon.”
Can anybody help me with this? I have never used regular expressions before.
The way to say this are lookbehind and lookahead assertions
See it here on Regexr
(?<=\d)is a lookbehind assertion that ensures a digit before the current position(?=\d)is a lookahead assertion that ensures a digit ahead of the current positionBut those digits are not part of the match!