fork download
  1. library(stringr)
  2. names <- c("John max Jr.", "manuel cortez", "samuel III", "Jameson")
  3. str_replace_all(names, "\\s*\\p{L}+\\.", "")
  4. str_replace_all(names, "\\s*\\w+\\.", "")
  5.  
Success #stdin #stdout 0.32s 42396KB
stdin
Standard input is empty
stdout
[1] "John max"      "manuel cortez" "samuel III"    "Jameson"      
[1] "John max"      "manuel cortez" "samuel III"    "Jameson"