ak.str.replace_substring ------------------------ .. py:module: ak.str.replace_substring Defined in `awkward.operations.str.akstr_replace_substring `__ on `line 13 `__. .. py:function:: ak.str.replace_substring(array, pattern, replacement, *, max_replacements=None, highlevel=True, behavior=None, attrs=None) :param array: Array-like data (anything :py:obj:`ak.to_layout` recognizes). :param pattern: Substring pattern to look for inside input values. :type pattern: str :param replacement: What to replace the pattern with. :type replacement: str or bytes :param max_replacements: If not None and not -1, limits the maximum number of replacements per string/bytestring, counting from the left. :type max_replacements: None or int :param highlevel: If True, return an :py:obj:`ak.Array`; otherwise, return a low-level :py:obj:`ak.contents.Content` subclass. :type highlevel: bool :param behavior: Custom :py:obj:`ak.behavior` for the output array, if high-level. :type behavior: None or dict :param attrs: Custom attributes for the output array, if high-level. :type attrs: None or dict Replaces non-overlapping subsequences of any string or bytestring-valued data that match a literal ``pattern`` with ``replacement``. The ``pattern`` and ``replacement`` are scalars; they cannot be different for each string/bytestring in the sample. Note: this function does not raise an error if the ``array`` does not contain any string or bytestring data. Requires the pyarrow library and calls `pyarrow.compute.replace_substring `__ or `pyarrow.compute.replace_substring `__ on strings and bytestrings, respectively. See also: :py:obj:`ak.str.replace_substring_regex`.