title: javascript regex to match anything between single quotes, double quotes and regex slashes
body: <p>I'm trying to match anything between either double quotes, single quotes, or regex slashes, basically anything that isn't tokenized by javascript as a string or regex. So far what I came up with is:</p>
  
  <pre><code>/"[^\\"\n]*(\\"[^\\"\n]*)*"|'[^\\'\n]*(\\'[^\\'\n]*)*'|\/[^\\\/\n]*(\\\/[^\\\/\n]*)*\//
  </code></pre>
  
  <p>But there are a couple of problems with this as you can see <a href="http://goo.gl/4Yn9pR" rel="nofollow"><strong>here</strong></a> </p>
  
  <h2><a href="http://goo.gl/4Yn9pR" rel="nofollow">http://goo.gl/4Yn9pR</a></h2>
  
  <p>Basically this shouldn't match <code>1+2/3+4/5</code> since it isn't a regex. Also<br>
  <code>Dont match "Match here\\" Dont match"</code> should match the first part and not the second (thats true for single quotes and regexes too)</p>
  
  <p>How should this be written?</p>
  
  <p>Edit: If it's not possible differentiate between <code>1+2/3+4/5</code>, <code>/*comment*/</code> and <code>/regex/</code> using regular expressions, how would I just solve the <code>Dont match "Match here\\" Dont match"</code> problem </p>