日期:2014-05-16 浏览次数:20719 次
1. var reg=new Regex(@"(?<=Compile Include=(""))[^""]+(?=\1)");
2. var reg=new Regex(@"(?<=GetParam\(("")[^""]\1,\1)[^""]+(?=\1)");
2. var reg=new Regex(@"(?<=GetParam\([^,]+,(""))[^""]+(?=\1\))");
string str1 = @"<Compile Include=""C:\Program Files\Adobe\abc\program.cs""/>";
string str2 = @"GetParam(""abc"",""D_ABC_PRAM_0"") ;";
string v1 = Regex.Match(str1, @"(?i)(?<=<Compile[^>]*?Include=['""])[^'""]*?(?=['""])").Value;//C:\\Program Files\\Adobe\\abc\\program.cs
string v2 = Regex.Match(str2, @"(?i)(?<=GetParam\([^,]*?,['""])[^'""]*?(?=['""])").Value;//D_ABC_PRAM_0