GREP in InDesign CS3

Book description

GREP (short for "General Regular-Expression Print") is a powerful tool that lets you use wildcards ("jokers") to search and replace text. InDesign CS3's GREP implementation can be used for text and also for formatting codes, finding patterns in text as well as literal text. GREP moves beyond the restrictions that hampered earlier InDesign search features, but unfortunately, it does have the reputation of being difficult to master. As with many things, it can be challenging to learn, but, fortunately, a lot can be done with surprisingly simple expressions. The aim of this Short Cut is to show how to create simple but powerful regular expressions.

Table of contents

  1. GREP in InDesign CS3
    1. Power Searching with Regular Expressions
    2. GREP by Example
    3. The Basics
      1. Adding Formatting Codes
      2. Undocumented Features
    4. Wildcards
      1. Any Character
      2. Any Uppercase Letter
      3. Any Lowercase Letter
      4. Any Letter
      5. Any Digit
      6. Any Word Character
      7. Accented Characters
      8. Accented Variants: Character Equivalents
      9. Any Quotation Mark
      10. Any Whitespace
      11. Any Punctuation
      12. Homemade Wildcards: Character Classes
      13. Negative Character Classes
      14. Alternatives: Sort of a Wildcard
    5. Locations
    6. Repeat: Sequences of Characters
      1. ? Zero or One Time
      2. * Zero or More Times
      3. + One or More Times
      4. Repeating a Specific Number of Times
    7. Referring to Wildcards: Back-Referencing
    8. Finding Formatted Text
    9. Replacing with Wildcards
      1. Swap First and Last Name
      2. Swap Last Name and Initials in a Selection
      3. Change First Names to Initials
      4. Change Date Format
      5. Remove Dots at the End of Section Headings
      6. Remove Duplicate Entries in a List
      7. Replace Certain Hyphens with an En Dash
    10. Splitting Up Complex Expressions
      1. Replace Hyphens in Page Ranges with En Dashes
      2. Drop Digits
      3. Keeping Initials Together
    11. Applying Styles with GREP
    12. Apply Formatting to Part of What You Find: Look Around
      1. Adjust Space Between Certain Characters
      2. Smallcaps Revisited
      3. Negative Lookahead
    13. Look Behind You
      1. Italicize Prefixed Words
      2. Italicize Letters Following a Year
      3. Negative Lookbehind
    14. Look Around
      1. Replace Certain Hyphens with En Dashes
      2. Match Words Wrapped in Certain Characters
      3. Keep Certain Words Together
      4. Avoid Single-Word Last Lines
      5. Lookbehind Limitation
      6. Replacing Using Location Markers
    15. Advanced Techniques
    16. Chaining Expressions
    17. Leftovers
    18. Troubleshooting
      1. Escape Characters
      2. GREP Is Case-Sensitive
      3. Hyphens in Character Classes
      4. Parentheses
      5. Split Complex Expressions
      6. Spaces
      7. Wrong Characters Because of Pasting Errors
      8. You're Trying a GREP Search Using the Text Search Tab
    19. Resources
    20. Quick Reference
      1. Character Representations
      2. Character Classes
      3. Location Markers
      4. Modifiers
    21. Acknowledgments
    22. About the Author

Product information

  • Title: GREP in InDesign CS3
  • Author(s):
  • Release date: October 2007
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596517069