#!/usr/bin/perl -lw use strict ; my $d = "2005-12-" ; if ( $d =~ /\d{4}-\d{1,3}(?!-)/ ) { print "yep" ; }