text: Q:
  
  How to put multiple regular expressions into gsub?
  
  I want to erase the character which are not one of: letter, number or blank space.
  I tried with [:punct:] but it erases polish letters.
  Given textToClean <- "polish letters: ł Ł; ż Ż ź Ź ą Ą ę Ę ó Ó ń Ń ć Ć 43434 ; ; ;!"
  I want the output as:
  polish letters ł Ł ż Ż ź Ź ą Ą ę Ę ó Ó ń Ń ć Ć 43434
  I tried this:
  textToClean <- "polish letters: ł Ł; ż Ż ą Ą ę Ę ó Ó 43434 ; ; ;!"
  gsub("(\\D)(\\S)(\\W)", "", textToClean) # doesn't work properly!
  
  and this:
  textToClean <- "polish letters: ł Ł; ż Ż ą Ą ę Ę ó Ó 43434 ; ; ;!"
  gsub("\\D+\\S+\\W", "", textToClean) # doesn't work properly!
  
  but it's bad.
  
  A:
  
  The \p{L} will match any letter and \s will match any space, tab or newline. If we negate this with the ^, we can replace all non-matches with "":
  gsub("[^\\p{L}\\s]+", "", textToClean, perl = TRUE)
  "polish letters ł Ł ż Ż ą Ą ę Ę ó Ó    "
  
  Note that the numbers are also removed. If you want to keep the numbers, you can use \p{P}, which matches only interpunction:
  gsub("\\p{P}", "", textToClean, perl = TRUE)
  "polish letters ł Ł ż Ż ą Ą ę Ę ó Ó 43434   "
  
  