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

Grep to find a range of numbers

Contributor ,
Sep 27, 2017 Sep 27, 2017

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?

Views

2.7K

Translate

Translate

Report

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

LEGEND , Sep 27, 2017 Sep 27, 2017

\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

(^/)

Votes

Translate

Translate
Adobe Employee ,
Sep 27, 2017 Sep 27, 2017

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

Votes

Translate

Translate

Report

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
Contributor ,
Sep 27, 2017 Sep 27, 2017

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.

Votes

Translate

Translate

Report

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
LEGEND ,
Sep 27, 2017 Sep 27, 2017

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

(^/)

Votes

Translate

Translate

Report

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
Contributor ,
Sep 28, 2017 Sep 28, 2017

Copy link to clipboard

Copied

LATEST

PERFECT! Many, many thanks.

Votes

Translate

Translate

Report

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