<p>I need to substitute the value of a string into my regular expression in Ruby. Is there an easy way to do this? For example:</p>

<pre><code>foo = "0.0.0.0"
goo = "here is some other stuff 0.0.0.0" 
if goo =~ /value of foo here dynamically/
  puts "success!"
end
</code></pre>

Use Regexp.new:
```
```
if goo =~ Regexp.new(foo) # Evaluates to /0.0.0.0/
```
```