Domanda

I'm attempting to utilize wro4j (1.6.2 and 1.6.3-SNAPSHOT) under maven and I've run into a problem with the jquery.tablesorter.js plugin.

On line 972 (or there about) there is a regex that eclipse and the wro4j JSMin (java port) are not liking.

return /\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);

So here's the problem. In Eclipse Indigo, the part '/.test(s);' is showing up as a string (blue highlight). JSMin chokes on it throwing an UnterminatedRegexException.

I've run the C based JSMin against the same file with no problem. What am I missing here?

Doing the following seems to mitigate it but I'm not understanding why this is considered an unterminated regex literal.

return /(\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4})/.test(s);
È stato utile?

Soluzione

The JsMin java port has some known limitations. Unless you have a good reason to continue using JsMin, I would suggest to try googleClosure to handle the js minimization.

Also, when finding this kind of problem, feel free to open an issue and probably it will be fixed in next release.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top