def METHOD_NAME(self, selector, result):
    match = ELEMENT_SELECTOR.match(selector)
    if match:
        name = match.group(1)
        self._add_element_rule(name, result)
        return
    match = ELEMENT_WITH_ATTR_SELECTOR.match(selector)
    if match:
        name, attr = match.groups()
        self._add_element_with_attr_rule(name, attr, result)
        return
    for regex in (
        ELEMENT_WITH_ATTR_EXACT_SINGLE_QUOTE_SELECTOR,
        ELEMENT_WITH_ATTR_EXACT_DOUBLE_QUOTE_SELECTOR,
        ELEMENT_WITH_ATTR_EXACT_UNQUOTED_SELECTOR,
    ):
        match = regex.match(selector)
        if match:
            name, attr, value = match.groups()
            self._add_element_with_attr_exact_rule(name, attr, value, result)
            return