Hi, At Sun, 12 Jun 2005 13:09:28 +0900, Jamis Buck wrote in [ruby-talk:145191]: > >> class Substring < String > >> def sub!(pat, r=nil, &b) > >> super(pat, r, &b) > >> $~ = eval("proc{$~}", b).call > > > >> # -------------------- > >> p $1 # -> "ll" > >> # -------------------- > >> > >> end > >> end > >> > > Hmmm. Either I'm misunderstanding you, or you misunderstood me. :) > This still doesn't allow the caller of Substring#sub! to access the > captured subgroups via the $digit variables. $digit variables are just wrappers of $~. -- Nobu Nakada