Using Microsoft Word wildcards to match timecodes

78 Views Asked by At

I want to remove the timecodes from the Microsoft Word Document. I have following pattern: 00:00:00:00 - 00:00:00:00

I am using this script: [0-9]{2}\:[0-9]{2}\:[0-9]{2}\:[0-9]{2} - [0-9]{2}\:[0-9]{2}\:[0-9]{2}\:[0-9]{2}

But this gives me an error "Pattern Match Expression" is too complex.

If I use following script then it works fine: [0-9]{2}\:[0-9]{2}\:[0-9]{2}\:[0-9]{2} - [0-9]{2}\:[0-9]{2}\:[0-9]{2}\:

But if I add the last two digits then it gives me an error.

For example, here my sample text:

00:00:00:00 - 00:00:05:08 Welcome to episode 819. We're exploring enterprise AI survival with guest who is, I think I can say, genuinely an industry luminary. 00:00:19:03 - 00:00:22:20 Great to be here. Is it really? 808 19 is that many really 00:00:22:20 - 00:00:24:21 819. 00:00:24:21 - 00:00:26:14 pretty impressive. Pretty impressive.

Can anyone help me with this?

1

There are 1 best solutions below

16
Wiktor Stribiżew On

I think there is a limit on the number of limiting quantifiers in the MS Word wildcard. [0-9]{2}:[0-9]{2}:[0-9]{2}:[0-9]{2}:[0-9]{2}:[0-9]{2}:[0-9]{2} (with 7 {2} quantifiers) is valid and [0-9]{2}:[0-9]{2}:[0-9]{2}:[0-9]{2}:[0-9]{2}:[0-9]{2}:[0-9]{2}:[0-9]{2} (with 8 {2} quantifiers) throws the error you mentioned.

You can group the repetitions and apply only one limiting quantifier for the right and left parts:

[0-9]{2}(:[0-9]{2}){3} - [0-9]{2}(:[0-9]{2}){3}

where (:[0-9]{2}){3} matches : and two digits three times.

enter image description here