Re: can't get any string replacements to clean this

From: Date: Fri, 14 Mar 2003 08:04:20 +0000
Subject: Re: can't get any string replacements to clean this
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-139680@lists.php.net to get a copy of this message
At 08:43 14.03.2003, Dennis Gearon said: --------------------[snip]-------------------- >I finally got something to do it, at least, in inline code. > >I couldn't figure out how to remove NULLS, anybody know? A search on: --------------------[snip]-------------------- I just found this thread, pardon me if I'm off topic, but something like this should work for you. It makes use of the fact that all of the replace functions can take arrays as input parameters. $from = array("/(\r\n)+/", "/(\n\r)+/", "/(\r)+/", "/[\x0..\x19]/"); $repl = array("\n", "\n", "\n", null); $str_cleaned = preg_replace($from, $to, $str_uncleaned); This construction should convert the occurrence of one or more successive newline combinations with a single newline character, and remove control characters at large (untested). -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

« previous php.general (#139680) next »