I have a document that has the word "The" capitalised in many places it shouldn't be. I wish to change "The" in those cases, to "the".

I need to change any instances of "The" that are not at the beginning of a sentence, that is, a capital is being used in the middle of a sentence, for example, A dog bit The boy.

I played around with the following

Use the wildcard expression <The> and replace results with the -- This will change each "The" to "the". From there I had planned on finding the words that SHOULD be capitalised and changing them back to "The", thus keeping all the lower-case words where they should be.

  1. Ctrl + H to open the Replace Window. Find *<The> and replace with the*
  2. Next, I wanted to find each "the" that was at the beginning of a new line and hence should be capitalised. [!. {1,9}]<the>. This should find each "the" that is NOT preceded by by 1-9 white-spaces. I set the replacement text to "The" to re-capitalise them.
  3. Next, I wanted to find each "the" that was at the start of a new sentence, but not at the start of a new line, for example, the Dog bit the boy. the boy cried hard. I came up with the following expression: [. {1,9}]<the> to be replaced with ". The". This should find each "the" that is preceded by a period and between one and nine white-spaces (in case of clumsy formatting).

That should set everything the way I want.

I ran in to the following issues:

  • When following step 3, it is not specific enough. It returns results that are well beyong a period. enter image description here

How should I write this so that I can find the beginning of a sentence not on a new line? Such as selecting the second the in the following: A brick smashed the window. the nun was not pleased.

  • When following step 2, I am getting results with a white-space selected. I am trying to find "The" at the beginning of a sentence and a new line, that is, there shouldn't be any spaces or a period before it. This doesn't work; it returns the following results.

Step 2 Why is it selecting a white-space with the text, and how should I alter it to only select "The" at the beginning of a sentence, and new line.

Also, what would be an example expression that finds only "The" when it is preceded by one of the following symbols: -,*,:, for example, * The. It would be helpful if you could also inverse that so that it only finds "The" when it is not preceded by one of those symbols.

  • Are you open to a macro/VBA solution? – Raystafarian Apr 15 '14 at 16:01
  • Hi! Preferably for the moment I would like to know how to better use the MS Word methods :) – Xivilai Apr 15 '14 at 16:12
  • So the problem being your asterisk in the regex is for any string of characters, which is why it's collecting text that is far away from periods, right? Why are you running {1,9}? Why not just 1 space after the period? relevant but you've probably already seen this – Raystafarian Apr 15 '14 at 16:17
  • I have seen that link thanks. I don't see an asterix in the wildcards above? I put in 9 just in case there were extra spaces as a result of poor formatting - This is a very long document :) – Xivilai Apr 15 '14 at 16:25

In regards to your issue with selecting extra spaces, the solution is to let Word select the spaces, but have it have no net effect on these spaces...

Add parentheses to the find, so that Word will assign variables to the sections of the search:

([!. {1,9}])(the)

Then, in the replace with


This will substitute back in the spaces right where they were.

As for

please help me with an example expression that finds only "The" when it is preceded by one of the following symbols -,*,: e.g * The.

Just escape the asterisk with the "\". So it would be: [\*:,]The and the opposite would be [!\*:,]The

  • Thanks for the answer. I was a bit confused as to why Word was selecting those blank spaces with that expression – Xivilai Apr 16 '14 at 9:19
  • ([!.()*:–1-50])([a-zA-Z])([ {1,9}])(<The>) I used the above expression to find the following: Instances of "The":Not preceded by periods,left or right parentheses, an asterix, semicolon,dash,or any number between 1 and 50..but is preceded by lower-case/upper-case letters.. and is preceded by white-space characters. This worked. I just have a question about capture groups? For example the sentence How Do I View The Price Of.. returns with "ew The" selected.Capture Group 1 contains "e", Group 2 "w" and Group 3 a whitespace. Group 4 is "The". Could anyone explain Groups 1 and 2? – Xivilai Apr 16 '14 at 11:22
  • Actually I just got it.. Group 2 finds a single letter, and Group 1 was designed to NOT find what I designated. e satisfies that condition and so is used for that group. – Xivilai Apr 16 '14 at 11:45
  • In the document I am trying to select all hyperlinks in the file. I hit Alt + F9 to show the fields and used the Find/Replace dialog to write an expression that will select every single Hyperlink. Each Hyperlink then appears in the following format dropbox.com/s/98wd2lbly779s1q/2014-04-17_12-00-32.png I want to select all hyperlinks like the above. In the Replace dialog I enabled wildcards and tried a few expressions e.g [\{HYPERLINK][ {1,3}]["*"\\h] but none selected what I need. I just need it to ONLY select each ENTIRE line (I want to alter them all at once) – Xivilai Apr 17 '14 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.