def parse_hpxregion(region):
    """Parse the HPX_REG header keyword into a list of tokens."""

    m = re.match(r'([A-Za-z\_]*?)\((.*?)\)', region)
    if m is None:
        raise Exception('Failed to parse hpx region string.')

    if not m.group(1):
        return re.split(',', m.group(2))
    else:
        return [m.group(1)] + re.split(',', m.group(2))