parens-extractors: Extract substrings from before and inside parentheses
Description
before_parens() and inside_parens() extract the part of a
string before or inside parentheses, brackets, braces, or custom
delimiters. split_by_parens() does the same for the columns of a data
frame.
String vector as long as string, with surrounding whitespace
removed. If a string has no opening delimiter, before_parens() returns
all of it and inside_parens() returns NA. A blank part, such as the
inside of "()", is NA, as is a part "NA" or "NaN".
Arguments
string
String vector.
delim
String. The pair of delimiters around the second part:
"parens" (the default), "brackets", or "braces", or two custom
strings, matched literally.