[Mono-list] RegExp Bug ...
John Duncan
jddst19@mac.com
Wed, 4 Sep 2002 11:08:26 -0500
Hans,
It's interesting to me that the two results are different but I also am
curious as to what you're trying to accomplish. The regular expression
should also match the "ny" in "Sunny" just the same as it should match
the "ddy" in "paddy".
Kind of strange.... Is that are you trying to accomplish? (You are
right, of course, that mcs is errant here.)
John
On Wednesday, September 4, 2002, at 10:34 AM, Hans-Jürgen Schönig wrote:
> 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
>
>
>
>
> _______________________________________________
> Mono-list maillist - Mono-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list