title: How to create a random string from a regular expression
body: <p>I want to generate a random string form a regular expression. <br/></p>
  
  <p>example:</p>
  
  <pre><code>random_string(/^[0-9]{4}$/) //==&gt; 7895
  random_string(/^[0-9]{4}$/) //==&gt; 0804
  random_string(/^[0-9,A-Z]{4}$/) //==&gt; 9ZE5
  random_string(/^[0-9,A-Z]{4}$/) //==&gt; 84D6
  </code></pre>