package com.alexfu.formvalidator.rules;


import com.alexfu.formvalidator.utils.Patterns;

public class EmailRule implements ValidationRule {
  private final String errorMessage;

  public EmailRule(String errorMessage) {
    this.errorMessage = errorMessage;
  }

  @Override
  public String errorMessage() {
    return errorMessage;
  }

  @Override
  public boolean isValid(String input) {
    return Patterns.EMAIL_ADDRESS.matcher(input).matches();
  }
}

@@ -111,344 +111,116 @@
 ule 
-implements ValidationRule %7B%0A  private final String errorMessage;%0A%0A  public EmailRule(String errorMessage) %7B%0A    this.errorMessage = errorMessage;%0A  %7D%0A%0A  @Override%0A  public String errorMessage() %7B%0A    return errorMessage;%0A  %7D%0A%0A  @Override%0A  public boolean isValid(String input) %7B%0A    return Patterns.EMAIL_ADDRESS.matcher(input).matches(
+extends RegexRule %7B%0A  public EmailRule(String errorMessage) %7B%0A    super(Patterns.EMAIL_ADDRESS, errorMessage
 );%0A 

Refactor EmailRule to inherit RegexRule