minify icon indicating copy to clipboard operation
minify copied to clipboard

Regex gets stripped as comment in JS.php

Open phildittrich opened this issue 4 years ago • 1 comments

I am trying to minify some javascript that contains

test: [/\sedg\//i],

which is not extracted as a string and seems to be matched by the single-line comments pattern in JS.php and gets truncated after //:

// single-line comments
$this->registerPattern('/\/\/.*$/m', '');

My try was to have the regex positively look behind for the beginning of the line or anything but a backslash:

$this->registerPattern('/(?<=^|[^\\])\/\/.*$/m', '');

But that did not match comments exactly at the beginning of the file.

How could that minification work?

Thanks a lot!

phildittrich avatar Apr 24 '20 10:04 phildittrich

Referencing #323

peixotorms avatar Apr 24 '20 10:04 peixotorms