Ruby 1.9.3 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Regexpクラス > ==

instance method Regexp#==

self == other -> bool[permalink][rdoc]
eql?(other) -> bool

otherが同じパターン、オプション、文字コードの正規表現であったらtrueを返します。

[PARAM] other:
正規表現を指定します。
p /^eee$/   == /~eee$/x   #=> false
p /^eee$/   == /~eee$/i   #=> false
p /^eee$/e  == /~eee$/u   #=> false
p /^eee$/ == Regexp.new("^eee$") #=> true
p /^eee$/.eql?(/^eee$/)          #=> true