Added missing regexp quoting.

This commit is contained in:
Martin Edenhofer 2013-03-07 23:42:37 +01:00
parent a9e8bef64a
commit f5295d319f
2 changed files with 5 additions and 1 deletions

View file

@ -162,7 +162,8 @@
var vals = this.filtered = values.filter($.proxy(function (e) { var vals = this.filtered = values.filter($.proxy(function (e) {
var exp = new RegExp('\\W*' + this.options.token + e.val + '(\\W|$)'); // var exp = new RegExp('\\W*' + this.options.token + e.val + '(\\W|$)');
var exp = new RegExp('\\W*' + this.options.token + escapeRegExp(e.val) + '(\\W|$)');
if(!this.options.repeat && this.getText().match(exp)) { if(!this.options.repeat && this.getText().match(exp)) {
return false; return false;
} }

View file

@ -39,6 +39,9 @@ if (!console.log) {
console.log = function(){} console.log = function(){}
} }
function escapeRegExp(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}
Date.prototype.getWeek = function() { Date.prototype.getWeek = function() {
var onejan = new Date(this.getFullYear(),0,1); var onejan = new Date(this.getFullYear(),0,1);