Regular expressions: replace "w1 w2 w3" with "w1 w2 <b>w3</b>"

  • Thread starter Thread starter Dougmeister
  • Start date Start date
D

Dougmeister

I want to make every occurance of a word in BOLD type when it comes after two
specific words.

I.e.:
"status of Completed" -> "status of <b>Completed</b>"

(last word is in bold)
 
You can do this without wildcards. Just manually format one occurrence of
"status of Completed" as desired (that is, add bold to "Completed") and copy
it to the clipboard. Then, in the Find and Replace dialog box, enter status
of Completed in the "Find what" box, and in the "Replace with" box, type ^c.
Click Replace All.
 
If there are enough different possible words such as "Completed" to make
it worthwhile,

a. Two steps would probably do it unless you need to preserve some
existing formatting - something like
1. find
(status of )(<*>)
replace with
\1\2
formatted in bold

2. find
(status of)
formatted in bold
replace with
\1
formatted not bold

b. If you needed to preserve formatting you could try to choose some
formatting that isn't currently used, e.g. if all text is in the
Automatic colour, and add a step, e.g.

1. find
(status of )(<*>)
replace with
\1\2
Text color: red

2. find
(status of)
text color: red
replace with
\1
text color: Auto

3. find

text color: red
replace with

Bold, text color: Auto

Peter Jamieson

http://tips.pjmsn.me.uk
 
Back
Top