title: Ruby Regular expressions (regex): character appear only once at most
body: <p>Suppose I want to make sure a string x equals any combination of abcd (each character appearing one or zero times-->each character should not repeat, but the combination may appear in any order)</p>
  
  <ol>
  <li>valid ex: bc .. abcd ... bcad ... b... d .. dc</li>
  <li>invalid ex. abcdd, cc, bbbb, abcde (ofcourse)</li>
  </ol>
  
  <p>my effort:
  I tried various techniques: 
  the closest I came was 
  x =~ <strong>^(((a)?(b)?(c)?(d)?))$</strong></p>
  
  <p>but this wont work if I do not type them in the same order as i have written:</p>
  
  <ol>
  <li>works for: ab, acd, abcd, a, d, c </li>
  <li>wont work for: bcda, cb, da (anything that is not in the above order)</li>
  </ol>
  
  <p>you can test your solutions here : <a href="http://rubular.com/r/wCpD355bub" rel="nofollow">http://rubular.com/r/wCpD355bub</a></p>
  
  <p>PS: the characters may not be in alphabetical order, it could be   u c  e t</p>