print(timeit(setup=
    "import re; regex = re.compile(r'((?:\\d{1,3}\\.){3}\\d{1,3})')", stmt=
    "r = regex.search('192.168.1.1 999.999.999.999')", number=1000000))
print(timeit(setup=
    "import re; regex = re.compile(r'(\\d{1,2}/\\w{3}/[2][0]\\d{2}:\\d{2}:\\d{2}:\\d{2}\\s[+][0]{4})')"
    , stmt='r = regex.search("[23/Jun/2015:11:10:57 +0000]")', number=1000000))
Python Regex slower than expected