I've got a text corpus containing some swear words and I tried to censor them, but upon further inspection I realised that the regular expression I used doesn't quite fit yet and also proper words get censored due to that.
x <- c("ass", "badass", "class")
gsub("ass\\b", "a*s", x)
this will return the first two words censored properly, and "cla*s", but obviously I want to keep "class". What do I need to add to the regex in order to change that? I tried "\w\." but it didn't work.