Extract text between first and last parentheses
Source:R/Functions-Txt.R
extractTextBetweenParens.RdFunction to extract text between first and last parentheses
Details
For each element in the vector, this extracts the string between the *first* "(" and *last* ")" from each element of the input character vector, or `NA` if no matching parentheses.
Examples
# example code
extractTextBetweenParens("fred(x,y)=0");
#> [1] "x,y"
extractTextBetweenParens(c("fred(x,y)=0","b(z0)"));
#> [1] "x,y" "z0"
extractTextBetweenParens("fred(x,y(z))=0");
#> [1] "x,y(z)"