def _parse_protocol_port(name, protocol, port):
    '''
    .. versionadded:: 2019.2.0

    Validates and parses the protocol and port/port range from the name
    if both protocol and port are not provided.

    If the name is in a valid format, the protocol and port are ignored if provided

    Examples: tcp/8080 or udp/20-21
    '''
    protocol_port_pattern = r'^(tcp|udp)\/(([\d]+)\-?[\d]+)$'
    name_parts = re.match(protocol_port_pattern, name)
    if not name_parts:
        name_parts = re.match(protocol_port_pattern, '{0}/{1}'.format(protocol, port))
    if not name_parts:
        raise SaltInvocationError(
            'Invalid name "{0}" format and protocol and port not provided or invalid: "{1}" "{2}".'.format(
                name, protocol, port))
    return name_parts.group(1), name_parts.group(2)