title: Regex - Should hyphens be escaped?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4068629/how-to-match-hyphens-with-regular-expression">How to match hyphens with Regular Expression?</a>  </p>
  </blockquote>
  
  
  
  <p>Hyphen is a special character in regex, for instance, to select a range, I could do something like: </p>
  
  <pre><code>[0-9A-F]
  </code></pre>
  
  <p>But outside of square brackets it's just a regular character right? I've tested this on a couple of online regex testers, and hyphens seem to function as a normal character outside of square brackets (or even inside of square brackets if it's not in-between two characters - eg [-g] seems to match - or g) whether it's escaped or not. I couldn't find the answer to this, but I'm wondering whether or not it is conventional to escape hyphens.</p>
  
  <p>Thanks!</p>