sprig icon indicating copy to clipboard operation
sprig copied to clipboard

ability to escape `"` in regex functions?

Open asoorm opened this issue 7 years ago • 1 comments

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?\".+\"

asoorm avatar Feb 05 '19 22:02 asoorm

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.

mattfarina avatar Sep 27 '19 15:09 mattfarina