[Mono-bugs] [Bug 48666][Nor] New - Regex.Replace makes replaces with empty strings

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 20 Sep 2003 18:52:52 -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 carlosga@telefonica.net.

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

--- shadow/48666	2003-09-20 18:52:52.000000000 -0400
+++ shadow/48666.tmp.26697	2003-09-20 18:52:52.000000000 -0400
@@ -0,0 +1,59 @@
+Bug#: 48666
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: Linux Red Hat 8
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: carlosga@telefonica.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Regex.Replace makes replaces with empty strings
+
+Hello:
+
+I'm testing my .net data providers for postgresql and firebird under linux
+using mono, both providers uses regular expressions to extract named
+parameters from the command text, and uses Regex.Replace to replace named
+parameters with the correct syntax supported by the RDBMS, the problem is
+that Regex.Reaplace in mono replace all with empty strings ( but it works
+ok using NS .NET under windows ), an example:
+
+Original command 
+
+insert into public.test_table values(@int4_field, @char_field,
+@varchar_field, @single_field, @double_field, @date_Field, @time_field,
+@timestamp_field)
+
+Modified command ( using Regex.Replace )
+
+insert into public.test_table values(, , , , , , , )
+
+
+Here is the regular expression i'm using for this:
+
+Regex search = new Regex("(@([a-zA-Z-$][a-zA-Z0-9_$]*))");
+
+
+And the Regex.Replace command:
+
+commandText = search.Replace(commandText, @"$$" + (i + 1).ToString(), 1);
+
+another example:
+
+sqlText = search.Replace(sqlText, "?");
+
+I have tested it with latest mono cvs sources.
+
+
+--
+Best regards
+
+Carlos Guzman Alvarez
+Vigo-Spain