Divide by Nought

Archive for July 2009

Finding Code Issues with Regular Expressions

leave a comment »

Finding dead code removed with pre-compiler directives:
^:Wh*\#~(else|endif|if DEBUG|region|endregion):i*

Finding unused exception blocks:

Visual Studio (single line only):
catch:Wh*\(:Wh*:a*Exception:a*:Wh*:a*:Wh*\):Wh*\{:Wh*\}

grepWin:
catch\s*\(\s*\w*Exception\w*\s*\w*\s*\)\s*\{((\s*\/\/.*?)|(\s*?))*\}

Finding console outpout:

Console.*Write.*(.*);

Finding trace outpout:
Trace.*Write.*(.*);

Advertisements

Written by me

Thursday, July 23, 2009 at 3:32 am