From: Robert Klemme Date: 2010-01-04T22:20:05+09:00 Subject: Re: regex =~ string or string =~ regex? On 01/04/2010 10:27 AM, Ruby Newbee wrote: > Sometime I saw you wrote regex =~ string, while sometime you wrote > string =~ regex. > What's their difference and what's the recommended way? Thanks. The first version invokes method Regexp#=~ and the second version invokes String#=~ - which happen to do roughly the same although I believe the second one to be a tad slower. I personally prefer the first form because of the speed difference and regular expression matching is rather an operation of Regexp than of String. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/