path = system.file("extdata", package = "seekr")
# Search all function definitions in R files
seek("[^\\s]+(?= (=|<-) function\\()", path, filter = "\\.R$")
# Search for usage of "TODO" comments in source code in a case insensitive way
seek("(?i)TODO", path, filter = "\\.R$")
# Search for error/warning in log files
seek("(?i)error", path, filter = "\\.log$")
# Search for config keys in YAML
seek("database:", path, filter = "\\.ya?ml$")
# Looking for "length" in all types of text files
seek("(?i)length", path)
# Search for specific CSV headers using seek_in() and reading only the first line
csv_files <- list.files(path, "\\.csv$", full.names = TRUE)
seek_in(csv_files, "(?i)specie", n_max = 1)
Run the code above in your browser using DataLab