# 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))
stopifnot(sum(ncards)<2)
# 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],
cardvalues[[(1:3)[ncards==1]]],intext[2])
}
intext <- gsub(" ", "", intext) # Remove the extra spaces
writeClipboard(intext)
cat(paste("Coppied to clipboard:\n",
paste(intext, "\n", collapse=" ")))
intext
}
bulk.search("mysite?")
bulk.search("mysite|")
bulk.search("mysite#")
No comments:
Post a Comment