Is it possible to design a search pattern for missing parts of code?

I tried to use following to search for all callbacks that are not enclosed in try-catch block:

private void $callbackName$(object $sender$, $eventArgsType$ $e$)
{
$someCode$
}

and replace it with:

private void $callbackName$(object $sender$, $eventArgsType$ $e$)
{
try
{
$someCode$
}
catch (Exception ex)
{

}
}

but the search pattern highlights callbacks already enclosed in try-catch block. Is it possible to achive using custom pattern search?

0

Please sign in to leave a comment.