I'd like to extract the expressions ${*} from a String.
val example = "Hello ${foo.bar} World"
But the dollar sign and the curly brackets are part of the expression syntax, so I tried to escape it.
val expr = "\\$\\{[a-zA-Z0-9\\w]*\\}".r
But this won't work and println prints nothing:
for (ex <- expr.findAllMatchIn(example)) println(ex)
Anyone has an idea what's wrong? There exists a more elegant regex?