Skip to main content
Participant
April 23, 2024
Answered

GREP Style for end of paragraph word OR after character

  • April 23, 2024
  • 1 reply
  • 576 views

I am horrible with coding (GREP).

Would anyone know how to either make this text (sale price) be applied with a character style? When I go to apply a Paragraph style, I either the ending word of the paragraph to have a style, or have it to run after a certain character. I'll include the attachment of how I want it (circled text). After all, I am horrible with coding. Maybe I can learn something!
Thanks!

This topic has been closed for replies.
Correct answer Eugene Tyson

\$\d+?\.\d{2}

 

It's all wild cards

\$ is a dollar sign the slash 'escapes' the $ which is used for signaling other thing with GREP - so basically means $ literally

\d is a digit

. on it's own is any character - so \. where the slash escapes the . means the actual dot

\d is a digit

{2} is two times

 

In the item code  paragraph style - go to the GREP Nested Style

Insert the code

Select the Character Style for price - if you don't have you you can create one there.

 

https://redokun.com/blog/grep-indesign

 

1 reply

Eugene TysonCommunity ExpertCorrect answer
Community Expert
April 23, 2024

\$\d+?\.\d{2}

 

It's all wild cards

\$ is a dollar sign the slash 'escapes' the $ which is used for signaling other thing with GREP - so basically means $ literally

\d is a digit

. on it's own is any character - so \. where the slash escapes the . means the actual dot

\d is a digit

{2} is two times

 

In the item code  paragraph style - go to the GREP Nested Style

Insert the code

Select the Character Style for price - if you don't have you you can create one there.

 

https://redokun.com/blog/grep-indesign

 

Peter Spier
Community Expert
Community Expert
April 23, 2024

Eugene, looks like you have an extra { before the two...

Community Expert
April 24, 2024
Thanks, fixed.
It takes a village