Reputation: 3213
Consider the following string and I want to replace a brackets which contains alphabets with space:
str = (abc pqr xyz (tttt) 2018(2))
I am expecting the following output:
str_op = abc pqr xyz tttt 2018(2)
How to write a regex for above example
Upvotes: 0
Views: 40
Reputation: 67988
(\([^\D]*\))|\(|\)
You can use this and replace by $1
.See demo.
https://regex101.com/r/sS2dM8/27
Upvotes: 1