php-general | 2001032
Date: 03/29/01
- Next message: Stuart J. Browne: "Re: [PHP] This PHP list"
- Previous message: Stuart J. Browne: "Re: [PHP] RE: [PHP-DB] Best way to check if a query succeeded"
- In reply to: David Balatero: "[PHP] Regexp"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <LHEJIKDFKMHLGMPILEDFOEFPCAAA.db <email protected>>,
db <email protected> ("David Balatero") wrote:
> So, I guess i need a regexp to remove all the
> \n and :space: chars.
Here are some ideas:
$out=preg_replace("/\s+/","",$in); //strip whitespace
or
$out=preg_replace("/\s+/"," ",$in); //replace whitespace with single space
Note that you requested is different from your example, in which it looks
like you are simply condensing multiple newlines down into a single
newline. For that, something like this might be more appropriate:
$out=preg_replace("/(\n|\r|\r\n)+/","\n",$in);
Play around with 'em. <g>
-- CC-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Stuart J. Browne: "Re: [PHP] This PHP list"
- Previous message: Stuart J. Browne: "Re: [PHP] RE: [PHP-DB] Best way to check if a query succeeded"
- In reply to: David Balatero: "[PHP] Regexp"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

