/([$set]).*\1/ # Look if there is any repetition or /[^$set]/ # Look if there is any unallowed character # Which combines to /([$set]).*\1|[^$set]/