Regular expression to validate name in .NET multilingual web application

烈酒焚心 提交于 2019-12-01 11:15:07

问题


how can i write a regular expression to validate name field in a multilingual web application, i want to validate the name field for non-English languages e.g. Spanish or German, and we need to make sure that no one enter digits or special characters. I'm using .NET 2.0

I believe we can't use expression as below for non-English language.

^[a-zA-Z]{1,20}$

Any help will be highly appreciated!

I got this Regular Expression, it works fien when i uses Regex Builder but when i try it in actual web application it fails:

^\p{L}[\p{L}\p{Pd}\x27]*\p{L}$

回答1:


use \w for letter. it is multilingual friendly



来源:https://stackoverflow.com/questions/2621275/regular-expression-to-validate-name-in-net-multilingual-web-application

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