(defined $var && $var =~ m/regex/) & 1