Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Regexp#inspect

rxp.inspect → string

Produce a nicely formatted string-version of rxp. Perhaps surprisingly, inspect actually produces the more natural version of the string than to_s.

Example
/ab+c/ix.inspect        #=> "/ab+c/ix"
See also #hash #match #fixed_encoding? #match? also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0