在VS里
con.ContId = this.textBoxContID.Text;
类似这种代码有近百行,想改成
this.textBoxContID.Text=con.ContId;想直接用编辑器的查找替换功能,正则要怎么写?

解决方案 »

  1.   

     string patternstr = @"([^=]*)=([^;]*);";
            Regex.Replace(str, patternstr, "$2=$1;");
    试试
      

  2.   

    你试了没有!?string str = "con.ContId = this.textBoxContID.Text;";
            string patternstr = @"([^=]*)=([^;]*);";
            str = Regex.Replace(str, patternstr, "$2=$1;");
            Response.Write(str);