Skip to main content
Known Participant
April 10, 2019
Answered

Is there a Grep that will style everything after a certain word?

  • April 10, 2019
  • 5 replies
  • 8052 views

Hi. I need to make everything after and including the word "NOW" bold and a certain color. Is this possible. Thank you for any help!

This topic has been closed for replies.
Correct answer FRIdNGE

Hi,

I've always preferred the precision! …

(\bNOW\b)(.(?!\1))+$

Best,

Michel, for FRIdNGE

5 replies

jane-e
Community Expert
Community Expert
April 10, 2019

Hi epheweAll

Just because no one has said it yet:

Whether you go with GREP or nested styles, you will need to create paragraph and character styles.

  • For GREP, you go to the GREP part of the paragraph style and put in the code, then assign the character style.
  • For nested styles, you say “use this character style until it meets this condition”, then use the paragraph style.

This is over-simplified, and you may know it already, but others may also come across this with a Search. We can explain in greater detail if necessary.

Jane

Stephen Marsh
Community Expert
Community Expert
April 10, 2019

Another approach, which is just a variation:

.+\KNOW.+

FRIdNGE
FRIdNGECorrect answer
Inspiring
April 10, 2019

Hi,

I've always preferred the precision! …

(\bNOW\b)(.(?!\1))+$

Best,

Michel, for FRIdNGE

epheweAllAuthor
Known Participant
April 10, 2019

Thanks Michel! Works great. Cheers

Community Expert
April 10, 2019

Hi epheweAll ,

that would be a positive look behind for the word:

(?<=\bNOW).+

If you don't like to include the white space after the word:

(?<=\bNOW\s).+

Depending how often the word NOW is used in the paragraph we need a more precise approach.

Regards,
Uwe

vladan saveljic
Inspiring
April 10, 2019

Hi Uwe,

epheweAll wants to include the word NOW

Community Expert
April 10, 2019

Ah yes. Did not have my morning coffee…

Thanks, Vladan!

Willi Adelberger
Community Expert
Community Expert
April 10, 2019

A nested style would have a better performance.

Inspiring
September 17, 2023

Can it search for certain words?

Peter Spier
Community Expert
Community Expert
September 17, 2023

Grep can find words, Nested Styles cannot. If you enter a word into the nested style trigger field it will trigger on any character in that word.

vladan saveljic
Inspiring
April 10, 2019

if you want to find everything, try this

\bNOW.+

but let us know if you don't want to find just everything after the word NOW

epheweAllAuthor
Known Participant
April 10, 2019

Thanks so much Vladan!