采用NG-模式(Angular.JS),用UNI code字符不希望的结果字符、模式、结果、Angular

由网友(可爱小笨蛋)分享简介:我使用的是NG-模式与输入字段应该只接受希伯来文字符。I am using an ng-pattern that with an input field that should accept only Hebrew characters.我必须找出UNI code号希伯来语字符是。I have find out...

我使用的是NG-模式与输入字段应该只接受希伯来文字符。

I am using an ng-pattern that with an input field that should accept only Hebrew characters.

我必须找出UNI code号希伯来语字符是。

I have find out what unicode numbers Hebrew chars are.

这是我的方式:

$scope.onlyHebrewPattern = /[u05D0-u05F3]+/g;

和我的表单输入:

<input tabindex=1 type="text" ng-disabled="disableButtons" name="firstname" ng-minlength="2" ng-maxlength="15" ng-model="register.firstName" placeholder="first name" ng-pattern="onlyHebrewPattern" required title="please enter your name">

现在的这种模式会工作,将不填充$ scope.firstname与错误的结果最喜欢的投入:ABCD

Now for most inputs that pattern will work and will not populate the $scope.firstname with wrong results like: "abcd".

但也有像输入:שד为由于某种原因正在由图案接受

But there are inputs like: "שדas" that for some reason are being accepted by the pattern.

我相信与模式的定义问题依赖。一定出事了,但我相信,u05D0-u05F3真的是这个范围内,我需要在我的模式。那么,这里是我的问题吗?

I believe the problem relies with the pattern definition. Something must be wrong but I am sure that u05D0-u05F3 is really that range that I need in my pattern. So what is my problem here?

推荐答案

试试这个:

$ scope.onlyHebrewPattern = / ^ [ u05D0- u05F3] + $ /克;

此致以希伯来文字符的任意字符串匹配。

Yours matches any string with a Hebrew character.

阅读全文

相关推荐

最新文章