зеркало из https://github.com/github/ruby.git
[DOC] State MatchData#[] when multiple captures with the same name
This commit is contained in:
Родитель
b5f33ba76f
Коммит
dee45ac231
11
re.c
11
re.c
|
@ -2151,6 +2151,17 @@ match_ary_aref(VALUE match, VALUE idx, VALUE result)
|
||||||
* m['foo'] # => "h"
|
* m['foo'] # => "h"
|
||||||
* m[:bar] # => "ge"
|
* m[:bar] # => "ge"
|
||||||
*
|
*
|
||||||
|
* If multiple captures have the same name, returns the last matched
|
||||||
|
* substring.
|
||||||
|
*
|
||||||
|
* m = /(?<foo>.)(?<foo>.+)/.match("hoge")
|
||||||
|
* # => #<MatchData "hoge" foo:"h" foo:"oge">
|
||||||
|
* m[:foo] #=> "oge"
|
||||||
|
*
|
||||||
|
* m = /\W(?<foo>.+)|\w(?<foo>.+)|(?<foo>.+)/.match("hoge")
|
||||||
|
* #<MatchData "hoge" foo:nil foo:"oge" foo:nil>
|
||||||
|
* m[:foo] #=> "oge"
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
|
Загрузка…
Ссылка в новой задаче