title: Checking whole string with a regex
body: <p>I'm trying to check if a string is a number, so the regex "\d+" seemed good. However that regex also fits "78.46.92.168:8000" for some reason, which I do not want, a little bit of code:</p>
  
  <pre><code>class Foo():
      _rex = re.compile("\d+")
      def bar(self, string):
           m = _rex.match(string)
           if m != None:
               doStuff()
  </code></pre>
  
  <p>And doStuff() is called when the ip adress is entered. I'm kind of confused, how does "." or ":" match "\d"?</p>