I am struggling to implement the following,
lets say I have string :
( z ) ( A ( z ) ( A ( z ) ( A ( z ) ( A ( z ) ( A ) ) ) ) )
I want to write a regex that takes out all characters that have a braked to their left and right. i.e. I would like this to return:
( z ) ( z ) ( z ) ( z ) ( z ) ( A )
I have tried a combination of regex’s like: (\\s\\S( \\W \\)\\s\\S)
thanks
daniel
This expression should work:
Literal parens need to be escaped in the regex and I think you’ve got a few extra ingredients there. The regex I show allows whitespace before and after the word chars contained within parens.