I would like to remove the words before 'not'. When I try the code snippet below, I didn't get expected result.
test <- c("this will not work.", "'' is not one of ['A', 'B', 'C'].", "This one does not use period ending!")
gsub(".*(not .*)\\.", "\\1", test)
But if I replace \\. with [[:punct:]], it works fine. Can anyone tell me why the first one is not working? I may need to keep other punctuations, other than period.
expected output:
> not work
> not one of ['A', 'B', 'C']
> not use period ending!
Thank you!