[Mono-bugs] [Bug 74735][Wis] New - Inconsistent behavior in Regex.Replace when using ${n}

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 26 Apr 2005 12:18:43 -0400 (EDT)


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 m@pernecky.sk.

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

--- shadow/74735	2005-04-26 12:18:43.000000000 -0400
+++ shadow/74735.tmp.12031	2005-04-26 12:18:43.000000000 -0400
@@ -0,0 +1,68 @@
+Bug#: 74735
+Product: Mono: Class Libraries
+Version: 1.1
+OS: All
+OS Details: Fedora Core 3
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: m@pernecky.sk               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Inconsistent behavior in Regex.Replace when using ${n}
+
+Mono throws exception where MS does handle it without error (even if not 
+more logical).
+
+Steps to reproduce the problem:
+Regex.Replace ("text", "x", "${1}");
+
+Actual Results:
+System.ArgumentException: Bad group name.
+in <0x00330> System.Text.RegularExpressions.ReplacementEvaluator:
+CompileTerm (System.String str, System.Int32 ptr)
+in <0x000b5> System.Text.RegularExpressions.ReplacementEvaluator:Compile 
+(System.String replacement)
+in <0x00043> System.Text.RegularExpressions.ReplacementEvaluator:.ctor 
+(System.Text.RegularExpressions.Regex regex, System.String replacement)
+in <0x00028> System.Text.RegularExpressions.Regex:Replace (System.String 
+input, System.String replacement, Int32 count, Int32 startat)
+in <0x0004c> System.Text.RegularExpressions.Regex:Replace (System.String 
+input, System.String replacement)
+in <0x00038> System.Text.RegularExpressions.Regex:Replace (System.String 
+input, System.String pattern, System.String replacement, RegexOptions 
+options)
+in <0x00012> System.Text.RegularExpressions.Regex:Replace (System.String 
+input, System.String pattern, System.String replacement)
+in <0x00063> ASP.test_aspx:__RenderTree (System.Web.UI.HtmlTextWriter 
+__output, System.Web.UI.Control parameterContainer)
+in (wrapper delegate-invoke) System.MulticastDelegate:
+invoke_void_HtmlTextWriter_Control (System.Web.UI.HtmlTextWriter,System.
+Web.UI.Control)
+in <0x0002e> System.Web.UI.Control:RenderChildren (System.Web.UI.
+HtmlTextWriter writer)
+in <0x00011> System.Web.UI.Control:Render (System.Web.UI.HtmlTextWriter 
+writer)
+in <0x00020> System.Web.UI.Control:RenderControl (System.Web.UI.
+HtmlTextWriter writer)
+in <0x0036d> System.Web.UI.Page:InternalProcessRequest ()
+in <0x000a9> System.Web.UI.Page:ProcessRequest (System.Web.HttpContext 
+context)
+in <0x00233> System.Web.HttpApplication+ExecuteHandlerState:Execute ()
+in <0x0007c> System.Web.HttpApplication+StateMachine:ExecuteState 
+(IStateHandler state, System.Boolean readysync)
+
+Expected Results:
+te${1}t
+
+How often does this happen? 
+Always
+
+Additional Information:
+Mono throws exception when the group is not founded, MS .NET FW returns the 
+text of the reference. This behavior is inconsistent.