sprig
sprig copied to clipboard
ability to escape `"` in regex functions?
Given the following string, how to change value of password using sprig regexReplaceAllLiteral when input and output contain " character?
{"name": "harry", "password": "foo"}
expected output:
{"name": "harry", "password": "obfuscated"}
example regex:
password\"\:\s?\".+\"
Sprig uses the golang regex syntax. You can find that documented at https://github.com/google/re2/wiki/Syntax. Instead of using a " to surround your string, for the regex, consider ` ... see an example at https://play.golang.org/p/62EGJpXbDKH.