I am not a scripter, nor do I play one on TV. I know my share of HTML, CSS, and XML, but really I’m just an old school publishing geek who never tires of learning the next trick or tool. My hands are all GUI from years of keyboard shortcuts.
GREP was added to InDesign with CS3 as a more powerful means of finding and replacing text. While it sounds like something you should be inoculated against (“The nurse gave Johnny his Dip/Tet, his Grep, and a lollipop.”) it really stands for General Regular Expression Print. Forget the General and the Print part, the heart of it are these things called Regular Expressions, little secret codes that function in a Find/Change operation. And they make GREP searches a jillion times more powerful than a plain Text search.
Text search in InDesign only gives you four wildcards: Any Digit, Any Letter, Any Character, and Any Whitespace. GREP has those plus many more wildcards. It also lets you look for locations, like the beginning and endings of words and paragraphs. So you can say “find every word (of any length) starting with a capital letter”.
It lets you specify repeat values, so you can say things like, “find every number of three or more digits”. Or, even fancier, “find every hyphen in between numbers of three or more digits”.
And you can add logic, to say find “Mike” or “mike,”, or find every word ending in “ike,” except “Mike.”
And it lets you take any part of a found expression and leave it alone. So you can find phone numbers, add parens around the area codes, and leave the numbers themselves unchanged.
Combine this text-finding ability with Find Format settings, and I think it’s fair to say you can now Find/Change anything you can think of in an InDesign document. Providing you’re thinking of text, of course.
The only “problem” with GREP is, it’s more digital trivia to learn. Your brain’s already addled with passwords, keyboard shortcuts, file formats, and the names of all the actors on Barney Miller. For the love of Abe Vigoda, how are you going to learn GREP codes?
You can just start playing, but that can be frustrating to say the least, because like all coding adventures, you don’t get much feedback when you’re doing it wrong. Nothing happens, or the wrong thing happens and you have no idea how to fix it. I bought the O’Reilly Safari book on GREP in InDesign CS3, which very good, well worth the $10. But there’s something even better, and it comes from New Zealand.
For learning GREP, there’s a great, free online tool called The Lightning Brain GREPGrokker. It’s offered up by Rorohiko Ltd. who also have a bunch of free and commercial plug-ins for InDesign (make your own Sudoku! Sweet!). The GREP Grokker is an interactive tool for learning GREP. You can follow the step-by-step instructions and see how typing in certain codes selects text. Or you can type/paste in your own text and search on that. It is just so cool to see how the selection changes as you change your codes. It’s very “oooh”, “ahh”. Check it out. And check out Rorohiko’s other plug-ins. There’s some fun free stuff in there. Like if you used to love Quark’s Jabberwocky, they have a version of it for InDesign.