import re


def ParseWithRegex(logline):
    """ Parse a line in the Apache Common Log format
    Args:
        logline (str): a line of text in the Apache Common Log format
    Returns:
        tuple: either a dictionary containing the parts of the Apache Access Log and 1,
               or the original invalid log line and 0
    """
    try:
        match = re.search(
            '^(\S+) (\S+) (\S+) \[([\w:/]+\s[+\-]\d{4})\] "(\S+) (\S+)\s*(\S*)\s*" (\d{3}) (\S+)',
            logline,
        )
        if match is None:
            return ("", "", "", "", "", "", "", -1, -1)
        size_field = match.group(9)
        if size_field == "-":
            size = 0
        else:
            size = int(match.group(9))
        return (
            match.group(1),
            match.group(2),
            match.group(3),
            match.group(4),
            match.group(5),
            match.group(6),
            match.group(7),
            int(match.group(8)),
            size,
        )
    except:
        return ("", "", "", "", "", "", "", -1, -1)