(1970-2029) :
Pattern pattern;
Matcher matcher;
String errorTag = null;
private static final String PATTERN_YEAR = "^(197\\d{1}|198\\d{1}|199\\d{1}|200\\d{1}|201\\d{1}|202\\d{1})";
...
if (filter.getName().contains("YYYY")){
pattern = Pattern.compile(PATTERN_YEAR);
matcher = pattern.matcher(filter.getValue());
if(!matcher.matches()){
errorTag= " *** The year is invalid, review the rate";
}
}
source
share