Project

General

Profile

This project is closed and read-only.

Actions

Backport #5452

closed

String#squeeze[!] with negated out-of-order sequence behaves like no argument was passed

Backport #5452: String#squeeze[!] with negated out-of-order sequence behaves like no argument was passed

Added by brixen (Brian Shirai) almost 15 years ago. Updated almost 10 years ago.


Description

See the examples below:

String#squeeze!

$ ruby -e 'p "-subbookkeeper-".squeeze!("b-e")'
"-subookkeper-"

$ ruby -e 'p "-subbookkeeper-".squeeze!("^b-e")'
"-subbokeeper-"

$ ruby -e 'p "-subbookkeeper-".squeeze!("e-b")'
nil

$ ruby -e 'p "-subbookkeeper-".squeeze!("^e-b")'
"-subokeper-"

^^^ This looks like a bug

$ ruby -e 'p "-subbookkeeper-".squeeze!'
"-subokeper-"

String#squeeze

$ ruby -e 'p "-subbookkeeper-".squeeze("e-b")'
"-subbookkeeper-"

$ ruby -e 'p "-subbookkeeper-".squeeze("^e-b")'
"-subokeper-"

^^^ And so does this

$ ruby -e 'p "-subbookkeeper-".squeeze'
"-subokeper-"

Thanks,
Brian

Updated by nobu (Nobuyoshi Nakada) almost 15 years ago Actions #1 [ruby-core:40165]

=begin
It raises an exception in 1.9.

$ ruby -e 'p "-subbookkeeper-".squeeze("^e-b")'
-e:1:in squeeze': invalid range "e-b" in string transliteration (ArgumentError) from -e:1:in

'

And 1.8 has no future to introduce any behavior changes.
=end

Updated by nobu (Nobuyoshi Nakada) almost 15 years ago Actions #2 [ruby-core:40166]

  • Status changed from Open to Rejected

Updated by nahi (Hiroshi Nakamura) almost 15 years ago Actions #3 [ruby-core:40434]

  • Category set to core
  • Status changed from Rejected to Open
  • Assignee set to shyouhei (Shyouhei Urabe)
  • Target version set to Ruby 1.8.7

It's fixed by #1953 and r25576 by Matz.

I re-open this for making sure Shyouhei can decide whether it's backportable or not.

Updated by naruse (Yui NARUSE) almost 15 years ago Actions #4

  • Tracker changed from Bug to Backport
  • Project changed from 2 to 5
  • Category changed from core to core
  • Status changed from Open to Assigned
  • Target version deleted (Ruby 1.8.7)

Updated by shyouhei (Shyouhei Urabe) almost 10 years ago Actions #5

  • Status changed from Assigned to Closed
Actions

Also available in: PDF Atom