るりまサーチ

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

別のキーワード

  1. _builtin pos
  2. _builtin pos=
  3. stringio pos
  4. stringio pos=
  5. zlib pos

ライブラリ

クラス

検索結果

StringScanner#post_match -> String | nil (27363.0)

前回マッチを行った文字列のうち、マッチしたところよりも後ろの 部分文字列を返します。前回のマッチが失敗していると常に nil を 返します。

...s = StringScanner.new('test string')
s.post_match # => nil
s.scan(/\w+/) # => "test"
s.post_match # => " string"
s.scan(/\w+/) # => nil
s.post_match # => nil
s.scan(/\s+/) # => " "
s.post_match # => "string"
s.scan(/\w+/) # => "string"
s.post_match # => ""
s.scan(/\w+/) # => nil
s.post_match #...

MatchData#post_match -> String (24309.0)

マッチした部分より後ろの文字列を返します($'と同じ)。

...マッチした部分より後ろの文字列を返します($'と同じ)。

//emlist[例][ruby]{
/(bar)(BAZ)?/ =~ "foobarbaz"
p $~.post_match # => "baz"
//}

@see MatchData#pre_match...