I have the following string:
Var text='¡Hola $var1$! Gracias $var2$'
How can I replace what is between $ by the value of the variable. Example:
var1="Juan", var2="Pedro" Resultado='¡Hola Juan! Gracias Pedro'
The text can have more variables and content, which is why I can not do with indexOf
Try with exp. regular, but not used very well.
var exp = text.search(/'$'[a-z A-Z]'$'/i);