Regular expression to match only if there are N unique characters

.net, regex

Solution

Not really, this is not a regex problem.

A much easier solution would be to use a Set like HashSet(T)

Split the string to characters and add each one to the set.

Count the number of elements in the set.

Problem

Is there a way how to define regular expression in which will match only if there are at least N unique characters? Example: (N = 3) ``` aba => no match abc => match abbc => match ab => no match abcd => match ```

Original source