Q: Caret (^) seems to escape forward slash when used as "not" in Javascript regex I'm working on a javascript lexer for a side project at the moment, and when running it across a test codebase I came across a regex that our lexer doesn't like:
/^(https?|ftp|tel|mailto):(\/\/|[^/])[^ ]+(\/|$)|^[^: ]+(\/|$)|^[\w.]+:\d+(\/|$)/
The problem is this unescaped forward slash here:
[^/] which our lexer is interpreting as a terminator for the regex literal.
I've tested this in node and chrome v8 and it appears to be valid syntax. However I can't seem to find any documentation to state that use of the ^ caret as NOT in a javascript regex also functions as an escape character for forward slash /.
Could someone help me find the documentation or an official explanation of the rules here?
