title: How to avoid using twice replace (using only one regex) in the following script?
body: <p>I need to edit a string from:</p>
  
  <p><code>rgb(250, 0, 0) 10px 10px 50px 0px</code></p>
  
  <p>to:</p>
  
  <p><code>rgba(250, 0, 0, 1) 10px 10px 50px 0px</code></p>
  
  <p>Assuming the input value is always correct, I need to add alpha channel of 1.</p>
  
  <p>The follow script I created works, but I was wondering about the double replace.</p>
  
  <p>I would like to know if you perform a better way, maybe using only one <code>regex</code> and avoiding using <code>replace</code> twice or a better alternative.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>        var _convertBoxShadowToTgba = function (boxShadow) {
              return boxShadow.replace(/rgb/i, 'rgba').replace(/\)/i, ', 1)');
          };
          var original = "rgb(250, 0, 0) 10px 10px 50px 0px";
          var final = _convertBoxShadowToTgba(original);
          console.log('original', original);
          console.log('final', final);</code></pre>
  </div>
  </div>
  </p>