Escape literal [ in regexp

Improves compatibility with strict ES5 regexp syntax
This commit is contained in:
Joshua Peek
2015-02-26 12:37:27 -06:00
parent c7a365b6f1
commit 7f7765546f
2 changed files with 3 additions and 3 deletions

View File

@@ -946,7 +946,7 @@
HEREDOC_INDENT = /\n+([^\n\S]*)(?=\S)/g;
REGEX = /^\/(?!\/)((?:[^[\/\n\\]|\\[^\n]|\[(?:\\[^\n]|[^\]\n\\])*])*)(\/)?/;
REGEX = /^\/(?!\/)((?:[^\[\/\n\\]|\\[^\n]|\[(?:\\[^\n]|[^\]\n\\])*\])*)(\/)?/;
REGEX_FLAGS = /^\w*/;

View File

@@ -837,11 +837,11 @@ HEREDOC_INDENT = /\n+([^\n\S]*)(?=\S)/g
# Regex-matching-regexes.
REGEX = /// ^
/ (?!/) ((
?: [^ [ / \n \\ ] # every other thing
?: [^ \[ / \n \\ ] # every other thing
| \\[^\n] # anything but newlines escaped
| \[ # character class
(?: \\[^\n] | [^ \] \n \\ ] )*
]
\]
)*) (/)?
///