I need a Visual Studio regex to match swallowed exceptions.
This is as far as I got, but it still matches valid code like this:
catch (ArgumentNullException)
{
//...
throw;
}
catch:Wh*\(:Wh*.*Exception.*\):Wh*\{[:Wh*.*]*[^(throw:Wh*.*;)].*
How can I fix this?
Edit: Am I to take it from the comments that testing for the absence of a pattern in a regular expression in Visual Studio is not possible? - This is the thrust of my question. I would like to put aside questions of validity of approach (I am fully aware of FxCop et al, lexing and parsing, and this seminal post. I am also aware that swallowing exceptions is sometimes OK).