Auto format a word with GREP Styles, Ignoring Capitalization and Accents
Someone wrote us recently asking about how to format a word with grep styles, but it had to ignore the capitalization and accents that may or may not appear in the word. This is tricky because GREP is very specific; if you search for “Aardvark” it will not find “AArdvark” or “Aàrdvark” or any other variation. But you can tell InDesign to be a little more flexible with some extra and somewhat obscure codes.
For example, let’s say you wanted to format the word NESCAFÉ® — but sometimes it has an accented final letter and sometimes it doesn’t; and sometimes it is just spelled Nescafe. Or perhaps it’s Citroën/Citroen, or Motörhead/MOTORHEAD, and so on.
So here are the two rules to remember:
- You can create a Grep Style (you’ll notice I am quite loose with my capitalization of GREp, too) that ignores capitalization by adding a
(?i)at the beginning. - You can search for any diacritical alternative of a letter by using the code
[[=a=]](but replacing the “a” with the letter you’re looking for)
So in the Nescafe example, you could search for: (?i)nescaf[[=e=]]~r?
(The tilde-r followed by the question mark means “there could be a registered trademark there, or perhaps not” — in other words, “zero or one ® symbols.”)
That would find Nescafe, Nescafé, NEScafÉ®, NESCAFE®, and so on…
This article was last modified on December 30, 2021
This article was first published on July 29, 2013
