import re


def get_integral_and_diff_info(formula:str) -> list:
    """
    def: operator(argument, action var)  , eg., diff(x**2/2, x)
    
    Take a formula that has integral(s) or derivative(s) or both ((based on 
    Sympy syntax)), and goves:
        1- the operator: diff, integral
        2- formula inside the operator (argument)
        3- the variable where the operator is based upon  (action var)
    formula = 'sin(x) + diff((a-2/u**2),z) - integrate(e*r,r**2)' 
     out  ---> [('diff', '(a-2/u**2)', 'z'), ('integrate', 'e*r)', 'r**2')]

    Parameters
    ----------
    formula : str
        DESCRIPTION.

    Returns
    -------
    list of tuples of three items, or empty list
        [(operator, argument, action var), ...].
        
    """
    formula = formula.replace(' ','')
    reg_expr = r'(diff|integrate)\(([\(\)\w+\-*/]*),([\w+\-*/]+)'
    return re.findall(reg_expr, formula)