0

My scenario, Here I am trying to validate my pricing textfield should support and allow only Integer and double or float values. I mean numbers with fullstop.

Below regex format workin for integers but if value float or double its not allowing.

My Regex:

^[0-9]+(?:,[0-9]+)*$

Expected output : 123 and 123.0 // It should allow both.

devmikle
  • 85
  • 10

1 Answers1

1

Try something like this:

^[0-9]+(?:[.,][0-9]+)*$

Demo

NeverHopeless
  • 10,869
  • 4
  • 34
  • 55