I have the following json:
Data: {"Account":"d\\adm","Password":"cWExZjEiMTM="},"SqlServer":{"InstanceName":"","MachineName":"MyMachine","Port":null}
I would like to use RegExp to replace Password value with ***.
cWExZjEiMTM= => ***
In my example I'm expecting the following output:
Data: {"Account":"d\\adm","Password":"***"},"SqlServer":{"InstanceName":"","MachineName":"MyMachine","Port":null
I only have the following solution:
string invokeSpec = "\":{\"Account\":\"d\\\\adm\",\"password\":\"cWExZjEiMTM=\"},\"SqlServer\":{\"InstanceName\":\"\",\"MachineName\":\"MyMachine\",\"Port\":null}";
var pattern = "\\\"Password\\\":\\\"(?<pass>[^\\\"]*)\\\"";
var replaced = Regex.Replace(invokeSpec, pattern, "\"Password\":\"***\"", RegexOptions.IgnoreCase);
":{"Account":"d\\adm","Password":"***"},"SqlServer":{"InstanceName":"","MachineName":"MyMachine","Port":null}
"Password":"Value". I mean I would like to kick"Password"from my replacement literal