diff --git a/core/modules/wiki.js b/core/modules/wiki.js index 69a29408d..d4358623a 100644 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -724,24 +724,29 @@ exports.search = function(text,options) { flags = options.caseSensitive ? "" : "i"; if(options.literal) { if(text.length === 0) { - return []; + searchTermsRegExps = null; + } else { + searchTermsRegExps = [new RegExp("(" + $tw.utils.escapeRegExp(text) + ")",flags)]; } - searchTermsRegExps = [new RegExp("(" + $tw.utils.escapeRegExp(text) + ")",flags)]; } else { terms = text.replace(/( +)/g," ").split(" "); - searchTermsRegExps = []; - if(terms.length === 0) { - return []; - } - for(t=0; t