M
matt neuburg
According to the 1.8.5 core API:
str =~ obj => fixnum or nil
Match. If obj is a Regexp, use it as a pattern to match against str. If
obj is a String, look for it in str (similar to String#index). Returns
the position the match starts, or nil if there is no match.
So I expect "cat" =~ "a" #=> 1
But:
irb(main):013:0> RUBY_VERSION
=> "1.8.5"
irb(main):014:0> "cat" =~ "a"
TypeError: type mismatch: String given
from (irb):14:in `=~'
from (irb):14
from :0
An undocumented change? Sorry if this has come up before, I did try to
find out. Thx - m.
str =~ obj => fixnum or nil
Match. If obj is a Regexp, use it as a pattern to match against str. If
obj is a String, look for it in str (similar to String#index). Returns
the position the match starts, or nil if there is no match.
So I expect "cat" =~ "a" #=> 1
But:
irb(main):013:0> RUBY_VERSION
=> "1.8.5"
irb(main):014:0> "cat" =~ "a"
TypeError: type mismatch: String given
from (irb):14:in `=~'
from (irb):14
from :0
An undocumented change? Sorry if this has come up before, I did try to
find out. Thx - m.