[Mono-bugs] [Bug 69269][Nor] New - Regex: matching with sets of \s, \t, \n etc doesn't find all matches

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 9 Nov 2004 05:43:42 -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 juergen@cis-comsoft.de.

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

--- shadow/69269	2004-11-09 05:43:41.000000000 -0500
+++ shadow/69269.tmp.27002	2004-11-09 05:43:41.000000000 -0500
@@ -0,0 +1,70 @@
+Bug#: 69269
+Product: Mono: Class Libraries
+Version: 1.0
+OS: GNU/Linux [Other]
+OS Details: Ubuntu 4.10
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: juergen@cis-comsoft.de               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Regex: matching with sets of \s, \t, \n etc doesn't find all matches
+
+Description of Problem:
+Matching of [\s\S] or [ \f\n\r\t\v\S] in a regex doesn't find 
+all matches (or nothing at all)
+
+Steps to reproduce the problem:
+1. 
+using System;
+using System.Text.RegularExpressions;
+
+class MainClass
+{
+	public static void Main(string[] args)
+	{
+		string s = "CREATE aa\faa; CREATE bb\nbb; CREATE cc\rcc; CREATE dd\tdd;
+CREATE ee\vee;";
+		MatchCollection matches = Regex.Matches(s, @"CREATE[\s\S]+?;");
+		foreach(Match m in matches) {
+			Console.WriteLine("Match: " + m.Value);
+		}
+
+		matches = Regex.Matches(s, @"CREATE[ \f\n\r\t\v\S]+?;");
+		Console.WriteLine("#: " + matches.Count);
+	}
+}
+
+Actual Results:
+Match: CREATE aa
+                aa;
+cc;ch: CREATE cc
+Match: CREATE dd        dd;
+Match: CREATE ee
+                ee;
+#: 0
+// the line for bb\nbb is missing, the second regex gives no result at all
+
+Expected Results:
+Match: CREATE aa
+                aa;
+Match: CREATE bb
+bb;
+cc;ch: CREATE cc
+Match: CREATE dd        dd;
+Match: CREATE ee
+                ee;
+#: 5
+
+How often does this happen? 
+everytime
+
+Additional Information:
+MS .NET handles output of some control-chars in console 
+differently but other than that gives expected results