Jacob Fugal wrote:
> On 12/8/06, Daniel Finnie <danfinnie / optonline.net> wrote:
>> Oops, forgot to paste this one in:
>> To get keep words like "of" and "is" lowercase: (basically anything
>> under 3 letters)
>> text.downcase.gsub(/[A-Za-z]{3,}(?!\/)/) {|x| x.capitalize}
> 
> I agree with Paul Lutus, there are too many special cases. And
> Daniel's regex here is a good example. I can spot at least three (to
> me) obvious errors:
> 
> 1) Anything with a '/' trailing will not get capitalized, so in the
> OP's example, neither "heat" nor "ac" would be capitalized at all.
Trailing /'s do work as long as the word before it is at least 3 letters 
long.
irb(main):004:0> src.downcase.gsub(/[A-Za-z]{3,}(?!\/)/) {|x| x.capitalize}
=> "Additional Spa (Only Available w/Purchase of Pool or Spa)  Seller 
Heat/ac/Ductwork "

> 2) There are plenty of words with fewer than three letters that should
> be capitalized. The first person pronoun "I", for instance. Or even
> "of" or "is", if they're the first word in the sentence.
> 
> 3) In the absence of 1 and 2, "ac" would still get turned into "Ac"
> rather than "AC".

These are valid points that I feel shouldn't be incorporated into the 
original regexp.