How to set the maximum price limit(e.g. £50.00) in this regular expression?
Regular Expression: /^\£?[0-9]+.[0-9][0-9]?$/
Sample Code used for testing
Valid values:
12.55
£12.55
3.88
£0.00
Invalid values:
£12.
£12
££12
£12.445
Here I want to enforce the following rules as well.
valid: 50.00 (MAX)
Invalid: 50.99,100.00,1212221.00
How to achieve this in the above Regex?
JSFIDDLE for this is available here
/^\£?((50(\.00)?)|([0-4]?[0-9](\.[0-9]{2})))$/
http://jsfiddle.net/s2hL7/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With