lib/rules/no-regex-spaces.js
function checkRegex(node, value, valueStart) {
            const multipleSpacesRegex = /( {2,})( [+*{?]|[^+*{?]|$)/u,
                regexResults = multipleSpacesRegex.exec(value);

            if (regexResults !== null) {
                const count = regexResults[1].length;

                context.report({
                    node,
                    message: "Spaces are hard to count. Use {{{count}}}.",
                    data: { count },
                    fix(fixer) {
                        return fixer.replaceTextRange(
                            [valueStart + regexResults.index, valueStart + regexResults.index + count],
                            ` {${count}}`
                        );
                    }
                });

                /*
                 * TODO: (platinumazure) Fix message to use rule message
                 * substitution when api.report is fixed in lib/eslint.js.
                 */
            }
        }
function checkRegex(node, value, valueStart) {
            const multipleSpacesRegex = /( {2,})( [+*{?]|[^+*{?]|$)/u,
                regexResults = multipleSpacesRegex.exec(value);

            if (regexResults !== null) {
                const count = regexResults[1].length;

                context.report({
                    node,
                    message: "Spaces are hard to count. Use {{{count}}}.",
                    data: { count },
                    fix(fixer) {
                        return fixer.replaceTextRange(
                            [valueStart + regexResults.index, valueStart + regexResults.index + count],
                            ` {${count}}`
                        );
                    }
                });

                /*
                 * TODO: (platinumazure) Fix message to use rule message
                 * substitution when api.report is fixed in lib/eslint.js.
                 */
            }
        }
function checkRegex ( node , value , valueStart ) { const multipleSpacesRegex = / ( {2,})( [+*{?]|[^+*{?]|$) / u , regexResults = multipleSpacesRegex . exec ( value ) ; if ( regexResults !== null ) { const count = regexResults [ 1 ] . length ; context . report ( { node , message : "Spaces are hard to count. Use {{{count}}}." , data : { count } , fix ( fixer ) { return fixer . replaceTextRange ( [ valueStart + regexResults . index , valueStart + regexResults . index + count ] , ` ${ count } ` ) ; } } ) ; /*
                 * TODO: (platinumazure) Fix message to use rule message
                 * substitution when api.report is fixed in lib/eslint.js.
                 */ } }
Validate regular expressions
@param {ASTNode} node node to validate
@param {string} value regular expression to validate
@param {number} valueStart The start location of the regex/string literal. It will always be the case that
`sourceCode.getText().slice(valueStart, valueStart + value.length) === value`
@returns {void}
@private
Validate regular expressions