title: Escape special chars in RegEx?
body: <p>I have a form, that sends the contents of a text field to my Rails application and 
  I have to generate a regular expression of this string. </p>
  
  <p>I tried it like this:</p>
  
  <pre><code>regex = /#{params[:text]}/
  </code></pre>
  
  <p>In general this is working, but if brackets or special characters are contained in the string, this method will not work.</p>
  
  <p>I don't want Rails to take care of the chars. They should be escaped automatically.</p>
  
  <p>I tried it like this:</p>
  
  <pre><code>/\Q#{params[:text]}\E/
  </code></pre>
  
  <p>but this isn't working either.</p>