I'm looking to remove the all parentheses from a given string. After some research, I've come to the conclusion that Regex was my best bet. However, looking at it (let alone looking at it, thinking about looking at it) gives me a headache. What would be the best way to approach this problem?
The following statement removes all characters (
and )
.
Regex.Replace("This (is (a) (test.", "[()]", "") // -> "This is a test."
Your question isn't very clear, or is very trivial.
Why not use String.Replace('(', '').Replace(')','')
?
If you must use a regex, this is the link for how you would use a Regex.Replace
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