I am pretty regex-blind so I was looking for a way to uniformly remove the word remove from the following string
x <- c('something,remove', 'remove, something', 'something, remove, somethingElse,alsoThis')
and get the result,
'something', 'something', 'something, somethingElse, alsoThis'
I can do it with strsplit but I was wondering for the regex version too
sapply(strsplit(x, ', |,'), function(i)paste(i[i != 'remove'], collapse = ', '))
#[1] "something" "something" "something, somethingElse, alsoThis"