Members Only

InDesign GREP of the Month: \x (Unicode)

This article appears in Issue 82 of InDesign Magazine.

Target any range of characters: Hebrew or Hirigana, Cherokee or currency, Devanagari or dingbats.

GREP is an excellent tool for finding characters in certain Unicode ranges and applying a character style to them. I’ve used this method to apply a phonetic font to phonetic characters and an Arabic font to Arabic script. To accomplish this, you need to know InDesign’s notation for Unicode characters and the limits of, in this case, the phonetic and Arabic Unicode ranges. GREP level medium The limits of Unicode ranges can be found on the website of the Unicode consortium. There you’ll find that the basic Arabic characters range from Unicode values 0600 to 06FF. InDesign’s format for Unicode characters is x{0000}, so in InDesign’s notation the basic Arabic characters range from x{0600} to x{06FF}. Assuming that your document contains a character style (e.g., “arabic”) that sets an Arabic font, you can apply that character style to all Arabic characters in the basic range like this: in the Find What field, enter [x{0600}-x{06FF}]+ and set the character style in the Change Format panel. The bracket notation is used in GREP expressions to define a range of characters (it’s called a character class); and we use the plus operator to apply the character to series of Arabic characters. Looking at the chart more closely, however, you notice that things are slightly more complicated: Arabic is contained not in one range, but in four. Apart from the basic range 0600–06FF, we have Arabic Extended-A (08A0–08FF), Arabic Presentation Forms-A (FB50–FDFF), and Arabic Presentation Forms-B (FE70–FEFF). In our document we’re interested only in one additional class, Extended-A. To find all characters in two ranges—here, Unicode ranges 0600–06FF and 08A0–08FF—we simply add the latter to the class

we defined earlier: [x{0600}-x{06FF}x{08A0}-x{08FF}]+

Peter Kahrel

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...