re_findall extracts all occurrences of a specified pattern (regular expression) from each element of a
character vector. If the provided pattern is not already a compiled pattern object, it compiles it using
re_compile.
Arguments
- pattern
 A regular expression pattern or a compiled pattern object.
- string
 A character vector where each element is a string from which to extract matches of the pattern.
- ...
 Arguments passed on to
re_compileIGNORECASEFlag to indicate case-insensitive matching.
IAbbreviation for IGNORECASE.
MULTILINEFlag to indicate multi-line matching, where
^and$match the start and end of each line.MAbbreviation for MULTILINE.
DOTALLFlag to indicate that
.(dot) should match any character including newline.SAbbreviation for DOTALL
VERBOSEFlag to allow a more verbose regex syntax, which can include comments and whitespace for readability.
XAbbreviation for VERBOSE
NOFLAGFlag to indicate that no flags should be set.
Value
A list of character vectors, where each vector contains all the matches found in the corresponding element of
string.
Examples
pattern <- re_compile("\\b\\w+\\b")
re_findall(pattern, "This is a test.") # Extracts all words
#> [[1]]
#> [1] "This" "is"   "a"    "test"
#> 
re_findall("\\d+", "123 abc 456")
#> [[1]]
#> [1] "123" "456"
#>