diff --git a/cli.js b/cli.js index 6762227..f667808 100644 --- a/cli.js +++ b/cli.js @@ -104,10 +104,11 @@ cli.flags = Object.entries(cli.flags).reduce((res, [key, val]) => { res.ignore = (val || []).map(ignore => { // Check regex - const match = ignore.match(/^\/(.*)\/([igmy]+)?$/); + const {groups} = /^\/(?.*)\/(?[igmy]+)?$/.exec(ignore) || {}; + const {expression, flags} = groups || {}; - if (match) { - return new RegExp(escapeRegExp(match[1]), match[2]); + if (groups) { + return new RegExp(escapeRegExp(expression), flags); } return ignore; diff --git a/src/dom.js b/src/dom.js index 9ff54f2..1bf855b 100644 --- a/src/dom.js +++ b/src/dom.js @@ -106,10 +106,10 @@ class Dom { } if (this.noscriptPosition === 'head') { - return result.replace(/^([\s\t]*)(<\/\s*head>)/gim, `$1$1${this.noscript.join('\n$1$1')}\n$1$2`); + return result.replace(/^([\s\t]*)(<\/\s*head>)/gim, `$1$1${this.noscript.join('\n$1$1')}\n$1$2`); // eslint-disable-line prefer-named-capture-group } - return result.replace(/^([\s\t]*)(<\/\s*body>)/gim, `$1$1${this.noscript.join('\n$1$1')}\n$1$2`); + return result.replace(/^([\s\t]*)(<\/\s*body>)/gim, `$1$1${this.noscript.join('\n$1$1')}\n$1$2`); // eslint-disable-line prefer-named-capture-group } createStyleNode(css, referenceIndent = this.headIndent.indent) {