Skip to content

Commit

Permalink
docs(vrl stdlib): Document regex replacement group escaping (#21467)
Browse files Browse the repository at this point in the history
Signed-off-by: Jesse Szwedko <[email protected]>
  • Loading branch information
jszwedko authored Oct 9, 2024
1 parent 59b7c9a commit aeaeecd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion website/cue/reference/remap/functions/replace.cue
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down

0 comments on commit aeaeecd

Please sign in to comment.