Capturing group with two-digit expression
- This topic has 2 replies, 2 voices, and was last updated 8 years, 8 months ago by .
- You must be logged in to reply to this topic.
Learn / Forums / General InDesign Topics / Capturing group with two-digit expression
Learn / Forums / General InDesign Topics / Capturing group with two-digit expression
Tagged: Capture group, GREP
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
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.
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.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies allows us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
To provide the best experiences, we and our partners use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us and our partners to process personal data such as browsing behavior or unique IDs on this site and show (non-) personalized ads. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Click below to consent to the above or make granular choices. Your choices will be applied to this site only. You can change your settings at any time, including withdrawing your consent, by using the toggles on the Cookie Policy, or by clicking on the manage consent button at the bottom of the screen.
You have to be logged in to save.
Not a member? Join Today - it's FREE!