GREP in InDesign is a powerful way to find patterns of text, then do something to that found text. To create a GREP expression that forms the basis of that search pattern, you’ll need to master many regular expressions (the RE in GREP). Don’t worry if you can’t remember them all, though. In InDesign, there is a little menu next to GREP input fields. Click on the little “@” symbol to the right of the field and you’ll find all sorts of GREP search options.
And, if you just want a handy reference, be sure to download my free GREP cheat sheet!
Hi, love your cheat sheet but i’ve been trying to figure out how to generate a grep style in Indesign CC that capitalises the first two words in a story only, not every paragraph. If this can be done could you please help, i can’t seem to find anything online that outlines how it could work. Thanking you
I’m sorry I missed your comment! Please let me know if you still need me to help out with this! -EG
Hi, the cheat codes are very handy. Many thanks for the same. I would like to know if there is any cheat codes for locating a particular letter in the beginning of a line in a paragraph.
If you are looking for a specific letter (perhaps the letter “b”), put
^b
. If you just want to find any character at the beginning, use^.
(if you know you want to find just upper case or lower case, use^\u
or^\l
).In case it’s hard to parse out what is code above, here is each code on its own line:
^b
^.
^\u
^\l
Thanks for the quick response. I was wondering if it is possible to locate the beginning of each line in any given paragraph. Not the beginning of a paragraph.
Hi Erica,
I really enjoyed your presentations on Creativelive. They helped me to start using Indesign and become productive as a freelance “book composer”.
I wonder if there is a way to use GREP to modify the figures of an index of names.
A book has an Index of names with page numbers pointing to the pages the names appear in this book.
Two pages have been removed in two separate places. Therefore, a page numbers range needs to be lowered by 1 another range by 2.
Can we search a range of figures and specify a decrease by 1 and for the second range, a decrease by 2 ?
Hi Chris!
No, GREP won’t let you do math to found text. There is an InDesign script that MIGHT do what you want. It’s called NumberAdjuster. I think there is an updated version here (though I’m not sure how new it is). And, lastly, there is this discussion here, with a script that may or may not work for you.
Glad you enjoy my CreativeLive courses…I have some new ones up and more to come!
Hi Erica, I hop you can help. I am trying to use grep to remove underlined spaces that appear at the end of lines within a multiline paragraph. But I am struggling to find the end of the line. Any help would be awesome.
Sorry I missed your comment. I’m sure it’s too late for the question you had asked, but for future reference, there is no end-of-line GREP code in InDesign. It knows end of paragraph and end of story only.
Brilliant free download, Erica. I have watched your LinkedIn Learning course, too. THANKS AGAIN!
Glad it was helpful… I know it needs a few updates here and there. It’s on my to-do list.