https://bugzilla.novell.com/show_bug.cgi?id=446897


           Summary: rgx.Replace("", "anything")
           Product: Mono: Class Libraries
           Version: 1.2.5
          Platform: Other
        OS/Version: FreeBSD
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [email protected]
          Found By: ---


When Replace is called on empty string, it does not replace 
if pattern matches.

using System;
using System.Text.RegularExpressions;

class Example
{
   public static void Main()
   {
      string pattern = @".*";
      Regex rgx = new Regex(pattern);

      string inputStr = "";

      string outputStr = rgx.Replace(inputStr, "ok");

      Console.WriteLine(
          String.Format("Pattern:       \"{0}\"", pattern) + "\n"+
          String.Format("Input string:  \"{0}\"", inputStr) + "\n"+
          String.Format("Output string: \"{0}\"", outputStr) + "\n"
      );
   }
}

Result on MONO:

Pattern:       ".*"
Input string:  ""
Output string: ""

Result on Microsoft .NET:

Pattern:       ".*"
Input string:  ""
Output string: "ok"


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to