Hello, The example Jack gave you will clear up spaces well, though to get both newlines and spaces into one:
$input = preg_replace("/([ ]|\n){1,}/", "\\1", $input); James "Jack Dempsey" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > $text = preg_replace('|\s+|',' ',$text); > > > -----Original Message----- > From: Ken [mailto:[EMAIL PROTECTED]] > 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 > [EMAIL PROTECTED] > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]