actually it does... james' solution will work but I forgot to mention a \s is whitespace, not a space, therefore it will get tabs, newlines, and spaces. look at http://www.cs.tut.fi/~jkorpela/perl/regexp.html " \s matches any whitespace character (space, tab, newline)" therefore my suggestion works: $t = preg_replace('/\s+/',' ',$text); its quicker to code, easier to understand, and will run faster because it doesn't have to match and remember or do alternation...
jack -----Original Message----- From: Ken [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 05, 2001 2:01 PM To: Jack Dempsey Subject: RE: [PHP] Reg ex help-Removing extra blank spaces before HTML output At 10:57 AM 12/5/01 -0500, Jack Dempsey wrote: >a space (\s is from perl) Ah, OK, yours doesn't deal with newlines. From list member "James", a solution that does: ----- From: "liljim" <[EMAIL PROTECTED]> 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); ----- Thanks again! - 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]