escape $ before performing regexp replace

Recently I found a problem when using your Grunt task.

When the replaced `value` contains a `$'` string (or any other [special replacement pattern](https://developer.mozilla.org/en/docs/JavaScript/Reference/Global_Objects/String/replace)), it is not escaped and therefore malforms the result.

Specifically, with document:

    <tag>@key</tag>

And value:

    Something $' like this

I was getting output:

    <tag>Something </tag> like this</tag>

Because `$'` inserts the remaining part of the document. Of course the desired output was:

    <tag>Something $' like this</tag>

This pull request contains a fix and a test for it.