I realize this question probably seems painfully simple to most regular expression masters, but reviewing similar questions has not yielded a solution.
I have a vector of e-mail addresses called email
and would like to extract the text after the final period in each one. For the sake of example,
email<-c("xxxxx1@xxx.com", "xxxx2@xxx.edu", "xxxxx3@xxx.co.uk")
I have tried:
grep("[\.][a-zA-Z]*?$", email, value=T)
This gets me the error message:
Error: '.' is an unrecognised escape in character string starting ""."`
Removing the escape character on the other hand
grep("[.][a-zA-Z]*?$", email, value=T)
returns the entire e-mail address as does:
grep("\\.[a-zA-Z]*$", email, perl=T, value=T)
I'd really appreciate help at this point.