Issue #8856 has been reported by k_takata (Ken Takata).

----------------------------------------
Bug #8856: gsub doesn't work properly with \K
https://bugs.ruby-lang.org/issues/8856

Author: k_takata (Ken Takata)
Status: Open
Priority: Normal
Assignee: 
Category: regexp
Target version: 
ruby -v: 2.0.0p247
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


Regexp#gsub で \K を使うと、正しく動作しないようです。
Regexp#sub は問題ありません。

http://rubyist.g.hatena.ne.jp/n2s/20130714/p1 より、

% irb-ruby-2.0.0-p247
2.0.0p247 :001 > a="foobarbazquux/foobarbazquux"
 => "foobarbazquux/foobarbazquux"
2.0.0p247 :002 > a.sub(/foo\Kbar/, "")
 => "foobazquux/foobarbazquux"
2.0.0p247 :003 > a.gsub(/foo\Kbar/, "")
 => "bazquux/bazquux"


-- 
http://bugs.ruby-lang.org/