title: Shared part in RegEx matched string
body: <p>In following code:</p>
  
  <pre><code>"a sasas b".match(/sas/g) //returns ["sas"]
  </code></pre>
  
  <p>The string actually include two <code>sas</code> strings, <code>a [sas]as b</code> and <code>a sa[sas] b</code>. </p>
  
  <p>How can I modify RegEx to match both?  </p>
  
  <p>Another example:</p>
  
  <pre><code>"aaaa".match(/aa/g); //actually include [aa]aa,a[aa]a,aa[aa]
  </code></pre>
  
  <p>Please consider the issue in general not just above instances.</p>
  
  <p>A pure RexEx solution is preferred.</p>