Members Only

GREP of the Month: Character Equivalents

David Blatner shows how to target all manner of accented characters with POSIX codes.

This article appears in Issue 83 of InDesign Magazine.

Searching for characters when a rose is a róse is a røse…

Intellectually, I understand that there is a difference between a, á, and à. As an American, I can’t actually pronounce the difference, but that’s my problem. And, of course, then there’s å, â, and ä (which are relatively common), and ã, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, and ? (which are mystifying). But GREP is usually extremely precise in its pattern matching, so if you search for a  you will find just that one character, no more and no less. That’s sad, because sometimes you want to search for “any a, no matter the accent.” You could do that with the code [aáàåâäã?????????????] but that would be insane, especially if you had to search for several characters, each of which may or may not have an accent. character equivalents Fortunately, InDesign adopted some of the POSIX codes (which isn’t strictly GREP, but works alongside the GREP features). And one of the most useful POSIX codes is called “character equivalents.” The code is expressed by placing the letter inside two square brackets and two equal symbols. Therefore [[=a=]] will find the “character equivalents” of the letter a. (Yes, I know that those other glyphs aren’t really “equivalents,” but that’s just the official name.) Unfortunately, this POSIX code is not case-sensitive! That means the expression above will also find A, Á, ?, and other variations of the capital A. So on the one hand, the code is very powerful, and on the other hand, its application is somewhat limited, and usually reserved for searching a document, rather than doing large-scale replacements. (For example, if you search for [[=c=]]a and replace it with ca, then all instances

of ca, ?a, Ca, and Ça will all change to the lowercase  letters “ca”. Nevertheless, if you have an author who has been inconsistent in how and when they applied accents, this code is a terrific way to find all the various instances quickly.

Bookmark
Please login to bookmark Close

Not a member yet?

Get unlimited access to articles and member-only resources with a CreativePro membership.

Become a Member

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading comments...