pyarrow.compute.replace_substring_regex#

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 instrings, replace non-overlapping substrings that matchthe given regular expressionpattern with the givenreplacement.Ifmax_replacements is given and not equal to -1, it limits themaximum amount replacements per input, counted from the left.Null values emit null.

Parameters:
stringsArray-like or scalar-like

Argument to compute function.

patternstr

Substring pattern to look for inside input values.

replacementstr

What to replace the pattern with.

max_replacementsint orNone, defaultNone

The maximum number of strings to replace in eachinput 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.