Skip to content

Commit aeaeecd

Browse files
authored
docs(vrl stdlib): Document regex replacement group escaping (#21467)
Signed-off-by: Jesse Szwedko <jesse.szwedko@datadoghq.com>
1 parent 59b7c9a commit aeaeecd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

website/cue/reference/remap/functions/replace.cue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ remap: functions: replace: {
55
description: """
66
Replaces all matching instances of `pattern` in `value`.
77
8-
The `pattern` argument accepts regular expression capture groups. **Note**: Use `$$foo` instead of `$foo`, which is interpreted in a configuration file.
8+
The `pattern` argument accepts regular expression capture groups.
9+
10+
**Note when using capture groups**:
11+
- You will need to escape the `$` by using `$$` to avoid Vector interpreting it as an
12+
[environment variable when loading configuration](/docs/reference/configuration/#escaping)
13+
- If you want a literal `$` in the replacement pattern, you will also need to escape this
14+
with `$$`. When combined with environment variable interpolation in config files this
15+
means you will need to use `$$$$` to have a literal `$` in the replacement pattern.
916
"""
1017

1118
arguments: [

0 commit comments

Comments
 (0)