ScottHamper / Cookies

JavaScript Client-Side Cookie Manipulation Library
The Unlicense
1.77k stars 170 forks source link

Syntax error in regular expression #8

Closed vcfgvcfg closed 11 years ago

vcfgvcfg commented 11 years ago

When I tried to minify the cookies.js file. The compiler complains:

/* Minification failed. Returning unminified contents. (3454,88-109): run-time error JS5017: Syntax error in regular expression: /[^!#-+--:<-[]-~]/g */

I think the correct expression should be /[^!#-+--:<-[]-~]/g

The square bracket should be escaped.

ScottHamper commented 11 years ago

Thanks!

Out of curiosity, which compiler are you using? It looks like the [ shouldn't need to be escaped when already inside of a character class (looking at http://www.regular-expressions.info/reference.html and http://www.regular-expressions.info/charclass.html). This might actually be a bug with the compiler you're using, as the regex works correctly in all browsers that I've tested without escaping the [.

vcfgvcfg commented 11 years ago

Hi Scott,

I am using the ASP.NET MVC JSminify Bundle to compress all JS on my site.

Dose it still work if I escaped the bracket?

ScottHamper commented 11 years ago

Interesting - I love the new bundling feature in MVC 4! And yea, everything still works properly with the square bracket escaped. No big deal!