public void FindAllMatches(byte[] input) { var e = Regex2.Matches(new String8(input, 0, input.Length), Regex).GetEnumerator(); while (e.MoveNext()) { } }
public void FindAllMatches(string input) { byte[] buffer = null; String8 input8 = String8.Convert(input, ref buffer); var e = Regex2.Matches(input8, Regex).GetEnumerator(); while (e.MoveNext()) { } }
public void TwoMatches() { Regex2 regex = new Regex2("thing", AlgorithmType); Match2[] matches = regex.Matches("A thing or another thing").ToArray(); Match2[] expected = new Match2[] { Factory.CreateMatch(2, 5, "thing"), Factory.CreateMatch(19, 5, "thing") }; CollectionAssert.AreEqual(expected, matches, "MatchCollection"); Assert.AreEqual(matches[1], matches[0].NextMatch(), "NextMatch/1."); Assert.AreEqual(Match2.Empty, matches[1].NextMatch(), "NextMatch/2."); Assert.AreEqual(Match2.Empty, matches[1].NextMatch().NextMatch(), "NextMatch/3."); }
public static List <string> Garbage2(this string input) { var result = new List <string>(); var matchCollection = Regex2.Matches(input); if (matchCollection.Count != 0) { //foreach (Match c in matchCollection) //{ // var s = c.Value.Substring(1, c.Value.Length - 2);//; // if (s.IsSurrounded()) // { // sum += Score(s, level + 1); // } // else // { // int start = 0; // for (int j = 0; start + j < s.Length; j++) // { // if (s.Substring(start, j + 1).IsSurrounded()) // { // sum += Score(s.Substring(start, j + 1), level + 1); // start += j + 2; // j = 0; // Console.WriteLine(); // } // else // { // Console.WriteLine(); // } // } // //foreach (var s1 in s.Split(',')) // //{ // // sum += Score(s1, level + 1); // //} // } // // //} } return(result); }