On 6/23/06, Mark Van Holstyn <mvette13 / gmail.com> wrote:
> irb(main):003:0> str = 'kame^hame^ha^'
> => "kame^hame^ha^"
> irb(main):004:0> str.tr '^', '-'
> => "kame-hame-ha-"

Oops - thanks for the reality check, Mark.

I just realized that the exception occurs in jcode, not in the core:

irb(main):001:0> str = 'kame^hame^ha^'
=> "kame^hame^ha^"
irb(main):002:0> str.tr '^','-'
=> "kame-hame-ha-"
irb(main):003:0> require 'jcode'
=> true
irb(main):004:0> str.tr '^','-'
RegexpError: invalid regular expression; empty character class: /[^]/
        from /usr/local/lib/ruby/1.8/jcode.rb:137:in `tr!'
        from /usr/local/lib/ruby/1.8/jcode.rb:148:in `tr'
        from (irb):4
irb(main):005:0>

That's weird I guess, but not as surprising as if was in the core
String behavior. I can live with this. Sorry for the false alarm -
it's been a long night!

-Pawel