variable $PREMATCH

$PREMATCH -> String | nil[permalink][rdoc][edit] [added by English]

$` の別名

require "English"

str = 'hoge,foo,bar,hee,hoo'

/foo/ =~ str
p $PREMATCH  #=> "hoge,"