import re


def drop_features(data, pattern, copy=True):
    """Drop features from data that respect the given string pattern

    Parameters
    ----------
    data: pd.DataFrame
    starting dataframe
    pattern: str
    character string that indicates which column has to be dropped
    copy: boolean
    True if a copy of the data has to be returned, false otherwise
    """
    if copy:
        return data[[col for col in data.columns
                     if re.search(pattern, col) is None]].copy()
    else:
        return data[[col for col in data.columns
                     if re.search(pattern, col) is None]]