title: In Regex, how can I globally replace only the first matching character *after* a matching capturing group
body: <p>I want to use regex select the first quote after each instance of img_ in the below code. In this example, it would be the " after the jpg. </p>
  
  <p>I tried using the following regex: </p>
  
  <p><code>\(?&lt;=img_.*)"+?\g</code></p>
  
  <p>but all the quotes after <code>img_</code> in each line were selected, including the quotes around <code>"533"</code>. How do I match the quotes after <code>.jpg</code> without matching any other quotes?</p>
  
  <pre><code>&lt;img class="confluence-embedded-image confluence-content-image-border" height="399" src="img_78.jpg" width="533" /&gt;
  
  &lt;img class="confluence-embedded-image confluence-content-image-border" height="399" src="img_78.jpg" width="533" /&gt;
  
  &lt;img class="confluence-embedded-image confluence-content-image-border" height="399" src="img_78.jpg" width="533" /&gt;
  </code></pre>
  
  <p>I want to avoid using .jpg because that .jpg could be many other thing (.png, .jpeg, etc). I want to get the first quote after <code>img_</code> regardless of what come between <code>img_</code> and the quote.</p>
  
  <p>I basically want to search in a file using that regex expression and only return the first quote after each instance of <code>img_</code>. I'm using the replace-in-file module in nodejs which takes in this regular expression and replaces it with a given expression. I tried the above regular expression but it replaces the entire match.</p>