Closed VisualMicro closed 9 months ago
I think I found a solution. The regex appears to work if it is set into a variable and then used in a json structure. for example
The regex must also have a trailing semi colon...
var vreg = /^[^\s-!@#$%^&()_+{}[]:;<>,.?~\/-]([^\s-!@#$%^&*()+{}[]:;<>,.?~\/-])$/;
{ foo: "baa", pattern: vreg, }
This fails to minify:-
{ foo: "baa", pattern: /^[^\s-!@#$%^&()_+{}[]:;<>,.?~\/-]([^\s-!@#$%^&*()+{}[]:;<>,.?~\/-])$/, }
We have a number of regex expressions that cause the JsMin to fail.
For example we have a pattern as below which causes the minifier to fail
/^[^\s-!@#$%^&()_+{}[]:;<>,.?~\/-]([^\s-!@#$%^&*()+{}[]:;<>,.?~\/-])$/
But the minifier works if we add the trailing "g"
pattern: /^[^\s-!@#$%^&()_+{}[]:;<>,.?~\/-]([^\s-!@#$%^&*()+{}[]:;<>,.?~\/-])$/g
Does anyone have any suggestions for a fix or a workaround?
Thank you