[VPM] delete blank lines in src files using regex

Jer A jeremygwa at hotmail.com
Sat May 20 21:14:49 PDT 2006


hello there,

I am try to tidy up my csharp src files before i put them through a custom 
parser (a project i am working on.

using regular expressions, i am trying to get rid of all blank lines, 
whether they are padded with tabs and/or space and/or newlines.

basically i would like the my csharp code to use every line in the src file. 
Indentation does *Not* matter to me.

included is a bit of my perl code, where i attempt, but fail to remove all 
blank lines.

Your help is appreciated.

Thank you,
-Jer A.

--------------------
my @arr;

open(SRC,"source.cs");
while(<SRC>)
{
	if($_ !~ m/^\s+$/ig && $_ !~ m/^\n/ig && $_ !~ m/^\t+$/ig)
	{
		push(@arr,$_);
	}
}
close(SRC);

---------------




More information about the Victoria-pm mailing list