Fix converting empty like pattern to regex

This commit is contained in:
Zaid Abdulla committed 2018-12-27 01:21:18 -08:00
1 parent 18c31ae934
commit b1c684fc9f
1 file changed
+1 -1
+1 -1
View File
@@ -226,7 +226,7 @@ function likePatternToRegExp(pat, esc = "", flags = "") {
"\\_": "." "\\_": "."
}; };
let chars = expressionParser.parseLikePattern(pat, esc); let chars = expressionParser.parseLikePattern(pat, esc);
if (!chars.length) return new RegExp("", flags); if (!chars.length) return new RegExp("^$", flags);
chars = chars.map(c => convChars[c] || c); chars = chars.map(c => convChars[c] || c);
chars[0] = chars[0] === ".*" ? "" : "^" + chars[0]; chars[0] = chars[0] === ".*" ? "" : "^" + chars[0];
const l = chars.length - 1; const l = chars.length - 1;