From: Simon Strandgaard Date: 2003-11-20T00:52:16+09:00 Subject: Re: $& write-protected? On Thu, 20 Nov 2003 00:25:59 +0900, ts wrote: >>>>>> "S" == Simon Strandgaard writes: > > S> My first thought were to extern 'last_match_getter' from 're.c' and > S> just supply my own last_match_setter. But then I noticed the function are > S> are 'static' (private). > > see the struct RMatch in re.h. str is the string, regs are the > registers. ruby use register to retrieve $&, $1, ... > > see for example rb_reg_match_pre() ($'), rb_reg_match_post() ($`), > rb_reg_nth_match() ($&, $1, ...) > > If you change the struct RMatch, this change will be reflected on $&, > $1, ... I bail out, maybe I will look at it tomorrow. I hoped it wouldn't be this complicated (im tired). I will follow the other approach and substitution all occurencies of $& and $1-$9 instead. Thanks for sharing you wisdom. BTW: Is there a reason that functions not found in Ruby's .H files, often has a 'static' tag, so thats impossible to extern them? Would it make any sense to remove all 'static' tags? -- Simon Strandgaard