C#正则表达式 委托替换

      MatchEvaluator myEvaluator = new MatchEvaluator(ReplaceCC);

            string sRegexInput = @"<INPUT.*?value=([0-9\.]*).*?>";  //替换input
            string sRegexSel = "<SELECT.*?selected>(.*?)</OPTION>.*?</SELECT>"; //替换sel

            string strWithOutInput = Regex.Replace(hnExcel.Value, sRegexInput, myEvaluator);
            string strWithOutSelect = Regex.Replace(strWithOutInput, sRegexSel, myEvaluator);

            sw.Write(header + strWithOutSelect);

protected static string ReplaceCC(Match m)
        {
            return m.Groups[1].Value;
        }

原文地址:https://www.cnblogs.com/wucg/p/1701076.html