Bug #2159: $' doesn't work if the String#match method got rewritten http://redmine.ruby-lang.org/issues/show/2159 Author: zhou xianhua Status: Open, Priority: Normal Assigned to: Kirk Haines ruby -v: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] or ruby 1.9.2dev (2009-07-18 trunk 24186) [x86_64-linux] It works fine here. <code> "star date 2200-12-12 !".match(/[\d]+-[\d]+-([\d]+)/) puts $' # " !" </code> ------------------- It doesn't works now. <code> class String alias_method :my_match, :match def match(re) my_match(re) end end "star date 2200-12-12 ?".match(/[\d]+-[\d]+-([\d]+)/) puts $' # "" </code> ---------------------------------------- http://redmine.ruby-lang.org