"(^$|\\d{4}-\\d{2}-\\d{2})|(\\d{4}-\\d{2})|(\\d{4})"
https://www.regexplanet.com/share/index.html?share=yyyypebe43d