[Mono-bugs] [Bug 79347][Nor] New - Regex.Replace bug

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Sep 9 15:40:27 EDT 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by alan.mcgovern at gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=79347

--- shadow/79347	2006-09-09 15:40:27.000000000 -0400
+++ shadow/79347.tmp.8594	2006-09-09 15:40:27.000000000 -0400
@@ -0,0 +1,61 @@
+Bug#: 79347
+Product: Mono: Class Libraries
+Version: 1.0
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: rharinath at novell.com                            
+ReportedBy: alan.mcgovern at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Summary: Regex.Replace bug
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+Regex is throwing an exception on a simple regex command. All the regex
+does is replace "announce" with "scrape".
+
+
+Steps to reproduce the problem:
+1. Compile and run the code below
+
+
+using System;
+using System.Text.RegularExpressions;
+
+namespace ConsoleApplication5
+{
+    class Program
+    {
+        static void Main(string[] args)
+        {
+            string announceUrl = "http://myannounceurl/test/announce.php";
+            string scrapeUrl = "";
+            if (announceUrl.Substring(announceUrl.LastIndexOf('/') + 1, 8)
+== "announce")
+            {
+                Regex r = new Regex("announce", RegexOptions.RightToLeft);
+                scrapeUrl = r.Replace(announceUrl, "scrape", 1);
+            }
+
+            bool isRightResult = (scrapeUrl ==
+"http://myannounceurl/test/scrape.php");
+            Console.WriteLine("Is right result: " + isRightResult.ToString());
+        }
+    }
+}
+
+Actual Results:
+Throws an exception.
+
+Expected Results:
+Should print out "true".
+
+How often does this happen? 
+Every time.


More information about the mono-bugs mailing list