somenames <- c("Abdul", "Abdul-", "Abdul-Ahad", "Abduallah", "T.")
sort.by.length.desc <- function (v) v[order( -nchar(v)) ]
firstnames <- data.frame(word=sort.by.length.desc(somenames), stringsAsFactors = FALSE)

regex.escape <- function(string) {
    gsub("([][{}()+*^${|\\\\?.])", "\\\\\\1", string)
}
firstnames$word2 <- paste0("(?!\\B\\w)",regex.escape(firstnames$word),"(?!\\B\\w)")

comment <- "Some text with Abdul Abdul- Abduallah Ta, My, and He in it"

for(i in 1:length(firstnames$word2)){
  comment <- gsub(firstnames$word2[i], "Z", comment, perl=TRUE)
}
comment
