I need to validate the decimal datatype in the incoming feed. Integer part and the fraction value combined together can have up to 7 chars. Fraction value is optional. Leading + or - is also optional.
For example DECIMAL(7, 2) defines numbers of the form 12345.67
Valid
-1
+1
1
+.1
-.1
.1
+11111.11
-11111.11
11.11
11111
Invalid
1111111
11.11111
0.111111
.1111111
+111111.11
-111111.11
+11111.111
-11111.111
11111.111
111111.11
+1.
-1.
1.
This is what I currently use
[+-]?\d\.?\d?
How should I change this?