On 21.11.2009 18:26, Philip Rhoades wrote: >> Btw, I'd rather name the word explicit, so for me it would be one of >> >> s.sub /To:\s+/, '' >> s.sub /^(\s*)To:\s*/, '\\1' > > s.sub /^To:\s*/, '\\1' > > is correct (I was indenting code to differentiate it) but why is > explicit better? Because it avoids accidentally doing the substitution of other text which consists of two characters. Even if that text is not supposed to appear in your input, using the explicit form helps documenting what's intended. And the code is more robust: it will not break if the input changes. Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/