As I learned, every line in a .vtt file starts with something like this:

00:00:06.984 --> 00:00:12.020 (line.1)

But it should be like this for a .srt file:

00:00:06,984 --> 00:00:12,020 (line.2)

(in case you didn't see it, . turned into ,)

How can I achieve this (replacing line.1 with line.2) using regex in notepad++?

By using \d\.\d I can find every instances like 6.9 and 2.0 but I don't know how to change them to 6,9 and 2,0.

  • If you have found a solution to your problem, please post it as an answer for future users. You can always answer your own questions. – abhishekkannojia Dec 11 '15 at 10:21
  • @abhishekkannojia I knew I could but thought maybe that's frowned upon or whatever they say.. I did answer my question. Thanks. – goofle Dec 11 '15 at 10:52
  • @Eternal_ink anyone ever wants to stop you just keep doing what you believe to be good and nice, all the more. especially if they were people at random. thanks for posting! – n611x007 Jan 4 '17 at 19:57
  • @Eternal_ink also one shouldn't care less about people "frowning". They can always go home and frown at the mirror. – n611x007 Jan 4 '17 at 20:01

I've managed to do it myself:

Find what: (\d)\.(\d)

Replace with: \1,\2

This replaces every instances like 6.9 and 2.0 by 6,9 and 2,0 in the .vtt file.

Save the changes to the file, and change the file extension to .srt, of course.

Now this will do, but if you fear that there might be a X.Y in the text that you wouldn't want to change to X,Y you should do as the following:

Find what: (\d\d:\d\d:\d\d).(\d\d\d) --> (\d\d:\d\d:\d\d).(\d\d\d)

Replace with: \1,\2 --> \3,\4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.