Javascript String Prototype Encode RegExp Symbols
String.prototype.encodeRegExp = function() { return this.replace(/([*+-.?^${}()|[\]\/\\])/g, '\\$1'); } console.log( "[] + ? + ^ { $ }".encodeRegExp() );