edited
/(?:(.)(?!.*?\1).*){3}/
Change 3 with the desired unique character value
PREEDIT - for documentation purposes only and to ensure consistency of comments, this was the original answer posted
/^(?:(.)(?!.*\1.*$)){3}$/
No, this is not what the OP needs, I misunderstood the problem. This regular expression verifies that the string is only formed by the specified number of unique characters.
MC ND
source share