Imagine we have a time code like this : 00:21:06,200
(our goal)
but in our text we have like this format too : 00:2106,200
or if 00:21x06,200
, x is another number too !
i want to find and to put :
between 21 and 06 for example or repalce x with :
.
i tried this way : (:)+/d{2}
it finds numbers like this pattern but now i want after finding this pattern numbers, it adds ":" after second digits and it gonna be like this : 00:21:06,200
. Ty so much :)
My Notepad++ regex isn't so god so i did my best.
You could use:
Find what:
\b\d\d:\K(\d\d)[x:\d]?(?=\d\d\b)
The pattern matches:
\b
A word boundary to prevent a partial word match\d\d:
Match 2 digits and :
\K
Forget what is matched so far(\d\d)
Capture group 1, match 2 digits[x:\d]?
Optionally match x
or :
or a digit(?=\d\d\b)
Assert 2 digits to the rightSee a regex demo
Replace with:
$1: