Using Advanced Find & Replace |
Select HOME > Find & Replace from the main menu to search for text within the currently open Project TTK or within a folder of Project files on disk.
Using the options, search for text in source or target segments, in memo and translator note fields, in segment identifiers, in context links and labels.
Find and replace is a powerful engine that can not only search plain text you enter, but also search wildcards using Regular expression.
The results of Find & Replace are stored in the Results window. There are 2 results window available. This differs from QuickFind where its results alters the string list (filtering) in the Project Workspace window. |
See the topic on regular expression for the syntax governing regular expression searching.
If you use a regular expression pattern to find text, you can then use the 'Replace with:' field to specify what alternative text should go in its place. Using groups in the search pattern will allow pieces of the searched text to be used when replacing.
Consider the example of a currency search and replace. You may wish to look for a pattern containing two numbers separated by a dot and replace by the same two numbers separated by a comma. E.g. 49.99 should appear as 49,99
This is an easy Find and Replace in CATALYST using regular expression search and replace
To search for the two digit number, use the regular expression [0-9]{2}, which means any digit in range zero to nine appearing twice.
Building on that, we can search for [0-9]{2}\.[0-9]{2}, which means a two digit number, followed by a dot, followed again by a two digit number.
To be able to use these matches as text in the replace field, we need to give them a special syntax called groups. This simply means placing a pair of braces around the match that you wish to use in the replace field.
Adding the braces gives us the final 'Find what:' pattern: ([0-9]{2})\.([0-9]{2}) - it contains two groups. The piece of text matching the first pattern can be referred to as \1, the resulting text from the second match can be referred to as \2.
Sample Text |
Group Matching using expression ([0-9]{2})\.([0-9]{2}) |
49.99 |
\1 = 49, \2 = 99 |
$49.99 |
\1 = 49, \2 = 99 |
20.909 |
\1 = 20, \2 = 90 |
€10,509.99 |
\1 = 09, \2 = 99 |
Note, the expression used here was created to match two digits either side of the dot. It could be easily extended to find larger numbers such as the last entry in the table.