https://bugzilla.novell.com/show_bug.cgi?id=675288
https://bugzilla.novell.com/show_bug.cgi?id=675288#c0 Summary: RegEx qualifier {0} differs from Microsoft implementation (and expectation) Classification: Mono Product: Mono: Class Libraries Version: 2.6.x Platform: i686 OS/Version: Ubuntu Status: NEW Severity: Normal Priority: P5 - None Component: System AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- Created an attachment (id=416386) --> (http://bugzilla.novell.com/attachment.cgi?id=416386) testREGEXP.cs User-Agent: Mozilla/5.0 (X11; U; Linux i686; en; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13 Hello, There is a difference at runtime between Mono and Microsoft interpretation of the {0} RegExp qualifier: The "a(?:b|c){0}c" should not match abc because of the {0}. I have the following output on Linux: Test #1: (expected NO match) 0:acd 1:d ----------------------------- Test #2: (expected 1 match) 0:ad 1:d Ends. And the following one on Microsoft Windows 7 (same binary, not recompiled using VC# nor MS csc) Test #1: (expected NO match) ----------------------------- Test #2: (expected 1 match) 0:ad 1:d Ends. I also tested it using python, and it reacts as MS interpretation. Regards, Damien Degois using System; using System.Text.RegularExpressions; namespace testREGEXP { class MainClass { public static void Main (string[] args) { Regex r; MatchCollection mc; Console.WriteLine("Test #1: (expected NO match)"); r = new Regex("a(?:b|c){0}(d)"); mc = r.Matches("acd"); foreach(Match m in mc) { for (int i = 0; i < m.Groups.Count; i++) { Console.Write(string.Format("{0}:{1}\t",i,m.Groups[i].Value)); } Console.WriteLine(); } Console.WriteLine("-----------------------------"); Console.WriteLine("Test #2: (expected 1 match)"); r = new Regex("a(?:b|c){0}(d)"); mc = r.Matches("ad"); foreach(Match m in mc) { for (int i = 0; i < m.Groups.Count; i++) { Console.Write(string.Format("{0}:{1}\t",i,m.Groups[i].Value)); } Console.WriteLine(); } Console.WriteLine ("Ends."); } } } Reproducible: Always Steps to Reproduce: 1. Compile the given source 2. Run it on Linux 3. Run it on Windows Actual Results: Test #1: (expected NO match) 0:acd 1:d ----------------------------- Test #2: (expected 1 match) 0:ad 1:d Ends. Expected Results: Test #1: (expected NO match) ----------------------------- Test #2: (expected 1 match) 0:ad 1:d Ends. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
