How do I get $1, $2, and $3 to get interpolated in the following
string = ‘This is a test of the emergency’
regexp = Regexp.new(’(\W)+(\w\w)(\W)+’)
replacement = ‘$1->$2<-$3’
Note: All variables above are set by the user of the program, so I
what they will contain before runtime.
return_value = replacement # Here, how do I get $1, $2, and $3 to
return_value.upcase! || return_value
I want return_value to be -> ‘This ->is<- a test ->of<- the emergency’
Note: I know that I can get it to work with the non-block version of
gsub! but I need to use the block version.