title: Why does \w+ match a trailing newline?
body: <p>I am curious why the following would output that there was a match:</p>
  
  <pre><code>import re
  
  foo = 'test\n'
  match = re.search('^\w+$', foo)
  
  if match == None:
    print "It did not match"
  else:
    print "Match!"
  </code></pre>
  
  <p>The newline is before the end of the string, yes? Why is this matching?</p>