Escape $ character in custom strings passed to replace function - fixes #118