JavaScript regex for validating for alphanumeric characters,all international characters (Japanese, Chinese, Russian etc)

我的未来我决定 提交于 2020-02-04 01:00:34

问题


One of my project requirements is to validate a data field(text box from web page). I need to allow alpha numeric characters in all foreign languages (japanese,chinese,korean,russian,latin american characters etc). And avoid special characters.

I am using the expression /[^a-zA-Z0-9]/ (javascript, asp .net page)

Many blogs I have read and not able to correctly understand what exactly I have to do here. I can't add any addons or plugins and have to use the available functionality of regex.

How do regex engine recognize other language characters (esp. Unicode)?


回答1:


You will need to use Unicode regular expressions. Please check this previous SO thread in which various unicode matching mechanisms are discussed.



来源:https://stackoverflow.com/questions/10006998/javascript-regex-for-validating-for-alphanumeric-characters-all-international-ch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!