How to Find and Replace, except when the word starts a line
Thread poster: John Fossey
John Fossey
John Fossey  Identity Verified
Canada
Local time: 10:13
Member (2008)
French to English
+ ...
Dec 30, 2022

I am translating a series of documents and need to find a way to Find and Replace all instances of a word except when it is the first word of the line.

For example, the word "Director" has been translated hundreds of times with the first letter capitalized "Director". Now the client wants it changed to all lower case "director". This is easy enough with the Find and Replace function, except that when the sentence begins with the word "Director" the "D" should remain capitalized.
... See more
I am translating a series of documents and need to find a way to Find and Replace all instances of a word except when it is the first word of the line.

For example, the word "Director" has been translated hundreds of times with the first letter capitalized "Director". Now the client wants it changed to all lower case "director". This is easy enough with the Find and Replace function, except that when the sentence begins with the word "Director" the "D" should remain capitalized.

How can I tell the Find and Replace function to only find instances when the word does not begin the sentence?
Collapse


 
Becca Resnik
Becca Resnik  Identity Verified
United States
Local time: 10:13
Member
German to English
+ ...
Use a space at the start Dec 31, 2022

If I understand the issue correctly, I believe using a space at the start of the search phrase should be just what you need.

 
Riccardo Schiaffino
Riccardo Schiaffino  Identity Verified
United States
Local time: 08:13
Member (2003)
English to Italian
+ ...
That wouldn't work in some instances Dec 31, 2022

Becca Resnik wrote:

If I understand the issue correctly, I believe using a space at the start of the search phrase should be just what you need.


That wouldn't work in some instances for example "Item 3: Director's fees to be rewarded blah blah (Director's fees are defined as blah blah)".

Here the first instance of Director would be correctly be replaced, but the second wouldn't.


 
Becca Resnik
Becca Resnik  Identity Verified
United States
Local time: 10:13
Member
German to English
+ ...
Always check Dec 31, 2022

Riccardo Schiaffino wrote:

Becca Resnik wrote:

If I understand the issue correctly, I believe using a space at the start of the search phrase should be just what you need.


That wouldn't work in some instances for example "Item 3: Director's fees to be rewarded blah blah (Director's fees are defined as blah blah)".

Here the first instance of Director would be correctly be replaced, but the second wouldn't.



Yes, it's always worth checking for instances like these, but it should work for all the "typical" instances. I almost mentioned this but figured it was understood.


 
Riccardo Schiaffino
Riccardo Schiaffino  Identity Verified
United States
Local time: 08:13
Member (2003)
English to Italian
+ ...
The solution may depend on the tool you are using Dec 31, 2022

Hi John,

The solution might depend on the tool you are using. If you need to do this in MS Word a solution could be to search using wildcards:

Find what: ([ \(])(Director)

Replace with: \1director

This means "search for a space or an open bracket followed by the word 'Director', and replace it with the same space or open bracket followed by the word 'director'"

If you are using a CAT tool like Trados or memoQ, you can do the same
... See more
Hi John,

The solution might depend on the tool you are using. If you need to do this in MS Word a solution could be to search using wildcards:

Find what: ([ \(])(Director)

Replace with: \1director

This means "search for a space or an open bracket followed by the word 'Director', and replace it with the same space or open bracket followed by the word 'director'"

If you are using a CAT tool like Trados or memoQ, you can do the same using a regex search:

With the "regex" option on (and, if you are in Trados, the option "case sensitive" selected), search for

(?<!^)(Director)

and replace it with

director

The regex pattern means "search for the word 'Director' so long as it is not the first word in a segment"

[Edited at 2022-12-31 01:33 GMT]
Collapse


Hans Lenting
 
Becca Resnik
Becca Resnik  Identity Verified
United States
Local time: 10:13
Member
German to English
+ ...
. Dec 31, 2022


If you are using a CAT tool like Trados or memoQ, you can do the same using a regex search...


This part should be applicable, as the post is in the memoQ support forum. However, this would still require double checking. For example, many style guides require that if a complete sentence follows a colon, the first word must be capitalized.


Riccardo Schiaffino
 
Denis Fesik
Denis Fesik
Local time: 17:13
English to Russian
+ ...
Three steps Dec 31, 2022

First, replace "^Director" with "zzzdirector". Next, replace "Director" with "director." Finally, replace "zzzdirector" with "Director"

Stepan Konev
 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

How to Find and Replace, except when the word starts a line






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! »
Anycount & Translation Office 3000
Translation Office 3000

Translation Office 3000 is an advanced accounting tool for freelance translators and small agencies. TO3000 easily and seamlessly integrates with the business life of professional freelance translators.

More info »