Reputation: 3931
This isn't matching. I want to match a string of characters that are not ]
or )
.
I used this regular expression, but it isn't matching '[^\\)\\]]+
'
I'm sure its simple, but, help please :)
Working in R:
gsub('[\\(\\[]{1}[^\\)\\]]+[\\)\\]]{1}','','JOSH [IS MY NAME]')
Does not match anything. I want it to remove the data between the square brackets.
Upvotes: 2
Views: 3632
Reputation: 3931
AH. I had to set perl=TRUE argument and it worked. All better thanks guys!
Upvotes: 1
Reputation: 32807
The regex would be
\\[[^\\[\\]]+\\]
This would replace anything within brackets..replace it with []
Upvotes: 2