From: Rick DeNatale Date: 2006-10-14T04:48:26+09:00 Subject: Re: My .irbrc for console/irb On 10/12/06, Dr Nic wrote: > Does anyone any interesting things in their .irbrc file? I don't know why I hadn't thought of it before but I just added: # show_regexp - stolen from the pickaxe def show_regexp(a, re) if a =~ re "#{$`}<<#{$&}>>#{$'}" else "no match" end end # Convenience method on Regexp so you can do # /an/.show_match("banana") class Regexp def show_match(a) show_regexp(a, self) end end -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ IPMS/USA Region 12 Coordinator http://ipmsr12.denhaven2.com/ Visit the Project Mercury Wiki Site http://www.mercuryspacecraft.com/