As the following shows,
I want "regex syntax highlight for new RegExp
", just as the regex literal.
How can I do that?
/^this\b(.*?)\bis(:{0,1})/g;
new RegExp(/*regex*/ `^this\b(.*?)\bis(:{0,1})`, 'g'); // << syntax higlight?
Update:
it was so obvious that this is a bad idea, and I didnt notice it:
-- the escape character \
in String has different meaning than in Regex Literal
-- and so String should not be highlighted as Regex Literal (unless you really mean to & has a way to solve the \
escape problem)