Regex 如何从字符串中获取代理

Regex 如何从字符串中获取代理,regex,vb.net,Regex,Vb.net,我有绳子 76.125.85.66:16805 | 0.238 | Little Rock | AR | Unknown | United States69.207.212.76:49233 | 0.274 | Sayre | PA | 18840 | United States96.42.127.190:25480 | 0.292 | Sartell | MN | 56377 | United States 下面是我如何从中获取代理的 我的代码 它只显示第一个代理76.125.85.66:

我有绳子

76.125.85.66:16805 | 0.238 | Little Rock | AR | Unknown | United
States69.207.212.76:49233 | 0.274 | Sayre | PA | 18840 | United 
States96.42.127.190:25480 | 0.292 | Sartell | MN | 56377 | United States
下面是我如何从中获取代理的 我的代码

它只显示第一个代理76.125.85.66:16805,但我希望它显示所有

76.125.85.66:16805

69.207.212.76:49233


96.42.127.190:25480

使用此模式为特定表达式返回多个结果

public ArrayList HRefs(tml中的字符串)
{
ArrayList ArrayList=新的ArrayList();
string pattern=“href\\s*=\\s*(?:\”(?[^\“]*)\“\”(?\\s+)”;
for(Match Match=Regex.Match(incomingtml,pattern,RegexOptions.IgnoreCase | RegexOptions.Compiled);Match.Success;Match=Match.NextMatch())
{
字符串str=match.Groups[1]。值;
arrayList.Add(str);
}
返回数组列表;
}

改用Regex方法并删除开头的单词边界

你可以这样写:

For Each m As Match In Regex.Matches(ip, "(?:\d{1,3}\.){3}\d{1,3}:\d+")
    Console.WriteLine(m.Value)
Next

?这样可以吗
\d{1,3}\.\d{1,3}.\d{1,3}.\d{1,3}:\d*
??,仅使用
匹配
而不是
匹配
该模式与字符串无关??我是说OP尝试匹配字符串中的IP/代理,而不是任何类型的href标记。这不是想法,想法是按模式查找多个结果,他的代码只查找一个结果。。。
For Each m As Match In Regex.Matches(ip, "(?:\d{1,3}\.){3}\d{1,3}:\d+")
    Console.WriteLine(m.Value)
Next