Find 3rd colon in a string?

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
Susan G
Posts: 15
Joined: Mon Nov 10, 2003 1:13 am

Find 3rd colon in a string?

Post by Susan G »

Hi-

I need to change a number of timestamps so that the final separator is a period instead of a colon.

So eg.
0:00:01:14

becomes
0:00:01.14

I haven't been able to come up with the correct RE syntax to find the 3rd colon. Any help would be very much appreciated!

Thanks-

-Susan
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Here is one way to do it:

Use "Posix" regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
Search | Replace... (<F8>):
Find what: \<([0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}+):([0-9]+)
Replace with: \1.\2

[X] Regular expression

Replace All
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post by ak47wong »

Here is another:

Find what: ([0-9]:[0-9][0-9]:[0-9][0-9]):([0-9][0-9])
Replace with: \1.\2
Susan G
Posts: 15
Joined: Mon Nov 10, 2003 1:13 am

Post by Susan G »

Thank you both very much for the quick replies!

-Susan
Post Reply