title: Remove non-digit characters from random string except first occurrence of #
body: <p>This question looks trivial - but is not. I want using regexp to remove all non-digits characters from string without first <code>#</code> character. You can use below snippet (and edit <code>magic</code> function there) to tests:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false">
  <div class="snippet-code snippet-currently-hidden">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function magic(str) {
     // example hardcoded implementation - remove it and use proper regexp
     return str.replace(/#1234a5678b910/,'#12345678910');
  }
  
  // Test
  
  tests = { // keys is input string, value is valid result for that input
      "#1234a5678b910": "#12345678910",
      "12#34a5678b910": "12#345678910",
      "1234a56#78b910": "123456#78910",
      "1234a5678b91#0": "1234567891#0",
      "1234a5678b91#0": "1234567891#0",
      "98#765a4321#039c": "98#7654321039",
      "98a765#4321#039c": "98765#4321039",
      "98a765b4321###39": "987654321#39",    
  }
  
  Object.keys(tests).map(k=&gt; console.log(`${k} Test: ${(''+(magic(k)==tests[k])).padEnd(5,' ').toUpperCase()} ( result is ${magic(k)} - should be ${tests[k]})`) );</code></pre>
  </div>
  </div>
  </p>
  
  <p>The input string is generated in random way.  I try this so far but no luck</p>
  
  <pre><code>function magic(str) {
     return str.replace(/(?&lt;=#.*)[^0-9]/g, '') ;
  }
  </code></pre>
  
  <p>Hot to do it using replace and regexp ?</p>