Fix #5275: $1 and so on now work with replacing with RegEx

Fixes #5275
Merge remote-tracking branch 'upstream/master' into patch-6
My try to improve the replace() function
Replace all $ substitutions in a regexp replace string, not just the first
Merge branch 'master' into nj/fix-regexp-replace
Add simple unit test for regexp replace
Merge pull request #5618 from adobe/nj/fix-regexp-replace

Handle regexp replacements with $1, $2, etc. properly