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})?$/"
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})?$/"
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)
What you want is the parenthesis and pipe. Like this: "(.|,)" This is saying that either a period or comma can be used here.