import re


def remove_tags(text: str) -> str:
    """
    Removes tags and extracts text inside square brackets [] and angle brackets <>.
    Also removes 'cleartext' 'CLEARTEXT' or 'Cleartext' as well as language attributes
    (2 letter uppercase sequences following 'cleartext' and space(s) or dash(es)).

    :param text:    Input text
    :return:        Text with tags removed and text extracted
    """
    return re.sub(
        r'(?:(<[ ]*(?:(?:cleartext|CLEARTEXT|Cleartext)(?:[ -][A-Z]{2})?[ -]*)?)|(\[))((?(1)[^>]*|[^\]]*))(?(1)>|\])',
        r'\3', text, flags=re.MULTILINE)