On Thu, 04 Mar 2004 21:55, Orton, Yves wrote; > Well, people who spend a lot of time on the message boards helping > out get a lot of questions like: > "How can I replace every letter 'o' not preceded by 'f' and not > followed by an 's' without using index, subtr, or a regex." > The useless answers are typically things like > "Very very carefully" > "With a piece of camembert and a two foot length of string" > The useful answers are typically like > "Why on earth do you want to do such a silly thing. USE THE > FRIGGIN REGEX ALREADY."
To the programmer who has some real reason not to use the regex engine, that you don't know about, none of the above are useful. On the other hand, sub doit {pack("C*",(map{($a!=102)&&($_!=115)&&($b==111)&&($b=118); ($q,$a,$b)=($a,$b,$_);$q}unpack("C*",$_[0])),$a,$b)} would either be entirely what they're after, or speak aloud as an adequate answer to why s/([^f])o([^s])/${1}v${2}/g is usually better. To broad-handedly cast aside the the bearer of a question's approach as flawed is incredibly closed minded. Pretending that you know best for their situation is at worst arrogant and at best naive. Remember - harmony, melody, chords[1]. We are each perfecting a symphony in our own direction. (see also http://www.perl.com/pub/a/2000/10/23/soto2000.html) -- Sam Vilain, sam /\T vilain |><>T net, PGP key ID: 0x05B52F13 (include my PGP key ID in personal replies to avoid spam filtering) With the exception of capitalism, there is nothing so revolting as revolution GEORGE BERNARD SHAW