Copy link to clipboard
Copied
Hi, I have two documents. In the first I want to GREP search for all instances where a number (ranging from 33 to 259) occurs between round brackets i.e. it should capture (33), (34), (35) all the way to (257), (258) and finally (259).
Same thing in document 2, where I want it to show me all instances between (260) and (416).
I tried some of the formulas noted in some of the discussions but they heavily focus on formulas looking for digits with the caveat of brackets which won't work for me as I need it to exclusively find numbers in bracket.
Thanks
Quickly written but here's the idea:
Numbers inside parenthesis, between 33 and 259:
(?x) \(\K ( 3[3-9] | [4-9]\d | 1\d\d | 2[0-5]\d ) (?=\))
Numbers inside parenthesis, between 260 and 416:
(?x) \(\K ( 2[6-9]\d | 3\d\d | 40\d | 41[0-6] ) (?=\))
(^/) The Jedi
Copy link to clipboard
Copied
Hi Khaleel,
I am guessing that when you say rounded brackets, you mean parentheses such as these character glyphs: ( and ) ?
If you want the Find/Change > GREP dialog box to Find the digits along with the parentheses, search for this:
\(\d+\)
But if you want to Find the digits within those parentheses, search for this:
(?<=\()\d+(?=\))
Copy link to clipboard
Copied
Quickly written but here's the idea:
Numbers inside parenthesis, between 33 and 259:
(?x) \(\K ( 3[3-9] | [4-9]\d | 1\d\d | 2[0-5]\d ) (?=\))
Numbers inside parenthesis, between 260 and 416:
(?x) \(\K ( 2[6-9]\d | 3\d\d | 40\d | 41[0-6] ) (?=\))
(^/) The Jedi
Copy link to clipboard
Copied
FRIdNGE
This code was exactly what I needed. Thank you. It worked perfectly and saved me lots of time on a time-pressured project. It's worth noting that I had tried ChatGPT before coming to this forum and it had generated formulas for me which I tested - and which failed - and I kept going back and it kept correctly/refining the formulas. But they just would not work for me despite several rounds of refinement. AI maybe great, but the human mind and experience is irreplaceable!
Copy link to clipboard
Copied
Thank you for the guidance Mike, much appreciated.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now