Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Why does the pattern matching not work in this?

$
0
0

public class PasswordValidator : IValidator
{
const int minLength = 8;
const string pattern = "@.,?!£$%^&*()";
public string Message { get; set; } = $"Password should at least {minLength} characters long and should include a special character {pattern}.";
public bool Check(string value) => !string.IsNullOrEmpty(value) && value.Length >= minLength && value.Contains(pattern);
}

When I run this and type in one of the characters from the pattern plus the 8 char, it does not let me validate it. Have I done something wrong?


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>