[PHP] Stripping carriage returns

2011-01-11 Thread Richard S. Crawford
I'm retrieving CLOB data from an Oracle database, and cleaning up the HTML in it. I'm using the following commands: $content = strip_tags($description-fields['CONTENT'],'polulli'); $content = preg_replace(/p.*/,p,$content); The second line is necessary because the p tag frequently comes

Re: [PHP] Stripping carriage returns

2011-01-11 Thread Ashley Sheridan
On Tue, 2011-01-11 at 11:13 -0800, Richard S. Crawford wrote: I'm retrieving CLOB data from an Oracle database, and cleaning up the HTML in it. I'm using the following commands: $content = strip_tags($description-fields['CONTENT'],'polulli'); $content =

Re: [PHP] Stripping carriage returns

2011-01-11 Thread Daniel Brown
On Tue, Jan 11, 2011 at 14:13, Richard S. Crawford rich...@underpope.com wrote: $content = str_replace(chr(13),$content) and $content = str_replace(array('\n','\r','\r\n'),$content) Neither of these have replacement values, which might just be a typo. However, the larger issue is in

Re: [PHP] Stripping carriage returns

2011-01-11 Thread David Harkness
On Tue, Jan 11, 2011 at 11:13 AM, Richard S. Crawford rich...@underpope.com wrote: $content = preg_replace(/[.chr(10).|.chr(13).]/,,$content) This should be $content = preg_replace('/[\r\n]/','',$content) First, you can embed \r and \n directly in the regular expression as-is (not

Re: [PHP] Stripping carriage returns

2011-01-11 Thread Richard S. Crawford
Strangely, when I use \n, or nl2br(), or PHP_EOL, or anything like that, it strips out not just line breaks, but most of the rest of the text as well. I suspect an encoding issue at this point. Daniel, you were right when you said that neither of my str_replace lines had repl.acement values; that

Re: [PHP] Stripping carriage returns

2011-01-11 Thread Mari Masuda
On Jan 11, 2011, at 11:34 AM, Richard S. Crawford wrote: Strangely, when I use \n, or nl2br(), or PHP_EOL, or anything like that, it strips out not just line breaks, but most of the rest of the text as well. I suspect an encoding issue at this point. Daniel, you were right when you said

Re: [PHP] Stripping carriage returns

2011-01-11 Thread Jim Lucas
On 1/11/2011 11:13 AM, Richard S. Crawford wrote: I'm retrieving CLOB data from an Oracle database, and cleaning up the HTML in it. I'm using the following commands: $content = strip_tags($description-fields['CONTENT'],'polulli'); $content = preg_replace(/p.*/,p,$content); The