I\'m trying to get the ending for email addresses (ie .net, .com, .edu, etc.) but the portion after the @ can have multiple periods.
library(stringi) stri
A solution using basic regex, assuming df1$X2 is a character vector:
df1 <- cbind(df1, X3 = regmatches(df1$X2, regexpr('\\.[A-Z|a-z]*$', df1$X2))) df1$X3 <- gsub("\\.", "", df1$X3)