开发者

Regular expression in android for accept only English language

开发者 https://www.devze.com 2023-02-18 14:04 出处:网络
I try Pattern.matches(开发者_开发百科\"[A-Za-z]+\" and it still can accept other languages such as ฟฟฟฟabc or abcฟฟฟ

I try

Pattern.matches(开发者_开发百科"[A-Za-z]+"

and it still can accept other languages such as ฟฟฟฟabc or abcฟฟฟ

what should I do?


^[A-Za-z]+$

Use start-of-string and end-of-string anchors.

If you don't, the regex does not have to match the entire string, but this is what you seem to want.


Are you working in UTF-8? Have you tried the \uFFFF, where FFFF is the hex representation of the Unicode character.

0

精彩评论

暂无评论...
验证码 换一张
取 消