正则表达式2

1>贪婪模式

  

1 string str = "111111。  1         1 。           111。1111111.";
2 string regStr = ".+。";
3 Match match = Regex.Match(str, regStr);
4 Console.Write(match.Value);
开关

 

 结果是:111111。  1         1 。           111。

2>终结贪婪模式

1             string str = "111111。  1         1 。           111。1111111.";
2             string regStr = ".+?。";
3             Match match = Regex.Match(str, regStr);
4             Console.Write(match.Value);         
View Code

 

      

 结果是111111。

posted @ 2013-12-17 20:13  Jianwen_Zheng  阅读(143)  评论(0)    收藏  举报