C#正则表达式之字符替换

string strTest= "www.BaiDu.com",strRst="";

            //忽略大小写,将strTest中的BaiDu替换为baidu
            Regex myRegex = new Regex("baidu",RegexOptions.IgnoreCase);
            strRst=myRegex.Replace(strTest,"baidu");


            Console.WriteLine("
替换前的字符串为:"+strTest);
            Console.WriteLine("
替换后的字符串为:"+strRst);
            Console.WriteLine();

            Console.WriteLine(The_Day.getTheDay()+" By yxHuang!...");

            //暂停,用于查看效果 
            Console.Read();
原文地址:https://www.cnblogs.com/iack/p/3540577.html