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!
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+) Drop the leading ':' or change it to ':?'. your reference string does not start with a : nor does a colon appear before the numeric expression.
(?: ... ) clustering notation does not match literal characters, but simply allows for subexpressions without capturing back-references.
(?: ... )or{n}notation as expected.