From aeaeecdcabd7f162946c5bb4ba7342fb062dc73c Mon Sep 17 00:00:00 2001 From: Jesse Szwedko Date: Wed, 9 Oct 2024 12:28:43 -0700 Subject: [PATCH] docs(vrl stdlib): Document regex replacement group escaping (#21467) Signed-off-by: Jesse Szwedko --- website/cue/reference/remap/functions/replace.cue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/website/cue/reference/remap/functions/replace.cue b/website/cue/reference/remap/functions/replace.cue index f15a1addc5804..2095cd5361a3f 100644 --- a/website/cue/reference/remap/functions/replace.cue +++ b/website/cue/reference/remap/functions/replace.cue @@ -5,7 +5,14 @@ remap: functions: replace: { description: """ Replaces all matching instances of `pattern` in `value`. - The `pattern` argument accepts regular expression capture groups. **Note**: Use `$$foo` instead of `$foo`, which is interpreted in a configuration file. + The `pattern` argument accepts regular expression capture groups. + + **Note when using capture groups**: + - You will need to escape the `$` by using `$$` to avoid Vector interpreting it as an + [environment variable when loading configuration](/docs/reference/configuration/#escaping) + - If you want a literal `$` in the replacement pattern, you will also need to escape this + with `$$`. When combined with environment variable interpolation in config files this + means you will need to use `$$$$` to have a literal `$` in the replacement pattern. """ arguments: [