Reputation: 1128
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
Upvotes: 3
Views: 368