ng-pattern仅适用于希伯来语字符
问题描述:
我想使用ng-pattern
验证我的文本输入字段,该字段应仅接受希伯来语字符,有时输入没问题,有时由于某种原因而被拒绝. (第一个是验证第二个字母不是,等等)
例如:
I want to use ng-pattern
validate my text input field that should accept only Hebrew characters, sometimes the input are ok and sometimes they are being rejected for some reason. (the first one is validate the second letter is not and etc.)
example:
<input type="text" class="form-control" name="firstName" ng-model="Join.firstName" id="firstName" aria-describedby="firstNameHelp" maxlength="15" ng-pattern="onlyHebrewPattern" required>
给出的解决方案是: scope.onlyHebrewPattern =/^ [\ u05D0- \ u05F3] + $/g;
and the solution that given was: scope.onlyHebrewPattern = /^[\u05D0-\u05F3]+$/g;
答
$scope.onlyHebrewPattern = /^[א-ת\s]+$/;