title: regex expression - specifying number of repeated character value in a string
body: <p>how can i check for a pattern occuring a certain number of times?</p>
  
  <p>eg:</p>
  
  <pre><code>4444444 =&gt; return 4
  
  4444332 =&gt; return 4
  
  4444431 =&gt; return 4
  
  4443333 =&gt; return 0
  
  4243424 =&gt; return ?
  </code></pre>
  
  <p>but if character <code>4</code> occurs less than 4 times then return 0</p>
  
  <p>i am just looking for <code>4</code> here. if it appears more than or equal to 4 times then value returned would be 4. the other 3 numbers in the string can range from 1 to 3 only.</p>
  
  <p>thank you.</p>