Javascript regex to match a pattern but NOT match a regex literal (r.js optimizer and uglify issue)?
问题 I've got a Backbone application, organized into modules using Require.js. One of these modules contains a Handlebars helper, which has a method I use to pull a legal header off of all our HTML templates for each View. The header is contained in an HTML comment, so I use the following regex to strip it off: /<!--[\s\S]*?-->/g Now, when I optimize (concatenate/compile/minify) the application using r.js, I'm doing the same removal of HTML comments using the onBuildWrite() method of r.js: