Here is a sample of the text.

NEW! Certificate in Office Operations (3 parts)
Office Operations
Cyber Security for Managers
Embracing Sustainability in the Workplace
Intro to 3D Printing
Intro to Maker Tech: The New Shop Class

I need to be able to match the three lines the follow any line containing the string "(3 parts)"

My thought would be to try a positive look-behind like this:

(?<=\(3 parts\)$)^.*$

but it doesn't match anything.

  • 1
    I'd suggest asking this on StackOverflow as it's really about GREP more than graphic design. And it seems some people on SO love GREP puzzles. (which is a good thing :) – DA01 Jan 29 '16 at 16:50
  • 1
    Does indesign's flavor of GREP allow for multi-line searches? The most basic paragraph is a line break, so GREP paragraph styles presumably stop looking at newline. (I think search-replace GREP can, but not GREP styles) – Yorik Jan 29 '16 at 17:03
  • 1
    I started in StackOverFlow and they were able to give me stuff that would work in other flavors of GREP but not in Indesign so I thought that i would try over here in Graphic Design. I am fairly new to GREP so I wasn't sure if Indesign could handle it. I was hoping that i could do it with a grep style but if i have to to do it through find and replace that would still be better than doing it all manually. I just can't figure out how to tell it what to look for. – jseymour186 Jan 29 '16 at 17:25
  • GREP is confusing enough...Adobe using their own version sounds even worse. Good luck! :) – DA01 Jan 29 '16 at 18:26
  • GREP Styles do not match multiple paragraphs. They stop looking beyond paragraph boundaries. It should work in a regular (GREP) Find and Change (except you probably should not use $ but \r). – Jongware Jan 29 '16 at 18:37

This is the GREP selecting only the following three paragraphs after the "...(3 parts)" sentence:

(?<=\(3 parts\)\r)(.+\r){3}

enter image description here

Search all the characters and the following .+ until the end of the paragraph \r repeated three times {3} preceded by (?<=...) (3 parts) and the end of the paragraph \(3 parts\)\r. With this you make sure the "...(3 parts)" sentence and its end of paragraph invisible character are not included in the search.


if you're doing this in indesign, are you able to change the '3 parts' text to something different? like '!!' for example, as you can hide simple characters like these using a character style.

I used 2 GREP styles in 1 paragraph style. Grep 1: apply [wanted style] to .+!! Grep 2: apply [hide style] to !!

[Hide style] is a character style where the size is 1pt, and horizontal and vertical scale are 1%

this should highlight all text before the '!!' and hide the '!!' for you too

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.