// Path: src/main/java/de/jformchecker/Criterion.java
// @FunctionalInterface
// public interface Criterion {
// 	/**
// 	 * Tests whether the specified value satisfies this criterion.
// 	 * 
// 	 * @param value
// 	 *            to be tested against this criterion.
// 	 * @return a ValidationResult which holds true or false for validaton result
// 	 *         and a potential errormsg
// 	 */
// 	public ValidationResult validate(FormCheckerElement value);
// 
// }
// 
// Path: src/main/java/de/jformchecker/FormCheckerElement.java
// public interface FormCheckerElement {
// 
// 	// RFE: check, if some methods can be protected
// 
// 	// get internal name of this input-element
// 	public String getName();
// 	
// 	// set internal name
// 	public void setName(String name);
// 
// 
// 	// get the value that the user entered
// 	public String getValue();
// 
// 	// get the value that the user entered, but html-encoded
// 	@Deprecated
// 	public String getValueHtmlEncoded();
// 
// 	public void setValue(String value);
// 
// 	public String getPreSetValue();
// 
// 	// set an initial value to the element, before the user edited it.
// 	public <T extends FormCheckerElement> T setPreSetValue(String value);
// 
// 	public <T extends FormCheckerElement> T setTabIndex(int tabIndex);
// 
// 	public int getTabIndex();
// 
// 	public int getLastTabIndex();
// 
// 	// set the test in the label (builder pattern)
// 	
// 	public <T extends FormCheckerElement> T setDescription(String desc);
// 
// 	// as "setDescription" but does not return anything (no builder pattern)
// 	public void changeDescription(String desc);
// 
// 	public String getDescription();
// 
// 	// returns true if element is valid
// 	public boolean isValid();
// 
// 	public void setInvalid();
// 
// 	// inits the value with the current http-request
// 	public void init(Request req, boolean firstrun, Validator validator);
// 
// 	public ValidationResult getValidationResult();
// 
// 	public void setValidationResult(ValidationResult validationResult);
// 
// 	public String getInputTag();
// 
// 	public String getInputTag(Map<String, String> attributes, MessageSource messageSource, boolean html5Validation);
// 	
// 	@Deprecated
// 	public String getInputTag(Map<String, String> attributes);
// 
// 	public boolean isRequired();
// 
// 	public <T extends FormCheckerElement> T setRequired();
// 
// 	public List<Criterion> getCriteria();
// 
// 	public void setFormChecker(FormChecker fc);
// 
// 	// returns the complete label-html tag
// 	public String getLabel();
// 
// 	// returns the label-html and the input-html
// 	public String getCompleteInput(); // RFE: Perhaps toString makes this even
// 										// more convenient?!
// 
// 	public String getHelpText();
// 
// 	// sets the size attribute
// 	public <T extends FormCheckerElement> T setSize(int size);
// 
// 	public String getType();
// 
// }


import java.util.regex.Pattern;
import de.jformchecker.Criterion;
import de.jformchecker.FormCheckerElement;
package de.jformchecker.criteria;



/**
 * Checks if a string matches a regular expression.
 * 
 * Based on work of armandino (at) gmail.com
 */
public class Regex implements Criterion {
	private Pattern pattern;
	private String errorMsg = "jformchecker.regexp";

// Path: src/main/java/de/jformchecker/Criterion.java
// @FunctionalInterface
// public interface Criterion {
// 	/**
// 	 * Tests whether the specified value satisfies this criterion.
// 	 * 
// 	 * @param value
// 	 *            to be tested against this criterion.
// 	 * @return a ValidationResult which holds true or false for validaton result
// 	 *         and a potential errormsg
// 	 */
// 	public ValidationResult validate(FormCheckerElement value);
// 
// }
// 
// Path: src/main/java/de/jformchecker/FormCheckerElement.java
// public interface FormCheckerElement {
// 
// 	// RFE: check, if some methods can be protected
// 
// 	// get internal name of this input-element
// 	public String getName();
// 	
// 	// set internal name
// 	public void setName(String name);
// 
// 
// 	// get the value that the user entered
// 	public String getValue();
// 
// 	// get the value that the user entered, but html-encoded
// 	@Deprecated
// 	public String getValueHtmlEncoded();
// 
// 	public void setValue(String value);
// 
// 	public String getPreSetValue();
// 
// 	// set an initial value to the element, before the user edited it.
// 	public <T extends FormCheckerElement> T setPreSetValue(String value);
// 
// 	public <T extends FormCheckerElement> T setTabIndex(int tabIndex);
// 
// 	public int getTabIndex();
// 
// 	public int getLastTabIndex();
// 
// 	// set the test in the label (builder pattern)
// 	
// 	public <T extends FormCheckerElement> T setDescription(String desc);
// 
// 	// as "setDescription" but does not return anything (no builder pattern)
// 	public void changeDescription(String desc);
// 
// 	public String getDescription();
// 
// 	// returns true if element is valid
// 	public boolean isValid();
// 
// 	public void setInvalid();
// 
// 	// inits the value with the current http-request
// 	public void init(Request req, boolean firstrun, Validator validator);
// 
// 	public ValidationResult getValidationResult();
// 
// 	public void setValidationResult(ValidationResult validationResult);
// 
// 	public String getInputTag();
// 
// 	public String getInputTag(Map<String, String> attributes, MessageSource messageSource, boolean html5Validation);
// 	
// 	@Deprecated
// 	public String getInputTag(Map<String, String> attributes);
// 
// 	public boolean isRequired();
// 
// 	public <T extends FormCheckerElement> T setRequired();
// 
// 	public List<Criterion> getCriteria();
// 
// 	public void setFormChecker(FormChecker fc);
// 
// 	// returns the complete label-html tag
// 	public String getLabel();
// 
// 	// returns the label-html and the input-html
// 	public String getCompleteInput(); // RFE: Perhaps toString makes this even
// 										// more convenient?!
// 
// 	public String getHelpText();
// 
// 	// sets the size attribute
// 	public <T extends FormCheckerElement> T setSize(int size);
// 
// 	public String getType();
// 
// }


// Path: src/main/java/de/jformchecker/criteria/Regex.java
import java.util.regex.Pattern;
import de.jformchecker.Criterion;
import de.jformchecker.FormCheckerElement;

package de.jformchecker.criteria;



/**
 * Checks if a string matches a regular expression.
 * 
 * Based on work of armandino (at) gmail.com
 */
public class Regex implements Criterion {
	private Pattern pattern;
	private String errorMsg = "jformchecker.regexp";

	public void setErrorMsg(String errorMsg) {