Hi, Rule: Between "select" and "from" rows every row has to end with comma except one row above from.
CORRECT select col1, col2, col3, col4, col5 from mytable Note: There can be several like 100 or more colN rows. Above is simplified sample. INNCORRECT select col1 col2, col3 col4, col5 from mytable There should be command after col1 and col3. I have put the "X" bellow to indicate where error highlight mark should appear. HIGHLIGHT MARK select col1X col2, col3X col4, col5 from mytable To see the matched pattern I have turned highlight search and incremental search settings: :set hlsearch :set incsearch Now I have come up with the following regex: /select\s*\n\_.*\(,\)\@<!\zs\n\ze\_.*\n\s*from The above regex is almost there, the only problem is, it only marks new-line character after "col3", but I would ALSO like to mark character after "col1" (like above "X" in HIGHLIGHT MARK sample). But if I add comma after "col3" then new-line after "col1" is marked, which is correct. There got to be some tiny thing that I can't figure it out how to fix. REQUEST: I would like to have error highlighting for ALL missing commas, not just the last one. I use the latest Vim 8.1.0490. EXPLAINING ABOVE REGEX Let me explain what I have come with so far. Regexp is: /select\s*\n\_.*\(,\)\@<!\zs\n\ze\_.*\n\s*from 1. There are words "select" and "from" that should searching happen in the first place. 2. \s* there can be zero or more spaces at the end of "select" row 3. \n new line follows 4. \_.* zero or more characters including new lines may follow 5. \(,\)\@<! search where there is missing "," See: :help \@<! 6. \zs\n\ze only mark new-line character 7. \_.* zero or more characters including new lines 8. \n\s* new line followed by zero or multiple spaces 9. from final word If you have turned on "hlsearch" and "incsearch" the new line after "col3" is marked, but new-line after "col1" is NOT marked. If I add comma after "col3", then new-line character after "col1" is marked. This both is correct, but I would like to have ALL missing comma marked in the same screen. Regards -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
