Simple problem: an existing project allows me to add additional fields (with additional checks on those fields as regular expressions) to support custom input forms. And I need to add a new form but cannot change how this project works. This form allows a visitor to enter his first and last name plus initials. So the RegEx ^[a-zA-Z.]*$
worked just fine for now.
Then someone noticed that it wouldn't accept diacritic characters as input. A Turkish name like ?mür
was not accepted as valid. It needs to be accepted, though.
So I have two options:
- Remove the check completely, which would allow users to enter garbage.
- Write a regular expression that would also include diacritic letters but still no digits, spaces or other non-letters.
Since I cannot change the code of the project, I only have these two options. I would prefer option 2 but now wonder what the proper RegEx should be. (The project is written in C# 4.0.)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…