Re: Stripping carriage returns
| From: | David Harkness | Date: | Tue, 11 Jan 2011 19:24:17 +0000 |
| Subject: | Re: Stripping carriage returns | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-310676@lists.php.net to get a copy of this message | ||
On Tue, Jan 11, 2011 at 11:13 AM, Richard S. Crawford <richard@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
converted to chr(10) by PHP) by using single quotes. Second, you don't want
the vertical bar inside []. That's only for ().
David