[#114181] [Ruby master Bug#19767] [Not really a bug, but more a not ideal notification] "historical binary regexp match" when using the "n" modifier in a ruby regex — "rubyFeedback (robert heiler) via ruby-core" <ruby-core@...>
SXNzdWUgIzE5NzY3IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IHJ1YnlGZWVkYmFjayAocm9iZXJ0IGhl
3 messages
2023/07/14
[ruby-core:114194] [Ruby master Bug#19769] Range of size 1 in String#tr causes unexpected behavior
From:
"alexandre (alexandre borderes) via ruby-core" <ruby-core@...>
Date:
2023-07-14 21:33:30 UTC
List:
ruby-core #114194
Issue #19769 has been updated by alexandre (alexandre borderes). Description updated I created a PR https://github.com/ruby/ruby/pull/8080 ---------------------------------------- Bug #19769: Range of size 1 in String#tr causes unexpected behavior https://bugs.ruby-lang.org/issues/19769#change-103880 * Author: alexandre (alexandre borderes) * Status: Open * Priority: Normal * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- Hi, I noticed a possible unexpected behavior in String#tr. Is that intentional? ``` ruby 'ABC'.tr 'A-AB', 'XY' # => "YYC" ``` I would expect the same result as: ``` ruby 'ABC'.tr 'AB', 'XY' # => "XYC" ``` The tr utility does exactly that: ``` shell echo ABC | tr A-AB XY # => "XYC" ``` The letter 'A' is interpreted 2 times in that case, shifting by 1 all the replacement string. (I found this related https://bugs.ruby-lang.org/issues/1953) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- [email protected] To unsubscribe send an email to [email protected] ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/