るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.153秒)

別のキーワード

  1. _builtin hash
  2. matrix hash
  3. hash []
  4. _builtin to_hash
  5. dbm to_hash

ライブラリ

クラス

検索結果

Regexp#named_captures -> { String => [Integer] } (18249.0)

正規表現に含まれる名前付きキャプチャ(named capture)の情報を Hash で返します。

...ャ(named capture)の情報を
Hash
で返します。

Hash
のキーは名前付きキャプチャの名前で、値は
その名前に関連付けられたキャプチャの index のリストを返します。

//emlist[例][ruby]{
/(?<foo>.)(?<bar>.)/.named_captures
# => {"foo"=>[1], "bar"=>[2]...
...}

/(?<foo>.)(?<foo>.)/.named_captures
# => {"foo"=>[1, 2]}

# 名前付きキャプチャを持たないときは空の Hash を返します。
/(.)(.)/.named_captures
# => {}
//}...