using NUnit.Framework;
using System;
+using System.Text;
using System.Text.RegularExpressions;
namespace MonoTests.System.Text.RegularExpressions
m = new Regex("'.*?[^,]'").Match(s1); Assert ("#03", m.Success); AssertEquals ("#03v", s1, m.Value);
m = new Regex("'.*?[^,]'").Match(s2); Assert ("#04", m.Success); AssertEquals ("#04v", s2, m.Value);
}
+
+ [Test]
+ public void Bug78007 ()
+ {
+ string test = "head><html>";
+ string pattern = @"\Ahead>\<html\>";
+ Regex r = new Regex (pattern);
+ Match m = r.Match (test);
+ Assert ("#01", m.Success);
+ AssertEquals ("#01i", 0, m.Index);
+ AssertEquals ("#01l", 14, m.Length);
+
+ m = m.NextMatch ();
+ Assert ("#02", !m.Success);
+ }
+
+ [Test]
+ public void CharClassWithIgnoreCase ()
+ {
+ string str = "Foobar qux";
+ Regex re = new Regex (@"[a-z\s]*", RegexOptions.IgnoreCase);
+ Match m = re.Match (str);
+ AssertEquals ("#01", str, m.Value);
+ }
+
+ void Kill65535_1 (int length)
+ {
+ StringBuilder sb = new StringBuilder ("x");
+ sb.Append ('a', length);
+ sb.Append ('y');
+ string teststring = sb.ToString ();
+ Regex regex = new Regex (@"xa*y");
+ Match m = regex.Match (teststring);
+ Assert ("#01 " + length, m.Success);
+ AssertEquals ("#02 " + length, m.Index, 0);
+ AssertEquals ("#03 " + length, m.Length, teststring.Length);
+ }
+
+ void Kill65535_2 (int length)
+ {
+ StringBuilder sb = new StringBuilder ("xaaaax");
+ sb.Append ('a', length);
+ sb.Append ('y');
+ string teststring = sb.ToString ();
+ Regex regex = new Regex (@"x.*y");
+ Match m = regex.Match(teststring);
+ Assert ("#01 " + length, m.Success);
+ AssertEquals ("#02 " + length, m.Index, 0);
+ AssertEquals ("#03 " + length, m.Length, teststring.Length);
+ }
+
+
+ [Test] // Based on bug #78278
+ public void No65535Limit ()
+ {
+ Kill65535_1 (65535);
+ Kill65535_1 (65536);
+ Kill65535_1 (131071);
+ Kill65535_1 (131072);
+
+ Kill65535_2 (65530);
+ Kill65535_2 (65531);
+ Kill65535_2 (131066);
+ Kill65535_2 (131067);
+ }
}
}