Index: tools/jsmin.py |
diff --git a/tools/jsmin.py b/tools/jsmin.py |
index 646bf143a5aae1c6182f8554829a72e01629c349..e82f3d031e884c92767e2714c6a191e7c25b526e 100644 |
--- a/tools/jsmin.py |
+++ b/tools/jsmin.py |
@@ -232,7 +232,9 @@ class JavaScriptMinifier(object): |
# A regexp that matches a regexp literal surrounded by /slashes/. |
# Don't allow a regexp to have a ) before the first ( since that's a |
# syntax error and it's probably just two unrelated slashes. |
- slash_quoted_regexp = r"/(?:(?=\()|(?:[^()/\\]|\\.)+)(?:\([^/\\]|\\.)*/" |
+ # Also don't allow it to come after anything that can only be the |
+ # end of a primary expression. |
+ slash_quoted_regexp = r"(?<![\w$'\")\]])/(?:(?=\()|(?:[^()/\\]|\\.)+)(?:\([^/\\]|\\.)*/" |
# Replace multiple spaces with a single space. |
line = re.sub("|".join([double_quoted_string, |
single_quoted_string, |