.NET Regular Expression to match any kind of letter from any language
\p{L}*
should match "any kind of letter from any language". It should work, I used it in a i18n-proof uppercase/lowercase recognition regex in .NET.
You can use Char.IsLetter
:
Indicates whether the specified Unicode character is categorized as a Unicode letter.
With .Net 4.0:
string onlyLetters = String.Concat(str.Where(Char.IsLetter));
On 3.5 String.Concat
only excepts an array, so you should also call ToArray
.
Your problem is more likely to the fact that you will only have to have one alpha-char, because the regex will match anything that has at least one char.
By adding ^
as prefix and $
as postfix, the whole sentence should comply to your regex. So this prob works:
^\p{L}*$
Regexbuddy explains:
^
Assert position at beginning of the string\p{L}
A character with the Unicode property 'letter' (any kind of letter from any kind of language) 2a. Between zero and unlimited times, as many as possible (greedy)$
Assert position at the end of the string