[Mono-bugs] [Bug 51146][Min] New - Regex.Split doesn't handle capturing groups expression correctly

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 19 Nov 2003 02:45:24 -0500 (EST)


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 guyagl@yahoo.com.

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

--- shadow/51146	2003-11-19 02:45:24.000000000 -0500
+++ shadow/51146.tmp.30733	2003-11-19 02:45:24.000000000 -0500
@@ -0,0 +1,59 @@
+Bug#: 51146
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: guyagl@yahoo.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Regex.Split doesn't handle capturing groups expression correctly
+
+Regex.Split is documented as:
+"If capturing groups are used in a Regex.Split expression, the capturing
+groups are included in the resulting string array."
+
+But the current implementation makes no distinction whether an expression
+is in a capturing group or not.  The results are the same.
+
+
+Sample to reproduce the problem: 
+using System;
+using System.Text.RegularExpressions;
+
+class spliterr {
+    public static void Main() {
+        String[] splitResult = new Regex("(-)").Split("a-bcd-e-fg");
+        foreach (string token in splitResult) {
+            Console.WriteLine(token);
+        }
+    }
+}
+
+
+Actual Results:
+a
+bcd
+e
+fg
+
+Expected Results:
+a
+-
+bcd
+-
+e
+-
+fg
+
+How often does this happen? 
+always
+
+Additional Information: