Copy link to clipboard
Copied
Hi,
Can anyone help with a grep query that finds specific ranges of numbers?
I'm trying to find/replace specific ranges so that any number found within that range has its paragraph style changed.
There are four ranges and I've worked out the last two, but am struggling with the first two without affecting higher numbers.
1-45 = ?
46-90 = ?
91-135 =
9[1-9]|1[0-2]\d|13[0-5]
136-180 =
13[6-9]|1[4-9]\d
Anyone know how?
\b([1-9]|[1-3][0-9]|4[0-5])\b
\b(4[6-9]|[5-8][0-9]|90)\b
\b(9[1-9]|1[0-2][0-9]|13[0-5])\b
\b(13[6-9]|1[4-7][0-9]|180)\b
(^/)
Copy link to clipboard
Copied
Hi,
Both of the needed greps look fairly easy to construct.
I would recommend you read this article https://indesignsecrets.com/topic/using-grep-to-select-a-number-range and still if you face any difficulty do let us know.
-Aman
Copy link to clipboard
Copied
Hi, I've wlready been through that one. I can get round the problem by doing find/change grep queries one after the other. So if the first changes every number, the next will change from where I need it to, then the next and so on.
Thought there would be something more specific to pin down exact ranges.
Copy link to clipboard
Copied
\b([1-9]|[1-3][0-9]|4[0-5])\b
\b(4[6-9]|[5-8][0-9]|90)\b
\b(9[1-9]|1[0-2][0-9]|13[0-5])\b
\b(13[6-9]|1[4-7][0-9]|180)\b
(^/)
Copy link to clipboard
Copied
PERFECT! Many, many thanks.