From: Mike Stok Date: 2002-08-26T11:45:44+09:00 Subject: Re: case-insensitive string compare? In article <3d6976a1_4@corp.newsgroups.com>, Russ Freeman wrote: > Hi folks, can't seem to find a straight answer to this. > > I expected to find something like "String.compareNoCase" with no luck. I'm > assuming I don't need to use either downcase explicitly or that horrid > global, $=, to achive the same result ? Have you tried a trailing i? irb(main):001:0> 'Ruby' =~ /^ruby$/i 0 irb(main):002:0> 'Ruby' =~ /^ruby$/ nil If you want to be more verbose then look at http://www.rubycentral.com/book/ref_c_regexp.html#Regexp.new e.g. irb(main):003:0> 'Ruby' =~ Regexp.new('ruby', Regexp::IGNORECASE) 0 Hope this helps, Mike -- mike@stok.co.uk | The "`Stok' disclaimers" apply. http://www.stok.co.uk/~mike/ | GPG PGP Key 1024D/059913DA mike@exegenix.com | Fingerprint 0570 71CD 6790 7C28 3D60 http://www.exegenix.com/ | 75D2 9EC4 C1C0 0599 13DA