1
我有這樣的正則表達式:正則表達式,替換其他組之間的組?
string ipPort = @"[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}[\s\S]*?[0-9]{1,5}";
Regex Rx = new Regex(ipPort,RegexOptions.Singleline);
List<string> catched = new List<string>();
foreach (Match ItemMatch in Rx.Matches(page))
{
catched.Add(ItemMatch.ToString());
}
它會找到IP,後跟任意數量的字符,後跟端口號。我想把這個「任意數量的字符」替換成單個冒號「:」。如何做到這一點,我不是很有經驗的正則表達式...