underscore.string
underscore.string copied to clipboard
replaceAll treats key as regex
replaceAll
should not treat its second parameter as a regex.
"1$a2".replace('$a', 'b'); // => "1b2" as expected
but
s("1$a2").replaceAll('$a', 'b').value(); // => "1$a2" but should be "1b2"
See also a stackoverflow discussion which suggests using the regex escape function presented here.
It might be nice to add the regex escape function to this library too.