I use regex to check numbers in angularjs. But my code shows a validation error when the number exceeds 9 digits. Maybe someone will ask me to correct my code so that you can enter any digits of the number.
I tried:
ng-pattern="/^\d{0,9}?$/"
Just delete {0.9}? and use * instead
/^\d*$/
{0.9} means any length between 0 and 9
I suspect the problem is understanding the difference between:
{0,9}
[0-9]
{0,9} means "from zero to 9 repetitions of the previous term", which in this case means "from zero to 9 digits".
[0-9] " 0 9 ()", \d.
\d
Try:
/^\d+$/
" " .
, :
/^\d+(\.\d+)?$/
, " , ".
{0,9} *. ? - :
*
?
ng-pattern="/^\d*$/"
:
ng-pattern="/^\d*(\.\d+)?$/"
"/^\d*?$/"
\d{0,9}= 0 9
\d{0,9}
\d*= 0 N
\d*
\ d = : 0 1 2 3 4 5 6 7 8 9
Source: https://habr.com/ru/post/1650309/More articles:Отладка переадресации портов для удаленного использования ноутбука Jupyter - sshCustomization and tools for several C ++ platforms - c ++What makes git post-receive umask different from umask user? - gitCSS is cleared only inside the parent div - htmlJersey cache method logic - javaResponsive default dynamic details - reactjsСократить слово в соответствии с шириной экрана - javascriptПолучение размера текста без использования функции boundingBox в библиотеке JavaScript Raphael - javascriptMultiple Ajax requests (with one callback) - javascriptTesting ReactJS components with mocking http calls - unit-testingAll Articles