title: How do I limit a character appearance in a regex?
body: <p>I am stuck with a problem that challenges me to create the regular expression for binary numbers (containing <code>0</code>s and <code>1</code>s). But the string should only match if the binary number only contains a maximum of five <code>1</code>s. <strong>How do I limit a character appearance in a regex?</strong></p>
  
  <p>Examples:</p>
  
  <ul>
  <li><code>01101101</code> is correct</li>
  <li><code>01111100</code> is correct</li>
  <li><code>10110011</code> is correct</li>
  <li><code>01111110</code> is wrong</li>
  <li><code>11111110</code> is wrong</li>
  </ul>