ids <- c("7", "8", "ids")
paste0("(?:", paste(ids, collapse="|"), ")$")