2

how can I generate REGEX for value > 2900.00 I used the formula below but it seems it is not working

(^[2-9][0-9]{3}|[0-9]{5,})(\.[0-9]+)$
Grijesh Chauhan
  • 52,958
  • 19
  • 127
  • 190

1 Answers1

1

I think this should work for you

/^29\d{2}\.[0-9][1-9]|[3-9]\d{3}\.\d{2}|[1-9]\d{4,}\.\d{2}$/

Explanation

4 digit >= 2900.01 — 29\d{2}\.[0-9][1-9]

OR

4 digit >= 3000.00 — [3-9]\d{3}\.\d{2}

OR

Any 5+ digit — [1-9]\d{4,}\.\d{2}


Personally, I think these kinds of regexp are kind of silly, though. Can't we just parse it and compare the result numerically?

Thank you
  • 107,507
  • 28
  • 191
  • 224