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.
--
matt neuburg, phd = matt tidbits.com, http://www.tidbits.com/m
att/
Tiger - http://www.takecontrolbooks.com/tiger-customizing.html
AppleScript - http://ww
w.amazon.com/gp/product/0596102119
Read TidBITS! It's free and smart. http://www.tidbits.com
|