On 12 Mar 2007 at 11:09, Grant wrote: > Hello, > > I'm having a lot of trouble figuring out how to remove blank lines > from my HTML. The lines are generated by my shopping cart. I use > (and highly recommend) interchange: > > http://www.icdevgroup.org > > I basically want to wrap all of my code in [filter > no_blank_lines][/filter]. no_blank_lines is defined this way: > > CodeDef no_blank_lines Routine <<EOR > sub { > my $val = shift; > #$val =~ s/\s+//g; > #$val =~ s/\s*\n+\s*/\n/g; > #$val =~ s/[^\S\n]*\n\s*\n/\n/g; > $val =~ s/\n\n+/\n/g; > return $val; > } > EOR
This is untested but usually works for me $val =~ s/^$//g not sure you'll need the gobal switch if you'r reading line by line but it can't hurt. > Those are all regexp's I've tried. They all seem to do nothing except > the first one removes all whitespace including the spaces in between > characters in my code which obviously breaks everything. Can anyone > suggest a solution? HTH, Dp. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
