GREP QUICK REFERENCE CHART

WILDCARDS Any Digit finds each single digit: Mary had 3 little lambs. Her whole flock was made up of these three, and 15 Any Digit \d fully-grown sheep. Any Letter [\l\u] Any Letter finds each single letter (uppercase or lowercase): Any Character . Mary had 3 little lambs. Her whole flock was made up of these three, and 15 Any White \s fully-grown sheep. Any Word Character \w Any Character finds each single character (except line break): Mary had 3 little lambs. Her whole flock was made up of these three, and 15 Any Lowercase Letter \l fully-grown sheep. Any Uppercase Letter \u

LOCATIONS Beginning of : Mary had 3 little lambs. Her whole flock was made up of these three, and 15 Beginning of Word \< fully-grown sheep. End of Word \> End of Paragraph: Word Boundary \b Mary had 3 little lambs. Her whole flock was made up of these three, and 15 Beginning of fully-grown sheep. ^ Paragraph End of Story: End of Paragraph $ Mary had 3 little lambs. Her whole flock was made up of these three, and 15 fully-grown sheep. Beginning of Story \ Her sister, Shari, didn’t have any sheep at all. End of Story \Z

REPEAT Zero or One Time: The item may appear one time in sequence, or it may not appear at all. Zero or One Time ? Zero or More Times: Zero or More Times * The item may appear any number of times in sequence, or it may not appear at One or More Times + all. Zero or One Time *? One or More Times: (Shortest Match) The item appears one time or more in sequence. One or More Times +? Shortest Match: (Shortest Match) Keeps the search to the first complete sequence. Without “shortest match,” InDesign looks to the whole paragraph for the sequence.

See more GREP examples and other Tips and Tricks at www.ericagamet.com GREP QUICK REFERENCE CHART

MATCH Offset text as expressions: Use parentheses to offset an entire expression or to group items together. For Marking () instance, in Find/Change, if you are looking for a string of 10 digits, but you Subexpression (parentheses) want to return them in a different order, or insert additional information Non-Marking between the groups, use parenthesis. (?:) Subexpression Example - format a phone number from a 10-digit string: 3035551212 [] Character Set In Find/Change: (\d\d\d)(\d\d\d)(\d\d\d\d) (square brackets) This will see each group separately. You could then return only the 2nd and 3rd Or | (pipe character) groups, if wanted. (See “Found” expressions) Positive (?<=) Look for something OR something else: Lookbehind Use the straight slash (or pipe character, located over the backslash) to indicate Negative either this item OR that item. You can have multiple items, each divided by the (?point by using a Positive Lookbehind. Looking behind the text (what appears before), if the string exists (the decimal point in this case), then do something with the searched text (the digits). Look for: (?<=\.)\d+ To find this: 123.45 Use Positive Lookbehind (?<=) and add in the decimal point. However, since the decimal means something specific in GREP, you need to “escape” the decimal to indicate you’re looking for an actual decimal. That is the backslash before the decimal. Put that inside the parentheses as well so it finds an entire string. The next part, the \d+, is looking for any digit, one or more times. You can then do something to the found portion, which is the 45 in the example above.

See more GREP examples and other Tips and Tricks at www.ericagamet.com GREP QUICK REFERENCE CHART

SYMBOLS AND BREAK CHARACTER Bullet Character ~8 ~_ Standard Carriage Return ~b Backslash Character \\ Dash ~= Break ~M Caret Character \^ Discretionary ~- Frame Break ~R Copyright ~2 Nonbreaking Hyphen ~~ Break ~P Ellipsis ~e Odd Page Break ~L WHITE SPACE Paragraph Symbol ~7 Even Page Break ~E Em Space ~m Reg. Trademark Symbol ~r Discretionary Line Break ~k En Space ~> Section Symbol ~6 Flush Space ~f VARIABLE Trademark Symbol ~d Hair Space ~| Any Variable ~v Open Parenthesis \( Nonbreaking Space ~S Running Header Close Parenthesis \) ~Y Nonbreaking Space (Paragraph Style) Open Brace \{ ~s (Fixed Width) Running Header ~Z Close Brace \} ~< (Character Style) Open Bracket \[ Figure Space ~/ Custom Text ~u Close Bracket \] Space ~. Last Page Number ~T Chapter Number ~H MARKERS Third Space ~3 Creation Date ~O Any Page Number ~# Quarter Space ~4 Modification Date ~o Current Page Number ~N Sixth Space ~% Output Date ~D Next Page Number ~X QUOTATION MARKS File Name ~I Previous Page Number ~V Any Double Quotation Marks “ Metadata Caption ~J Section Marker ~x Any Single ‘ Anchored Object Marker ~a Straight Dbl Quotation Marks ~” OTHER Footnote Reference Right Indent Tab ~y ~F Double Left Quotation Mark ~{ Marker Double Right Quotation Mark ~} Indent to Here ~i Index Marker ~I Straight Single Quotation Mark ~’ End Nested Style Here ~h Single Left Quotation Mark ~[ Non-joiner ~j Single Right Quotation Mark ~]

See more GREP examples and other Tips and Tricks at www.ericagamet.com GREP QUICK REFERENCE CHART

MODIFIERS More Information: Case-insensitive On To see more examples of GREP in action, visit my website at: Case-insensitive Off www.ericagamet.com Multiline On I’ll be updating this file from time to time as well, so be sure to check the site for Multiline Off the newest version. Single-line On Feel free to email me with any GREP questions you might have. Chances are, the Single-line Off GREP you need has been done before and can be found online or through my resources. POSIX [[:alnum:]] Be sure to check out Peter Kahrel’s book, “Grep in InDesign.” If you’re a member [[:alpha:]] of Adobe’s InDesign User Group, you can get it at a discount. [[:digit:]] [[:lower:]] [[:punct:]] [[:space:]] [[:upper:]] [[:word:]] [[:xdigit:]] [[:=a=:]]

See more GREP examples and other Tips and Tricks at www.ericagamet.com