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?
var cleaned = Regex.Replace(given, "[^A-Za-z]", " ");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With