Ruby 1.8.7 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Regexpクラス > options
options -> Integer正規表現の生成時に指定されたオプションを返します。戻り値は、 Regexp::EXTENDED, Regexp::IGNORECASE, Regexp::MULTILINE の論理和です。
p Regexp::IGNORECASE # => 1
p //i.options # => 1
p Regexp.new("foo", Regexp::IGNORECASE ).options #=> 1
p Regexp.new("foo", Regexp::EXTENDED).options #=> 2
p Regexp.new("foo", Regexp::IGNORECASE | Regexp::EXTENDED).options #=> 3
p Regexp.new("foo", Regexp::MULTILINE).options #=> 4
p Regexp.new("foo", Regexp::IGNORECASE | Regexp::MULTILINE ).options #=> 5
p Regexp.new("foo", Regexp::MULTILINE | Regexp::EXTENDED).options #=>6
p Regexp.new("foo", Regexp::IGNORECASE | Regexp::MULTILINE | Regexp::EXTENDED).options #=> 7