日期:2014-05-17  浏览次数:20400 次

有关正则的替换。。。。。。标题长才会有人看的到。。。。。。。。
把count("xxx") > 2 替换为 xxx>2

------解决方案--------------------
C# code

void Main()
{
    String str="count(\"xxx\") > 2";
    str=Regex.Replace(str,@"[^()]+\(""([^""]+)""\)\s*(\S+)\s*(\S+)","$1$2$3");
    Console.WriteLine(str);  //xxx>2
}

------解决方案--------------------
C# code
string temp = @"count(""xxx"") > 2";
                temp = Regex.Replace(temp,@"\w+?\((['""]?)([^'""]+?)\1\)\s*?(.*?)","$2$3");
                //xxx > 2