Remove/Replace/Extract URLs

Usage

rm_url(text.var, trim = TRUE, clean = TRUE, pattern = "(http[^ ]*)|(www\\.[^ ]*)", replacement = "", extract = FALSE, ...)

Arguments

text.var
The text variable.
trim
logical. If TRUE removes leading and trailing white spaces.
clean
trim logical. If TRUE extra white spaces and escaped character will be removed.
pattern
A character string containing a regular expression (or character string for fixed = TRUE) to be matched in the given character vector.
replacement
Replacement for matched pattern.
extract
logical. If TRUE the URLs are extracted into a list of vectors.
...
Other arguments passed to gsub.

Remove/Replace/Extract URLs

Value

Returns a character string with URLs removed.

Description

Remove/replace/extract URLs from a string.

Examples

## <strong>Not run</strong>: # x <- " I like www.talkstats.com and http://stackoverflow.com" # rm_url(x) # rm_url(x, replacement = '<a href="\\1" target="_blank">\\1</a>') # rm_url(x, extract=TRUE) # ## <strong>End(Not run)</strong>

See also

gsub