Re: [Patch] Use str_replace instead of preg_replace in
| From: | Michael Wallner | Date: | Mon, 20 Sep 2004 09:41:26 +0000 |
| Subject: | Re: [Patch] Use str_replace instead of preg_replace in | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-33479@lists.php.net to get a copy of this message | ||
Hi Chuck Hagenbuch, you wrote:
> I've committed the comma-doubling change - thanks. However, I need
> someone to indulge my lack of testing time at the moment and convince
> me that the first change really does what it's supposed to do and
> won't miss things/double newlines/etc.
Well, I doubt that the new line problem can be solved with str_replace(),
as easy as with PCRE. I think one would have to transform any CR and CRLF
to single LF first. The patch also seems to miss the replacement of single
CRs. Though I'd recommend using the following regular expression:
preg_replace(array('/(?<!\r)\n/','/\r(?!\n)/'), "\r\n", ...)
Regards,
--
Michael - < mike(@)php.net >
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc