def regexp_replace(col: ColT, regex: str, replacement: str) -> Func:
    r"""
    Replaces substring that match a regular expression.

    Args:
        col (str | Column | Func | literal): Column to perform replacement on.
            If a string is provided, it is assumed to be the name of the column.
            If a Column is provided, it is assumed to be a column in the dataset.
            If a Func is provided, it is assumed to be a function returning a string.
            If a literal is provided, it is assumed to be a string literal.
        regex (str): Regular expression pattern to replace.
        replacement (str): Replacement string.

    Returns:
        Func: A `Func` object that represents the regexp_replace function.

    Example:
        ```py
        dc.mutate(
            s1=func.string.regexp_replace("signal.name", r"\d+", "X"),
            s2=func.string.regexp_replace(dc.C("signal.name"), r"\d+", "X"),
            s3=func.string.regexp_replace(
                dc.func.literal("Random string"),
                r"\s+",
                "_",
            ),
        )
        ```

    Notes:
        - The result column will always be of type string.
    """

    def inner(arg):
        return string.regexp_replace(arg, regex, replacement)

    if get_origin(col) is literal:
        cols = None
        args = [col]
    else:
        cols = [col]
        args = None

    return Func("regexp_replace", inner=inner, cols=cols, args=args, result_type=str)

    Replaces substring that match a regular expression.

    Args:
        col (str | Column | Func | literal): Column to perform replacement on.
            If a string is provided, it is assumed to be the name of the column.
            If a Column is provided, it is assumed to be a column in the dataset.
            If a Func is provided, it is assumed to be a function returning a string.
            If a literal is provided, it is assumed to be a string literal.
        regex (str): Regular expression pattern to replace.
        replacement (str): Replacement string.

    Returns:
        Func: A `Func` object that represents the regexp_replace function.

    Example:
        ```py
        dc.mutate(
            s1=func.string.regexp_replace("signal.name", r"\d+", "X"),
            s2=func.string.regexp_replace(dc.C("signal.name"), r"\d+", "X"),
            s3=func.string.regexp_replace(
                dc.func.literal("Random string"),
                r"\s+",
                "_",
            ),
        )
        ```

    Notes:
        - The result column will always be of type string.
    
src/datachain/func/string.py