So I'm trying to use the following regex to match patterns of valid prices
(derived from another question here on SO)
Constraints for matching being:
- $1.00 <= price <= $999,999.99
- Decimal place is not required ($1 is valid as is $1.00)
- Single digit post decimal place is invalid ($1.1, $2.9 etc..)
- 3+ digits post decimal place is invalid ($1.111, $2.999 etc..)
The above pattern works to deal with the first two constraints but not the others. The issue being that in the case of (3) or (4), the portion of the price that precedes the decimal point is matched.
$100,000.4 matches to $100,000
$200,000.444 matches to $200,000.44
How can I modify this so that in the case of (3) or (4) the entire string is not matched?