I would like to validate something like this, Numeric values and or with the dot
These would be valid:
- 1
- 1.1
- 12.12.12
- 123.123.123.12
- 1.12.123.12345.123456
These would not be valid:
- .1
- 1.
- 123.123.
- 123..
What I’ve tried
/^[\d*\.?\d*]+$/.test(the_number_from_form_input_field)this.value.match(/[^\d*\.?\d*$]/)/^[\d+(\.\d)?]+$
What I’m currently using
/^[\d\.]+$/.test(the_number_from_form_input_field)this.value.match(/[^\d\.]/)
Would like this to work with the .match() and .test()
JSfiddle
-edit- Thanks veeTrain, last
\d*removed as it did not do anything. (It’s still in the fiddle)