I am trying to match proxy patterns using the following regex:
((?:\d{1,3}\.){3}\d{1,3}):(\d+) It is working well thus far, but is not matching the following: 218.25.249.186:80
Any ideas? Thanks!
12 Answers
This match in python regex
>>> import re >>> ip = '218.25.249.186:80' >>> match = re.match(r'((?:\d{1,3}\.){3}\d{1,3}):(\d+)', ip) >>> print match <_sre.SRE_Match object at 0xb755da88> Could be:
(\d{1,3}\.){3}\d{1,3}:(\d+) 0Drop the leading ':' or change it to ':?'. your reference string does not start with a : nor does a colon appear before the numeric expression.
1