title: check if a string matches an IP address pattern in python?
body: <p>What is the fastest way to check if a string matches a certain pattern? Is regex the best way?</p>
  
  <p>For example, I have a bunch of strings and want to check each one to see if they are a valid IP address (valid in this case meaning correct format), is the fastest way to do this using regex? Or is there something faster with like string formatting or something. </p>
  
  <p>Something like this is what I have been doing so far:</p>
  
  <pre><code>for st in strs:
      if re.match('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}', st) != None:
         print 'IP!'
  </code></pre>