Reputation: 49
I want a regular expressions to accept only only Unicode letters, whitespaces and digits.
I'm trying to use this regex, but it only removes the Arabic special character:
text = Regex.Replace(text, @"[^\u0600-\u06FF ]+", "");
Upvotes: 2
Views: 59
Reputation: 626747
You can use
text = Regex.Replace(text, @"[^\p{L}\d\s]+", "");
The [^\p{L}\d\s]+
regex matches one or more (+
) chars other than Unicode letters (\p{L}
), any Unicode digits (\d
), and any Unicode whitespaces (\s
).
Upvotes: 1