Regex是String吗?string的replace函数是没有3个参数的,他override过了?

解决方案 »

  1.   

    ms-help://MS.NETFrameworkSDK.CHS/cpref/html/frlrfSystemTextRegularExpressionsRegexClassReplaceTopic.htm
      

  2.   

    从输入字符串中的第一个字符开始,用替换字符串替换由正则表达式定义的匹配的所有匹配项。[Visual Basic]
    <Serializable>
    Overloads Public Shared Function Replace( _
       ByVal input As String, _
       ByVal pattern As String, _
       ByVal replacement As String _
    ) As String
    [C#]
    [Serializable]
    public static string Replace(
       string input,
       string pattern,
       string replacement
    );
    [C++]
    [Serializable]
    public: static String* Replace(
       String* input,
       String* pattern,
       String* replacement
    );
    [JScript]
    public
       Serializable
    static function Replace(
       input : String,
       pattern : String,
       replacement : String
    ) : String;
    参数
    input 
    要修改的字符串。 
    pattern 
    要匹配的正则表达式模式。 
    replacement 
    替换字符串。 
    返回值
    已修改的字符串。备注
    替换只能在替换模式中使用。对于正则表达式中的类似功能,请使用 backreference,如\1。字符转义和替换是替换模式中识别的仅有的特殊构造。所有其他的语法构造只能在正则表达式中使用,在替换模式中不被识别。例如,替换模式 a*${test}b 插入字符串“a*”,后跟由“test”捕获组匹配的子字符串,如可能后面还有字符串“b”。在替换模式中 * 字符不被识别为元字符。同样,在正则表达式匹配模式中不识别$ 模式。在正则表达式中,$ 表示字符串的结尾。其他例子还有:$123 替换由组号 123(十进制)匹配的最后一个子字符串,${name) 替换由 (?<name>) 组匹配的最后一个子字符串。静态 Replace 方法等效于使用指定的正则表达式模式构造 Regex 对象并调用实例方法 Replace。提供静态方法是为了独立、单独地使用正则表达式,而不用显式创建 Regex 对象。
      

  3.   

    将此实例中的指定 Unicode 字符或 String 的所有匹配项替换为其他指定的 Unicode 字符或 String。重载列表
    将此实例中的指定 Unicode 字符的所有匹配项替换为其他指定的 Unicode 字符。受 .NET Framework 精简版的支持。[Visual Basic] Overloads Public Function Replace(Char, Char) As String
    [C#] public string Replace(char, char);
    [C++] public: String* Replace(__wchar_t, __wchar_t);
    [JScript] public function Replace(Char, Char) : String;
    将此实例中的指定 String 的所有匹配项替换为其他指定的 String。受 .NET Framework 精简版的支持。[Visual Basic] Overloads Public Function Replace(String, String) As String
    [C#] public string Replace(string, string);
    [C++] public: String* Replace(String*, String*);
    [JScript] public function Replace(String, String) : String;
    示例
    下面的代码示例说明如何使用 Replace 方法来更正拼写错误。[Visual Basic] 
    Imports SystemPublic Class ReplaceTest
        
        Public Shared Sub Main()
            Dim errString As String = "This docment uses 3 other docments to docment the docmentation"
                    
            Console.WriteLine("The original string is:{0}'{1}'{0}", Environment.NewLine, errString)        ' Correct the spelling of "document".  
            Dim correctString As String = errString.Replace("docment", "document")
          
            Console.WriteLine("After correcting the string, the result is:{0}'{1}'", Environment.NewLine, correctString)
        End Sub 'Main
    End Class 'ReplaceTest
    string的replace函数是没有3个参数的 你或者写错了   或者他重载了