Removes all blank lines.
PHP:
trim(preg_replace("/(^[\r\n]|[\r\n]+)[\s\t][\r\n]+/", "\n", $string));
You have replace with a newline char to break non-blank lines. This also leaves a single trailing newline, easily removed with trim($string); if needed.
Submitted by anonymous - 8 years ago