GREP and Metacharacters in the Indesign CS5 and CS5.5 Find
Total Page:16
File Type:pdf, Size:1020Kb
GREP and Metacharacters in the Find/Change dialog box of InDesign CS5 & 5.5 Description Text GREP Quotation Marks Text GREP Beginning of Paragraph . ^ Found (Change Field) GREP Tab . ^t . \t Any Double Quotation Marks . “ . “ End of Paragraph . $ Found Text . $0 Forced Line Break . ^n . \n Any Single Quotation Marks . ‘ . ‘ Beginning of Story . .\A . Found 1 . $1 End of Paragraph . ^p . \r. Straight Double Quotation Marks “ . ^” . ~” End of Story . \Z Found 2 . $2 Symbols Text GREP Double Left Quotation Marks “ . ^{ . ~{ Repeat GREP Found 3 . $3 Bullet Character • . ^8 . .~8 Double Right Quotation Marks “ . ^} . ~} Zero or One Time . ? Found 4 . $4 Carat Character ^ . ^^ . \^ Straight Single Quotation Mark ‘ . ^’ . ~’ Zero or More Times . * Found 5 . $5 Backslash Character \ . \ . \\ Single Left Quotation Mark ‘ . ^[ . ~[ One or More Times . +. Found 6 . $6 Copyright Symbol © . ^2 . ~2 Single Right Quotation Mark ’ . ^] . ~] Zero or One Time (Shortest Match) . ?? Found 7 . $7 Ellipsis … . ^e . ~e Break Character Text GREP Zero or More Times (Shortest Match) . *? Found 8 . $8 Paragraph Symbol ¶ . ^7 . ~7 Standard Carriage Return . ^b. .~b One or More Times (Shortest Match) . +? Found 9 . $9 Registered Trademark Symbol ® . ^r . ~r Column Break . ^M . ~M Match GREP More undocumented GREP codes Section Symbol § . ^6 . .~6 Frame Break . ^R . .~R Marking Subexpression . () Letter . \p{letter} Trademark Symbol ™ . ^d. .~d Page Break . ^P . .~P Non-Marking Subexpression . (?:) Lowercase letter . \p{lowercase_letter} Open Parenthesis ( . ( . \( Odd Page Break . ^L . ~L Character Set . [] Uppercase letter . \p{uppercase_letter} Closed Parenthesis ) . ) . \) Even Page Break . ^E . ~E Or . .| Titlecase letter . \p{titlecase_letter} Open Brace Character { . { . \{ Discretionary Line Break . .^k . ~k Positive Lookbehind . (?<=) Spacing modifier letter . .\p{modifier_letter} Closed Brace Character } . } . \} Variable Text GREP Negative Lookbehind . (?<!) Non-case non-modifier letters . \p{letter_other} Open Bracket Character [ . [ . \[ Any Variable . ^v . ~v Positive Lookahead . (?=) Marks . \p{mark} Closed Bracket Character ] . ] . \] Running Header (Paragraph Style) . ^Y . ~Y Negative Lookahead . (?!) Diacritical and tone marks . \p{non_spacing_mark} Markers Text GREP Running Header (Character Style) . .^Z . ~Z Modifiers GREP Vowels SE Asian languages . \p{spacing_combining_mark}. Any Page Number . ^# . .~# Custom Text . ^u . .~u Case-Insensitive On . (?i) Circles, squares, keycaps . \p{enclosing_mark} Current Page Number . ^N . .~N Last Page Number . ^T . ~T Case-Insensitive Off . (?-i). Spaces, returns, 2028, 2029 . .\p{separator} Next Page Number . ^X . ~X Chapter Number . ^H . .~H Multiline On . (?m) All spaces except tab & return . \p{space_separator} Previous Page Number . ^V . ~V Creation Date . ^O . .~O Multiline Off . (?-m) Line separator character 2028 . \p{line_separator} Section Marker . ^x . ~x Modification Date . ^o . ~o Single-Line On . (?s) Paragraph separator 2029 . \p{paragraph_separator} Anchored Object Marker . .^a . ~a Output Date . ^D . .~D Single-Line Off . (?-s) Math and Wingdings . \p{symbol} Footnote Reference Marker . ^F . ~F File Name . ^1 . ~1 Ignore Whitespace On . (?w) Math symbols . \p{math_symbol}. Index Reference Marker . ^I . ~I Metadata Caption . ^J . ~J Ignore Whitespace Off . (?-w) Currency symbols . \p{currency_symbol} Hyphens and Dashes Text GREP Other Text GREP Posix GREP Modifier symbols . \p{modifier_symbol} Em Dash . .^_ . ~_ Right Indent Tab . ^y . ~y Any alphanumeric character . [[:alnum:]] Wingdings, dingbats . \p{other_symbol} En Dash . ^= . ~= Indent to Here . ^i . ~i Any alphabetic character . [[:alpha:]]. Numbers . \p{number} Discretionary Hyphen . ^- . ~- End Nested Style Here . .^h . .~h Only digits 0 to 9 . [[:digit:]] Digits 0 to 9 . \p{decimal_digit_number} Nonbreaking Hyphen . ^~ . ~~ Non-Joiner . ^j . ~j Any lowercase character a to z . [[:lower:]] Roman numerals . \p{letter_number} White Space Text GREP Clipboard Contents, Formatted . ~c Any punctuation and symbols . [[:punct:]] Other numbers . .\p{other_number} Em Space . ^m . ~m Clipboard Contents, Unformatted . ~C Any whitespace and break . [[:space:]] Punctuation . \p{punctuation} En Space . ^> . ~> Wildcards Text GREP Any uppercase character A to Z . [[:upper:]] Hyphens and dashes . \p{dash_punctuation} Flush Space . ^f . ~f Any Digit . ^9 . \d Any letter, number, and underscore . [[:word:]] Opening parentheses, braces . \p{open_punctuation} Hair Space . ^| . ~| Any Letter . ^$ . [\l\u] Any hexadecimal 0-9, a-f, and A-F . [[:xdigit:]] Closing parentheses, brackets . \p{close_punctuation} Nonbreaking Space . ^S . ~S Any Character . ^? . Any character of a certain glyph set . [[=a=]] Opening quotes . \p{initial_punctuation} Nonbreaking Space (Fixed Width) . ^s . ~s Any White Space . ^w . \s (such as a, à, á, â, ã, ä, å, A, À, Á, Â, Ã, Ä, Å) Closing quotes . \p{final_punctuation} Thin Space . .^< . ~< Any Word Character . \w Any blank character, ie space or tab . [[:blank:]] Underscore, 203F, 2040, 2054 . \p{connector_punctuation} Figure Space . ^/ . ~/ Any Lowercase Letter . \l Any control character . [[:cntrl:]] Other punctuation . \p{other_punctuation} Punctuation Space . ^. ~ . Any Uppercase Letter . \u Any visible character . [[:graph:]] Other . \p{other} Third Space . ^3 . ~3 Locations GREP Any visible characters and spaces . [[:print:]] Control characters . \p{control} Quarter Space . ^4 . .~4 Beginning of Word . \< Any character code greater than 255 . [[:unicode:]] Formatting character markers . \p{format} Sixth Space . ^% . ~% End of Word . \> (applies only to the wide character traits classes) E000–F8FF . \p{private_use} Word Boundary . \b Unassigned Unicode range . .\p{unassigned}. [email protected] | www.jetsetcom.net | [email protected] | www.trainingonsite.com GREP and InDesign CS5 some useful search examples to explore 1. Find ALL CAPS paragraphs 6. Find and delete soft return line breaks 12. Search for phone numbers to regularize 16. TitleCase applied except for small words Find: \u\u+(\ \?\r?)$. Find: \s?\n Find: \d?[- . ]? Find: :\s\l|[-\s]\l(?!(f|he|nd?|o|y|rom|or|ut)?\b) Change with formatting: paragraph style Change: with single spacebar space \(?(\d{3})\)?[- . ]?(\d{3})[- . ]?(\d{4}) Change: formatting to All Caps styling Note: When your untagged text has occasional paragraphs Note: Soft returns replaced by spacebar space Change: $1 .$2 .$3 Note: Search the selection . Leave the Change what field blank . typed in all caps, this script finds two or more uppercase Or Change: $1-$2-$3 or Change: ($1) $2-$3 This won’t work on all uppercase text! This also converts to letters followed by a period and a hard return . This is uppercase any word that follows a colon or a hyphen . enough to find such paragraphs and tag them . Step 2, run 7. Find quoted words and change to italic Note: This finds a sequence of 3, 3, and 4 digits . The ? symbol ChangeCaseofSelectedStyle .jsx, a script by Dave Saunders of Find: (~{)(\u*\l*\s* *\w*\d*)(~}). indicates that the element can exist zero or one time in the PDSAssoc .com . This converts case . string, so the code [- . ]? means that a hyphen, dot, or space 17. Undocumented negation in Wildcards Change: $2 and italic character style formatting may or may not exist between the digits . Replace can use Not documented in the Wildcards flyout is that the periods, parentheses, or hyphens, as you wish . 2. Find ALL CAPS words Note: This finds the quotes but leaves them out since it only uppercase version of the wildcards negates them . changes to found group 2; not 1 and 3 . Find: \<[A-Z]{2,}\> 13. Search for dates to format Note: Thus, \D finds everything that is not a digit; \U.