module StringExtensions def words s = self.dup s.gsub!(/\w+/, 'X') s.gsub!(/\W+/, '') s.length end end