Copy link to clipboard
Copied
Hi,
I work with InDesign for a while, but I am not very familiar with the coding features. I am struggling with wich seems a simple issue.
What I would like to do is:
change (9) into [9]
In the text body - change any numbers that are in parentheses into numbers in brackets.
In GREP, I can find all such occurences in text with simple code \(\d\), but I do not know what to put into the Change to: field.
I know it might be silly easy, but I just don't know and will be grateful for any help.
Thanks in advance.
Martin L.
Hi Martin,
Try the following
FindWhat :- \((\d+)\)
Change To :- [$1]
-Manan
Copy link to clipboard
Copied
Hi Martin,
Try the following
FindWhat :- \((\d+)\)
Change To :- [$1]
-Manan
Copy link to clipboard
Copied
Hi Manan,
that works just fine, thank you very much.
What is the difference in that FindWhat query you used, because when I was using that mine \(\d\) and used [$1] in ChangeTo, it only put [$1] into text body as a replacement.
Copy link to clipboard
Copied
Hi Martin,
In your FindWhat query you were not creating a capturing group so there was no group associated with $1, hence it was replaced literally. In my query i create a capturing group by enclosing the number part within () this would set $1, which would correspond with the number part of the search result.
Hope this made sense
-Manan
Copy link to clipboard
Copied
ok, it makes sense, yes.
Thank you again, have a good day.
m.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now