1
0
Fork 0
forked from svrjs/svrjs

Changed invalid regex error message

This commit is contained in:
Dorian Niemiec 2023-12-03 13:07:28 +01:00
parent 0ed74bc55d
commit 17def48271

2
svr.js
View file

@ -543,7 +543,7 @@ function getOS() {
function createRegex(regex, isPath) { function createRegex(regex, isPath) {
var regexStrMatch = regex.match(/^\/((?:\\.|[^\/\\])*)\/([a-zA-Z0-9]*)$/); var regexStrMatch = regex.match(/^\/((?:\\.|[^\/\\])*)\/([a-zA-Z0-9]*)$/);
if (!regexStrMatch) throw new Error("Invalid regex!"); if (!regexStrMatch) throw new Error("Invalid regular expression: " + regex);
var searchString = regexStrMatch[1]; var searchString = regexStrMatch[1];
var modifiers = regexStrMatch[2]; var modifiers = regexStrMatch[2];
if (isPath && !modifiers.match(/i/i) && os.platform() == "win32") modifiers += "i"; if (isPath && !modifiers.match(/i/i) && os.platform() == "win32") modifiers += "i";