I'm trying to format a keyword(s) that comes after specific string. For example, I want to bold the words, "happy", "sad", and "angry", but only if they are preceded by "be" or "become". This is an example of what I expect to be bolded:

I am happy, but I will be angry soon. Though she is sad now, she will become happy.

I have tried to GREP it like this:


This seems to work on other programs but not Indesign. I could construct the arguments "be" and "become" separately like this: (?<=be)(happy|sad|angry)|(?<=become)(happy|sad|angry), but it's not feasible when there are a lot of strings I need to match.

2 Answers 2


try using the InDesign script “FindChangeByList.jsx”. Find out about it here:

InDesign: how to run multiple find/change queries at once

In your instance, after first adding the “bold” character style to your document, you would add these lines to the “FindChangeList.txt”, then run the script.

grep    {findWhat:"(?<=be.)(happy|sad|angry)"}  {appliedCharacterStyle:"bold"}  {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}

grep    {findWhat:"(?<=become.)(happy|sad|angry)"}  {appliedCharacterStyle:"bold"}  {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}

It doesn't work because a lookbehind assertion has to be fixed width. Use this instead:


\b for word boundary.

\s for space, instead of . (which matches any character).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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