Regex For Dollar Amount Greater Than $500
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 dat
Solution 1:
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/
Post a Comment for "Regex For Dollar Amount Greater Than $500"