Copy link to clipboard
Copied
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!
Hi,
I've always preferred the precision! …
(\bNOW\b)(.(?!\1))+$
Best,
Michel, for FRIdNGE
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Thanks so much Vladan!
Copy link to clipboard
Copied
A nested style would have a better performance.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Can it search for certain words?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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! 😉
(^/) The Jedi
Copy link to clipboard
Copied
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".
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi Uwe,
epheweAll wants to include the word NOW
Copy link to clipboard
Copied
Ah yes. Did not have my morning coffee…
Thanks, Vladan!
Copy link to clipboard
Copied
Thanks for your help Laubender!
Copy link to clipboard
Copied
Another approach, which is just a variation:
.+\KNOW.+
Copy link to clipboard
Copied
Hi,
I've always preferred the precision! …
(\bNOW\b)(.(?!\1))+$
Best,
Michel, for FRIdNGE
Copy link to clipboard
Copied
Thanks Michel! Works great. Cheers
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
NOW \$\d+(\.\d+)?
Copy link to clipboard
Copied
Thank you again @Michel [FRIdNGE] ! Damn you are good at this
This has saved me!
Cheers
Copy link to clipboard
Copied
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!
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
Regards,
Uwe
Copy link to clipboard
Copied
Thanks again Laubender for all the info. I'll look into it.
Have a great day!
Copy link to clipboard
Copied
Thanks @Stephen_A_Marsh!
Copy link to clipboard
Copied
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.
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