How to Validate date using the Class Pattern?
<p>I made this code with my simple knowledge of using the Class Pattern (java.util.regex.Pattern).  Of course it returns true for all the real dates from <code>0000-00-00</code> to <code>9999-12-31</code>. But unfortunately it still return true for <code>2013-22-01,2013-01-99</code>, . . .etc. Help me to validate it correctly.</p>

<pre><code>String regex = "([0-9]){4}+([-])?([0-2]){2}+([-])?([0-9]){2}";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(textFieldName.getText());
return matcher.find();
</code></pre>
