Creating Word macro for searching&replacing strings? Initiator des Themas: Cilian O'Tuama
|
Hi All, I've been asked for a quote on a huge Word file with zillions of strings of different lengths, which of course will not have to be translated. All are contained within square brackets ( [blabla...] ). The strings consist of letters, numbers and other symbols. There are so many of these strings that I can't include them in my word/line count. Does anyone know how to create a Word macro (if possible in Word 97) that can replace all of these strings, irrespective o... See more Hi All, I've been asked for a quote on a huge Word file with zillions of strings of different lengths, which of course will not have to be translated. All are contained within square brackets ( [blabla...] ). The strings consist of letters, numbers and other symbols. There are so many of these strings that I can't include them in my word/line count. Does anyone know how to create a Word macro (if possible in Word 97) that can replace all of these strings, irrespective of length and content, in a single operation? If this has been discussed before, a pointer in the right direction would be appreciated. Thanks, Cilian ▲ Collapse | | | Beatrice T Italien Mitglied (2010) Deutsch > Italienisch + ... You can try with wildcards | Jun 6, 2003 |
Hi Cilian, I hope I got the point try this: (in any Word version, 95, 97, 2000) Edit> Find: \[*\] Replace: what you want this string to be replaced with Check the checkbox "Use wildcards" If you like, you can register this operation as a macro, obviously. Hope it is of any help. Bye! | | | Have you tried Search & Replace? | Jun 6, 2003 |
I always use the Search and Replace utility (www.funduc.com) for this kind of operation, including glossary lookups. It has many useful features, including searching and replacing * strings (not possible in Word) with or without confirmation. Good luck, Jørgen | | | Klaus Herrmann Deutschland Local time: 17:22 Mitglied (2002) Englisch > Deutsch + ...
Did you ever try UltraEdit ? It's the perfect tool for this purpose. You can download a 30-day trial version from www.ultraedit.com. | |
|
|
Gerard de Noord Frankreich Local time: 17:22 Mitglied (2003) Englisch > Niederländisch + ... A macro is not really necessary | Jun 6, 2003 |
Hi Cilian, In this case you could simply replace \[*\] with nothing in a copy with the file. Use wildcards and think about removing double spaces, if necessary. Regards, Gerard | | | Marc P (X) Local time: 17:22 Deutsch > Englisch + ... Searching/replacing strings | Jun 6, 2003 |
Hi Cilian, If I've understood you correctly, all you want to do is delete all instances of [...] from the text, in order to be able to count the remaining text. If that's the case, then simply check the "Use wildcards" option in the search & replace dialog and enter backslash - open square bracket - asterisk - backslash - close square bracket (as you've probably realized by now, ProZ is playing havoc with our efforts to enter this literally) a... See more Hi Cilian, If I've understood you correctly, all you want to do is delete all instances of [...] from the text, in order to be able to count the remaining text. If that's the case, then simply check the "Use wildcards" option in the search & replace dialog and enter backslash - open square bracket - asterisk - backslash - close square bracket (as you've probably realized by now, ProZ is playing havoc with our efforts to enter this literally) as the search term. Leave the replace field blank. "*" represents "0 or more characters", and the backslash indicates that the brackets are to be interpreted literally, as they otherwise have a special function of their own. This works for Office 97. Marc
[Edited at 2003-06-06 14:50] ▲ Collapse | | | Search and replace/special, with wildcards | Jun 6, 2003 |
Cilian O'Tuama wrote: All are contained within square brackets ( [blabla...] ). The strings consist of letters, numbers and other symbols. There are so many of these strings that I can't include them in my word/line count. Hi Cilian, If it's for a one-off quote, I'd find it just as quick to use a few search-and-replace operations. The symbol * stands for 'any string' in a wildcard search and replace. The problem is that your expressions are contained in square brackets, which Word Advanced search and replace otherwise uses for special purposes. So, first I'd replace the all left and the right square brackets with something which does not occur elsewhere in the document (e.g. LEFTBRACKET for all the left ones and RIGHTBRACKET for all the right ones). That's two operations. Step 3: Search the string LEFTBRACKET*RIGHTBRACKET with More/'Wildcards' or 'Pattern matching' activated, and Replace with Format/Highlight or a particular text colour to make the non-translatable text stand out visually. If you're using a translation tool, you replace the strings with the non-translatable style (telling the tool not to count them or present them for translation, which would obviate the need for step 4). Step 4: search for the Highlight (text colour, style, whatever) and replace with nothing, i.e. delete it, so that you can count the remaining words. (Obviously this would all be done on a copy of the file...) Also, don't forget to reinstate the brackets after translation! All the best, Deborah | |
|
|
Cilian O'Tuama Deutschland Local time: 17:22 Deutsch > Englisch + ... THEMENSTARTER Problem solved | Jun 6, 2003 |
Cheers Everyone - I followed Marc's edited (thanks) instructions and lo and behold... I must admit I was confused - backslash, what backslash! Another slight drawback was that I only have German versions of Word, and who could guess that 'with wildcard' = 'mit Mustervergleich'!? Thanks again. Cilian | | | Robert Zawadzki (X) Local time: 17:22 Englisch > Polnisch + ... For me \[*\] works | Jun 6, 2003 |
When wildcards are turned on, [ has a special meaning. Gerard de Noord wrote: Hi Cilian, In this case you could simply replace with nothing in a copy with the file. Use wildcards and think about removing double spaces, if necessary. Regards, Gerard | | | To report site rules violations or get help, contact a site moderator: You can also contact site staff by submitting a support request » Creating Word macro for searching&replacing strings? Protemos translation business management system | Create your account in minutes, and start working! 3-month trial for agencies, and free for freelancers!
The system lets you keep client/vendor database, with contacts and rates, manage projects and assign jobs to vendors, issue invoices, track payments, store and manage project files, generate business reports on turnover profit per client/manager etc.
More info » |
| Trados Studio 2022 Freelance | The leading translation software used by over 270,000 translators.
Designed with your feedback in mind, Trados Studio 2022 delivers an unrivalled, powerful desktop
and cloud solution, empowering you to work in the most efficient and cost-effective way.
More info » |
|
| | | | X Sign in to your ProZ.com account... | | | | | |