I would like to create a match pattern for any opening brace that does not follow one of these patterns: A:
{\n\n
B:
{\s*\/\/.*\n\(\s*\/\/.*\)\?\n
The more general problem is highlighting violations of a coding spec at work, which enforces a blank line following {
Clarification: I'm looking for this to catch code like the following:
if (foo) {
this_is_bad____no_blank_line_above();
} else {this_is_worse();}
while (1) { //This comment is allowed
//this one too
theres_nothing_wrong_with_this();
}
if (foo) {
.... //<-- Ideally we could mark this as bad, due to the spaces here
otherwise_perfectly_good();
}
What I really need is:
{\(\n\n\|\s*\/\/.*\n\(\s*\/\/.*\)\?\n\)\!
Where the made-up symbol ! means "Does not match either of these two options". I see a way of doing that for individual characters, but not for a longer string