概要
MatchData#to_a -> [String]
詳細
$&, $1, $2,... を格納した配列を返却
サンプルコード
require 'tbpgr_utils' "hogehigehage@@@@@" =~ /(h\wge)(h\wge)(h\wge)/ bulk_puts_eval binding, <<-EOS $~ $~.to_a 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"> $~.to_a # => ["hogehigehage", "hoge", "hige", "hage"]