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

InDesign GREP find digits in last word of paragraph

New Here ,
Mar 11, 2021 Mar 11, 2021

Copy link to clipboard

Copied

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.

TOPICS
How to

Views

798

Translate

Translate

Report

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

Community Expert , Mar 11, 2021 Mar 11, 2021

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

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

Votes

Translate

Translate
Community Expert ,
Mar 11, 2021 Mar 11, 2021

Copy link to clipboard

Copied

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

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

Votes

Translate

Translate

Report

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
New Here ,
Mar 11, 2021 Mar 11, 2021

Copy link to clipboard

Copied

Works like a charm! Thanks so much.

Votes

Translate

Translate

Report

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
New Here ,
Apr 17, 2023 Apr 17, 2023

Copy link to clipboard

Copied

Hi pixxxelschubser  This GREP code is very helpfull. I want to add a single space before the number (any number of digits) at the end of paragraph. What could be the code for this? I give an example  (PO Number123  >  PO Number 123)  or (PO Number3  >  PO Number 3) Thanks in advance

Votes

Translate

Translate

Report

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 ,
Apr 17, 2023 Apr 17, 2023

Copy link to clipboard

Copied

You can try this:

 

In Find what: [[:alpha:]]+\K\d+

In change to: \s$0 

Votes

Translate

Translate

Report

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
New Here ,
Apr 17, 2023 Apr 17, 2023

Copy link to clipboard

Copied

This works fine! Exactly what i needed. Thank a lot!

Votes

Translate

Translate

Report

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 17, 2023 Apr 17, 2023

Copy link to clipboard

Copied

@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.

Votes

Translate

Translate

Report

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 ,
Apr 17, 2023 Apr 17, 2023

Copy link to clipboard

Copied

@Peter Kahrel Nice and simple. Thanks

Votes

Translate

Translate

Report

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
New Here ,
Apr 17, 2023 Apr 17, 2023

Copy link to clipboard

Copied

LATEST

This is also very helpfull.  I will do it the next time. Thanks!

Votes

Translate

Translate

Report

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