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 #172345 is a reply to message #172344] Mon, 14 February 2011 02:25 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
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
[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: Tue Nov 26 06:54:24 GMT 2024

Total time taken to generate the page: 0.04532 seconds