'DO not allow dot in ng-pattern-restrict in angularjs

In angularjs I have used ng-pattern-restrict="^([A-Z0-9]{0,})$" Why does this pattern is allowing dot.

What can I do to restrict dot?



Solution 1:[1]

It will match an empty string and not a dot (You can check that here https://regex101.com/r/qMMCVt/1), since you have specified that the length of input can be 0 or more. Change the width to {1,}

^([A-Z0-9]{1,})$ 

OR

^([A-Z0-9]+)$ 

+ A plus sign indicates one or more of the previous character.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 anotherGatsby