Description Usage Arguments Value Examples
View source: R/str_extract_between.R
Vectorised over 'string' and 'pattern'.
1 2 3 4 5 6 7 | str_extract_between(
string,
pattern1,
pattern2,
which_pattern1 = "first",
which_pattern2 = "last"
)
|
string |
The string from which to extract. |
pattern1 |
Pattern to look for before the return content of a string. The default interpretation is a regular expression, as described in stringi::stringi-search-regex. Control options with regex(). Match a fixed string (i.e. by comparing only bytes), using fixed(). This is fast, but approximate. Generally, for matching human text, you'll want coll() which respects character matching rules for the specified locale. Match character, word, line and sentence boundaries with boundary(). An empty pattern, "", is equivalent to boundary("character"). |
pattern2 |
Pattern to look for after the return content of a string. See pattern1 for more details. |
which_pattern1 |
If there are multiple patterns, what should the function return? "first" (the default) returns the first occurrence of pattern1 |
which_pattern2 |
If there are multiple patterns, what should the function return? "last" (the default) returns the last occurrence of pattern2 |
The part of the string after the first pattern and before the second pattern.
1 2 | test_string <- 'url.com/string_before_pattern_after-another_string_with_pattern2/'
str_extract_between(string = test_string, pattern1 = "_pattern_", pattern2 = "_pattern2")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.