[Mono-bugs] [Bug 446897] New: rgx.Replace("", "anything")
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed Nov 19 19:50:24 EST 2008
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: mono-bugs at lists.ximian.com
ReportedBy: moko at moko.ru
QAContact: mono-bugs at lists.ximian.com
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.
More information about the mono-bugs
mailing list