import re


def mask_oab(txt):

    """
        Finds an OAB (which stands for Order of Attorneys of Brazil) pattern and then masks it.

        Parameters
        -----------
        txt:  str
            A piece of text containing the OAB pattern


        Returns
        -----------
        str
            masked OAB string as ' [oab] '

        list
            list with the found pattern(s)

    """
    
    find=[]
    pattern='OAB\s?[:-]?\s?\d+\s?/?\s?[A-Z]?[A-Z]?'
    pattern2='OAB\s?/?\s?[A-Z]?[A-Z]?\s?[:-]?\s?\d+'
    sub=' [oab] '

    txt, find = re.sub(pattern, sub, txt, flags=re.I), re.findall(pattern, txt, flags=re.I)
    txt, find2 = re.sub(pattern2, sub, txt, flags=re.I), re.findall(pattern2, txt, flags=re.I)

    return txt, find+find2