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 #172344 is a reply to message #172335] Mon, 14 February 2011 01:58 Go to previous messageGo to previous message
spambait is currently offline  spambait
Messages: 35
Registered: September 2010
Karma:
Member
In article <ij8mk6$vl6$1(at)news(dot)albasani(dot)net>, The Natural Philosopher <tnp(at)invalid(dot)invalid> wrote:
> Doug Miller wrote:
>> In article <vscel6le4f6810hekfooookik3ircj3ue3(at)4ax(dot)com>,
> evan(at)theobvious(dot)espphotography(dot)com(dot)invalid wrote:
>>> On Sat, 12 Feb 2011 20:23:54 -0500, Jerry Stuckle
>>> <jstucklex(at)attglobal(dot)net> wrote:
>>>
>>>> Sorry, Evan, you've just proven you are ignorant and a troll. You
>>>> aren't even intelligent enough to understand when he's right.
>>> What part of "Well, it didn't work for me, so if it works for someone
>>> else, more power to them." did you not understand?
>>
>> If it didn't work for you, clearly you implemented it wrong. Or, as seems
> more
>> likely, you didn't actually try it at all.
>>
>> Here's a formal proof that Richard's method is correct:
>>
>> Let A be the string <a>\r\n<b>, and B the string <c>\n<d>,where <a>, <b>,
> <c>,
>> and <d> are any arbitrary strings not containing "\n". The first operation,
>> replace all "\r\n" with "\n", changes A to <a>\n<b> and leaves B untouched.
>> The second operation, replace all "\n" with "\r\n", changes A to <a>\r\n<b>,
>> and B to <c>\r\n<d>, which is the specified result: change \n to \r\n except
>> when \n is immediately preceded with \r.
>>
>> If you would dispute that proof, demonstrate the flaw in it, or post a
>> counterexample. Otherwise, you owe Richard an apology.
>>
>> Time to man up, Evan.
>>
> Indeed. simple problems like this, it's easy to construct state machines
> for, and examine every possible combination, and produce totally
> reliable bug free code. Sadly such examples are few and far between.
>
>
> As someone else pointed out tho, what about a single '\r'?

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.
[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: Fri Sep 20 16:33:08 GMT 2024

Total time taken to generate the page: 0.05040 seconds