RE: [PHP] Reg ex help-Removing extra blank spaces before HTML output

From: Date: Wed, 05 Dec 2001 07:40:14 +0000
Subject: RE: [PHP] Reg ex help-Removing extra blank spaces before HTML output
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-76654@lists.php.net to get a copy of this message
$text = preg_replace('|\s+|',' ',$text); -----Original Message----- From: Ken [mailto:kenzo@free-music.com] Sent: Wednesday, December 05, 2001 2:06 AM To: PHP list Subject: [PHP] Reg ex help-Removing extra blank spaces before HTML output I want to remove all superfluous blank spaces before I sent my HTML output, to make the output smaller. So I'd like to take $input, replace any number of blank space or newlines that are consecutive and replace them with a single blank. I.e. I will list a blank space as b and a newline as n: If input is: bbbbbTEXTHEREbbbnnnbnMOREbEVENMORE Then output should be: bTEXTHEREbMOREbEVENMORE I imagine this would be handled by a simple regular expression call, but I'm no pro with them yet. Any help? Thanks, Ken kenzo@free-music.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#76654) next »