Bulk search for domain names using R

June 8, 2013

[This article was first published on Econometrics by Simulation, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

# There are several domain name servers that allow 
# for bulk searching of domain names.
# http://www.godaddy.com/bulk-domain-search.aspx
# http://www.namestation.com/bulk-domain-search
# However, they do not provide any wildcard support
# and instead expect users to supply their own list.
# Which is not a problem if you are an R coder.
# This single command will copy to the clipboard a list
# of mysite1 mysite2 mysite3....mysite500. You can then
# paste it directly into the godaddy window.
writeClipboard(paste0("mysite", 1:500))

# Using the built in vector letters will produce:
# mysite-a mysite-b mysite-c....mysite-z
writeClipboard(paste0("mysite-", letters))
# I have also written a bulk search command but 
# I am not sure that it is really any better than
# the above command since it is really not as powerful.
# However, it does demonstrate how one might 
# generate a wildcard search algorithm.
bulk.search <- function(intext) {
# Add spaces before and after
  intext <- paste0(" ", intext, " ")    
card <- c("|", "?", "#") # Declare the wildcards
 # Declare the wildcard values
  cardvalues <- list(c(letters,0:9), letters, 0:9)   
    # A vector for saving wildcard detections
  ncards <- NULL                      
for (i in 1:length(card)) ncards[i] <-
nchar(gsub(sprintf("[^%s]", card[i]),"",intext))
  # If a wildcard is selected expand the intext
if (sum(ncards)==1) {
intext <- unlist(strsplit(intext, 
                     card[ncards==1], fixed = TRUE))
intext <- paste0(intext[1], 
intext <- gsub(" ", "", intext) # Remove the extra spaces
cat(paste("Coppied to clipboard:\n",
        paste(intext, "\n", collapse=" ")))

Created by Pretty R at inside-R.org

To leave a comment for the author, please follow the link and comment on their blog: Econometrics by Simulation.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)