/*
 * ValidarFecha.java
 *
 * Created on 28 de marzo de 2007, 10:05 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.fidufosyga.rules.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 
 * @author Jsolano
 */
public class ValidarFecha {

	private static Pattern pattern;

	static {
		pattern = Pattern
				.compile("(0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/](18|19|20)[0-9]{2}");

	}

	/** Creates a new instance of ValidarFecha */
	public ValidarFecha() {
	}

	public static boolean esFecha(String field) {
		if (field.length() != 10) {
			return false;
		}

		Matcher matcher = pattern.matcher(field);
		return matcher.find();

	}
}
