function checkRegex(pattern, node, regexNode, flags) {
			let ast;

			try {
				ast = parser.parsePattern(pattern, 0, pattern.length, {
					unicode: Boolean(flags && flags.includes("u")),
					unicodeSets: Boolean(flags && flags.includes("v")),
				});
			} catch {
				// ignore regex syntax errors
				return;
			}

			regexpp.visitRegExpAST(ast, {
				onCapturingGroupEnter(group) {
					if (!group.name) {
						const rawText = sourceCode.getText(regexNode);
						const suggest = suggestIfPossible(
							group.start,
							pattern,
							rawText,
							regexNode,
						);

						context.report({
							node,
							messageId: "required",
							data: {
								group: group.raw,
							},
							suggest,
						});
					}
				},
			});
		}
Function to check regular expression.
@param {string} pattern The regular expression pattern to be checked.
@param {ASTNode} node AST node which contains the regular expression or a call/new expression.
@param {ASTNode} regexNode AST node which contains the regular expression.
@param {string|null} flags The regular expression flags to be checked.
@returns {void}