Browse Source

Fixes #1903, local search now escapes special chars

pull/1785/merge
jlukic 9 years ago
parent
commit
38ca8f5ccc
1 changed files with 5 additions and 3 deletions
  1. 8
      src/definitions/modules/search.js

8
src/definitions/modules/search.js

@ -438,8 +438,9 @@ $.fn.search = function(parameters) {
searchFields = $.isArray(settings.searchFields) searchFields = $.isArray(settings.searchFields)
? settings.searchFields ? settings.searchFields
: [settings.searchFields], : [settings.searchFields],
searchRegExp = new RegExp(regExp.exact + searchTerm, 'i'),
fullTextRegExp = new RegExp(searchTerm, 'i')
searchExp = searchTerm.replace(regExp.escape, '\\$&'),
searchRegExp = new RegExp(regExp.exact + searchExp, 'i'),
fullTextRegExp = new RegExp(searchExp, 'i')
; ;
source = source || settings.source; source = source || settings.source;
@ -900,7 +901,8 @@ $.fn.search.settings = {
}, },
regExp: { regExp: {
exact: '(?:\s|^)'
escape : /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,
exact : '(?:\s|^)'
}, },
selector : { selector : {

Loading…
Cancel
Save