2017-04-09 84 views
0

如何从中选择代理正则表达式代理

LIVE | 194.208.15.89:16698 | 1.65 |福拉尔贝格| 6830 | 194-208-015-089.tele.net |奥地利|黑名单:是的

我只想选择194.208.15.89:16698

感谢

回答

1

使用这个表达式:\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\:[0-9]{1,5}\b

说明:

\b     -> Word boundary 
[0-9]{1,3}   -> Digit with length of 1 to 3 
(?:[0-9]{1,3}\.){3} -> Digit with length of 1 to 3 with a dot (.) at the end 3 times (Ex. 194.208.15.) 

演示:https://regex101.com/r/fjSCm5/3

为了更准确,您可以使用这个:\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?):[0-9]{1,5}\b

+0

我建议用这种方式'\ b(?:[1-2]?[0-9] {1,2} \。){3} [1-2]?[0 -9] {1,2} \ b',以进一步提高ip匹配的准确性,取消匹配任何超过300+的ip https://regex101.com/r/fjSCm5/2 – Ibrahim

+0

感谢它的工作,但如何选择代理和端口194.208.15.89:16698? – irfan666

+0

@ irfan666回答更新 –