Repository: pola-rs/polars
File: py-polars/src/polars/expr/string.py (Python)

Code before:
    ) -> Expr:
        """
        Use the Aho-Corasick algorithm to replace many matches.

        Parameters
        ----------
        patterns
            String patterns to search and replace.
            Accepts expression input. Strings are parsed as column names, and other
            non-expression inputs are parsed as literals. Also accepts a mapping of
            patterns to their replacement as syntactic sugar for
            `replace_many(pl.Series(mapping.keys()), pl.Series(mapping.values()))`.
        replace_with
            Strings to replace where a pattern was a match.
            Accepts expression input. Non-expression inputs are parsed as literals.
            Length must match the length of `patterns` or have length 1. This can be
            broadcasted, so it supports many:one and many:many.
        ascii_case_insensitive
            Enable ASCII-aware case-insensitive matching.
            When this option is enabled, searching will be performed without respect
            to case for ASCII letters (a-z and A-Z) only.
        leftmost
            Guarantees in case there are overlapping matches that the leftmost match
            is used. In case there are multiple candidates for the leftmost match
            the pattern which comes first in patterns is used. May not be used
            together with overlapping = True.

        Notes
        -----
        This method supports matching on string literals only, and does not support
        regular expression matching.

        Examples
        --------
        Replace many patterns by passing sequences of equal length to the `patterns` and
        `replace_with` parameters.

        >>> _ = pl.Config.set_fmt_str_lengths(100)
        >>> _ = pl.Config.set_tbl_width_chars(110)
        >>> df = pl.DataFrame(
        ...     {
        ...         "lyrics": [
        ...             "Everybody wants to rule the world",
        ...             "Tell me what you want, what you really really want",
        ...             "Can you feel the love tonight",
        ...         ]
        ...     }
        ... )
        >>> df.with_columns(
        ...     pl.col("lyrics")
        ...     .str.replace_many(

Review comment (suggestion):
This is not very clear to me, can you add an example for this argument? (not a Polars dev, just a user)

Code after:
        patterns: IntoExpr | Mapping[str, str],
        replace_with: IntoExpr | NoDefault = no_default,
        *,
        ascii_case_insensitive: bool = False,
        leftmost: bool = False,
    ) -> Expr:
        """
        Use the Aho-Corasick algorithm to replace many matches.

        Parameters
        ----------
        patterns
            String patterns to search and replace.
            Accepts expression input. Strings are parsed as column names, and other
            non-expression inputs are parsed as literals. Also accepts a mapping of
            patterns to their replacement as syntactic sugar for
            `replace_many(pl.Series(mapping.keys()), pl.Series(mapping.values()))`.
        replace_with
            Strings to replace where a pattern was a match.
            Accepts expression input. Non-expression inputs are parsed as literals.
            Length must match the length of `patterns` or have length 1. This can be
            broadcasted, so it supports many:one and many:many.
        ascii_case_insensitive
            Enable ASCII-aware case-insensitive matching.
            When this option is enabled, searching will be performed without respect
            to case for ASCII letters (a-z and A-Z) only.
        leftmost
            Guarantees in case there are overlapping matches that the leftmost match
            is used. In case there are multiple candidates for the leftmost match
            the pattern which comes first in patterns is used.

        Notes
        -----
        This method supports matching on string literals only, and does not support
        regular expression matching.

        Examples
        --------
        Replace many patterns by passing sequences of equal length to the `patterns` and
        `replace_with` parameters.

        >>> _ = pl.Config.set_fmt_str_lengths(100)
        >>> _ = pl.Config.set_tbl_width_chars(110)
        >>> df = pl.DataFrame(
        ...     {
        ...         "lyrics": [
        ...             "Everybody wants to rule the world",
        ...             "Tell me what you want, what you really really want",
        ...             "Can you feel the love tonight",
        ...         ]
        ...     }