diff --git a/share/html/Ticket/Update.html b/share/html/Ticket/Update.html index 6446e46042b..4601292f634 100644 --- a/share/html/Ticket/Update.html +++ b/share/html/Ticket/Update.html @@ -292,7 +292,8 @@ var unchecked = 0; jQuery('input:checkbox[name^=' + prefix + ']').each( function() { var name = jQuery(this).attr('name'); - name = name.replace(prefix + '-', ''); + name = escapeRegExp(name.replace(prefix + '-', '')); + var filter_function = function(n,i) { return n.match(new RegExp('^\\s*' + name + '\\s*$', 'i')) || n.match(new RegExp('<\\s*' + name + '\\s*>', 'i')); }; diff --git a/share/static/js/util.js b/share/static/js/util.js index f3ea840c29e..bd422412560 100644 --- a/share/static/js/util.js +++ b/share/static/js/util.js @@ -677,6 +677,10 @@ function escapeCssSelector(str) { return str.replace(/([^A-Za-z0-9_-])/g,'\\$1'); } +function escapeRegExp(str) { + return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string +} + function createCookie(name,value,days) { var path = RT.Config.WebPath ? RT.Config.WebPath : "/";