Basic Regex question

I know this is a bit of a simple one, but I have been trying for a long time to get it to work without any success.

I have a VTT file, and I’m trying to use regex (with Text Parser → Match Pattern) to remove all of the lines with timestamps.

The text looks like this:

WEBVTT

NOTE
This file was generated by Descript <www.descript.com>

00:00:05.019 → 00:00:11.729
Hello, hello hello, and welcome to English Learning for Curious Minds, by Leonardo English.

00:00:11.959 → 00:00:15.859
The show where you can listen to fascinating stories, and learn weird and

00:00:15.859 → 00:00:19.769
wonderful things about the world at the same time as improving your English.

I’ve tried multiple different Regex approaches, which work when I have tried them on Regex testers, but not in Make.

e.g.

^0.$
^.±->.
$
^\d{2}:\d{2}:\d{2}.\d{3} → \d{2}:\d{2}:\d{2}.\d{3}$
^\d{2}:\d{2}:\d{2}\.\d{3} → \d{2}:\d{2}:\d{2}\.\d{3}$

I know it must be a very simple fix, but I can’t figure it out. Any help from a kind soul?



Use this module

Text Parse.json (5.5 KB)

2 Likes

Looks like your regex is correct.

I would change it to https://regex101.com/r/5beIYm

\d{2}:\d{2}:\d{2}.\d{3} --> \d{2}:\d{2}:\d{2}.\d{3}\s*

You want to replace with an empty string, otherwise the default is “null”.

i.e.:

{{emptystring}}
3 Likes

thanks very much. I tried this and it worked on the test piece of text but not on the real data.

After much experimentation I realised that the formatting of the arrow was slightly different, i.e. it should be “–>” rather than “→”.

This ended up being the fix.

Oops, this forum converts --> to →

:frowning:

This is why we have to format the text when pasting into this forum:

1.

You can add three backticks ``` before and after the text, like this:

```
text goes here
```

2.

or use the format code button in the editor:
Screenshot_2023-10-02_191027

perfect, thanks. Good tip re: {{emptystring}}.

2 Likes