title: Regex to match all instances not inside quotes
body: <p>From <a href="https://stackoverflow.com/questions/2700953/a-regex-to-match-a-comma-that-isnt-surrounded-by-quotes">this q/a</a>, I deduced that matching all instances of a given regex <em>not</em> inside quotes, is impossible. That is, it can't match escaped quotes (ex: <code>&quot;this whole \&quot;match\&quot; should be taken&quot;</code>). If there is a way to do it that I don't know about, that would solve my problem.</p>
  <p>If not, however, I'd like to know if there is any efficient alternative that could be used in JavaScript. I've thought about it a bit, but can't come with any elegant solutions that would work in most, if not all, cases.</p>
  <p>Specifically, I just need the alternative to work with .split() and .replace() methods, but if it could be more generalized, that would be the best.</p>
  <p><em>For Example:</em><br/>
  An input string of:<br/> <code>+bar+baz&quot;not+or\&quot;+or+\&quot;this+&quot;foo+bar+</code><br/>
  replacing + with #, not inside quotes, would return:<br/> <code>#bar#baz&quot;not+or\&quot;+or+\&quot;this+&quot;foo#bar#</code></p>