Ruby regexes can interpolate expressions in the same way that strings do, using the #{} notation. However, you do have to escape any regex special characters. For example:
input_str = "A man + a plan * a canal : Panama!"
/#{Regexp.escape input_str}/i