diff --git a/.eslintrc.js b/.eslintrc.js index 3eb77a64c98b..3ede5c1cb589 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -447,6 +447,8 @@ const base = { 'regexp/prefer-d': 'error', // enforce using `+` quantifier 'regexp/prefer-plus-quantifier': 'error', + // enforce using quantifier + 'regexp/prefer-quantifier': 'error', // enforce using `?` quantifier 'regexp/prefer-question-quantifier': 'error', // enforce using `*` quantifier diff --git a/package.json b/package.json index 6fbe73cd73ba..1cfc99c9b411 100644 --- a/package.json +++ b/package.json @@ -31,14 +31,14 @@ "core-js-pure": "file:./packages/core-js-pure", "david": "^12.0.0", "es-observable": "git+https://github.com/tc39/proposal-observable.git#d3404f06bc70c7c578a5047dfb3dc813730e3319", - "eslint": "^7.20.0", + "eslint": "^7.21.0", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-import": "^2.22.1", "eslint-plugin-node": "^11.1.0", "eslint-plugin-optimize-regex": "^1.2.0", "eslint-plugin-qunit": "^5.3.0", "eslint-plugin-radar": "~0.2.1", - "eslint-plugin-regexp": "~0.1.1", + "eslint-plugin-regexp": "~0.2.1", "eslint-plugin-unicorn": "^28.0.2", "karma": "^5.2.3", "karma-chrome-launcher": "^3.1.0", diff --git a/packages/core-js/internals/get-substitution.js b/packages/core-js/internals/get-substitution.js index 7e55a619b8f3..074226dae403 100644 --- a/packages/core-js/internals/get-substitution.js +++ b/packages/core-js/internals/get-substitution.js @@ -2,8 +2,8 @@ var toObject = require('../internals/to-object'); var floor = Math.floor; var replace = ''.replace; -var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g; -var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g; +var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g; +var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g; // https://tc39.es/ecma262/#sec-getsubstitution module.exports = function (matched, str, position, captures, namedCaptures, replacement) {