diff options
| -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) |
