note 59207 added to function.preg-replace

From: Date: Tue, 29 Nov 2005 16:07:45 +0000
Subject: note 59207 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-99298@lists.php.net to get a copy of this message
The previously-posted blank line removal code doesn't remove blank lines from the beginning of a string. This function is a solution. <?php /* * Removes all blank lines from a string. */ function removeEmptyLines($string) { $string = preg_replace("/[\r\n]+[\s\t]*[\r\n]+/", "\n", $string); $string = preg_replace("/^[\s\t]*[\r\n]+/", "", $string); return $string; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+59207 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59207&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59207&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59207&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59207&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59207&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59207&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59207&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+59207&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#99298) next »