[#69616] [Ruby trunk - Feature #11258] add 'x' mode character for O_EXCL — cremno@...
Issue #11258 has been updated by cremno phobia.
3 messages
2015/06/16
[#69643] [Ruby trunk - Misc #11276] [RFC] compile.c: convert to use ccan/list — normalperson@...
Issue #11276 has been updated by Eric Wong.
3 messages
2015/06/17
[#69751] [Ruby trunk - Bug #11001] 2.2.1 Segmentation fault in reserve_stack() function. — kubo@...
Issue #11001 has been updated by Takehiro Kubo.
3 messages
2015/06/27
[ruby-core:69743] [Ruby trunk - Feature #11309] [Open] Iterator over string matches
From:
sawadatsuyoshi@...
Date:
2015-06-26 14:55:44 UTC
List:
ruby-core #69743
Issue #11309 has been reported by Tsuyoshi Sawada.
----------------------------------------
Feature #11309: Iterator over string matches
https://bugs.ruby-lang.org/issues/11309
* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
This was hinted from a problem in stackoverflow (http://stackoverflow.com/questions/31074050/build-list-of-strings-containing-substrings-separated-by-an-from-a-string/31075511#31075511).
Suppose there is a string:
s = "a_b_c_d_e"
To get an array of pre-matches that result from matching `s` with `"_"`, I can do this:
a = []
s.scan("_"){a.push($`)}
a # => ["a", "a_b", "a_b_c", "a_b_c_d"]
But this looks too Perlish. I thought it would be nice if there is a method on `String` that creates an enumerator over matches so that I can do something like this:
"a_b_c_d_e".some_method("_").with_object([]){|m, a| a.push(m.post_match)}
# => ["a", "a_b", "a_b_c", "a_b_c_d"]
where `m` is the last matchdata instance at that point. I believe such method would have wider application.
--
https://bugs.ruby-lang.org/