title: RegEx: Match odd amount of repeat between other characters in each line
body: <p>I was wondering how to match and replace an odd amount of slashes (<code>\</code>) in every line at javascript.<br>
  They are used in escaping a string, but sometimes the string is wrapped into lines, so the slash have to move to the next line.</p>
  
  <p>Here is an example: <a href="http://regex101.com/r/iI9vO9" rel="nofollow">http://regex101.com/r/iI9vO9</a></p>
  
  <p>I want to match the lines which are marked via "Yes" and ignore the lines marked with "No".</p>
  
  <p>For Example:</p>
  
  <pre><code>"Yes 1\" + 
  "No 2\\" + 
  "Yes 3\\\" + 
  "No 4\\\\" + 
  "No"
  </code></pre>
  
  <p>Should be changed to:</p>
  
  <pre><code>"Yes 1" + 
  "\No 2\\" + 
  "Yes 3\\" + 
  "\No 4\\\\" + 
  "No"
  </code></pre>
  
  <p>Notice there is characters before and after the slashes in each line, and the slash is moved to the next line when it is repeated an odd time.<br>
  I couldn't get it working with <code>(\\)(\\\\)*</code> or look-around.<br></p>
  
  <p>This is what I have in mind if this work: <br></p>
  
  <pre><code>text.replace(/([^\\])\\" \+ \n"(.)/gm, '$1\\$2"+ \n "')
  </code></pre>
  
  <p>If this is not possible with RegEx, I would appreciate any other way to make this possible.<br>
  Thanks for your help.</p>
  
  <p><strong>EDIT:</strong><br>
  For whoever look this up on Google, this is exactly what solves the problem:</p>
  
  <pre><code>text.replace(/([^\\])((\\{2})*)\\" \+ \n"/g, '$1$2" + \n"\\')
  </code></pre>
  
  <p><a href="http://jsfiddle.net/5mGWF/1/" rel="nofollow">http://jsfiddle.net/5mGWF/1/</a></p>