title: How to search replace with regex and keep case as original in javascript
body: <p>Here is my problem.  I have a string with mixed case in it.  I want to search regardless of case and then replace the matches with some characters either side of the matches.</p>
  
  <p>For example:</p>
  
  <pre><code>var s1 = "abC...ABc..aBC....abc...ABC";
  var s2 = s.replace(/some clever regex for abc/g, "#"+original abc match+"#");
  </code></pre>
  
  <p>The result in s2 should end up like:</p>
  
  <pre><code>"#abC#...#ABc#..#aBC#....#abc#...#ABC#"
  </code></pre>
  
  <p>Can this be done with regex? If so, how?</p>