6件ヒット
[1-6件を表示]
(0.020秒)
検索結果
-
MatchData
# captures -> [String] (62120) -
$1, $2, ... を格納した配列を返します。
...します。
MatchData#to_a と異なり $& を要素に含みません。
グループにマッチした部分文字列がなければ対応する要素は nil になります。
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.to_a # => ["foobar", "foo", "bar", nil]
p $~.captures # => ["......foo", "bar", nil]
@see MatchData#to_a... -
MatchData
# to _ a -> [String] (21019) -
$&, $1, $2,... を格納した配列を返します。
...2,... を格納した配列を返します。
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.to_a # => ["foobar", "foo", "bar", nil]
@see MatchData#captures...
