Trying to extract the domain name out of URL. For example:
x <-\"https://stackoverflow.com/questions/ask\"
to: stackoverflow.com
stackoverflow.com
Why not use parseURI from XML? It breaks a URL into its different elements.
parseURI
XML
x <- "http://stackoverflow.com/questions/ask" library(XML) parseURI(x)$server # [1] "stackoverflow.com"