Advanced find and replace (in translations)
Normally, when you're working on a translation, you use Quick find to search for and replace text in the documents. But when you need to fine-tune your search, you need the Advanced find and replace window.
How to get here
Open a document for editing: Open a project. In Project home, choose Translations. Double-click the name of the document.
Or: Open a translation memory for editing: In Resource Console, on the left, click Translation memories. Click a TM, and under the list, click the Edit link.
Or: Open a LiveDocs corpus document (monolingual or bilingual) or document pair for editing: In Resource Console, on the left, click LiveDocs. In the upper list, click a corpus. In the lower list, double-click a document or a document pair.
Press Ctrl+F. The Quick find window opens. Press Ctrl+F again.
Or: On the Edit ribbon, in the Find And Replace section, click the Advanced icon.
The Advanced find and replace window opens.
You can start Find and replace directly from Project home: In Translations, do not open a document. Instead, just press Ctrl+H or Ctrl+F. When you do this, memoQ assumes that you want to run Find and replace on several documents, not just one.
Using regular expressions to search
What can you do?
In the Find what dropdown, type the text you are looking for. Or, expand the dropdown, and choose an expression from previous searches.
To search inside inline tags: Check the Search within tags as well check box. Then you can look for tags like this: <mq:ch>.
To run a case-sensitive search: Click the Case sensitive icon.
In the Replace with dropdown, type the text that will replace the Find what text. Or, expand the dropdown, and choose an expression from previous replacements. (When you close memoQ, this list is cleared.)
Normally, memoQ will look in the source and in the target text, but not in comments or in context identifiers. Use the check boxes under Find where.
- To look in the target only: Clear the Source text check box, and make sure the Target text check box is checked.
- To look in the source only: Clear the Target text check box, and make sure the Source text check box is checked.
- To look in comments, too: Check the Comments check box.
- To look in the segments' context identifiers, too: Check the Context ID check box.
First, under More find options, choose a Match option:
- Anything: Find the Find what expression, even if it's just part of a word.
- Only whole words: The Find what expression will be found only if whole words look like the expression.
- Entire segment/field: The Find what expression will be found only if the entire segment (or comment) is the same as the expression.
To keep formatting when replacing text: Check the Do not replace if formatting would change check box.
Tell memoQ which documents and segments it must search through: Under Find where, choose from the Search in dropdown.
If you come from the translation editor, you have these choices:
If you come from the Translations pane of Project home - that is, from the list of documents, you have these choices:
If your project contains views, and you need to look for text in the views: On the Translations pane of Project home, click the Views tab first. Then press Ctrl+F. After that, the Search in dropdown will offer these choices:
- If you are editing a translation memory, the list will only have the This translation memory item.
- If you are editing a document in a LiveDocs corpus, the list will only have the This LiveDocs document item.
Some items may be missing: For example, you will not see Selected documents if no documents are selected. Or , if you have not opened a view, the Open views option will not be there.
To jump to the first or the next match: Click Find next. memoQ jumps to the nearest segment where the Find what text occurs, and highlights the text. If necessary. memoQ will open or switch to the document where the match is.
The Advanced find and replace window stays open. You can even click the segment, make changes, and then return to the Advanced find and replace window.
- To replace the latest match: Click the Replace this button. memoQ replaces the match with the Replace with text. Then it jumps to the next match, and highlights it. The Advanced find and replace window stays open.
- To replace all occurrences in the open document: Click the Replace all button. memoQ replaces every occurrence of the Find what text with the Replace with text. memoQ counts the occurrences, and shows the number on the right. When memoQ finishes replacing, it announces the result in the Find/Replace message box. To return to the Find and Replace window: Click OK. The Find and replace window stays open.
- To list occurrences in several documents: Click the Find all button. memoQ searches all the specified documents and segments, then displays the result list on a separate document tab. This is best if you need to search many documents: It would take a lot of time to open each document in the translation editor. After the list opens, memoQ closes the Advanced find and replace window.
- To replace occurrences one by one, in a list: Click the Preview and replace button. The same result list opens as above, and memoQ closes the Advanced find and replace window.
- To just mark the segments that contain matches: Click the Mark all button. memoQ searches through the documents, and mark every segment that contains a match. Marked segments have an outline on their Comments icon: . memoQ will not open a list of matches. However, you can use filtering or views to get to these segments.
- To highlight the search results within the segments: Click the Highlight all button. memoQ puts yellow highlighting on the segment parts that match the search phrase. The Find and replace window stays open. To remove the highlighting: Click the Clear highlighting button.
If you need to find several different things that still have something in common, you can use regular expressions. With regular expressions, you can write up patterns rather than the exact text you are looking for.
To use regular expressions: Next to the Find what box, click the regex mode switcher icon. The Advanced find and replace window will change like this:
Type your regular expression in the Find what box. If you need assistance, open the Regex Assistant: Click the icon on the right, and create a regex, or choose one from the regex library. Copy it, then switch back to this window, and paste your regex into the Find what text box. Do the same with the Replace with text box if needed.
You can also click the Information icon: The Regular expressions help page opens.
Because the Find what box is a big one with several lines, it cannot have a dropdown list. To get back to earlier search terms, use the < and > icons to the right.
In the Replace with box, you can include matching variables. Type $1 for the first recognized chunk; $2 for the second one; and so on. You can use these if you are in regex mode, and there are replaceable groups (for example, (^s+)) in the Find what box. To learn more, see the Regular expressions help page.
All the other options are the same as in the normal view of the window. However, you have no more options on controlling the match: memoQ will find the regular expression wherever they occur, even if they cover an entire word or an entire segment.
When you finish
To close the Find and replace window, and go back to the translation editor or to Translations: click Close.