1

I want to remove all punctuation except the markers : "?" and "!"

gsub("[[:punct:]]", " ", "hi, i'm (john), nice to meet you !! Do you want some water ?// #")

Any idea ?

Axeman
  • 32,068
  • 8
  • 81
  • 94
  • 1
    `gsub("[^[:alnum:][:space:](?|!)]", "", "your string")` – Ronak Shah Mar 09 '17 at 09:22
  • 3
    @RonakShah `[^[:alnum:][:space:]?!]` is enough unless you wish to exclude parentheses and pipe character. No need for an alternation within a character class. – Tensibai Mar 09 '17 at 09:26

0 Answers0