Another solution would be to customize the $ string interpolation symbol in Powershell
I am not aware of that being possible but you might not need to go that route anyway.
Not sure if this is a feasible solution for you but one option you could do is allow PowerShell to expand all of the strings it finds anyway. However what you would do before that is make some variables beforehand that would place in the text of the variable name itself.
$inputString = @'
There is some $data here.
It looks like we are getting $real $crazy.
Look at the colour $colour to see what is going on.
'@
There are 4 potential variables in that here-string. It is single quoted so no expansion is taking place yet. We create a collection of "variables" that we do not want expanded. As well as the one variable we want expanded. I am choosing to replace $colour
$skip = "data","real","crazy"
$colour = "Green"
Then we create the variables for each string in $skip
where the data is the variable name itself with a dollar sign.
$skip | ForEach-Object{New-Variable -Name $_ -Value "`$$_"}
So now when we do variable interpolation all variables are affected but we controlled the outcome of the ones that should not have their values changed.
$ExecutionContext.InvokeCommand.ExpandString($inputString)
There is some $data here.
It looks like we are getting $real $crazy.
Look at the colour Green to see what is going on.
So all of the string were expanded but we placed in the same text for data, real and crazy and the $colour
was allowed to change. I had a look at your other question and this does not really help for subexpressions beyond what the answer there already tells you.
Be aware that $ExecutionContext.InvokeCommand.ExpandString
can be dangerous if you do not control or trust the data being inserted and the source string itself. There is potential malicious behavior there.