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

Replace non-overlapping substrings that match regex pattern by replacement.

For each string in strings, replace non-overlapping substrings that match the regular expression pattern by replacement using the Google RE2 library. If max_replacements != -1, it determines the maximum amount of replacements made, counting from the left. Note that if the pattern contains groups, backreferencing macan be used. Null values emit null.

  • strings (Array-like or scalar-like) – Argument to compute function

  • memory_pool (pyarrow.MemoryPool, optional) – If not passed, will allocate memory from the default memory pool.

  • options (pyarrow.compute.ReplaceSubstringOptions, optional) – Parameters altering compute function semantics

  • **kwargs (optional) – Parameters for ReplaceSubstringOptions constructor. Either options or **kwargs can be passed, but not both at the same time.