111,096
社区成员




string result = Regex.Replace(yourStr,@"(?m:^).+?\bach=\x22(\d+).+classId=\x22(\d+)\S+","be:$1/$2");
string str = "u=\"3\" ach=\"67\" classId=\"5\" u=\"4\" ach=\"251\" classId=\"0\"";
Regex re = new Regex("(.*?)ach=\"(.*?)\"(.*?)classId=\"(.*?)\"(.*?)");
MatchCollection result = re.Matches(str);
foreach (Match item in result)
{
Console.WriteLine("be:"+item.Groups[2]+"/"+item.Groups[4]);
}
Console.ReadLine();
string test = @"u=""3"" ach=""67"" classId=""5""";
foreach(Match m in Regex.Matches(test,@"(?m:^).+?ach=\x22(\d+).+?classId=\x22(\d+)"))
{
string result = "be:" + m.Groups[1].Value + "/" + m.Groups[2].Value + "\n";
Console.WriteLine(result);
}
string test = @"u=""3"" ach=""67"" classId=""5"";
foreach(Match m in Regex.Matches(test,@"(?m:^).+?ach=\x22(\d+).+?classId=\x22(\d+)"))
{
string result = "be:" + m.Groups[1].Value + "/" + m.Groups[2].Value + "\n";
Console.WriteLine(result);
}
string test = @"u=""3"" ach=""67"" classId=""5""
u=""4"" ach=""251"" classId=""0""";
Regex reg = new Regex(@"(?i)ach=""([^""]*)""\s+classid=""([^""]*)""");
MatchCollection mc = reg.Matches(test);
foreach (Match m in mc)
{
richTextBox2.Text += "be:" + m.Groups[1].Value + "/" + m.Groups[2].Value + "\n";
}
//写得太烂了
string inputStr = "u=\"3\" ach=\"67\" classId=\"5\" u=\"4\" ach=\"251\" classId=\"0\"";
Regex re = new Regex("(?i).*?ach=\"(?<ach>.*?)\"\\sclassId=\"(?<classId>.*?)\"");
MatchCollection myMatchs = re.Matches(inputStr);
string str = "";
foreach (Match item in myMatchs)
{
str += "de:" + item.Groups["ach"].Value + "/" + item.Groups["classId"].Value;
}
MessageBox.Show(str);