5

How can I match all numbers greater than 36 to any bigger number?

I tried this expression:

[4-9]\d+|\d{3,}

Problem is this will select all number greater than 40 but I need 37, 38 and 39 as well, How can i achieve that?

NOTE: My query is different: I couldn't understand from there so I asked my own question and my query is 100% different. Being similar in some ways is another thing than being duplicate. Peace out.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Mansoor Akram
  • 1,997
  • 4
  • 24
  • 40

3 Answers3

7

Simply adding 3[7-9] (to match 37, 38, 39) will work:

3[7-9]|[4-9]\d+|\d{3,}

UPDATE

To prevent matching numbers like 0001:

3[7-9]|[4-9]\d+|[1-9]\d{2,}
falsetru
  • 357,413
  • 63
  • 732
  • 636
1

The simplest solution:

37|38|39|[4-9]\d+|\d{3,}

or to exclude numbers starting with 0:

\b(37|38|39|[4-9]\d+|(?!0)\d{3,})\b
w.b
  • 11,026
  • 5
  • 30
  • 49
0

It works for range between 10 - 99

[3-9][7-9]|[4-9]\d
Arsen
  • 10,815
  • 2
  • 34
  • 46