Remove part of strings after occurrence of a character Remove part of strings after “.” a <- c("NM_020506.1", "NM_020519.1", "NM_001030297.2", "NM_010281.2", "NM_011419.3", "NM_053155.2") gsub("\\..*","",a) [1] "NM_020506" "NM_020519" "NM_001030297" "NM_010281" "NM_011419" "NM_053155"