title: Comprehensive RegExp to remove JavaScript comments
body: <p>I need to dependably remove all JavaScript comments with a single Regular Expression. </p>
  
  <p>I have searched StackOverflow, and other sites, but none take into account alternating quotes, multi-line comments, comments within strings, regular expressions, etc. </p>
  
  <p>Is there any Regular expressions that can remove the comments from this:</p>
  
  <pre class="lang-js prettyprint-override"><code>var test = [
      "// Code",
      '// Code',
      "'// Code",
      '"// Code',
      //" Comment",
      //' Comment',
      /* Comment */
      // Comment /* Comment
      /* Comment
       Comment // */ "Code",
      "Code",
      "/* Code */",
      "/* Code",
      "Code */",
      '/* Code */',
      '/* Code',
      'Code */',
      /* Comment
      "Comment",
      Comment */ "Code",
      /Code\/*/,
      "Code */"
  ]
  </code></pre>
  
  <p>Here's a <a href="http://goo.gl/C9sjiS" rel="noreferrer">jsbin</a> or <a href="http://goo.gl/k2ofVO" rel="noreferrer">jsfiddle</a> to test it.</p>