regexreplacetextmateoniguruma

Find and replace numbers in textmate


I am trying to remove huge sequence of time stamp on a text file.

It's formatted like this:
Service Commands(04:59)
Using system-config-services(03:49)

I want it to look like this:
Service Commands
Using system-config-services

I tried with the following wild cards ? and * to replace it by just leaving it empty:
Find attempt1:
(??:??)

Find attempt2:
(\**:**)

Replace:



Nothing happens. Am I using the correct wildcards for textmate? What am I missing here?


Solution

  • Textmate supports regex. In regex, ? does not match a single character and * does not match multiple characters. Assuming you selected the regex option in the TextMate find dialog, you can match what you're looking for with \(\d\d\.\d\d\). The parentheses and period need to be quoted with the backslash character because they are special characters. \d will match a single digit. See the regex documentation for more operations, such as how to specify how many digits in a row you want to match using *, + or {} notation.