我想提出一个代理刮板程序的某些字符串,我需要找到代理服务器阵列中的C#中找到一个数组
这里是什么,我想摆脱这一行的例子:
document.write('77.237.138.51')
我想删除document.write('" and "')
所以它只显示了代理
这里是我当前的代码:
client.DownloadFile("http://www.gatherproxy.com/sockslist", "source.txt");
string [] lines = File.ReadAllLines("source.txt");
string start = "document.write('";
string end = "')";
现在我将如何使它所以在那里我可以删除开始和结束并返回中间元素(代理)
在回答Domysee
using (WebClient client = new WebClient())
client.DownloadFile("http://www.gatherproxy.com/sockslist", "source.txt");
string[] lines = File.ReadAllLines("source.txt");
for (int i = 0; i < 1000; i++)
{
string[] ipAddresses = lines.Select(l => Regex.Match(l, @"(\d+\.){3}\d+").Value).ToArray();
i++;
string[] port = lines.Select(l => Regex.Match(l, @"(\d+\.){3}\d+").Value).ToArray();
Console.WriteLine(ipAddresses + ":" + port);
}
Console.ReadLine();
所以的Source.txt所包含的行格式 “文件撰写('11 .111.111.11' )”,你需要 “11.111.111.11” 的呢? – Domysee
是的,这是正确的。 – Zezima
您的源文件包含其他具有IP地址的行? – Enigmativity