fix a bug that strings which have '$' characters can't be replaced propely

Hi!

I find that MarkMultipleSubstitute function can't replace strings which have $ characters. I think this behavior is a bug, so fix it.
In my branch, the $type variables in the following code are replaced properly.

function($type) {
    $type = "type";
}

Thanks.