I'm trying to get a regex that checks that a 9 character integer is long and contains at least 6 non-repeating digits
Example:
123456123 ------> Matches (6 different digits) 123243521 ------> Doesn't match (5 different digits)
It's much easier to do it without regex:
var str = "1234567890"; var isOk = str.Length >= 9 && str.All(c => c >= '0' && c <= '9') && str.Distinct().Count() >= 6;