is now part of CreativePro.com!

Auto format a word with GREP Styles, Ignoring Capitalization and Accents

4

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…

David Blatner is the co-founder of the Creative Publishing Network, InDesign Magazine, CreativePro Magazine, and the author or co-author of 15 books, including Real World InDesign. His InDesign videos at LinkedIn Learning (Lynda.com) are among the most watched InDesign training in the world.
You can find more about David at 63p.com

Follow on LinkedIn here
  • Jongware says:

    Here is how you can use this trick to quickly locate all *misspellings*: look for

    (?!Nescafé~r)(?i)nescaf[[=e=]]~r?

    This looks ahead for NOT “the proper spelling”, so it will only find mismatches.

  • I love InDesign’s GREP, but wish it had one additional feature. Let one GREP search when completed call another GREP search. Then problems like that described above (multiple spellings of a term) could be handled with a series of simple scripts rather than one complicated one.

    And speaking of tweaking spelling, has anyone create a plug-in for InDesign that switches a document between American and British spelling (i.e. “program” to “programme”)? It’d be a real time-saver, particularly if it were smart enough to know which terms should always be changed and which need to be viewed in context.

    My hope is that Creative Cloud subscriptions will give Adobe the freedom to continually make these handy sorts of tweaks, perhaps even giving users a Kickstarter-like way to vote for changes they want.

    I tell those that whine about the cost of a subscription that if Adobe does that, the tweaks are likely to save enough time each month to easily cover the cost of subscribing. And given my busyness, I like the idea of improvement coming out continually. There are features that Adobe added several versions back that I’ve still not adopted because the big leap of a version change didn’t leave me time to learn them.

  • >
    Notice: We use cookies on our websites to give you a great online experience. If you keep browsing, we'll assume you're ok with this. For more information, see our privacy policy. By closing this banner, you agree to the use of cookies.I AGREENo