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 #172349 is a reply to message #172345] Mon, 14 February 2011 09:51 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
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".
>
I have had this using various means of combining files from different
origins.


> 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: Sun Dec 01 02:07:39 GMT 2024

Total time taken to generate the page: 0.04377 seconds