るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.133秒)
トップページ > クエリ:l[x] > クエリ:>[x] > クエリ:NIL[x] > クエリ:post_match[x]

別のキーワード

  1. _builtin nil?
  2. nilclass nil?
  3. object nil?
  4. _builtin nil
  5. object nil

ライブラリ

クラス

モジュール

検索結果

StringScanner#post_match -> String | nil (18484.0)

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

... nil
返します。

//emlist[例][ruby]{
require 'strscan'

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+/) # => "st...
...ring"
s.post_match # => ""
s.scan(/\w+/) # => nil
s.post_match # => nil
//}...

Kernel$$' -> String | nil (3329.0)

現在のスコープで最後に成功した正規表現のパターンマッチでマッチした 部分より後ろの文字列です。 最後のマッチが失敗していた場合には nil となります。

... nil となります。

Regexp.last_match.post_match と同じです。

この変数はローカルスコープかつスレッドローカル、読み取り専用です。
Ruby起動時の初期値は nil です。

//emlist[例][ruby]{
str = '<p><a href="http://example.com">example.com</a></p>'
i...
...f %r[<a href="(.*?)">(.*?)</a>] =~ str
p $'
end
#=> "</p>"
//}...