def METHOD_NAME(text_df, id_df=None, text_column="abstract"):
    """Extract Cognitive Atlas terms and count instances using regular expressions.
    Parameters
    ----------
    text_df : (D x 2) :obj:`pandas.DataFrame`
        Pandas dataframe with at least two columns: 'id' and the text.
        D = document.
    id_df : (T x 3) :obj:`pandas.DataFrame`
        Cognitive Atlas ontology dataframe with one row for each term and at least three columns:
        - ``"id"``: A unique identifier for each term.
        - ``"alias"``: A natural language expression for each term.
        - ``"name"``: The preferred name of each term. Currently unused.
    text_column : :obj:`str`, optional
        Name of column in text_df that contains text. Default is 'abstract'.
    Returns
    -------
    counts_df : (D x T) :obj:`pandas.DataFrame`
        Term counts for documents in the corpus.
        One row for each document and one column for each term.
    rep_text_df : (D x 2) :obj:`pandas.DataFrame`
        An updated version of the ``text_df`` DataFrame with terms in the text column replaced
        with their CogAt IDs.
    Notes
    -----
    The Cognitive Atlas :footcite:p:`poldrack2011cognitive` is an ontology for describing
    cognitive neuroscience concepts and tasks.
    References
    ----------
    .. footbibliography::
    See Also
    --------
    nimare.extract.download_cognitive_atlas : This function will be called automatically if
                                              ``id_df`` is not provided.
    """
    text_df = text_df.copy()
    if id_df is None:
        cogat = download_cognitive_atlas()
        id_df = pd.read_csv(cogat["ids"])
    gazetteer = sorted(id_df["id"].unique().tolist())
    if "id" in text_df.columns:
        text_df.set_index("id", inplace=True)
    text_df[text_column] = text_df[text_column].fillna("")
    text_df[text_column] = text_df[text_column].apply(_uk_to_us)
    # Create regex dictionary
    regex_dict = {}
    for term in id_df["alias"].values:
        term_for_regex = term.replace("(", r"\(").replace(")", r"\)")
        regex = "\\b" + term_for_regex + "\\b"
        pattern = re.compile(regex, re.MULTILINE | re.IGNORECASE)
        regex_dict[term] = pattern
    # Count
    count_arr = np.zeros((text_df.shape[0], len(gazetteer)), int)
    counts_df = pd.DataFrame(columns=gazetteer, index=text_df.index, data=count_arr)
    for term_idx in id_df.index:
        term = id_df["alias"].loc[term_idx]
        term_id = id_df["id"].loc[term_idx]
        pattern = regex_dict[term]
        counts_df[term_id] += text_df[text_column].str.count(pattern).astype(int)
        text_df[text_column] = text_df[text_column].str.replace(pattern, term_id, regex=True)
    return counts_df, text_df