Creating Word macro for searching&replacing strings?
Thread poster: Cilian O'Tuama
Cilian O'Tuama
Cilian O'Tuama  Identity Verified
Germany
Local time: 06:36
German to English
+ ...
Jun 6, 2003

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
Beatrice T  Identity Verified
Italy
Member (2010)
German to Italian
+ ...
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!


 
Jørgen Madsen
Jørgen Madsen  Identity Verified
Local time: 06:36
English to Danish
+ ...
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
Klaus Herrmann  Identity Verified
Germany
Local time: 06:36
Member (2002)
English to German
+ ...
UltraEdit Jun 6, 2003

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
Gerard de Noord  Identity Verified
France
Local time: 06:36
Member (2003)
English to Dutch
+ ...
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)
Marc P (X)  Identity Verified
Local time: 06:36
German to English
+ ...
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


 
Deborah Shannon
Deborah Shannon  Identity Verified
Germany
Local time: 06:36
German to English
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
Cilian O'Tuama  Identity Verified
Germany
Local time: 06:36
German to English
+ ...
TOPIC STARTER
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)
Robert Zawadzki (X)  Identity Verified
Local time: 06:36
English to Polish
+ ...
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?






    Wordfast Pro
    Translation Memory Software for Any Platform

    Exclusive discount for ProZ.com users! Save over 13% when purchasing Wordfast Pro through ProZ.com. Wordfast is the world's #1 provider of platform-independent Translation Memory software. Consistently ranked the most user-friendly and highest value

    Buy now! »
    TM-Town
    Manage your TMs and Terms ... and boost your translation business

    Are you ready for something fresh in the industry? TM-Town is a unique new site for you -- the freelance translator -- to store, manage and share translation memories (TMs) and glossaries...and potentially meet new clients on the basis of your prior work.

    More info »