Skip to main content
Participant
March 11, 2021
Answered

InDesign GREP find digits in last word of paragraph

  • March 11, 2021
  • 2 replies
  • 1449 views

I'm struggling to figure out this GREP code. I created a paragraph style to highlight numbers in the last word of a paragraph.

 

An example data set would be:

Baltimore 3

Jacksonville 5*

Portland 9+

Sunny7 3+

 

I want to only highlight the numbers, but only if they're at the end of the paragraph, and I don't want to select the pluses or asterisks.

This topic has been closed for replies.
Correct answer pixxxelschubser

Without further informations (maybe) I would do something like this:

\d+(?=[*+]$)|\d+$

2 replies

Peter Kahrel
Community Expert
Community Expert
April 17, 2023

@Krdms Please start a new topic for new questions. But anyway, to add a space before paragraph-final numbers, do this:

Find what: (?=\d+$)

Change to: <a space character>

 

P.

Bedazzled532
Inspiring
April 17, 2023

@Peter Kahrel Nice and simple. Thanks

pixxxelschubser
Community Expert
pixxxelschubserCommunity ExpertCorrect answer
Community Expert
March 11, 2021

Without further informations (maybe) I would do something like this:

\d+(?=[*+]$)|\d+$

Participant
March 11, 2021

Works like a charm! Thanks so much.