-1

I want to use ng-pattern for 2 sets of languages, for example english and hebrew, all my tries just don't work:

vm.uNamePattern = "/^[a-zA-Z\s]|[א-ת]*$/";
vm.uNamePattern = "/^[a-zA-Zא-ת\s]*$/";

Here is a ref to only hebrew question - hebrew-only.

Thanks.

Itsik Mauyhas
  • 3,824
  • 14
  • 69
  • 114

1 Answers1

0
vm.uNamePattern = "/^[a-zA-Zא-ת\s]*$/";

should be

vm.uNamePattern = /^[a-zA-Zא-ת\s]*$/;

You want a Regexp, not a string.

Demo

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255