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

GREP expression for a string followed by digits

Community Expert ,
Jul 11, 2020 Jul 11, 2020

Copy link to clipboard

Copied

Hi,

 

I''m cleaning up  a manual TOC.

 

What would the GREP expression be for the following

Topic 1...................10

Topic 2.............................12

 

Final result needs to look like this

Topic 1

Topic 2

 

tia

TOPICS
How to

Views

440

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 , Jul 11, 2020 Jul 11, 2020

If you want to remove those full stops and digits at the end, use this:

 

\.+\d+$

 

and replace with nothing. This will not affect any text and/or formatting at the start of each line.

Votes

Translate

Translate
Community Expert ,
Jul 11, 2020 Jul 11, 2020

Copy link to clipboard

Copied

Hi There,

 

Try the following

Find what

(Topic\s+\d+).+

Replace with

$1

 

-Manan

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 ,
Jul 11, 2020 Jul 11, 2020

Copy link to clipboard

Copied

If you want to remove those full stops and digits at the end, use this:

 

\.+\d+$

 

and replace with nothing. This will not affect any text and/or formatting at the start of each line.

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 ,
Jul 12, 2020 Jul 12, 2020

Copy link to clipboard

Copied

Thanks everybody,

 

@_Jongware, This almost works perfectly.

 

I noticed that the . is followed by a space. My bad, sorry.

 

So the text is Topic. . . . 123

 

I've tried \.\s+\d+$ but it only takes away the last . \d\d

 

This works, but I lose the paragraph break a the end \.\s+\d+ 

 

tia

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 ,
Jul 11, 2020 Jul 11, 2020

Copy link to clipboard

Copied

Please show a screenshot of the table of contents of your InDesign file with 'show hidden characters'.

 

One shot into darkness:

Are your "points" real points?

Or only a tab with fill characters?

If this is the case:

\t\d+$

replace with

nothing

should do the job.

 

 

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
Explorer ,
Jul 11, 2020 Jul 11, 2020

Copy link to clipboard

Copied

[\h\.]\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
Community Expert ,
Jul 12, 2020 Jul 12, 2020

Copy link to clipboard

Copied

My crystal ball isn't clean enough.

 

Again (to quickly find a final solution):

@pixxxel_schubser wrote: "… Please show a screenshot of the table of contents of your InDesign file with 'show hidden characters' …"

 

for example:

\h(\.\h)+\d+

Fuellzeichen_weg01.png

 

Fuellzeichen_weg02.png

 

 

 

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 ,
Jul 13, 2020 Jul 13, 2020

Copy link to clipboard

Copied

LATEST

?

 

@master_mo, do you need further assistance?

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