Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

GREP: Replacing consecutive numbers with dash

Return to Member Forum

  • Author
    Posts
    • #14338582
      Cristian Radu
      Participant

      Hi. Is there a possibility to replace the consecutive numbers with a dash? Like: 12, 13, 14, 15 -> 12-15.

      Is about pages from an index and I couldn’t find a way to do this from inside the Index panel or with a script.

    • #14339742
      Aaron Troia
      Participant

      Unfortunately not, GREP isn’t smart enough to recognize consecutive numbers like that, but you could do it if you selected the numbers, but you would physically need to select each range of numbers which I’m not really sure would be any quicker.

      Here is an example GREP for that (with text selected)
      Find:(\d+),.+?(\d+)$
      Change: $1–$2
      Search: Selection

      Aaron

    • #14339744
      Cristian Radu
      Participant

      Thanks for your answer. Fortunately I found a script that solved my issue.

Viewing 2 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads