Prepare a pattern from a vector of characters. It particularly useful to find files of given extension within a vector of names.
complete_pattern(x, begin = FALSE, ending = FALSE, extension = FALSE)
character, vector of patterns to be completed
logical, should the pattern be at the beginning of strings
logical, should the pattern be at the end of strings
logical, should the pattern considered as an extension with a starting dot
character of length one. To each element of x, it is firts applied transformation given by begin, ending and extention. Then, it is collapsed with "|". It can be used in a grep call.
extension = c("zip", "7z") complete_pattern(extension) #>  "zip|7z" complete_pattern(extension, extension = TRUE) #>  "[.]zip|[.]7z" complete_pattern(extension, ending = TRUE) #>  "zip$|7z$"