title: Regex to match all combinations of a given string
body: <p>I am trying to make a regex to matches all the combinations of a given string. For example of the string is "1234", answers would include:</p>
  
  <ol>
  <li>"1"</li>
  <li>"123"</li>
  <li>"4321"</li>
  <li>"4312"</li>
  </ol>
  
  <p>Nonexamples would include:</p>
  
  <ol>
  <li>"11"</li>
  <li>"11234"</li>
  <li>"44132"</li>
  </ol>
  
  <p>If it matters, the programming language I am using is javascript.</p>
  
  <p>Thank you for any help.</p>