Because $
, {
and }
all have special meaning in a regex and need to be backslashed to match those literal characters, because *
doesn't work that way, and because you didn't actually include a capturing group for the data you want to capture. Try:
re := regexp.MustCompile(`\$\{.+?)\}`)