«
»

Advanced InDesign/InCopy GREP Commands

There’s a font I work with from time to time that has some funky punctuation—the commas and periods look alike, the apostrophes and quotation marks look malformed, etc. Not all of the punctuation is weird, but most of it is. So I went to Rabbi Google for the wisdom of InDesign/InCopy GREP searching for just punctuation, and it wasn’t easy to find. And once I had, some of this info was buried in a PDF that didn’t have copy/paste allowed.

Apparently there are many undocumented or understated codes in InDesign/InCopy’s GREP engine that take the form of \p{code}, where you replace particular command phrases in for code. Punctuation was simple: \p{punctuation}, which allowed me to make this search and save it as a query.

Screen Shot 2014-08-29 at 4.08.42 PM

Note that I never use “Change All” on that, because there is some stuff I want to keep in the original font. But I want to manually verify all instances, rather than guess at all the punctuation we might use and find one not in my query that I’ll really wish was when we go to approvals.

More InDesign GREP Codes

Most of these you can do with brackets, and I haven’t tried all of these, but I’ve still found the commands I have used super-helpful. (U+ means that’s a unicode specification.)

Letters

Letter \p{letter}
Lowercase letter \p{lowercase_letter}
Uppercase letter \p{uppercase_letter}
Titlecase letter \p{titlecase_letter}
Spacing modifier letter \p{modifier_letter}
Non-case non-modifier letters \p{letter_other}

Numbers

Numbers \p{number}
Digits 0 to 9 \p{decimal_digit_number}
Roman numerals \p{letter_number}
Other numbers \p{other_number}

Punctuation

Punctuation \p{punctuation}
Hyphens and dashes \p{dash_punctuation}
Opening parentheses, braces \p{open_punctuation}
Closing parentheses, brackets \p{close_punctuation}
Opening quotes \p{initial_punctuation}
Closing quotes \p{final_punctuation}
Underscore, U+203F, U+2040, U+2054 \p{connector_punctuation}
Other punctuation \p{other_punctuation}

Spaces and Separators

Spaces, returns, line separator character, paragraph separator \p{separator}
All spaces except tab & return \p{space_separator}
Line separator character (U+2028) \p{line_separator}
Paragraph separator (U+2029) \p{paragraph_separator}

Symbols

Math and Wingdings \p{symbol}
Math symbols \p{math_symbol}
Currency symbols \p{currency_symbol}
Modifier symbols \p{modifier_symbol}
Wingdings, dingbats \p{other_symbol}

Marks

Marks \p{mark}
Diacritical and tone marks \p{non_spacing_mark}
Vowels SE Asian languages \p{spacing_combining_mark}
Circles, squares, keycaps \p{enclosing_mark}

Other

Other \p{other}
Control characters \p{control}
Formatting character markers \p{format}
Unicode E000–F8FF \p{private_use}
Unassigned Unicode range \p{unassigned}

If you know of others or any errors above, please leave them in the comments!

– Ryan

Share
«
»

3 Responses to Advanced InDesign/InCopy GREP Commands

  1. Ryan Macklin says:

    A comment on the G+ page from Tresi Arvizo:
    https://plus.google.com/u/0/115238641855986579653/posts/Fdx4ttigWMx

    “I don’t know InDesign, but I do know Perl. These look like the Unicode Character Properties that Perl uses. Maybe InDesign’s GREP uses the Perl Compatible Regular Expressions library (http://en.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions)?

    If so, then basic properties are at http://perldoc.perl.org/perlunicode.html#Unicode-Character-Properties and gritty details are at http://perldoc.perl.org/perluniprops.html.

  2. Brilliant! I didn’t know these either (and I’ve been teaching InDesign GREP)! Many are similar to the POSIX commands. For example, you can also use [[:punct:]] in InDesign’s GREP features to find any punctuation.

  3. David Popham says:

    Thanks for posting. I can see potential uses for the symbols codes.