当前位置: 代码迷 >> ASP.NET >> *请问一个关于Regex.Replace的有关问题*
  详细解决方案

*请问一个关于Regex.Replace的有关问题*

热度:5064   发布时间:2013-02-26 00:00:00.0
*************************请教一个关于Regex.Replace的问题*******************
我是这样做的
string   str   =   ".........theForm.Submit();......... ";
string   sTemp   =   Regex.Replace(str   ,   "theForm.Submit(); ", "theForm.Submit();fun1(); ",RegexOption.IgnoreCase);

用上面的代码把把theForm.Submit();替换成theForm.Submit();fun1();
但是程序执行后没有替换,是什么地方没对吗?

------解决方案--------------------------------------------------------
string sTemp = Regex.Replace(str, "theForm\\.Submit\\(\\); ", "theForm.Submit();fun1(); ", RegexOptions.IgnoreCase | RegexOptions.Multiline);
  相关解决方案