日期:2014-05-17 浏览次数:21047 次
string str = @"/*
------------------------
four lines comment
*/
/*
------------------------
five lines comment
*/";
var result = Regex.Matches(str, @"(?<=^
------解决方案--------------------
\n)(?!(/\*
------解决方案--------------------
\*/).*?)[^\n]+?(?=\n
------解决方案--------------------
$)").OfType<Match>().Select(a => a.Value);
/*
* [0] "------------------------" string
[1] "four lines comment" string
[2] "\r" string
[3] "------------------------" string
[4] "five lines comment" string
*/