Gets all the level 2 and 3 subheadings from the text and returns these in an array.

@param {string} text The text to return the headings from.

@returns {Array<string[]>} Matches of subheadings in the text, first key is everything including tags,
second is the heading level, third is the content of the subheading.
function getSubheadingsTopLevel( text ) {
	const subheadings = [];
	const regex = /<h([2-3])(?:[^>]+)?>(.*?)<\/h\1>/ig;
	let match;

	while ( ( match = regex.exec( text ) ) !== null ) {
		subheadings.push( match );
	}

	return subheadings;
}