[Mono-bugs] [Bug 675288] RegEx qualifier {0} differs from Microsoft implementation (and expectation)
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Fri Feb 25 20:13:47 EST 2011
https://bugzilla.novell.com/show_bug.cgi?id=675288
https://bugzilla.novell.com/show_bug.cgi?id=675288#c1
Damien Degois <damien at degois.info> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |damien at degois.info
--- Comment #1 from Damien Degois <damien at degois.info> 2011-02-26 01:13:46 UTC ---
Proposed patch for review/integration of
mcs/class/System/System.Text.RegularExpressions/parser.cs
--- mcs/class/System/System.Text.RegularExpressions/ORG_parser.cs 2011-02-26
01:53:57.492607003 +0100
+++ mcs/class/System/System.Text.RegularExpressions/parser.cs 2011-02-26
02:00:03.912607003 +0100
@@ -774,7 +774,7 @@
/* assign min and max */
min = n;
- if (m > 0)
+ if (m >= 0)
max = m;
else
max = 0x7fffffff;
Regards,
Damien Degois
PS: Follows, new test code:
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");
ShowMatchCollection(mc);
Console.WriteLine("-----------------------------");
Console.WriteLine("Test #2: (expected 1 match)");
r = new Regex("a(?:b|c){0}(d)");
mc = r.Matches("ad");
ShowMatchCollection(mc);
Console.WriteLine("-----------------------------");
Console.WriteLine("Test #3: (expected 1 match)");
r = new Regex("a(?:b|c){0,}(d)");
mc = r.Matches("abbcbcd");
ShowMatchCollection(mc);
Console.WriteLine("-----------------------------");
Console.WriteLine("Test #4: (expected NO match)");
r = new Regex("a(?:b|c){,2}(d)");
mc = r.Matches("abbcbcd");
ShowMatchCollection(mc);
Console.WriteLine ("Ends.");
}
public static void ShowMatchCollection(MatchCollection mc) {
int match_count = 0;
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));
}
match_count++;
Console.WriteLine();
}
Console.WriteLine("Got {0} match(s)",match_count);
}
}
}
--
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