esmangle
esmangle copied to clipboard
reduce escape sequences in regular expressions
We already do something similar with strings, reducing '\x20' to ' ' (escodegen handles this for us automatically). It gets trickier with regular expressions, though, because we will need to avoid control characters such as [](){}-\. When expressed as \u????, these control characters can still be reduced to \x??.
It breaks the regexp.source result.
So we need to provide advance mode to do such optimizations.