I want to test for this input:
[an optional negative sign] 2 digits [an optional . and an optional digit] like this:
-34 or -34.5333 or 34.53333 or 34 in JavaScript
This is what I came up with but it doesn’t work!
/^(-)\d{2}(\.d\{1})$/
Can someone please help me?
Try this regex: