regex.escape <- function(string) {
  gsub("([][{}()+*^$|\\\\?.])", "\\\\\\1", string)
}
BuildRegex <- function(search) {
	x<-strsplit(search,"\\s+")
	paste0("^(?=.*(?<!\\w)", paste(regex.escape(unlist(x)), collapse="(?!\\w))(?=.*(?<!\\w)"), "(?!\\w))")
}
BuildRegex("John Tolkien")
grepl(BuildRegex("John Tolkien"), "John Ronald Reuel Tolkien", perl=TRUE)
grepl(BuildRegex("Tolkien John"), "John Ronald Reuel Tolkien", perl=TRUE)
grepl(BuildRegex("John Ronald Tolkien"), "John Ronald Reuel Tolkien", perl=TRUE)