I'm using the regex that I found from another stackoverflow-post from the postal code of the netherlands.
My code(in class UserContainer
, but that shouldn't matter):
public bool CheckZip(string input)
{
return Regex.IsMatch(input, "/^[1-9][0-9]{3}?(?!sa|sd|ss)[a-z]{2}$/i");
}
unit test (returns false
):
[TestMethod()]
public void ZipCheckTest()
{
string zip = "1001AA";
Assert.IsTrue(container.CheckZip(zip));
}
I'm really new to regex, so can someone tell me what I'm doing wrong?