我有以下代碼來解析一個FTP鏈接的部分:正則表達式來解析FTP鏈接字符串
Regex exp = new Regex(@"(?i)ftp:\/\/(?<user>\S+?):(?<passwd>\S+?)@(?<host>\S+?.\S+?.\S+?.\S+?)");
Match m = exp.Match(@"Link: ftp://username:[email protected]<ftp://username:[email protected]/>");
Console.WriteLine("Host = " + m.Groups["host"].Value);
Console.WriteLine("User = " + m.Groups["user"].Value);
Console.WriteLine("Pass = " + m.Groups["passwd"].Value);
哪產生以下輸出:
Host = host.su
User = username
Pass = password
爲什麼在主機被截斷?
韋爾普,現在你已經在非貪我的回答只是看起來像已經來不及了評論編輯。 – Rawling