Skip to content
instance method

Regexp#eql?

(untyped other) -> bool
regexp == object -> true or false

Returns true if object is another Regexp whose pattern, flags, and encoding are the same as self, false otherwise:

Example
/foo/ == Regexp.new('foo')                          # => true
/foo/ == /foo/i                                     # => false
/foo/ == Regexp.new('food')                         # => false
/foo/ == Regexp.new("abc".force_encoding("euc-jp")) # => false
See also #encoding #fixed_encoding? #casefold? #hash also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0