function findMissingReferences(node, nodeText) {
	const missing = [];
	const nodeStartLine = node.position.start.line;
	const nodeStartColumn = node.position.start.column;

	/*
	 * Matches substrings like "[foo]", "[]", "[foo][bar]", "[foo][]", "[][bar]", or "[][]".
	 * `left` is the content between the first brackets. It can be empty.
	 * `right` is the content between the second brackets. It can be empty, and it can be undefined.
	 */
	const labelPattern =
		/(?<!\\)\[(?<left>(?:\\.|[^\]])*)(?<!\\)\](?<!\\)(?:\[(?<right>(?:\\.|[^\]])*)(?<!\\)\])?/dgu;

	let match;

	/*
	 * This loop searches the text inside the node for sequences that
	 * look like label references and reports an error for each one found.
	 */
	while ((match = labelPattern.exec(nodeText))) {
		// skip illegal shorthand tail -- handled by no-invalid-label-refs
		if (illegalShorthandTailPattern.test(match[0])) {
			continue;
		}

		const { left, right } = match.groups;

		// `[][]` or `[]`
		if (!left && !right) {
			continue;
		}

		let label, labelIndices;

		if (right) {
			label = right;
			labelIndices = match.indices.groups.right;
		} else {
			label = left;
			labelIndices = match.indices.groups.left;
		}

		const { lineOffset: startLineOffset, columnOffset: startColumnOffset } =
			findOffsets(nodeText, labelIndices[0]);
		const { lineOffset: endLineOffset, columnOffset: endColumnOffset } =
			findOffsets(nodeText, labelIndices[1]);

		missing.push({
			label: label.trim(),
			position: {
				start: {
					line: nodeStartLine + startLineOffset,
					column:
						startLineOffset > 0
							? startColumnOffset + 1
							: nodeStartColumn + startColumnOffset,
				},
				end: {
					line: nodeStartLine + endLineOffset,
					column:
						endLineOffset > 0
							? endColumnOffset + 1
							: nodeStartColumn + endColumnOffset,
				},
			},
		});
	}

	return missing;
}
Finds missing references in a node.
@param {TextNode} node The node to check.
@param {string} nodeText The text of the node.
@returns {Array<{label:string,position:Position}>} The missing references.