110,532
社区成员
发帖
与我相关
我的任务
分享
void Main()
{
string str = @"\ul\f0\fs22 123456\cf0\ulnone \cf1\ul 456789\cf0\ulnone";
foreach(Match m in Regex.Matches(str, @"(?<=\\ul)[^none].*?(?=\\ulnone)"))
{
Console.WriteLine(m.Value);
};
}
/*
\f0\fs22 123456\cf0
456789\cf0
*/
string str = @"\ul\f0\fs22 123456\cf0\ulnone \cf1\ul 456789\cf0\ulnone";
string pstr = @"(?<=\\ul(?!none)).+?(?=\\ulnone)";
MatchCollection mc = Regex.Matches(str, pstr);
for (int i = 0; i < mc.Count; i++)
{
Response.Write(mc[i].Value);
}