@Test
public void testRegex() {

  assertEquals(3, Patterns.regex("a*").match("aaab", 0, 4));
  assertEquals(3, Patterns.regex("a*").match("aaab", 0, 3));
  assertEquals(2, Patterns.regex("a*").match("aaab", 0, 2));
  assertEquals(0, Patterns.regex("a*").match("bbbb", 2, 2));
  assertEquals(MISMATCH, Patterns.regex("a+").match("aaab", 0, 0));
  assertEquals(MISMATCH, Patterns.regex("a*").match("aaab", 3, 2));
}