my $date = '201006'; #Jahr und Monat my $regex = qr{^(20[1-9][0-9])(0[1-9]|1[012])$};