def it IRB.CurrentContext.last_value end def rv RUBY_VERSION end def show_match(s, re) if s =~ re then "#{$`}<<#{$&}>>#{$'}" else "no match" end end def smg(s, re) if s =~ re then groups = "" sep = "" 1.upto(20) { |n| if $~[n] groups += "#{sep}$#{n} = <<#{$~[n]}>>" sep = ", " end } groups = " " + groups if !groups.empty? "#{$`}<<#{$&}>>#{$'}#{groups}" else "no match" end end alias :sm :show_match