I have a date field that takes a date with the "dd/MM/yyy" format or "yyyy". So I used this regex:
REGEX_DATE = "^((([0]{1}[1-9]{1})|([1-2]{1}[0-9]{1})|([3]{1}[0-1]{1}))"
            + "/(([0]{1}[1-9]{1})|([1]{1}[0-2]{1}))/([0-9]{4}))"
            + "|(([1]{1}([9]{1})[1-9]{1}[0-9]{1}))"
            + "|(([2]{1}([0-9]{3}))) "
            + "|^((([0]{1}[1-9]{1})|([1-2]{1}[0-9]{1})|([3]{1}[0-1]{1}))(([0]{1}[1-9]{1})|([1]{1}[0-2]{1}))([0-9]{4}))"
            + "|^$";
But the dates with the format "yyyy" are not working. Where is my mistake?
Thanks!