string.c: unset $~ if unmatch

* string.c (rb_pat_search): unset $~ if the last match failed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
string.c: backref substitution

* re.c (rb_reg_regsub): allow nil regexp for string matching.

* string.c (rb_str_sub_bang, str_gsub): make substitution if
  replacement string has backref escapes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
string.c: infect match result

* string.c (rb_pat_search): match result should be infected by the
  pattern.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e