From 22385c3198bf99fe68b979fc71fe97ffcf3f9c00 Mon Sep 17 00:00:00 2001 From: Chris Arcand Date: Thu, 11 Jul 2019 11:29:41 -0500 Subject: [PATCH] Added regex details to replace() docs --- website/docs/configuration/functions/replace.html.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/website/docs/configuration/functions/replace.html.md b/website/docs/configuration/functions/replace.html.md index 7a6817a07..e8789e8ab 100644 --- a/website/docs/configuration/functions/replace.html.md +++ b/website/docs/configuration/functions/replace.html.md @@ -20,9 +20,19 @@ each occurrence with a given replacement string. replace(string, substring, replacement) ``` +If `substring` is wrapped in forward slashes, it is treated as a regular +expression; the syntax conforms to the [re2 regular expression +syntax](https://github.com/google/re2/wiki/Syntax) syntax. If using a regular +expression for the substring argument, the `replacement` string can incorporate +captured strings from the input by using an `$n` sequence, where `n` is the +index or name of a capture group. + ## Examples ``` > replace("1 + 2 + 3", "+", "-") 1 - 2 - 3 + +> replace("hello world", "/w.*d/", "everybody") +hello everybody ```