VS regex search: Find Try..Finally with no Catch <p>I want to use the Regular Expression search in Visual Studio to find all instances of a Try/Finally block without a Catch.</p> <p>After reading the <a href="http://msdn.microsoft.com/en-us/library/2k3te2cs%28v=vs.80%29.aspx" rel="nofollow">help file</a>, I started with this which returns a match of <strong>Try</strong> without matching <strong>End Try</strong>.</p> <pre><code>~(End )Try\n </code></pre> <p>Then, I wanted to get a match where there was <strong>Finally</strong>:</p> <pre><code>~(End )Try\n*Finally\n </code></pre> <p>This actually doesn't work. </p> <p>The full, working Regex, I assume would look something like this:</p> <pre><code>~(End )(Sub|Function)*~(End )Try\n*~(Catch*\n)*Finally\n*End (Sub|Function) </code></pre> <p>That's try trying to say, within a Sub Or Function, return matches that have <strong>Try/Finally</strong> but no <strong>Catch</strong>.</p> <p>Am I in the ballpark for accomplishing this search?</p>