るりまサーチ

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

別のキーワード

  1. net/imap param
  2. win32ole win32ole_param
  3. win32ole_param name
  4. win32ole_param input?
  5. win32ole_param retval?

ライブラリ

キーワード

検索結果

MatchData#values_at(*index) -> [String] (6108.0)

正規表現中の n 番目の括弧にマッチした部分文字列の配列を返します。

...列全体を表します。

@param index インデックスを整数またはシンボル(名前付きキャプチャの場合)で 0 個以上指定します。

//emlist[例][ruby]{
m = /(foo)(bar)(baz)/.match("foobarbaz")
# same as m.to_a.values_at(...)
p m.values_at(0, 1, 2, 3, 4) # => ["fo...
...z", "foo", "bar", "baz", nil]
p m.values_at(-1, -2, -3, -4, -5) # => ["baz", "bar", "foo", nil, nil]

m = /(?<a>\d+) *(?<op>[+\-*\/]) *(?<b>\d+)/.match("1 + 2")
m.to_a # => ["1 + 2", "1", "+", "2"]
m.values_at(:a, :b, :op) # => ["1", "2", "+"]
//}

@see Array#values_at, Array#[]...

MatchData#bytebegin(n) -> Integer | nil (32.0)

n 番目の部分文字列先頭のバイトオフセットを返します。

...ルを渡した場合は、対応する名前付きキャプチャの先頭のバイトオフセットを返します。

@param n 部分文字列を指定する数値。
@param name 名前付きキャプチャを指定する文字列またはシンボル。

@raise IndexError 範囲外の n を指...
...=> #<MatchData "cあいうdef" 1:"c" 2:"いう" 3:"ef">
p $~.bytebegin(0) # => 2
p $~.bytebegin(1) # => 2
p $~.bytebegin(2) # => 6
p $~.bytebegin(3) # => 13
p $~.bytebegin(4) # => index 4 out of matches (IndexError)
//}

//emlist[シンボルを指定する例][ruby]{
/(?<key>\S+):\s*(?<value>\S+)/...
...=~ "name: ruby"
$~ # => #<MatchData "name: ruby" key:"name" value:"ruby">
$~.bytebegin(:key) # => 0
$~.bytebegin(:value) # => 6
$~.bytebegin(:foo) # => undefined group name reference: foo (IndexError)
//}...

MatchData#bytebegin(name) -> Integer | nil (32.0)

n 番目の部分文字列先頭のバイトオフセットを返します。

...ルを渡した場合は、対応する名前付きキャプチャの先頭のバイトオフセットを返します。

@param n 部分文字列を指定する数値。
@param name 名前付きキャプチャを指定する文字列またはシンボル。

@raise IndexError 範囲外の n を指...
...=> #<MatchData "cあいうdef" 1:"c" 2:"いう" 3:"ef">
p $~.bytebegin(0) # => 2
p $~.bytebegin(1) # => 2
p $~.bytebegin(2) # => 6
p $~.bytebegin(3) # => 13
p $~.bytebegin(4) # => index 4 out of matches (IndexError)
//}

//emlist[シンボルを指定する例][ruby]{
/(?<key>\S+):\s*(?<value>\S+)/...
...=~ "name: ruby"
$~ # => #<MatchData "name: ruby" key:"name" value:"ruby">
$~.bytebegin(:key) # => 0
$~.bytebegin(:value) # => 6
$~.bytebegin(:foo) # => undefined group name reference: foo (IndexError)
//}...

MatchData#byteend(n) -> Integer | nil (32.0)

n 番目の部分文字列終端のバイトオフセットを返します。

...ルを渡した場合は、対応する名前付きキャプチャの終端のバイトオフセットを返します。

@param n 部分文字列を指定する数値。
@param name 名前付きキャプチャを指定する文字列またはシンボル。

@raise IndexError 範囲外の n を指...
...# => #<MatchData "cあいうdef" 1:"c" 2:"いう" 3:"ef">
p $~.byteend(0) # => 15
p $~.byteend(1) # => 3
p $~.byteend(2) # => 12
p $~.byteend(3) # => 15
p $~.byteend(4) # => index 4 out of matches (IndexError)
//}

//emlist[シンボルを指定する例][ruby]{
/(?<key>\S+):\s*(?<value>\S+)/ =~...
..."name: ruby"
$~ # => #<MatchData "name: ruby" key:"name" value:"ruby">
$~.byteend(:key) # => 4
$~.byteend(:value) # => 10
$~.byteend(:foo) # => undefined group name reference: foo (IndexError)
//}...

MatchData#byteend(name) -> Integer | nil (32.0)

n 番目の部分文字列終端のバイトオフセットを返します。

...ルを渡した場合は、対応する名前付きキャプチャの終端のバイトオフセットを返します。

@param n 部分文字列を指定する数値。
@param name 名前付きキャプチャを指定する文字列またはシンボル。

@raise IndexError 範囲外の n を指...
...# => #<MatchData "cあいうdef" 1:"c" 2:"いう" 3:"ef">
p $~.byteend(0) # => 15
p $~.byteend(1) # => 3
p $~.byteend(2) # => 12
p $~.byteend(3) # => 15
p $~.byteend(4) # => index 4 out of matches (IndexError)
//}

//emlist[シンボルを指定する例][ruby]{
/(?<key>\S+):\s*(?<value>\S+)/ =~...
..."name: ruby"
$~ # => #<MatchData "name: ruby" key:"name" value:"ruby">
$~.byteend(:key) # => 4
$~.byteend(:value) # => 10
$~.byteend(:foo) # => undefined group name reference: foo (IndexError)
//}...

絞り込み条件を変える