Created
September 26, 2012 15:57
-
-
Save xsurge83/3788851 to your computer and use it in GitHub Desktop.
Regex to replace password
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using NUnit.Framework; | |
namespace REGEX.TESTS | |
{ | |
[TestFixture] | |
public class RegexTests | |
{ | |
[Test] | |
public void Regex() | |
{ | |
var requestBodyJson = "{\"Username\":\"Tom\",\"Password\"}"; | |
var test = Regex.Replace(requestBodyJson, "\"Password\":\"[^\"]*\"", "\"Password\":\"*******\""); | |
Assert.IsTrue(test.Contains("\"Password\":\"***\"")); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment