01: package org.jreform.criteria;
02:
03: /**
04: * Checks that the value conforms to the U.S. ZIP code format.
05: *
06: * @author armandino (at) gmail.com
07: */
08: public final class ZipCode extends Regex {
09: private static final String REGEX = "^\\d{5}(-\\d{4})?$";
10:
11: ZipCode() {
12: super (REGEX);
13: }
14:
15: protected String generateErrorMessage() {
16: return "Please enter a valid ZIP code";
17: }
18:
19: }
|