I have the following regex to stylize SQL keywords within a string (keywords shortened for readability):
autocmd Syntax * syn match pythonSql /\v("|')\s*([A-Z]{3,}<.*)@=\zs(SELECT|FROM|WHERE)
\ze(\s|\()\_.*\1/ containedin=.*String
This seems to work well for the first term, but is then skipping all the rest of the terms. That is, it is doing:
- "SELECT * FROM table WHERE id=1", that is, marking up
SELECT
, but notFROM
orWHERE
What I'm trying to have the regex do is (a bit of a crude way, but good enough for my purposes:
- For text that starts with
"
or'
... - And, ignoring spaces, the first word after is all-caps of length 3 or more followed by a space (such as SELECT, INSERT, UPDATE, etc..)
- Highlight all of the keywords up until the terminating string (ignoring string escapes).
How could this be improved to capture all the SQL keywords and not just the first one?