Skip to main content
davidb47479670
Participant
May 9, 2024
Answered

Using a word in nested styles

  • May 9, 2024
  • 3 replies
  • 295 views

I am applying a nested style to text that has a lead-in. The nested style would apply a bold character style for the first sentence, or up to the first period. The issue is that some lead-ins contain "U.S." so the nested style will stop at the period between "U" and "S".

 

The one common word in each lead-in is that the sentence always ends with "Risk.". I would like to change the nested style rule to end with that but it doesn't work.

 

Does anyone know of another solution?

 

Thanks in advance.

This topic has been closed for replies.
Correct answer davidb47479670

I didn't describe what I needed properly. I wrote that I wanted to look for anything up to when I actually meant through. I took what Peter sent and modified it a bit to

^.+?(?<=Risk)

 This got the results I was looking for.

 

Thank you Peter and Willi for your help and advice!

3 replies

davidb47479670
davidb47479670AuthorCorrect answer
Participant
May 9, 2024

I didn't describe what I needed properly. I wrote that I wanted to look for anything up to when I actually meant through. I took what Peter sent and modified it a bit to

^.+?(?<=Risk)

 This got the results I was looking for.

 

Thank you Peter and Willi for your help and advice!

davidb47479670
Participant
May 9, 2024

Is there a GREP that will look for anything up to "Risk." and apply a character style? Or am I looking at this the wrong way?

Peter Kahrel
Community Expert
Community Expert
May 9, 2024
^.+?(?=Risk)
Willi Adelberger
Community Expert
Community Expert
May 9, 2024

Use a GREP style instead.