InDesign GREP: Italicized specific characters

1.3k Views Asked by At

I want to use a GREP style to italicize a portion of a company name. For example: "In*Design*." Design is only italicized when it follows the word "In" but "Design" never appears italicized when it stands by itself.

1

There are 1 best solutions below

0
On

Piece of cake. Use Lookahead and Lookbehind codes to limit the match to "InDesign" only. Use word boundaries to make sure the entire word gets matched.

That leads to

(?<=\bIn)Design\b

where (?<=\bIn) is the lookbehind part: only "Design" should match when preceded by "In". The \b before and after indicate a word break -- there may not be an additional word character before or after the phrase. So it will match "InDesign" but not "inDesign" (GREP is case sensitive by default), "wInDesign" (a word character before the \b word break), or "InDesigner" (a word character after the last \b word break).