title: Replace only special characters which are in groups using JQuery
body: <p>I need to output the expanded notation of an IPv6 address such as <code>2001:db8:a0b:12f0::1/48</code> to  <code>2001:db8:a0b:12f0:0000:0000:1/48</code>. As you can see, only where there are 2 <code>::</code> that needs to be replaced with <code>:0000:0000:</code>.
  <br/>
  I tried to do it but every <code>:</code> is getting replaced with <code>:0000:0000:</code>.
  <br/>These are the codes:
  <p>
  <strong>Codes</strong></p>
  
  <pre><code>var inputString = ip,
  outputString = inputString.replace(/([:: ])+/g, ':0000:0000:').replace(/^(-)+|(-)+$/g,'');
  console.log(outputString);
  $("#prefix").attr("value",outputString);
  </code></pre>
  
  <p>Any help please? Thanks.</p>