mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-01-13 16:57:54 -05:00
Escape literal [ in regexp
Improves compatibility with strict ES5 regexp syntax
This commit is contained in:
@@ -946,7 +946,7 @@
|
||||
|
||||
HEREDOC_INDENT = /\n+([^\n\S]*)(?=\S)/g;
|
||||
|
||||
REGEX = /^\/(?!\/)((?:[^[\/\n\\]|\\[^\n]|\[(?:\\[^\n]|[^\]\n\\])*])*)(\/)?/;
|
||||
REGEX = /^\/(?!\/)((?:[^\[\/\n\\]|\\[^\n]|\[(?:\\[^\n]|[^\]\n\\])*\])*)(\/)?/;
|
||||
|
||||
REGEX_FLAGS = /^\w*/;
|
||||
|
||||
|
||||
@@ -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 \\ ] )*
|
||||
]
|
||||
\]
|
||||
)*) (/)?
|
||||
///
|
||||
|
||||
|
||||
Reference in New Issue
Block a user