EXPAND ALL
- Home
- About Pixie
- Installing Pixie
- Using Pixie
- Tutorials
- Reference
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.
The original string with all occurrences of the pattern replaced by the substitution string.
Variable | Type | Description |
---|---|---|
arg1 | STRING | The regex pattern to replace. |
arg2 | STRING | The string column to replace pattern occurrences in. |
arg3 | STRING | The string to replace the pattern with. |
df.replaced_str = px.replace('10\.0\.0\.[0-9]+', df.resp_body, 'IP_ADDR')