Home > other >  VS Code Highlight syntax
VS Code Highlight syntax

Time:11-25

I'm using the Hightlight Extension in VS Code that would markup parts of the code. I have sql models and what I want to do is to highlight when I have a combination at the join level. Eg:

Join table2 T1 ON t1.dbid = t2.dbid

so the pattern would be * join word ON word.dbid = word.dbid

I've tried various combinations but nothing worked perfectly. Even tried a Regex generator.

(?i)^join [a-zA-Z]  on  [a-zA-Z] ._db_id = [a-zA-Z] ._db_id$

Any ideas?

CodePudding user response:

Try this one:

join\s .*?\s on\s [^.]*?\.dbid\s*=\s*[^.]*?\.dbid

Important point: be sure you are not set as "Match case".

↓ tested here ↓

regex101

  • Related