るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

キーワード

検索結果

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

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

...チャの場合)で 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) # => ["foobarbaz", "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 (50.0)

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

...r 正規表現中で定義されていない name を指定した場合に発生します。

//emlist[例][ruby]{
/(c).*(いう).*(e.*)/ =~ 'abcあいうdef'
p $~ # => #<MatchData "cあいうdef" 1:"c" 2:"いう" 3:"ef">
p $~.bytebegin(0) # => 2
p $~.bytebegin(1) # => 2
p $~.bytebegin(...
...es (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 refer...

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

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

...r 正規表現中で定義されていない name を指定した場合に発生します。

//emlist[例][ruby]{
/(c).*(いう).*(e.*)/ =~ 'abcあいうdef'
p $~ # => #<MatchData "cあいうdef" 1:"c" 2:"いう" 3:"ef">
p $~.bytebegin(0) # => 2
p $~.bytebegin(1) # => 2
p $~.bytebegin(...
...es (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 refer...

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

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

...or 正規表現中で定義されていない name を指定した場合に発生します。

//emlist[例][ruby]{
/(c).*(いう).*(e.*)/ =~ 'abcあいうdef'
p $~ # => #<MatchData "cあいうdef" 1:"c" 2:"いう" 3:"ef">
p $~.byteend(0) # => 15
p $~.byteend(1) # => 3
p $~.byteend(2) # =...
...tches (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...

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

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

...or 正規表現中で定義されていない name を指定した場合に発生します。

//emlist[例][ruby]{
/(c).*(いう).*(e.*)/ =~ 'abcあいうdef'
p $~ # => #<MatchData "cあいうdef" 1:"c" 2:"いう" 3:"ef">
p $~.byteend(0) # => 15
p $~.byteend(1) # => 3
p $~.byteend(2) # =...
...tches (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...

絞り込み条件を変える