(!!!公告!!!)正则表达式专用讨论区(精华)
我来提第一个问题!
******************************
请看下面一段代码:
string word="!!heaven!killer aaa!";
//string word="!!";
string strReg=@"!\S*!";//pick max character?
Regex r=new Regex(strReg);
Match m=r.Match(word);
Console.WriteLine("Is Matched:"+m.Success.ToString());
for(int i=0;i<m.Groups.Count;i++)
{
Console.WriteLine("Groups["+i+"] value"+m.Groups[i].Value);
for(int j=0;j<m.Groups[i].Captures.Count;j++)
{
Console.WriteLine(m.Groups[i].Captures[j].Value);
}
}
应该有两个匹配!!和!!heaven!,但为什么只有!!heaven! 呢 ?