Closed kkoomen closed 4 years ago
@chemzqm Can you merge this?
It doesn't fix the highlight.
@chemzqm Sorry, you should use this regex (demo):
const colorHex = /(?<!&|\w)((?:#)([a-f0-9]{6}([a-f0-9]{2})?|[a-f0-9]{3}([a-f0-9]{1})?))\b/;
I thought it already used negative-look-behind, but it didn't, so I used that. Makes more sense in this case.
@chemzqm Can you merge?
The current highlighting for colors should not highlight the color when prefixed with the
&
character. I suggest to add a look-around here by optimizing the regex to:(The above adds
&
to(?<=\W|^)
). See regex101 for working demo.Screenshot