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


Ruby | MatchData | regexp

概要

MatchData#regexp -> String

詳細

元になった正規表現オブジェクトを返却。

サンプルコード
require 'tbpgr_utils'

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

bulk_puts_eval binding, <<-EOS
$~
$~.regexp
EOS

__END__
下記はTbpgrUtils gemの機能
bulk_puts_eval

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

出力

$~        # =>                        #<MatchData "hogehigehage" 1:"hoge" 2:"hige" 3:"hage">
$~.regexp # => /(h\wge)(h\wge)(h\wge)/



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

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