test <- c("i really wasn aware and i wasnt aware at all. but i wasn't aware. just wasn't. this wasn45'e meant to be. it wasn@'re simple", "Wasn&^$tt that nice?", "You say wasnmmmt?", "No, he wasn&#t#@$.", "She wasn%#@t##, I know.")gsub("wasn[^. ]*","wasn't",test)
Standard input is empty
[1] "i really wasn't aware and i wasn't aware at all. but i wasn't aware. just wasn't. this wasn't meant to be. it wasn't simple" [2] "Wasn&^$tt that nice?" [3] "You say wasn't" [4] "No, he wasn't." [5] "She wasn't I know."
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!