JustAce
JustAce

Reputation: 244

How to create ng-pattern not allowing uppercase

How to create ng-pattern in angular not allowing input in uppercase?Thanks in advance. Like this pattern. ng-pattern="/^[a-zA-Z0-9]*$/"

Upvotes: 1

Views: 3327

Answers (1)

j_buckley
j_buckley

Reputation: 1936

Change your example to ng-pattern="/^[a-z0-9]*$/". This regex will fail if it finds any upper case letters. You just needed to remove the A-Z from your example so the regular expression knows not to allow them.

Upvotes: 3

Related Questions