Abdullah
Abdullah

Reputation: 11

Selecting Catch Block (in visual studio) with Regular Expression Search

I want to select all catch blocks (in my C# code in visual studio) using regular express search but unable to create a regular expression that selects all catch blocks (including empty blocks and blocks with different exception handling)

I have tried following regular expressions but failed

.*catch.*(\r?\n)*.*(})
.*catch.*(\r?\n)*\s*.*(\r?\n)*.*(\r?\n)*

Upvotes: 0

Views: 74

Answers (1)

Abdullah
Abdullah

Reputation: 11

I have found the solution, regular expression catch(.|\n)*?} will select all catch blocks

Upvotes: 1

Related Questions