title: Ruby RegEx problem text.gsub[^\W-], '') fails
body: <p>I'm trying to learn RegEx in Ruby, based on what I'm reading in "<em>The Rails Way</em>". But, even this simple example has me stumped. I can't tell if it is a typo or not:</p>
  
  <pre><code>text.gsub(/\s/, "-").gsub([^\W-], '').downcase
  </code></pre>
  
  <p>It seems to me that this would replace all spaces with <code>-</code>, then anywhere a string starts with a non letter or number followed by a dash, replace that with ''. But, using irb, it fails first on <code>^</code>:</p>
  
  <blockquote>
    <p>syntax error, unexpected '^', expecting ']'</p>
  </blockquote>
  
  <p>If I take out the <code>^</code>, it fails again on the W.</p>