Skip to content

Commit

Permalink
Add a "curly braces with named references" example in regexp_replace …
Browse files Browse the repository at this point in the history
…docs (#5130)
  • Loading branch information
philrz authored Jun 3, 2024
1 parent e40a039 commit ff299bf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/language/functions/regexp_replace.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,13 @@ echo '"option: value"' | zq -z 'yield regexp_replace(this,/(?P<key>\w+):\s+(?P<v
```mdtest-output
"option=value"
```

Wrap a named reference in curly braces to avoid ambiguity:

```mdtest-command
echo '"option: value"' | zq -z 'yield regexp_replace(this,/(?P<key>\w+):\s+(?P<value>\w+)$/,"$key=${value}AppendedText")' -
```
=>
```mdtest-output
"option=valueAppendedText"
```

0 comments on commit ff299bf

Please sign in to comment.