@Override
protected Validator createValidator() {
FacesContext ctx = FacesContext.getCurrentInstance();
Application app = ctx.getApplication();
RegexValidator validator =
(RegexValidator) app.createValidator("com.sun.faces.ext.validator.RegexValidator");
validator.setPattern((String) regex.getValue(ctx.getELContext()));
return validator;
}