[Mono-bugs] [Bug 45976][Nor] New - Regular expression character classes don't work with IgnoreCase

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Tue, 8 Jul 2003 11:04:31 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by joergr@voelcker.com.

http://bugzilla.ximian.com/show_bug.cgi?id=45976

--- shadow/45976	Tue Jul  8 11:04:31 2003
+++ shadow/45976.tmp.30916	Tue Jul  8 11:04:31 2003
@@ -0,0 +1,86 @@
+Bug#: 45976
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Debian Woody
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: JoergR@voelcker.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Regular expression character classes don't work with IgnoreCase
+
+Description of Problem:
+Regular expressions using character classes don't work as expected when
+interpreted using option RegexOptions.IgnoreCase.
+
+Steps to reproduce the problem:
+using System;
+using System.Text.RegularExpressions;
+
+namespace Bug
+{
+	public class MainClass
+	{
+		public static void Main()
+		{
+			try
+			{
+				string test = "ABBA";
+				string [] expressions = new string [] 
+					{ 
+						"[A-F]+",
+						"[A-Fa-f]+",
+						"[A-Z]+",
+						"[A-Za-z]+",
+						"[AB]+",
+						"[ABab]+"
+					};
+	
+				foreach ( string expression in expressions )
+				{
+					Match match = Regex.Match( test, expression, RegexOptions.IgnoreCase );
+
+					if(match.Success)
+						Console.WriteLine("String <{0}> matches pattern <{1}>.", test,
+expression);
+					else
+						Console.WriteLine("String <{0}> doesn't match pattern <{1}>.", test,
+expression);
+				}
+			}
+			catch ( Exception ex )
+			{
+				Console.WriteLine("Exception caught: {0}", ex);
+			}
+		}
+	}
+}
+
+
+Actual Results:
+String <ABBA> doesn't match pattern <[A-F]+>.
+String <ABBA> matches pattern <[A-Fa-f]+>.
+String <ABBA> doesn't match pattern <[A-Z]+>.
+String <ABBA> matches pattern <[A-Za-z]+>.
+String <ABBA> doesn't match pattern <[AB]+>.
+String <ABBA> matches pattern <[ABab]+>.
+
+Expected Results:
+String <ABBA> matches pattern <[A-F]+>.
+String <ABBA> matches pattern <[A-Fa-f]+>.
+String <ABBA> matches pattern <[A-Z]+>.
+String <ABBA> matches pattern <[A-Za-z]+>.
+String <ABBA> matches pattern <[AB]+>.
+String <ABBA> matches pattern <[ABab]+>.
+
+How often does this happen? 
+Always.
+
+Additional Information: