rm_email(text.var, trim = TRUE, clean = TRUE, pattern = "([_+a-z0-9-]+(\\.[_+a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,14}))", replacement = "", extract = FALSE, ...)
TRUE
removes leading and trailing white
spaces.TRUE
extra white spaces and escaped
character will be removed.fixed = TRUE
) to be matched in the given
character vector.pattern
.TRUE
the emails are extracted into a list
of vectors.gsub
.Returns a character string with email addresses removed.
Remove/replace/extract email addresses from a string.
The email regular expression was taken from: http://stackoverflow.com/a/25077704/1000343
## <strong>Not run</strong>: # x <- "fred is fred@foo.com and joe is joe@example.com - but @this is a # twitter handle for twit@here.com or foo+bar@google.com/fred@foo.fnord" # # x2 <- c("fred is fred@foo.com and joe is joe@example.com - but @this is a", # "twitter handle for twit@here.com or foo+bar@google.com/fred@foo.fnord", # "hello world") # # rm_email(clean(x)) # rm_email(clean(x), replacement = '<a href="mailto:\\1" target="_blank">\\1</a>') # rm_email(clean(x), extract=TRUE) # rm_email(x2, extract=TRUE) # ## <strong>End(Not run)</strong>