title: Regular Expression to escape double quotes inside single quotes
body: <p>I would need a regular expression that escapes or captures (if not already escaped) <strong>ALL</strong> the double quote characters <strong>INSIDE</strong> a single quoted string and then convert the opening single quotes to double quotes!</p>
  
  <p>We are refactoring files that have a lot (and i mean a lot!) of single quoted strings in either PHP and also JS files. The only thing they have in common is that the strings are at least in one line and are concated with = in both languages.</p>
  
  <p>I give an example (<em>the example is ugly legacy code so dont judge it please, i already did this</em> :) )
  We have a file that starts like this:</p>
  
  <pre><code>var baseUrl = $("#baseurl").html();
  var head = '&lt;div id="finishingDiv" style="background-image:url({baseUrl}css/userAd/images/out_main.jpg); background-repeat: repeat-y; "&gt;'+
  '&lt;div id="buttonbar" style="width:810px; text-align:right"&gt;';
  </code></pre>
  
  <p>and i want it to look like this:</p>
  
  <pre><code>var baseUrl = $("#baseurl").html();
  var head = "&lt;div id=\"finishingDiv\" style=\"background-image:url({baseUrl}css/userAd/images/out_main.jpg); background-repeat: repeat-y; \"&gt;" +
  "&lt;div id=\"buttonbar\" style=\"width:810px; text-align:right\"&gt;";
  </code></pre>
  
  <p>As you see the correct double quote strings are not touched.</p>
  
  <p>So my basic question: How do i capture all characters of one kind (in my case the character " ) between a certain start and end character (in my case the character ' ).</p>
  
  <p>This regex <code>'.*(").*'</code>  or <code>'[^']*(")[^']*'</code> just captures always one " for me per match. If if needs more than one step its also ok, it should just work.
  I would be happy of any solution, IDE specific, language specific or shell specific, that acutally works.</p>
  
  <p>Please help, im desperate, thanks a lot</p>