I need a pattern for only Numeric & dot.
Eg : 120 / 120.03 / -123.03 / 0.32
whole number and decimal digits are user defined.
Whole numbers & decimals may less then the user defined. Thanks in Advance.
Asked
Active
Viewed 24 times
0

Willie Cheng
- 7,679
- 13
- 55
- 68

gnk
- 1
- 1
-
Sorry, can't find the code… – RobG Feb 03 '16 at 06:01
-
Possible duplicate of [Simple regular expression for a decimal with a precision of 2](http://stackoverflow.com/questions/308122/simple-regular-expression-for-a-decimal-with-a-precision-of-2) – PM 77-1 Feb 03 '16 at 06:03
-
check this: /\d\.?/g – kp singh Feb 03 '16 at 06:03
-
@PM77-1 , in the specified case, if user defined decimal was 3 then it should allow upto 3. Eg : 3 / 3.1 / 3.11 / 3.111. how to resolve this. – gnk Feb 03 '16 at 07:13
-
Thank you all. got the pattern based on above. I used "^[-+]?(\d{1,4})(\.\d{1,4})?$". – gnk Feb 03 '16 at 07:36