Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help on searching for a number range within round brackets

New Here ,
Oct 25, 2025 Oct 25, 2025

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

TOPICS
How to
120
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Oct 25, 2025 Oct 25, 2025

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

Translate
Community Expert ,
Oct 25, 2025 Oct 25, 2025

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+(?=\))

Mike Witherell
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Oct 25, 2025 Oct 25, 2025

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 25, 2025 Oct 25, 2025
LATEST

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! 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 25, 2025 Oct 25, 2025

Thank you for the guidance Mike, much appreciated.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines