diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-04-24 23:09:01 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-04-24 23:09:01 +0000 |
commit | a1157429688ec922f97963db99bc5913b39a5972 (patch) | |
tree | cf45ac0087a4a980292ac385c91c2c216f8d88e6 | |
parent | 870eb33e6b65b877638168dbc9b84b8367fff7ee (diff) | |
download | ruby-a1157429688ec922f97963db99bc5913b39a5972.tar.gz |
* lib/jcode.rb (String::tr_s): should have translated non
squeezing character sequence (i.e. a character) as well. thanks
to Hiroshi Ichikawa <gimite at gimite.ddo.jp> [ruby-list:42090]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | lib/jcode.rb | 2 |
2 files changed, 7 insertions, 1 deletions
@@ -1,3 +1,9 @@ +Tue Apr 25 07:55:31 2006 Yukihiro Matsumoto <matz@ruby-lang.org> + + * lib/jcode.rb (String::tr_s): should have translated non + squeezing character sequence (i.e. a character) as well. thanks + to Hiroshi Ichikawa <gimite at gimite.ddo.jp> [ruby-list:42090] + Tue Apr 25 00:08:24 2006 Yukihiro Matsumoto <matz@ruby-lang.org> * regex.c (re_compile_pattern): should check if c is not a diff --git a/lib/jcode.rb b/lib/jcode.rb index 691d22dafe..e5367e815b 100644 --- a/lib/jcode.rb +++ b/lib/jcode.rb @@ -175,7 +175,7 @@ class String def tr_s!(from, to) return self.delete!(from) if to.length == 0 - pattern = SqueezePatternCache[from] ||= /([#{_regex_quote(from)}])\1+/ + pattern = SqueezePatternCache[from] ||= /([#{_regex_quote(from)}])\1*/ if from[0] == ?^ last = /.$/.match(to)[0] self.gsub!(pattern, last) |