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?
Álvaro González
147k45 gold badges282 silver badges378 bronze badges
-
Your expression doesn't account for table alias.Álvaro González– Álvaro González2022年11月24日 12:12:11 +00:00Commented Nov 24, 2022 at 12:12
1 Answer 1
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 ↓
answered Nov 24, 2022 at 12:36
Vincent Flotron
6124 silver badges15 bronze badges
Sign up to request clarification or add additional context in comments.