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 ]
with GREP Styles/Find&Replace it should be possible, yes…
PS: Please specify your «problem» inside the Titel and Content of your post.
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.
I'm not a serial GREPer but I came up with this
(\d+), \d.+, (\d+)
It's very specific, so might not catch all cases.
For example on 1,2,3,4,5
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.
You need The Force! (I mean scripting!) 😉
(^/) The Jedi
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.
Do you need the replacement for parts of the text?
Or for a table of contents? (There are already (free) scripts for this.)
Please give a more detailed description.
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.
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.
Thanks a lot. This was of real help.