0

I'm using this pattern to restrict user to use only numbers with max 5 decimals, but it gets valid only when user inputs ' , ' as decimal point, but i want to make it that user can insert ' . ' too, code :

ng-pattern="/^[0-9]+(\.[0-9]{1,5})?$/"
Mark
  • 209
  • 1
  • 5
  • 18

2 Answers2

0

I wonder if it's some sort of locale issue - and it is using a comma as a decimal, instead of a stop.

For me, the pattern works as expected (eg "6.7" = valid)

NightCabbage
  • 469
  • 4
  • 12
0

What you want is the parenthesis and pipe. Like this: "(.|,)" This is saying that either a period or comma can be used here.

http://regexr.com/3da8k

JeremyS
  • 427
  • 2
  • 7