import re
import string


def clean(text):
    """
    Remove tickers, special characters, links and numerical strings

    Parameters

    text : str

       User given input

    Returns
    -------
    str

        cleaned text

    Examples

    --------

    >>>text="RT $USD @Amila #Test\nTom\'s newly listed Co. &amp; Mary\'s unlisted Group to supply tech for
    nlTK.\nh.. $TSLA $AAPL https://  t.co/x34afsfQsh'"
    
    >>> clean(text)

    'RT   Amila  TestTom s newly listed Co   amp  Mary s unlisted Group to supply tech for  nlTK h    '
    """

    # remove tickers
    remove_tickers=re.sub(r'\$\w*','',text)

    # remove new line symbol
    remove_newline=re.sub(r'\n','',remove_tickers)

    # remove links
    remove_links=re.sub(r'https?:\/\/.*\/\w*','',remove_newline)

    # remove special characters
    remove_punctuation=re.sub(r'['+string.punctuation+']+', ' ', remove_links)

    # remove numerical strings
    remove_numeric_words=re.sub(r'\b[0-9]+\b\s*', '',remove_punctuation)

    clean_text=remove_numeric_words

    return clean_text