Regular expression to validate name in .NET multilingual web application

Posted by BT on Stack Overflow See other posts from Stack Overflow or by BT
Published on 2010-04-12T10:24:41Z Indexed on 2010/04/12 17:13 UTC
Read the original article Hit count: 304

Filed under:
|
|

Hi, 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.

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

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

Any help will be highly appreciated!

Solution: I'm using this regular expression

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

, and the below MSISDN article was very helpful:

MSDN - Regular Expression

Also below tool is very helpful, in validating your regular expression:

Regex Builder

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#