title: Testing for non-repeating integers in a RegExp
body: <p>I need my Regular Expression to not have any repeating decimals unless I specify so.</p>
  
  <p>For example, I have a RegExp <code>/[12]{2}/</code></p>
  
  <p>This is just saying that I need to have 2 digits, either 1 or 2. I want to reject the string if it was 11 or 22, but have it pass if the numbers weren't repeating. So it could either be 12 or 21. So the way I check to make sure 11 or 22 aren't passed is by checking after the first RegExp with this: <code>!(/^.*(.).*\1.*$/</code></p>
  
  <p>Therefore, if n is 12 or 21, then it'll pass, but not with 11 or 22.</p>
  
  <p>Now here comes my problem. I'd like to not have repeating numbers unless it's necessary. Say for example my RegExp is <code>/[494]{3}/</code>. I'd like to have it where there would be no more than two 4s in my number. So the only acceptable numbers would be 494, 449, 944, but not 444, 499, 994, 999 etc...</p>
  
  <p>If I try and use my previous two tests to check for multiples of any digit, then it will reject any number that I input because a digit repeats.</p>
  
  <p>How can I create a regular expression where it allows for a digit to be used in any order and not repeated, unless otherwise stated?</p>