semi-related: a replace or substitute regex implementation would be wonderful to have. findRegex and matchRegex are there but no replaceRegex. (anyone know why?)
If you want to replace certain parts of a string with the value of that string when interpreted as code, this would be a method that is related to “interpret” and less to “format”. Might also be represented as a string class that does such embedding tricks.