New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 724586 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jul 9
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Regex is wrongly highlighted in console

Reported by hakerh403@gmail.com, May 19 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36

Steps to reproduce the problem:
1. Type the following JavaScript code in the Chrome's console:
console.log(0&&[.../\//],1);

What is the expected behavior?
The output is ok. Chrome correctly interprets the code. However, it is wrongly highlighted as a comment, not as a regular expression.

What went wrong?
I see green highlighting (used to highlight comments) instead of regex highlighting, which should be red.

Did this work before? No 

Chrome version: 58.0.3029.110  Channel: stable
OS Version: 6.3
Flash Version: The flash is disabled.

I think it is because Chrome doesn't expect spread operator to be placed before regex. However, it is allowed according to the standard.
 

Comment 1 by hakerh403@gmail.com, May 19 2017

I found a few more similar issues:

// Spread operator before regex
[.../\//];

// Void before regex
void/\//;

// A regex in do...while loop
do/\//
while(0);

// A regex in if..else statement
if(0);else/\//;
Labels: Needs-Triage-M58

Comment 3 by l...@chromium.org, May 23 2017

Labels: -Needs-Triage-M58
Owner: einbinder@chromium.org
Status: Assigned (was: Unconfirmed)
Interesting cases!  einbinder@, can we make the codeMirror highlighter detect these, or is this something better filed on their project?
 Issue 725361  has been merged into this issue.

Comment 5 by l...@chromium.org, Nov 15 2017

Cc: kavvaru@chromium.org mmanchala@chromium.org l...@chromium.org
 Issue 725484  has been merged into this issue.

Comment 6 by hakerh403@gmail.com, Jun 28 2018

Seems to be fixed in 67.0.3396.87
Status: Fixed (was: Assigned)
Thank you for verifying.  I can also confirm it is fixed in 67.0.3396.99.  I'd guess this was fixed in the last CodeMirror roll.

Sign in to add a comment