Adding spec for backreferences to keep matched string's class
Fixing named captures not being original class

Subclassing String and applying a Regexp.match on it will result in
named captures ($1...9, $`, $+, $&) that are of class String, not the
original subclass.

This incorrect behavior is illustrated here:
  class MyString < String; end
  /(name)/ =~ MyString.new("name")

  $1.class
  => String

This patch corrects this behavior to:
  class MyString < String; end
  /(name)/ =~ MyString.new("name")

  $1.class
  => MyString

To fix this problem, the MatchData functions now change the klass of
their output strings to that of the MatchData's original source string
before returning.
Merge pull request #2781 from pH14/master

Adding spec for backreferences to keep matched string's class (fails on rbx)