I would like to get the last substring of a variable (the last part after the underscore), in this case: "myvar".
x = "string__subvar1__subvar2__subvar3__myvar"
my attempts result in a match starting from the first substring, e.g.
library(stringr)
str_extract(x, "__.*?$)
How do I do this in R?