I just stumbled upon the following which I can\'t quite get my head around. When you create a new Regexp in Ruby like so:
Regexp.new(\'http://www.example.com\')
You can do:
Regexp.escape('http://www.example.com')
That will return the fully escaped string