FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » How do I do this search and replace?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: How do I do this search and replace? [message #172368 is a reply to message #172345] Mon, 14 February 2011 12:50 Go to previous messageGo to previous message
sheldonlg is currently offline  sheldonlg
Messages: 166
Registered: September 2010
Karma:
Senior Member
On 2/13/2011 9:25 PM, Denis McMahon wrote:
> On 14/02/11 01:58, Doug Miller wrote:
>
>> That's outside the original specifications of the problem. Whether the
>> specifications *should* have included that condition is a separate issue. The
>> fact is, they didn't, and the solution Richard posted is a correct solution to
>> to problem as originally posed.
>
> Oh indeed, I only mentioned them because I felt that the OP ought to
> consider the possibility that a system that can generate "\n" and "\r\n"
> as line delimiters might also generate "\r", and possibly various other
> combinations of "\r" and "\n".
>
> replace any combination of one or more carriage returns and line feeds
> with a single cr/lf pair:
>
> $contents = preg_replace("/[\r\n]+/","\r\n",$contents);
>
> Rgds
>
> Denis McMahon

Actually, I don't think so. The way I read the OP's original is that he
wanted \r\n and not \n. I, too, thought that he also should look at
single \r. However, I don't think he would have wanted \n\n to become
\r\n, but would have wanted it to become \r\n\r\n. At least that is the
way I read the original.

--
Shelly
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Curious problem
Next Topic: Hot Sameera Hot Cleavage show - Download
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Dec 01 03:51:25 GMT 2024

Total time taken to generate the page: 0.04309 seconds