pyarrow.compute.replace_substring_regex(strings, /, pattern, replacement, *, max_replacements=None, options=None, memory_pool=None)#

Replace matching non-overlapping substrings with replacement.

For each string in strings, replace non-overlapping substrings that match the given regular expression pattern with the given replacement. If max_replacements is given and not equal to -1, it limits the maximum amount replacements per input, counted from the left. Null values emit null.

stringsArray-like or scalar-like

Argument to compute function.


Substring pattern to look for inside input values.


What to replace the pattern with.

max_replacementsint or None, default None

The maximum number of strings to replace in each input value (unlimited if None).

optionspyarrow.compute.ReplaceSubstringOptions, optional

Alternative way of passing options.

memory_poolpyarrow.MemoryPool, optional

If not passed, will allocate memory from the default memory pool.