@@ -0,0 +1,683 @@
+import regex.Matcher;%0Aimport regex.Pattern;%0A%0Apublic class Regex %7B%0A  private static void expect(boolean v) %7B%0A    if (! v) throw new RuntimeException();%0A  %7D%0A%0A  private static Matcher getMatcher(String regex, String string) %7B%0A    return Pattern.compile(regex).matcher(string);%0A  %7D%0A%0A  private static void expectMatch(String regex, String string) %7B%0A    expect(getMatcher(regex, string).matches());%0A  %7D%0A%0A  private static void expectNoMatch(String regex, String string) %7B%0A    expect(!getMatcher(regex, string).matches());%0A  %7D%0A%0A  public static void main(String%5B%5D args) %7B%0A    expectMatch(%22a(bb)?a%22, %22abba%22);%0A    expectNoMatch(%22a(bb)?a%22, %22abbba%22);%0A    expectNoMatch(%22a(bb)?a%22, %22abbaa%22);%0A  %7D%0A%7D%0A

Add a unit test for the regular expression engine