Closed ashclarke closed 6 years ago
Why are you trying to remove comment blocks that are clearly marked as not for removal
?
I’m trying to remove all comment blocks except our file header, on a concatenated file.
It may have something to do with the fact that your regex isn't repeated. See the example, I am using flag /g
in the end for repeated search.
I tried adding the g
flag, but it had no effect.
I then removed the g
flag (as I am only trying to remove one instance of this regex), removed the !
as well and the comment was successfully ignored.
Not sure if this is expected behaviour but I'm not precious about the !
and can work with this - I can also tell UglifyJS to ignore any comment containing the app name, for the minified version of the file.
In general, you shouldn't try to delete /*!
comments. If you want comments deleted, you should use either /*
or /**
for those ;)
Hi, I have a regular expression that looks for a particular comment to ignore:
\/\*![^]*?(?=app-name)[^]*?\*\/
(https://regex101.com/r/sQ9EtT/1)As you can see, this is designed to match a single important comment containing
app-name
, located at the start of the file (index 0):It should not match any other multiline comment, such as:
or:
/*! hi */
.I have the following config for decomment:
I'm finding that the comment is removed anyway (Note: I wouldn't expect it to but, for completeness,
trim: false
does not fix the issue).I console.logged the parser in my node_modules folder and I have the following:
It seems like the index is off - can you confirm?