When minifying a JS file with a (certain) regex, it changes the regex to a regex that does something different.
minify file.js > min.js
The following regex:
const regex = /^([A-Z0-9_+-]+\.?)*[A-Z0-9_+-]@([A-Z0-9][A-Z0-9-]*\.)+[A-Z]{2,}$/i;
is converted to:
const regex = /^([\w+-]+\.?)*[\w+-]@([\da-z][\da-z-]*\.)+[a-z]{2}$/i;
Running terser file.js -o min.js --compress --mangle (terser@5.31.3 in node@22.11) directly does not produce the same result.
When minifying a JS file with a (certain) regex, it changes the regex to a regex that does something different.
minify file.js > min.jsThe following regex:
is converted to:
Running
terser file.js -o min.js --compress --mangle(terser@5.31.3innode@22.11) directly does not produce the same result.