In ng-patternwe have the opportunity to indicate that the field should match a specific template.
ng-pattern
How can we indicate that it should NOT match the specified pattern?
Example
<input type="text" ng-pattern="/[*|\":<>[\]{}`()';@&$]/" />
Here I do NOT want the field to match the pattern. On the contrary, I want to show an error if the pattern matches.
To check if a string contains any substring, you can use string binding with a string:
/^(?!.*[*|\x22:<>[\]{}`()';@&$])/
Watch the demo
AngularJS , RegExp ( ), ( , ).
, ^(?:(?![*|\x22:<>\[\]{}`()';@&$]).)*$ (. demo), , .
^(?:(?![*|\x22:<>\[\]{}`()';@&$]).)*$
, \x22 ng-pattern.
\x22
((?!pattern)), :
(?!pattern)
ng-pattern="/(?![*|\":<>[\]{}`()';@&$])/"
Source: https://habr.com/ru/post/1622733/More articles:AVPlayerViewController pop-up screen causes restrictions - iosNode Js will not connect via http, but will exceed https? - javascriptAndroid WebView HTML extraction - javaПередача переменной Javascript для Android-активности? - javaWriting code contracts for methods of increasing activity - c #How to define record hierarchy with SQL or JPA - javaCorrect code formatting for ngdocs, especially when working with ES6 modules - angularjsPass value from button to input value - javascriptРамка мобильных приложений без angular.js - web-applicationsHow to create two LicenseFile pages in Inno Setup - licensingAll Articles