Better string sub documentation

This commit is contained in:
Mike Farah
2021-04-16 16:07:40 +10:00
parent 6c26344449
commit b2a538bdfc
3 changed files with 7 additions and 5 deletions
+3 -3
View File
@@ -15,7 +15,7 @@ var stringsOperatorScenarios = []expressionScenario{
},
{
description: "Substitute / Replace string",
subdescription: "This uses golang regex, described [here](https://github.com/google/re2/wiki/Syntax)",
subdescription: "This uses golang regex, described [here](https://github.com/google/re2/wiki/Syntax)\nNote the use of `|=` to run in context of the current string value.",
document: `a: dogs are great`,
expression: `.a |= sub("dogs", "cats")`,
expected: []string{
@@ -24,9 +24,9 @@ var stringsOperatorScenarios = []expressionScenario{
},
{
description: "Substitute / Replace string with regex",
subdescription: "This uses golang regex, described [here](https://github.com/google/re2/wiki/Syntax)",
subdescription: "This uses golang regex, described [here](https://github.com/google/re2/wiki/Syntax)\nNote the use of `|=` to run in context of the current string value.",
document: "a: cat\nb: heat",
expression: `.[] |= sub("([a])", "${1}r")`,
expression: `.[] |= sub("(a)", "${1}r")`,
expected: []string{
"D0, P[], (doc)::a: cart\nb: heart\n",
},