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

58 Views Asked by At

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)*
1

There are 1 best solutions below

0
Abdullah On

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