title: Postgres invalid regular expression: invalid character range
body: <p>I'm using the following line in a postgres function:</p>
  
  <p><code>regexp_replace(input, '[^a-z0-9\-_]+', sep, 'gi');</code></p>
  
  <p>But I'm getting <code>ERROR:  invalid regular expression: invalid character range</code> when I try to use it. The regex works fine in Ruby, is there a reason it'd be different in postgres?</p>