Description Usage Arguments Value Examples
View source: R/str_extract_after.R
Vectorised over 'string' and 'pattern'.
1 | str_extract_after(string, pattern, which = "first", num_char = NULL)
|
string |
The string from which to extract. |
pattern |
Pattern to look for. 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"). |
which |
If there are multiple patterns, should the function bring back the "first" or "last" occurrence? |
num_char |
The number of characters to return from after the pattern. Leave NULL to return everything after the pattern. |
The part of the string after the pattern.
1 2 3 4 | test_string <- 'url.com/string_before_pattern_after-another_string_with_pattern2/'
str_extract_after(string = test_string, pattern = '_pattern_')
str_extract_after(string = test_string, pattern = '_pattern_', num_char = 5)
str_extract_after(string = test_string, pattern = '_', which = "last")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.