Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Explorer ,
Apr 09, 2019 Apr 09, 2019

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!

Screen Shot 2019-04-10 at 5.12.52 PM.png

6.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Apr 10, 2019 Apr 10, 2019

Hi,

I've always preferred the precision! …

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

Best,

Michel, for FRIdNGE

Translate
Guide ,
Apr 09, 2019 Apr 09, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 10, 2019 Apr 10, 2019

Thanks so much Vladan!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2019 Apr 10, 2019

A nested style would have a better performance.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2019 Apr 10, 2019

This is an interesting comment (and one I have never considered):

A nested style would have a better performance.

So here is my question for all of you GREP gurus on this thread: if you can accomplish the same task with either  nested styles (in the OP's example, three nested styles) or one nested GREP style—is there an advantage to going with nested vs GREP? Do nested styles have measurably better performance, apples to apples?

~Barb

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Apr 10, 2019 Apr 10, 2019

Barb,

I think the performance of GREP styles versus Nested styles has to be similar at the simple level. ID still needs to evaluate the paragraph they are part of for changes in conditions, words, phrases, etc.

Here's a short version of why I choose one versus the other.

If it can be done with a nested style, I'll do it that way. If for no other reason it is "dumb" logic. I only really use nested styles for lead-ins, simple changes to the appearance of a repeated word or phrase, etc.

If I need to find a pattern(s), then I will use GREP styles. Especially if there are more than single logic statements needed.

Else I'll use f/c (where GREP may/will be involved) or cobble together a script if I have to.

Mike

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 17, 2023 Sep 17, 2023

Can it search for certain words?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 17, 2023 Sep 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 17, 2023 Sep 17, 2023

Hmm! ... Writing "Nested styles don't find words (one or more)" doesn't seem really true to me at the very least.

But it's a personal point of view!  😉

 

Capture d’écran 2023-09-17 à 16.07.35.png

 

(^/)  The Jedi

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 17, 2023 Sep 17, 2023
LATEST

Nested styles can COUNT words, but cannot tell what those words are, which would be required to FIND them.

If youo need to do something to a particualr word, or befor or after a particular word, nested styles can oly work if there is a fixed pattern to the location of that word that can be identified, such as it is the third word in the second sentence, or the fifth word after the second comma. You cannot say apply [myStyle] up to the word "cat" as it will trigger on the first c, a or t that it finds, not the word "cat".

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2019 Apr 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 10, 2019 Apr 10, 2019

Hi Uwe,

epheweAll wants to include the word NOW

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2019 Apr 10, 2019

Ah yes. Did not have my morning coffee…

Thanks, Vladan!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 10, 2019 Apr 10, 2019

Thanks for your help Laubender!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2019 Apr 10, 2019

Another approach, which is just a variation:

.+\KNOW.+

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 10, 2019 Apr 10, 2019

Hi,

I've always preferred the precision! …

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

Best,

Michel, for FRIdNGE

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 10, 2019 Apr 10, 2019

Thanks Michel! Works great. Cheers

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 10, 2019 Apr 10, 2019

Sorry to bother you again @Michel [FRIdNGE]. Do you know if theres a way to continue this through a paragraph and ONLY style the word "NOW" and the price "$123" as seen in photograph? Thanks again for any help!

Screen Shot 2019-04-11 at 8.59.14 AM.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 10, 2019 Apr 10, 2019

NOW \$\d+(\.\d+)?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 10, 2019 Apr 10, 2019

Thank you again @Michel [FRIdNGE] ! Damn you are good at this

This has saved me!

Cheers

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2019 Apr 10, 2019

epheweAll  wrote

Sorry to bother you again @Michel [FRIdNGE]. Do you know if theres a way to continue this through a paragraph and ONLY style the word "NOW" and the price "$123" as seen in photograph? Thanks again for any help!

Screen Shot 2019-04-11 at 8.59.14 AM.png

Hi,

somehow I already thought this question would come up. 🙂

FWIW: Learn about GREP.

Try to analyze the text you like to find. Look at diverse samples in your text. Ask yourself if something can be said generally of the text or at least chunks of it.

Read into GREP land e.g. here:

Peter Kahrel | GREP in InDesign, 3rd Edition

https://indesignsecrets.com/now-available-grep-in-indesign-3rd-edition.php

Use tools that help to understand found patterns like this free script:

Jongware's whatthegrep script

Indesign GREP Help

Regards,
Uwe

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 10, 2019 Apr 10, 2019

Thanks again Laubender​ for all the info. I'll look into it.

Have a great day!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 10, 2019 Apr 10, 2019

Thanks @Stephen_A_Marsh!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 10, 2019 Apr 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines