re_findall {re} | R Documentation |
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
.
re_findall(pattern, string, ...)
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
|
A list of character vectors, where each vector contains all the matches found in the corresponding element of
string
.
Python re.findall() documentation
pattern <- re_compile("\\b\\w+\\b")
re_findall(pattern, "This is a test.") # Extracts all words
re_findall("\\d+", "123 abc 456")