title: Regular Expression, Unknown escape squence '\s'
body: <p>I'm looking to strip the whitespace out of the beginning and end of my string. I'm using the following regular expression.</p>
  
  <pre><code>NSString *pattern = @"(?:^\s+|\s+$)";
  </code></pre>
  
  <p>This is coming up with an error that <code>\s</code> is not a valid escape character. Replacing this with <code>\\s</code> appears to work but what I'd like to know is why? I thought <code>\s</code> is a whitespace charecter and <code>\\s</code> would give me a literal string of '\s'?</p>