str_view
shows the first match; str_view_all
shows all
the matches. To build regular expressions interactively, check out the
RegExplain RStudio addin.
str_view(string, pattern, match = NA) str_view_all(string, pattern, match = NA)
string | Input vector. Either a character vector, or something coercible to one. |
---|---|
pattern | Pattern to look for. The default interpretation is a regular expression, as described
in stringi::stringi-search-regex. Control options with
Match a fixed string (i.e. by comparing only bytes), using
Match character, word, line and sentence boundaries with
|
match | If |
str_view(c("abc", "def", "fgh"), "[aeiou]") str_view(c("abc", "def", "fgh"), "^") str_view(c("abc", "def", "fgh"), "..") # Show all matches with str_view_all str_view_all(c("abc", "def", "fgh"), "d|e") # Use match to control what is shown str_view(c("abc", "def", "fgh"), "d|e") str_view(c("abc", "def", "fgh"), "d|e", match = TRUE) str_view(c("abc", "def", "fgh"), "d|e", match = FALSE)