From: dblack@... Date: 2007-06-29T19:54:59+09:00 Subject: Re: Help with regular expression Hi -- On Fri, 29 Jun 2007, Stephen Ball wrote: > On 6/28/07, dblack@wobblini.net wrote: >> Hi -- >> > >> On Fri, 29 Jun 2007, Jesse Hk wrote: >> >> > Am I missing something here? Why not just test for equality? >> > >> > >> > irb(main):001:0> "foo" == "foo" >> > => true >> > irb(main):002:0> "foo" == "bar" >> > => false >> >> That doesn't cover the case where the string includes the substring >> "bar" but also includes other characters. >> >> >> David >> > > In that case it still works, so we have: > > "foo" => "foo" > > irb(main):001:0> "foo" == "foo" > => true > > "bar " => nil > > irb(main):002:0> "foo" == "bar" > => false > > "foobar" => nil > > irb(main):003:0> "foo" == "foobar" > => false True; I got it backwards. What it really doesn't cover is the case of a string that doesn't contain "bar" but isn't equal to "foo": "foo" == "abcdef" # false, but should be true because "abcdef" # does not include "bar" David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)