Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


[ Branched ] Group consecutive numbers

Community Beginner ,
Apr 15, 2021 Apr 15, 2021

Copy link to clipboard

Copied

Hi there. My problem is pretty different. I need to find any range of consecutive numbers and replacing the no between first and last with a dash.

E.g.: Find: 12, 13, 14, 15, 16 etc. and replace with 12-16.

Is this possible? Thanks.



[ topic branched to InDesign forum by moderator ]

[ title added by moderator ]

 

 

TOPICS
How to

Views

260

Likes

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

Adobe Community Professional , Apr 17, 2021 Apr 17, 2021
Search for  groupSequentiellNum.jsx  or  groupSequentiellNum2.jsx  by the German script writer Martin Fischer. These scripts replace: Content 1 ........ 1, 2 Contents 2 ........ 4, 5, 6 Contents 3 ........ 7, 8, 9, 10 in (variant 1): Contents 1 ........ 1-2 Contents 2 ........ 4-6 Contents 3 ........ 7-10 or in (variant 2): 1, 2, 11, 12, 13, 21, 22, 23, 24, 31-32, 41-43, 51-54 --> 1f., 5, 11ff., 21ff., 31f., 41ff., 51ff.

Likes

Translate

Translate
Adobe Community Professional ,
Apr 16, 2021 Apr 16, 2021

Copy link to clipboard

Copied

hi,

with GREP Styles/Find&Replace it should be possible, yes…

https://community.adobe.com/t5/indesign/grep-to-find-a-range-of-numbers/m-p/9357941

 

PS: Please specify your «problem» inside the Titel and Content of your post.

Likes

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 Beginner ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

Thank you, but your link leads to a different issue and doesn't get an answer to my question.

P.S. I'll try to edit the title of my post.

Likes

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
Adobe Community Professional ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

I'm not a serial GREPer but I came up with this

 

(\d+), \d.+, (\d+)

 

$1-$2

 

It's very specific, so might not catch all cases.

 

For example on 1,2,3,4,5

 

 

Likes

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 Beginner ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

Thanks for your effort, you are almost there, but I need to find only consecutive numbers. Your grep finds all the numbers in a row. 

Likes

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
Advisor ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

You need The Force! (I mean scripting!)  😉

 

(^/)  The Jedi

Likes

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
Adobe Community Professional ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

I don't think that's possible with GREP.

 

It might be able to be scripted - but that is specialist and where someone might do it off their own accord as a favour; it is specialist, so someone may have a fee in mind to create a script for you. 

 

Is that something you'd be interested in? 

The forum has some very good scripters.

Likes

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
Adobe Community Professional ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

Do you need the replacement for parts of the text?
Or for a table of contents? (There are already (free) scripts for this.)
Or ...

 

Please give a more detailed description.

Likes

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 Beginner ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

It is about the number of pages generated by the Index. Lots of them are consecutive numbers, such as 760, 761, 762, 763, 764 - and I wish to replace them with 760-764. Thanks. I found a script of Peter Kahrel (Index_update, as I remember), but doesn't work. It just deletes the whole paragraph.

Likes

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
Adobe Community Professional ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

Search for  groupSequentiellNum.jsx  or  groupSequentiellNum2.jsx  by the German script writer Martin Fischer.

These scripts replace:
Content 1 ........ 1, 2
Contents 2 ........ 4, 5, 6
Contents 3 ........ 7, 8, 9, 10

 

in (variant 1):
Contents 1 ........ 1-2
Contents 2 ........ 4-6
Contents 3 ........ 7-10

 

or in (variant 2):

1, 2, 11, 12, 13, 21, 22, 23, 24, 31-32, 41-43, 51-54  -->  1f., 5, 11ff., 21ff., 31f., 41ff., 51ff.

 

 

Likes

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 Beginner ,
Apr 19, 2021 Apr 19, 2021

Copy link to clipboard

Copied

LATEST

Thanks a lot. This was of real help.

Likes

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