Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Regexp#inspect
() -> ::String
inspect → string
re.c
View on GitHub ↗
static VALUE
rb_reg_inspect(VALUE re)
{
if (!reg_initialized_p(re)) {
return rb_any_to_s(re);
}
return rb_reg_desc(re);
}
Returns a nicely-formatted string representation of self:
Example
/ab+c/ix.inspect # => "/ab+c/ix"
Related: Regexp#to_s.