[C#] 
using System.Text.RegularExpressions;重载1:
替换在 Regex 构造函数中指定的正则表达式所定义的字符模式的所有匹配项。在每个匹配处均调用 MatchEvaluator 委托以计算替换。
[C#] public string Replace(string, MatchEvaluator);重载2:
从输入字符串中的第一个字符开始,用替换字符串替换指定的正则表达式模式的所有匹配项。
[C#] public string Replace(string, string);重载3:
从输入字符串中的第一个字符开始,用替换字符串替换由 Regex 构造函数中指定的正则表达式定义的模式的指定数目的匹配项。在每个匹配处均调用 MatchEvaluator 委托以计算替换。
[C#] public string Replace(string, MatchEvaluator, int);
重载4:
从输入字符串中的第一个字符开始,用指定的替换字符串替换由 Regex 构造函数中指定的正则表达式定义的指定数目的模式匹配项。
[C#] public string Replace(string, string, int);重载5:
从第一个字符开始,用替换字符串替换由正则表达式定义的字符模式的所有匹配项。在每个匹配处均调用 MatchEvaluator 委托以计算替换。
[C#] public static string Replace(string, string, MatchEvaluator);重载6:
从输入字符串中的第一个字符开始,用替换字符串替换由正则表达式定义的匹配的所有匹配项。
[C#] public static string Replace(string, string, string);重载7:
从输入字符串中的指定字符位置开始,用替换字符串替换 Regex 构造函数中指定的模式的指定数目的匹配项。在每个匹配处均调用 MatchEvaluator 委托以计算替换。
[C#] public string Replace(string, MatchEvaluator, int, int);重载8:
从输入字符串中的指定字符位置开始,用指定的替换字符串替换由 Regex 构造函数中指定的正则表达式定义的输入字符串中的模式的指定数目的匹配项。
[C#] public string Replace(string, string, int, int);

解决方案 »

  1.   

    示例:
    class RegExSample 
    {
       static string CapText(Match m) 
       {
          // Get the matched string.
          string x = m.ToString();
          // If the first char is lower case...
          if (char.IsLower(x[0])) 
          {
             // Capitalize it.
             return char.ToUpper(x[0]) + x.Substring(1, x.Length-1);
          }
          return x;
       }
        
       static void Main() 
       {
          string text = "four score and seven years ago";
          System.Console.WriteLine("text=[" + text + "]");
          string result = Regex.Replace(text, @"\w+",
             new MatchEvaluator(RegExSample.CapText));
          System.Console.WriteLine("result=[" + result + "]");
       }
    }
      

  2.   

    yiyi0518(世上的盐和光) :
    这是msdn上的例子,我的意思是
    在静态函数里
    IniFile iniOrdForm = new IniFile(???+@"\Form.ini"); 
    是不是不能用的?
    如果不能该怎么办?