Custom Patterns removing comments and whitespace

I've created a custom pattern:

catch (Exception $exception$)
    Logger.Log(new LogItem(this, $exception$));
    throw $exception$;

with a replace of '$code$' to remove redundant logging calls.

This works great for removing the try / catch and logging, but also removes blank lines and, more importantly, all comments.

Is there a setting to control this or a different way to write the pattern? Perhaps we need a new type 'block' which is all the lines within a scope block.

Please sign in to leave a comment.