KK
регексы представляют собой дополнительную сложность, не стоит их необдуманно пихать
Size: a a a
KK
M
KK
DK
N
KK
setLenient
надо прописатьKK
AK
try {
SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy");
try {
Date d = format.parse(monthDayToFrom);
if(!monthDayToFrom.equals(format.format(d)))
return "Это не дата";
} catch..
AK
M
try {
SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy");
try {
Date d = format.parse(monthDayToFrom);
if(!monthDayToFrom.equals(format.format(d)))
return "Это не дата";
} catch..
KK
KK
AK
N
БС
БС
Almost 5 years after posting this answer, I realize that this is a stupid way to validate a date format. But i'll just leave this here to tell people that using regex to validate a date is unacceptable
AK
KK
try {
SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy");
try {
Date d = format.parse(monthDayToFrom);
if(!monthDayToFrom.equals(format.format(d)))
return "Это не дата";
} catch..
AK
KТ