Capturing group with two-digit expression

Learn / Forums / General InDesign Topics / Capturing group with two-digit expression

Viewing 2 reply threads
  • Author
    Posts
    • #76986
      Peter Gala
      Member

      Hello all, I’m trying to fix my ISBN numbers inside the publication with GREP. I want to make the format uniform. For example “333-22-333-4444-1”. The problem is fast every ISBN has its own format (different dash positions).

      I’m trying to fix that this way
      find: (\d)\-*(\d)\-*(\d)\-*(\d)\-*(\d)\-*(\d)\-*(\d)\-*(\d)\-*(\d)\-*(\d)\-*(\d)\-*(\d)\-*(\d)\-*
      change: $1$2$3-$4$5-$6$7$8-$9$10$11$12-$13

      But the result is: 333-22-333-4303132-33
      The problem is – capturing of the group works only to the number “9”. Do you have any tip how to capture two-digit group? 10, 11, 12…

      Many thanks

    • #76988
      John Kelsall
      Member

      I’m not 100% sure what the final outcome you want is, but how about doing the (\d)- search for $1-$8 so that the search changes the results to the colour red. Then alter your search as necessary to search the rest of the (\d)\- that are in black. Not sure this is the answer, but may be it might help. When finished delete the colour red back to black. I know this is not the answer you want, but it is a way round it.

    • #76989
      Peter Gala
      Member

      Hi Johnny, thanks for reply. According to the example the result might be “333-22-333-4444-1”
      Yes, it is possible to change that in two steps – I finaly use first expression to delete all dashes: (?<=\d)\-(?=\d) and in the second sep I’m adding dashes at the right position:
      find: (\d{3})(\d{2})(\d{3})(\d{4})(\d{5})
      change: $1-$2-$3-$4-&5

      But the question is, if it even goes to express/catch the group in position with number 10 and higher.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.
>