title: Regular Expression replace 2 or more with 2 or more
body: <p>I want to replace more than one space with more than one <code>&amp;nbps;</code>, but if only 1 I want to leave it as a normal space.</p>
  
  <p>Test Cases:</p>
  
  <pre><code>input     | desired output
  ---------------------------
  a test    | a test
  a  test   | a&amp;nbsp;&amp;nbsp;test
  a   test  | a&amp;nbsp;&amp;nbsp;&amp;nbsp;test
  </code></pre>
  
  <p>In this particular case i want to preserve line breaks as well, which i will later replace with <br/>, so i'm only using <code></code> as my regex attempt</p>
  
  <p>All I've got so far is <code>/ {2,}/g</code> replacing with <code>&amp;nbsp;</code>, but i can't figure out how to make the substitution match the count found by the <code>{}</code> in the pattern. Is there a way to do this, or would it be better to do through some iterative process?</p>
  
  <p>I'm using C# in this case: <code>Regex.Replace(input, @" {2,}", "&amp;nbsp;")</code></p>