带重音字母的正则表达式 [英] Regular Expression for Alphabetic Letter with accent

查看:132
本文介绍了带重音字母的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用正则表达式在c#和asp.net中验证一个texbox.

I need a validation a texbox in c# and asp.net using Regular Expression.

我需要允许:

  • 字母大写和小写或任何CombINAtion
  • 带重音的字母,例如:èèéàù...
  • 数字
  • 只有一个空格"

我需要点不允许:

  • 任何特殊字符,例如:|!£$%&//()<> ...

有什么想法吗?谢谢您的帮助

Any ideas? Thanks for your help

推荐答案

如果验证发生在服务器端 ,则可以使用以下模式:

If validation occurs at server side, you can use the pattern:

^\w*(\s\w*)?$

.Net中的

\ w 是Unicode感知的-它应包含所有字母.

\w in .Net is Unicode aware - it should include all letters.

请注意, \ w 也包括下划线和其他单词连接器.您可以使用 [\ p {L} \ p {Nd}] 代替 \ w 来禁止使用它们.

Note that \w also include the underscore and other word-connectors. You can use [\p{L}\p{Nd}] instead of \w to disallow them.

另请参见:字符类

这篇关于带重音字母的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆