title: Count the number of pattern matches in a string
body: <p>For example, I have a string</p>
  <pre><code>&quot;AAAAAAACGAAAAAACGAAADGCGEDCG&quot;
  </code></pre>
  <p>I want to count how many times <code>&quot;CG&quot;</code> is repeated.
  How do I do that?</p>