[Mono-list] RegExp Bug ...

Hans-Jürgen Schönig hs@cybertec.at
Wed, 04 Sep 2002 17:34:48 +0200


I have found a bug in the regular expression implementation:
Here is what I am doing:

using System;
using System.Text.RegularExpressions;

public class Demo
{
	public static void Main()
	{
		string str = "Sunday Bloody Sunday";

	        Regex reg = new Regex("d*.y");
		MatchCollection mat = reg.Matches(str);
		Console.WriteLine("Gefunden: " + mat.Count );
	        for     (int i = 0; i < mat.Count; i++)
                {
                        Console.WriteLine("{0} - {1}", i, mat[i]);
                }
	}
}


and that comes out:


[hs@duron regexp]$ mono file.exe
Gefunden: 2
0 - day
1 - day


and that comes out when running windows:

C:\monobsp>csc file.cs
Microsoft (R) Visual C# .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.0.3705
Copyright (C) Microsoft Corporation 2001. All rights reserved.
C:\monobsp>file
Gefunden: 3
0 - day
1 - dy
2 - day
C:\monobsp>


by the way: why is there no way to use d.*y to find day,dy,day? d*.y looks VERY ugly to a Perl programmer ... (thanks to Bill G.).
Can anybody verify this and fill out a bugzilla?

	Hans