[Mono-bugs] [Bug 467369] New: Regex bug with groups

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Jan 19 10:12:10 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=467369


           Summary: Regex bug with groups
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: jbevain at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Running the following snippet:

<<<
using System;
using System.Text.RegularExpressions;

class Test {

    static void Main ()
    {
        var regex = new
Regex("(?:(?<w>\\d+)[.](?<adp>\\d+))|(?:(?<w>\\d+)\\s+(?<n>\\d+)/(?<d>\\d+))|(?:(?<n>\\d+)/(?<d>\\d+))|(?<w>\\d+)");
        string text = "2";

        var m = regex.Matches (text);

        foreach (Match match in m) {
            Console.WriteLine ("w: {0}, adp: {1}", match.Groups ["w"].Value,
match.Groups ["adp"].Value);
            Console.WriteLine ("n: {0}, d: {1}", match.Groups ["n"].Value,
match.Groups ["d"].Value);
        }
    }
}
<<<

net prints:

w: 2, adp:
n: , d:

Mono prints:

C:\Tmp>test
w: 2, adp:
n: 2, d:

So something is different with the `n' group.

-- 
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.


More information about the mono-bugs mailing list