I have the following character vector:
text_test <- c(
"\\name{function_name}",
"\\title{function_title}",
"The function \\name{function_name} is used somewhere"
)
I would like to extract the words between curly braces, i.e function_name
and function_title
. I tried this:
stringr::str_extract(text_test, '\\{[^\\}]*\\}')
but this extracts the curly braces as well.
I have two questions:
how can I modify this regex to exclude the curly braces?
how can I do that in base R?