What is the fastest way to check if a string matches a certain pattern? Is regex the best way?
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.
Something like this is what I have been doing so far:
for st in strs:
if re.match('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}', st) != None:
print 'IP!'