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.
Hi Erica, I’m a creative manager for a commercial real estate firm, and we create large-format documents. GREP Styles has played a significant role in formatting those documents. I always find it challenging to create my own GREP codes. However, I have successfully created two (very basic) codes that have been helpful. Your LinkedIn Learning on GREP was excellent and very helpful in creating those codes. Since the training was published four years ago, has much changed since? Are there any new codes or suggestions you might have since then?
Hi Jamie! I’m sorry I didn’t see this comment waiting for approval… apologies! I hope your use of GREP has continued to grow. There really hasn’t been much in the way of additional expression or other GREP integrations, no. There are a few that are undocumented in InDesigns, such as \v and \h for all vertical or horizontal spaces, respectively. Also there is \K which basically tells InDesign to ignore whatever it finds before the \K.
I would suggest joining the Treasures of GREP Facebook page, if you can. They are a wonderful resource!
Hi Erica!!! I am amazed by your content!!! Do you have any GREP-only courses available? Here in Brazil it is difficult to find anything related to Indesign, especially GREP. Good luck!
Sorry I never saw this comment waiting on approval. If you are still looking for a GREP course, I have a paid one at CreativePro here: https://creativepro.com/introduction-to-grep-for-indesign/
I also have playlists on my YouTube channel and there are several GREP videos on the CreativePro YouTube channel.
I will also be giving an intro to GREP session at Adobe MAX, which is available online for free (in October).
Hi Erica, thanks for the very useful guide!
You’re quite welcome!