0

I'm trying to match dollar amounts greater than $500. Signals that it's a dollar amount would be a dollar sign or a decimal point with 2 zeros.

I put my try so far plus sample data at the following link. Any help would be appreciated!

http://regexr.com/38mh3

Jody G
  • 583
  • 8
  • 21

1 Answers1

4

Seems weird to validate a number greater than with a regular expression, but it would be something like this

^\$([5-9]\d{2}|[1-9]\d{3,})\.\d{2}$

Uses an or to do the validation of the range.

  • [5-9]\d{2} < matches range from 500 to 999
  • [1-9]\d{3,} < matches 1000 +

JSFiddle: http://jsfiddle.net/9N7B3/2/

epascarello
  • 204,599
  • 20
  • 195
  • 236
  • Shouldn't you be escaping the first `$`? – devnull Apr 10 '14 at 17:33
  • This one is close but there are a few issues I'm trying to work around on it. First, it matches 500.0 but probably shouldn't. $500 yes and $500.00 yes and 500.00 yes but probably not 500.0. Also, it seems to match 1000 and probably shouldn't. $1000 yes and 1000.00 yes but probably not 1000. – Jody G Apr 10 '14 at 17:35