library(stringr) names <- c("John max Jr.", "manuel cortez", "samuel III", "Jameson") str_replace_all(names, "\\s*\\p{L}+\\.", "") str_replace_all(names, "\\s*\\w+\\.", "")
Standard input is empty
[1] "John max" "manuel cortez" "samuel III" "Jameson" [1] "John max" "manuel cortez" "samuel III" "Jameson"