我想提出一個代理刮板程序的某些字符串,我需要找到代理服務器陣列中的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