I'm writing a vim syntax highlighting script to determine if a global param is in uppercase only. If its not - I want to highlight it. The problem is that the global params is in a specific part in the page.
The code looks something like this:
***VARS***
${VAR1}
${var2}
***OTHERS***
${var3}
So I want that all the variables under VARS which contains lowercase to be highlighted - in my example, only ${var2} should be highlighted.
I tried to do this:
syn match global_var_match "\${.*[a-z][^}]+}" contained
syn region global_variables start="\(\*\*\*VARS\*\*\*\)\@<=" end="\(\*\*\* OTHERS\*\*\*\)\@=" contains=global_var_match
hi link global_variables ErrorMsg
But then also ${VAR1} and ${var2} is highlighted.
\${.*[a-z][^}]+}should probably be\${[^}]*[a-z][^}]*}. The.*will match the closing}; and what if the lower-case character is just before the closing}?