正则表达式
string text = @"abc";Regex r = new Regex(@".*?");
Console.WriteLine("r match count:" + r.Matches(text).Count);
Match m = r.Match(text);
if (m.Success)
{
Console.WriteLine(m.ToString());
m = m.NextMatch();
}
--------------------编程问答-------------------- while(m.Success)
{
Console.WriteLine(m.ToString());
m = m.NextMatch();
}
虽然我不知道你要干什么、 --------------------编程问答-------------------- System.Text.RegularExpressions.Match m = System.Text.RegularExpressions.Regex.Match(str, pattern);
string v="";
while (m.Success)
{
v+=m.Value;
m = m.NextMatch();
}
--------------------编程问答--------------------
--------------------编程问答--------------------
string text = @"abcki";
Regex r = new Regex(@".*?");
Console.WriteLine("r match count:" + r.Matches(text).Count);
Match m = r.Match(text);
while (m.Success)
{
Console.WriteLine(m.Value);
m = m.NextMatch();
}
补充:.NET技术 , C#