Reputation: 46740
I have a regex
[A-Za-z]
and a string, such as
Hi! This is a string.
I want to replace all charcters that are not in the Regex with space. So, I'll end up with
Hi This is a string
How is this done?
Upvotes: 7
Views: 2322
Reputation: 31198
Try:
string output = Regex.Replace(input, "[^A-Za-z]", " ");
Upvotes: 5