Hi, @Robin-cruise and All,
Of course, you may add these 3 look-aheads, consecutively, after the litteral \) ending parenthesis, as you did :
(?!;)(?![\}])(?![\{])
Indeed, while evaluating each condition, in each look-ahead, the regex engine location does NOT change ( It is just between the ) and its next character ! )
However, you can, also, use the unique look-head (?![;{}]) ! In addition, when inside a character class [....], the { and } braces are just literal characters :-))
Recall :
Inside a character class [....], 4 characters, only, have a special meaning :
The character ^, which must be at any position but the first, to be considered as literal or at any position if preceded with the \ escape symbol
The character ], which must be the very first character, after ], to be taken as literal or at any position if preceded with the \ escape symbol
The character -, which must be at the very beginning or at the the very end of the character class to be considered as literal or at any position if preceded with the \ escape symbol
The character \, which can be at any position of the character class, if preceded, itself, with an other \ escape symbol, to be taken as a literal character
All the other chracters, inside a character class [....], are just literal chars !
To sum up, assuming an unique block (.....) per line, the regex ^[^(\r\n]*\K\)(?![;{}])|\((?!(?-s).*\)) would find :
The ending ) parenthesis, if not followed with a ;, a } or a { character AND if a ( parenthesis has not been found, before, in current line
The starting ( parenthesis, if a ) parenthesis cannot be found, further on, in current line
Cheers,
guy038