import re


def parse_env_var_def(s):
    """
    Parse string defining a shell environment variable, returning name and val

    Returns (varname, value) if matching pattern, else None
    """
    match = re.search(r"\s*(?<=export)\s+([^=]+)=(.*)", s)
    if match:
        lhs, rhs = match.groups()

        # Remove whitespace and any quoted strings' quotes
        lhs = lhs.strip().strip('\'').strip('"')
        rhs = rhs.strip().strip('\'').strip('"')
        # If both sides exist, return them
        if lhs and rhs:
            return lhs, rhs
    return None