replace-last
Replaces last match for pattern in string with replacement
npm install --save replace-last
Node
var replaceLast = require('replace-last');
replaceLast(str, pattern, replacement);
Browser
<script src="node_modules/replace-last/replaceLast.js"></script>
<script>
replaceLast(str, pattern, replacement);
</script>
Arguments
str (string): The string to modify.
pattern (RegExp|string): The pattern to replace.
replacement (string): The match replacement.
Returns
(string): Returns the modified string.
Example
replaceLast('hello hello hello', 'hello', 'bye');
Another missing method from the AWOL library