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
  • 105
  • 2
  • 11

1 Answers1

2

Try something like this:

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

Demo

NeverHopeless
  • 11,077
  • 4
  • 35
  • 56