EXPAND ALL
  • Home

replace

This function replaces all matches of the regex pattern (first arg) in the string (second arg) with the substitution string (third arg). We support google RE2 syntax. More details on that syntax can be found here. Note that numbered capture groups are supported and can be accessed in the substitution string with \1...\N. See the google RE2 docs for more details on capture groups. However, named capture groups are not supported.

Returns: STRING

The original string with all occurrences of the pattern replaced by the substitution string.

Arguments

VariableTypeDescription
arg1STRINGThe regex pattern to replace.
arg2STRINGThe string column to replace pattern occurrences in.
arg3STRINGThe string to replace the pattern with.

Examples:

df.replaced_str = px.replace('10\.0\.0\.[0-9]+', df.resp_body, 'IP_ADDR')
This site uses cookies to provide you with a better user experience. By using Pixie, you consent to our use of cookies.