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
  • 90,369
  • 161
  • 124
  • 175
Mansoor Akram
  • 1,919
  • 3
  • 23
  • 39

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
  • 336,967
  • 57
  • 673
  • 597
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
  • 10,668
  • 5
  • 27
  • 47
0

It works for range between 10 - 99

[3-9][7-9]|[4-9]\d
Arsen
  • 10,515
  • 2
  • 33
  • 45