diff --git a/hooks/modify-java-files.js b/hooks/modify-java-files.js index f4ed73449..9e90e3c19 100644 --- a/hooks/modify-java-files.js +++ b/hooks/modify-java-files.js @@ -480,18 +480,18 @@ async function main() { } function getConstructorRegex(filename) { - return new RegExp(`([^]*${filename.split('.')[0]}\\s*\\(.*\\)\\s*{[^}]*})([^]*)`, 'm'); + return new RegExp(`([^]*?${filename.split('.')[0]}\\s*\\(.*?\\)\\s*{[^}]*})([^]*)`, 'm'); } function getInterfaceDeclarationRegex(filename) { - return new RegExp(`([^]*interface\\s+${filename.split('.')[0]}[\\s\\w]*{)([^]*})`, 'm'); + return new RegExp(`([^]*?interface\\s+${filename.split('.')[0]}[\\s\\w]*{)([^]*})`, 'm'); } function getClassDeclarationRegex(filename) { - return new RegExp(`([^]*class\\s+${filename.split('.')[0]}[\\s\\w]*{)([^]*})`, 'm'); + return new RegExp(`([^]*?class\\s+${filename.split('.')[0]}[\\s\\w]*{)([^]*})`, 'm'); } function removeComments(content) { - return content.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm, ''); + return content.replace(/\/\*[^]*?\*\/|([^\\:]|^)\/\/.*$/gm, ''); } } diff --git a/rspack.config.js b/rspack.config.js index ea2f88041..9bb41530b 100644 --- a/rspack.config.js +++ b/rspack.config.js @@ -96,7 +96,7 @@ module.exports = (env, options) => { }, // Regular CSS/SCSS files { - test: /(? str.replace(/\\([\s\S])|([`"])/g, "\\$1$2"); + const escapeCh = (str) => str.replace(/\\([^])|([`"])/g, "\\$1$2"); const ar = name.split("/"); return ar.map((dirname) => escapeCh(dirname)).join("/"); } diff --git a/src/lib/console.js b/src/lib/console.js index 370052a6c..3e1094858 100644 --- a/src/lib/console.js +++ b/src/lib/console.js @@ -590,7 +590,7 @@ import loadPolyFill from "utils/polyfill"; * @returns {IterableIterator} */ function matchRegex(str) { - return str.matchAll(/(?:(\d+):(\d+)/.exec(stack[1]) || []; + let regExecRes = /<([^>]*)>:(\d+):(\d+)/.exec(stack[1]) || []; if (!regExecRes.length) { const errorInfo = stack[1]?.split("/").pop(); - regExecRes = /(.+):(\d+):(\d+)/.exec(errorInfo) || []; + regExecRes = /(.+?):(\d+):(\d+)/.exec(errorInfo) || []; } let src = ""; const location = regExecRes[1]; diff --git a/src/lib/editorFile.js b/src/lib/editorFile.js index deb11c3ea..9c89af17b 100644 --- a/src/lib/editorFile.js +++ b/src/lib/editorFile.js @@ -797,7 +797,7 @@ export default class EditorFile { let text = this.session.doc.toString(); if (value === "windows") { - text = text.replace(/(?()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, + /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+?"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, }, ...extraFields, { diff --git a/src/plugins/cordova-plugin-buildinfo/scripts/after_install.js b/src/plugins/cordova-plugin-buildinfo/scripts/after_install.js index 472b5873b..77cb5f285 100644 --- a/src/plugins/cordova-plugin-buildinfo/scripts/after_install.js +++ b/src/plugins/cordova-plugin-buildinfo/scripts/after_install.js @@ -35,7 +35,7 @@ function installWindows(windowsPath) { // Replace to if (projitems.match(/[\s]*?[\s]*?/m; + const search = /[\s]*?/m; const replace = "\r\n" diff --git a/src/plugins/cordova-plugin-buildinfo/scripts/before_uninstall.js b/src/plugins/cordova-plugin-buildinfo/scripts/before_uninstall.js index d692b26f9..dffa5e305 100644 --- a/src/plugins/cordova-plugin-buildinfo/scripts/before_uninstall.js +++ b/src/plugins/cordova-plugin-buildinfo/scripts/before_uninstall.js @@ -35,7 +35,7 @@ function uninstallWindows(context, windowsPath) { // Replace to if (projitems.match(/[\s]*?[\s]*?/m; + const search = /[\s]*?/m; const replace = "\r\n" @@ -47,9 +47,9 @@ function uninstallWindows(context, windowsPath) { } // Remove - if (projitems.match(//gm; + const search = /[\r\n ]*/gm; projitems = projitems.replace(search, ''); changed = true; diff --git a/utils/scripts/dev.js b/utils/scripts/dev.js index 17cf4579c..b2212cc89 100644 --- a/utils/scripts/dev.js +++ b/utils/scripts/dev.js @@ -441,7 +441,7 @@ async function applyPluginUpdates() { } const xml = fs.readFileSync(pluginXml, "utf8"); - const idMatch = /]*\sid=["']([^"']+)["']/.exec(xml); + const idMatch = /]*?\sid=["']([^"']+)["']/.exec(xml); const pluginId = idMatch?.[1]; if (!pluginId) { log("warn", `Could not find plugin id in ${dir}/plugin.xml`); diff --git a/utils/setup.js b/utils/setup.js index e7b69b885..5a742fee8 100644 --- a/utils/setup.js +++ b/utils/setup.js @@ -27,7 +27,7 @@ function isPaidVersion() { }); } - const widgetId = /]*\sid=["']([^"']+)["']/.exec(config)?.[1]; + const widgetId = /]*?\sid=["']([^"']+)["']/.exec(config)?.[1]; return widgetId === ID_PAID; }