Re: Regexp

From: Date: Fri, 30 Mar 2001 01:52:01 +0000
Subject: Re: Regexp
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-46217@lists.php.net to get a copy of this message
In article <LHEJIKDFKMHLGMPILEDFOEFPCAAA.db@icegaming.com>, db@icegaming.com ("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

« previous php.general (#46217) next »