import re


def short_cite_re(regex):
    """Convert a full citation regex into a short citation regex.
    Currently this just means we turn '(?P<reporter>...),? (?P<page>...'
    to '(?P<reporter>...),? at (?P<page>...'"""
    return re.sub(
        r"""
            # reporter group:
            (
                \(\?P<reporter>[^)]+\)
            )
            (?:,\?)?\  # comma and space
            # page group:
            (
                \(\?P<page>
            )
        """,
        r"\1,? at \2",
        regex,
        flags=re.VERBOSE,
    )