import re


def extractCompositeFigureStrings(latexString):
    """
    Returns a list of latex figures as strings stripping out captions.
    """

    # extract figures
    figureStrings = re.findall(r"\\begin{figure}.*?\\end{figure}", latexString, re.S)
    # filter composite figures only and remove captions (preserving captions in subfigures)
    figureStrings = [
        re.findall(r"\\begin{figure}.*(?=\n.*\\caption)", figureString, re.S)[0] + "\n\\end{figure}"
        for figureString in figureStrings if "\\begin{subfigure}" in figureString
    ]
    return figureStrings