るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.037秒)
トップページ > ライブラリ:ビルトイン[x] > クエリ:index[x] > クエリ:named_captures[x] > 種類:インスタンスメソッド[x]

別のキーワード

  1. _builtin named_captures
  2. regexp named_captures
  3. matchdata named_captures
  4. ec named_curve
  5. openssl named_curve

クラス

検索結果

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

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

... index のリストを返します。

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

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

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