Closed briandamgaard closed 1 year ago
Hi @briandamgaard,
As far as I know you cannot use backreferences inside a character class. If you manage to get this going in your browser console or a jsfiddle please let me know.
I'm marking this as invalid for now.
As far as I know you cannot use backreferences inside a character class.
That is precisely what I said. You have not understood the point yet, which is that the "Explanation" field on the webpage falsely says that the "\1" inside the character class IS a back reference. That is a bug.
My apology, I misunderstood. You're right that's not normal behavior for the javascript flavor.
Thank you, I will push a fix for this.
JavaScript does not support back references from inside a character class. An example:
RegEx Flavor: JavaScript
Regular Expression: (a|b)[c\1d]e
Test String: aae
Match Information: Your regular expression does not match the subject string.
Explanation: \1 matches the same text as most recently matched by the 1st capturing group
The highlights of the various regex parts in the regular expression match the explanation of "\1".
The explanation and the highlighting are wrong. JavaScript does not support back references from inside a character class.
The match information for the example is correct, i.e., "aae" doesn't match the regular expression.