Ben asked:
> Well everything in it is going to be fairly easy to translate
> except the ability to loop over matches of an RE.  

Without having time to read your mail properly and analyze the code I'd
suggest two things:

  str = getSourceStr
  re  = /#{fairly_complex_re}/
  while matches = re.match(str)
    have_fun_with(matches[1..-1])
    str = matches.post_match
  end

There's also a dedicated C module to not do so much copying:

  http://www.ruby-lang.org/en/raa-list.rhtml?name=strscan

But another, easy way is to use String#scan:

  http://www.rubycentral.com/ref/ref_c_string.html#scan

Disclaimer 2:) I might misunderstood your problem completely.

	- Aleksi