[ruby-core:77162] [Ruby trunk Misc#12730] Documentation String.slice!(regex)

From: cody-soultz@...
Date: 2016-09-06 19:44:28 UTC
List: ruby-core #77162
Issue #12730 has been updated by Cody Soultz.

Subject changed from Documentation String.splice(regex) to Documentation String.slice!(regex)

----------------------------------------
Misc #12730: Documentation String.slice!(regex)
https://bugs.ruby-lang.org/issues/12730#change-60380

* Author: Cody Soultz
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
at http://ruby-doc.org/core-2.2.0/String.html#method-i-slice-21

In the example
string = "this is a string"
string.slice!(/s.*t/)   #=> "sa st"

When ran in irb the result is different than shown because the regex starts at the first s and then ends at the last t.

in irb 
2.3.0 :001 > string = "this is a string"
 => "this is a string" 
2.3.0 :002 > string.slice!(/s.*t/)
 => "s is a st" 

the documentation should be:

string.slice!(/s.*t/)   #=> "s is a st"



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

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next