Skip to content

Instantly share code, notes, and snippets.

@marius7383
marius7383 / ko-money.js
Last active April 26, 2016 10:33 — forked from jakiestfu/ko-money.js
Used to display and read formatted money via Knockout binding
(function () {
// Credit for escapeRegExp goes to MDN
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Using_Special_Characters
function escapeRegExp(str) {
return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
}
// Credit for replaceAll goes to Sean Bright
// http://stackoverflow.com/a/1144788/2919694