user1043856
user1043856

Reputation: 451

Using casecmp in Ruby with Pattern Matching

Is there any way to use casecmp in Ruby in conjunction with pattern matching? For example, if I want to compare "Ba" with "Alabama", would I be able to do it with casecmp?

Thanks so much

Upvotes: 1

Views: 718

Answers (1)

Victor Moroz
Victor Moroz

Reputation: 9225

Did you mean

"Alabama" =~ /Ba/i #=> 3

?

http://www.ruby-doc.org/core-1.9.3/Regexp.html, section Options

Upvotes: 1

Related Questions