add option to ignore $legacy variable style substitution

Hi Michael,
Here is the updated pull request based on our discussions in #2819.