Skip to main content
Participant
May 8, 2020
Question

Is there a simple way to find/change multiple words and highlight?

  • May 8, 2020
  • 6 replies
  • 4397 views

I would like to create a GREP search or Script that would search a list of pre-defined words that are on my company's "do not use" list. My ideal would be that InDesign would search for these words (regardless of capitalization, or use ... I'll explain this in a moment), and highlight each occurrence.

 

To clarify, this is what I am trying to accomplish:

 

Find "Ensure" | highlight the word | find next use of the same word and repeat until no more are found;

Then, find the next word in the list and do the same

Repeat until the list is completed throughout the document.

 

However, we might use "Ensuring" or "Ensured" ... I would want these highlighted as well. I'm okay if we just search "ensur" ... but it would need to be found regardless of capitalization and any use of the root word "ensur". 

 

I'd started this as individual GREP Find/Change, but we have over 50 words that I would need this done for and we work in LONG documents, so doing this 50+ times is not the best use of our time. I was hoping for just one GREP search, or even a script that would do this in one click.

 

Does this make sense? 

Thanks!!

This topic has been closed for replies.

6 replies

Community Expert
October 27, 2022

Looks like you're in the wrong forum. InDesign can't help you improve your website.

Geоrge
Legend
May 11, 2020
Remember, never say you can't do something in InDesign, it's always just a question of finding the right workaround to get the job done. © David Blatner
Community Expert
May 11, 2020

You could also give a try to FindChangeByList script shipped with InDesign. In a nutshell this script takes input from a text file where you can write your find/change queries and processes those queries one at a time. So you would add a query for each word in your "do not use", highlight it using say a CharacterStyle with a that applies color. So once the script execution is complete each word in the list would be higlighted with it's unique color

 

-Manan

-Manan
willcampbell7
Legend
May 10, 2020

I have a script for find/change of multiple pairs, and it has confirmation along the way as found instances are selected. So perhaps it would be helpful to you. Its intent was to search and replace, but you could click the skip button each time something is found. This might give the result you want. ??? I could modify the script if it's close but not quite the solution. As for "ensure" vs "ensuring" just put both into the CSV file (and more). I've considered a version of this script using GREP but haven't gotten around to it, and no one has asked for it. Most scripts I make are usually something to solve a problem with with current job, or someone else has expressed a specific need. Anyway have look. Free to download.

https://www.marspremedia.com/software/indesign/find-change-from-spreadsheet

William Campbell
willcampbell7
Legend
October 27, 2022

By the way, in the time since I posted this, I now have a GREP version of the script.

https://www.marspremedia.com/software/indesign/grep-replace-from-spreadsheet

 

William Campbell
jctremblay
Community Expert
Community Expert
May 8, 2020

A long GREP query could apply a Condition Text highlight to your 50 words. Than a simple Find can be use to go to each of them.

jctremblay
Community Expert
Community Expert
May 8, 2020

You want that to be interactive... what action will be done after each highlighting? Do you want it for each occurences of a specific word, than all the next one, and so on? Or it could be all mixed order?

Participant
May 11, 2020

Basically the highlight will be for our reviewers to verify that the content that is highlighted is what they want to say, and if not they will edit. We use a character style to make the highlight.

 

Order - it doesn't matter ... as long as all the words in our list are found!

jctremblay
Community Expert
Community Expert
May 11, 2020

You can try to use something like this:

(?i)\b(ensur|word2|word3).*?\b

(?i) if for making InDesign GREP case insensitive
\b is for words boundaries making InDesign search a whole word
Inside the ( ) are your words separated by a pipe | 
After the closing ) you find .*? to capture, if presents any additionnal character after the words in your list. In the sample here, teh word ensur, ensure and ensuring will be found.
You can use this to apply either your highlight character style, or a Text Condition set to Highlight for the indicator method. I would definately use a Text Condition for that since applying a character can interfere with already styled text.