Project

General

Profile

Actions

Misc #12730

closed

Documentation String.slice!(regex)

Added by cody-soultz (Cody Soultz) over 7 years ago. Updated over 7 years ago.

Status:
Rejected
Assignee:
-
[ruby-core:77163]

Description

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"

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0