top | dibdib: Random things | programming: Ruby / EDF / Palm / Perl | obsessions: Games | about: me / my pages / people
patch to Ruby 1.6.6 (RubyUnit test)
A patch to Ruby 1.6.6 that lets you do things like
string = "text string for this"
string =~ /(?[foo]st.*?) /
puts "#{$foo}" # prints "string"
It doesn't check that the variable you're passing is legal, valid, sensible or even vaguely presentable. It trusts you not to hurt it.
I'm not sure the memory management is sensible (I use strdup at one point, but I guess I could easily change that to use rb_str_new() and store the Ruby string instead of the C string. The only documentation I had to work from was README.EXT in the source tarball.
Variables are only wiped when the whole regexp fails, not individually, which is suboptimal but better than nothing for the moment.