Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

Regex Pattern for Proxy

Writer Matthew Martinez

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!

1

2 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+)
0

Drop the leading ':' or change it to ':?'. your reference string does not start with a : nor does a colon appear before the numeric expression.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy