以下の内容はhttps://tbpgr.hatenablog.com/entry/20140613/1402669423より取得しました。


Ruby | MatchData | post_match

概要

MatchData#post_match -> String

詳細

マッチした部分より後ろの文字列を返却

$'

と同じ。

サンプルコード
require 'tbpgr_utils'

"hogehigehage" =~ /(h\wge)(h\wge)(h\wge)/

(1..3).each do |i|
  bulk_puts_eval binding, <<-EOS
$~.begin(i)
$~.end(i)
$~.post_match(i)
  EOS
end

__END__
下記はTbpgrUtils gemの機能
bulk_puts_eval

https://rubygems.org/gems/tbpgr_utils
https://github.com/tbpgr/tbpgr_utils

出力

$'            # => "@@@@@"
$~.post_match # => "@@@@@"



以上の内容はhttps://tbpgr.hatenablog.com/entry/20140613/1402669423より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14