ac_extract_file() returns one list element per file. Each element contains
the matched text and the corresponding pattern values.
Arguments
- ac
An
<ac_automaton>object created byac_build().- path
A vector of file paths to search.
- stream
If
FALSE(default), each file is read into memory before searching. IfTRUE, files are searched as streams. Stream search requires an automaton built withmatch_kind = "standard".- overlapping
Default is
FALSE. IfTRUE, extract overlapping matches. This is only supported whenstream = FALSEandacwas built withmatch_kind = "standard".
Value
A list with the same length as path. Each element is a data frame
with one row per match and two columns:
matches: Text matched in the file.patterns: Pattern values corresponding to each match.
Examples
ac <- ac_build(c("hello", "world"))
path <- tempfile()
writeLines("hello world", path)
ac_extract_file(ac, path)
#> [[1]]
#> matches patterns
#> 1 hello hello
#> 2 world world
#>