Bye Bye Moore

PoCソルジャーな零細事業主が作業メモを残すブログ

===でも、正規表現のオプションを使う事ができる

===でも、正規表現のオプションを使う事ができます。

> /abC/ === "abc"
#=> false

> /abC/i === "abc"
#=> true

ということは、case文でもイケるという事ですね。

> str = 'UEC'
> case str
> when /uec/i then puts 0
> when /tat/i then puts 1
> else		   puts -1
> end

#=> 0
#=> nil